You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Retention trusts the client clock, with no guard on what it drops #74
Retention works out the current period from the container's clock (pg_partsmith/strategies/base.py, datetime.now()) and never compares it with the server. With the clock set to 2027-06 against data through 2026-09, one apply --allow-destructive dropped every monthly partition, including the one holding the current month, and exited 0.
Ideas, any of which would help:
read now() from the server, or refuse to run when client and server differ by more than a threshold
never drop the partition containing the server's now()
an optional cap on drops per run
Heads-up: I found this while testing pg-partsmith against Outpost's schema with a fair amount of LLM help. I reproduced it myself, but haven't dug deep, so treat it as a report rather than a requirement; your call on whether and how to fix it.
Fixed in 1.6.0 (#77), image ghcr.io/bedrock-python/pg-partsmith:1.6.0. Plans are now made on the database's clock (SELECT now()) instead of the container's, so a container sitting in June 2027 plans for whatever month the database is in. The regression test freezes the process three years ahead and checks the current month is still attached; on 1.5.1 it fails exactly the way you described.
Of your three ideas I took the first. The skew check and the cap on drops protect against the two clocks disagreeing, and there's no longer a second clock in that decision.
One thing is still on the process clock: the instant a detach is stamped with, which the orphan grace period counts from. A wrong clock there shifts when an orphan gets dropped, not what gets detached. Moving it changes the repository protocol, so it'll be its own PR.
Thanks for this one. I'd never have seen it on a machine with a correct clock.
Activity
feat: plan on the database's clock, not the process's
AlexeyShalaev commentedon Sep 29, 2026
Fixed in 1.6.0 (#77), image
ghcr.io/bedrock-python/pg-partsmith:1.6.0. Plans are now made on the database's clock (SELECT now()) instead of the container's, so a container sitting in June 2027 plans for whatever month the database is in. The regression test freezes the process three years ahead and checks the current month is still attached; on 1.5.1 it fails exactly the way you described.Of your three ideas I took the first. The skew check and the cap on drops protect against the two clocks disagreeing, and there's no longer a second clock in that decision.
One thing is still on the process clock: the instant a detach is stamped with, which the orphan grace period counts from. A wrong clock there shifts when an orphan gets dropped, not what gets detached. Moving it changes the repository protocol, so it'll be its own PR.
Thanks for this one. I'd never have seen it on a machine with a correct clock.