Repository navigation
feat!: pg-partsmith 1.0.0 — partition schemes, lifecycle policies and maintenance plans - #25
Merged
Merged
Conversation
… (core + aio/sync, tests pending)
…reign leaves satisfy windows, CreateUntil survives JSON
…, optional period_at, detach hook context, converge hooks, raw bounds
… back, report lifecycle units only - PARTITION_FACTS_SQL measures a relation with no partition tree as its own single leaf, so a detached leaf's size and rows reach the drop predicates. - An orphan whose window is inside retention (retention grew) is re-attached under DropAfter; under DropNever detached tables are never brought back. - ensure_partitions / create_future_partitions return the lifecycle units they created; members created to complete an existing subtree are repairs. - tests: 1.0 aio integration suites and the nested-partitioning support module.
…the two-coroutine tests - scripts/sync_tests_mirror.py: skip marker on its own line, yield-from fixtures, a sync_db_session twin of db_session, stale modules removed. - tests/integration/sync/test_concurrency.py: the two maintainers and the drop lock-contention scenarios with real threads (the one hand-written module of the sync suite). - The session-timezone engine helper pins the zone through a pool event, so both drivers share one code path.
…and release-please in CONTRIBUTING
- IntegerSequence: one integer value per partition; ListPartitioning(sequence=...) is a progression level rotated by CreateNextIf / bounded by CreateUntil, with its cursor read off the newest member (CursorSource.NEWEST_MEMBER). - One planner path for RANGE windows and LIST values: bounds_for / window_of on the level, ownership by single-value bounds, multi-value partitions unmanaged. - ensure_partition(s) accept positions on the root's axis (values, instants). - Redis lock managers: real integration tests on both mirrors (testcontainers).
…n leaves - LocalLeaves: tablespace, storage parameters (leaves only), inherited owner and grants replayed in the creating transaction. - ForeignLeaves: leaves are CREATE FOREIGN TABLE ... SERVER with templated options; branches stay local; refused before any DDL on a parent with a unique index (PostgreSQL's rule, verified on 15/17). - Foreign relations are commented with COMMENT ON FOREIGN TABLE, dropped with DROP FOREIGN TABLE and never LOCKed; the planner owns foreign partitions only under a foreign-leaves configuration. - Test mirror: mock assertion spellings are mirrored too.
…tion moves everything back - PartitionLifecycleService.partition_data: window by window, oldest first, the partition is created detached, filled from DEFAULT in batches and attached once nothing of its window is left; a batch budget leaves it detached for the next call to resume. - PartitionLifecycleService.unpartition: every partition emptied into one table in batches, optionally detached and dropped through the usual path. - Repository: batched reconcile (tableoid, ctid), move_rows; metadata: the DEFAULT probe. Executor: create_partition with a fill step before attach. - MigrationResult and the MOVE issue step.
…ls as issues - FactKind.REFERENCES / PartitionFacts.referenced: one EXISTS per incoming foreign key (on the parent or the partition itself), measured only when a rule asks. - Unreferenced(): true when no row of another table references the partition -- the condition PostgreSQL itself imposes on DETACH (23503, verified on 15 and 17 for the plain and CONCURRENTLY forms). - A detach PostgreSQL refuses is PartitionReferencedError, recorded as an issue while the run goes on; measured lock levels on referencing tables documented on the operation.
… matrix on PostgreSQL 15/16/17 - New guide: leaf backends. Sliding LIST in the schemes guide, Unreferenced and FK locks in the policies guide, partition_data / unpartition in the migration guide, recipes for ci_builds, pg_clickhouse tiering, template tables and the monolithic-table path. - RFC: gap matrix and phases updated (all shipped), the shipped API in the examples; PostgreSQL semantics: foreign tables, storage/tablespace/privileges, 98 foreign-key scenarios; OSS verdicts updated; cheat sheet and changelog. - CI: integration job runs on PostgreSQL 15, 16 and 17 (PG_PARTSMITH_TEST_PG_IMAGE); classifier Production/Stable.
Release-As: 1.0.0
…ides and reference - Getting started: installation; three tutorials (first table, production, multi-tenant event store) with plans, trees and findings captured from a real PostgreSQL 17. - Concepts: how it works, schemes, boundaries/cursors/calendars, lifecycle policies, the plan, ownership and safety, executing DDL, leaf backends. - How-to guides: configuration, scheduling, monitoring, backfill, partitioning an existing table, migration from pg_partman, changing a scheme, archiving, foreign keys, cold tiering, custom calendars/codecs, extending, troubleshooting, recipes. - Reference: configuration fields, findings and issues, environment settings, glossary; API reference kept. - Settings: LEAVES JSON for the leaf backend.
…e arguments Review of the rebuilt documentation against the code turned up three library-side gaps, fixed here together with the doc corrections. - pg_partition_tree() omits a partition whose DETACH CONCURRENTLY was interrupted once its first transaction has committed, so the planner could never see one. The tree is now read with a recursive walk over pg_inherits, which lists it with inhdetachpending set and, as a side effect, takes no ACCESS SHARE lock on the members. The planner plans DETACH ... FINALIZE for it (Reason.DETACH_FINALIZE; the detach_pending finding becomes INFO) instead of excluding it forever. An integration test reproduces a cancelled DETACH CONCURRENTLY on a live server. - Every lifecycle rule with one defining value takes it positionally (CreateAhead(3), KeepNewest(12), DropAfter(timedelta(days=7)), ExpireIf(SqlPredicate(...))), the form the README and docstrings used. - FindingReason.CURSOR_UNKNOWN, MaintenanceIssueStep.PLAN and UnsupportedCapabilityError were exported and documented but never produced; removed. Docs: keyword-form samples where the positional form was ambiguous, Redis lock prefix default, missing imports, name-length arithmetic, after_* hooks re-raise, marker transaction for the concurrent path, weekly-inside-monthly qualification, coverage_unknown's LCM cause, explicit reason scope, troubleshooting entries for every finding and exception, pg_inherits instead of pg_partition_tree in the lock tables. Verified on PostgreSQL 15, 16 and 17: 475 integration tests each; 2312 unit tests; mypy strict; docs build clean.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Data safety: - Row moves (DEFAULT reconciliation, partition_data, unpartition) fail closed when an incoming foreign key declares ON DELETE CASCADE / SET NULL / SET DEFAULT (RowMoveRefusedError, recorded as an issue): the action fires on the DELETE half of a move and would delete or rewrite the referencing rows while the moved row lives on. (F-001) - unpartition(drop_emptied=True) detaches, drains the tail, and the drop moves whatever arrived late in the same transaction under its ACCESS EXCLUSIVE lock (drop_partition(drain_into=)); a committed row can no longer be dropped. unpartition also refuses destinations inside the tree (the root, a member, an orphan) and empties this library's own detached partitions; DropNever orphans are reported and leave the result incomplete. (F-002, F-006, F-010) - detach_partition takes expected_oid and re-checks identity and attachment under the detach's own lock, after the before_detach hooks ran -- a hook that swaps another relation in at the planned name gets PlanStaleError, not a detached replacement. (F-003) - attach_partition strips the orphan marker in the attach's transaction, so a later detach starts a fresh grace period instead of inheriting the old instant. (F-004) - Under DropNever a matching detached table is never re-attached; the wanted window is reported (name_unusable) instead of recreated over its name. (F-005) Validation and SQL: - User-authored models refuse unknown fields (extra="forbid") -- a misspelled garce/retentoin no longer validates into a destructive default; KeepFor and WindowAgeAbove refuse negative ages. (F-007, F-008) - The movers list only writable columns, so generated columns are recomputed rather than copied, and add OVERRIDING SYSTEM VALUE when the target has an identity column; foreign relations are never LOCK TABLEd, so partition_data drains DEFAULT into ForeignLeaves through the wrapper. (F-009, F-012) - partition_data fills and re-attaches a matching detached partition through the new PlanExecutor.attach_partition(fill=) instead of giving up on its window. (F-011) Planning and reporting: - maintain() applies detach_finalize operations first and re-plans under the same lock: an interrupted DETACH CONCURRENTLY is finalized and its table re-attached or retired in one call, with no false name collision. (F-013) - CreatePartition/AttachPartition capabilities name the SHARE ROW EXCLUSIVE locks on referencing tables; the changelog lists the 0.5 imports removed with their feature; the asyncio-only test helper is skipped by the sync test mirror. (F-015, F-016, F-014) Verified: ruff and mypy strict clean; 2369 unit tests; 492 integration tests on each of PostgreSQL 15, 16 and 17 (17 new, one per repaired behaviour).
…, identity sequences
Follow-up to the external review's verification pass (REVIEW-PR25-VERIFICATION):
four partially-resolved findings and two regressions, all reproduced by the
verifier, fixed.
- Referenced rows cannot be moved at all -- mid-move a row is outside the
referenced tree, so even ON DELETE NO ACTION refuses at the end of the
statement. The movers translate that 23503 into RowMoveRefusedError with
guidance; destructive actions stay refused up front; unreferenced rows
under NO ACTION keep moving. Docs state the honest contract. (F-001)
- An OID-guarded DETACH CONCURRENTLY pins the relation: a holder connection
takes ACCESS SHARE, the identity and attachment are verified and the
marker written under the pin, and the pin is released only once the
statement's own ACCESS EXCLUSIVE request is queued on the partition --
by lock-queue ordering a swap can then only make the statement fail on a
vanished OID, never redirect it. (Measured: the statement's first
transaction requests AEL on the partition, so pin-until-pending would
deadlock; the poll paces on real round trips, no clock sleeps.) The sync
mirror pins the same way through a worker thread in its hand-kept pin
module; a foreign relation uses the blocking form, which now re-checks
the OID after the statement inside its transaction and rolls a swap back
marker and all. (F-003)
- After every move the target's identity sequences ('a' and 'd') are
advanced past the moved ids with setval, in the move's transaction, so
the destination's next ordinary INSERT does not collide. (F-009/V-001)
- drop_partition returns the rows its drain moved; the executor's
drop_single_partition returns int | None; unpartition counts them in
MigrationResult.rows_moved. (F-002/V-002)
- unpartition refuses a destination that is a partition of *any* tree --
a leaf of an unrelated root reads as a plain table in pg_class. (F-010)
- The orphan-fill path holds identity end to end: every reconcile batch
verifies expected_target_oid under the target's lock before a row leaves
DEFAULT, the executor re-verifies after the fill, and ATTACH carries
expected_oid, re-checked after the statement in its own transaction.
(F-011)
Verified: ruff and mypy strict clean; 2391 unit tests; 502 integration
tests on each of PostgreSQL 15, 16 and 17 (new live coverage: a swap
timing out against the pin, a before_drop writer counted into rows_moved,
NO ACTION referenced-row refusal, an identity destination's next insert,
a foreign leaf drained by partition_data, a mid-fill swap failing stale).
…FKs; descending identities Follow-up to the second verification pass (REVIEW-PR25-VERIFICATION-ROUND2): four partially-resolved items and one new blocker, all reproduced by the verifier, fixed. - create_table_like and create_foreign_table_like return the created relation's OID, read inside the creating transaction; the executor holds it through every fill batch and the final ATTACH (re-checked after the statement in its own transaction), and the already-exists resume path acquires the identity once, at recovery. A relation swapped in at the name fails stale instead of receiving rows or going live. (V-003) - The movers run SET CONSTRAINTS ALL IMMEDIATE in the move's transaction (the drop-time drain included), so DEFERRABLE INITIALLY DEFERRED foreign-key violations fire at the statement and are translated into RowMoveRefusedError instead of escaping to commit as raw errors. (F-001) - Finalizing an interrupted DETACH CONCURRENTLY is transactional: an unlocked probe, then one transaction taking the partition's lock, re-probing, checking the OID, writing the marker, running FINALIZE and re-checking -- a swap rolls everything back, marker included (FINALIZE, unlike CONCURRENTLY, may run inside a transaction; exercised on 15/16/17). The pin's release condition is scoped to the statement backend's own pg_backend_pid(), so a bystander's queued lock cannot lift the pin early. (F-003) - Identity sequences follow pg_sequence.seqincrement: descending sequences are advanced past MIN(column) with LEAST, ascending past MAX with GREATEST, keeping a farther-along pre-existing position either way. (V-001) - The DEFAULT-conflict retry passes expected_target_oid (a stale result is logged with the OID that safely holds the already-reconciled rows), and a foreign fill target, which cannot be locked, is covered by OID checks before and after the move statement in its own transaction -- a swap rolls back the DELETE and the remote INSERT together. (F-011) Verified: ruff and mypy strict clean; 2393 unit tests; 508 integration tests on each of PostgreSQL 15, 16 and 17 (new live coverage: a deferred referenced-row refusal, a descending identity destination's next insert, a just-created target renamed mid-fill failing stale with DEFAULT intact, a foreign mapping swapped mid-fill moving nothing).
…ity sequences Follow-up to the third verification pass (REVIEW-PR25-VERIFICATION-ROUND3): four partially-resolved items and one new blocker, all reproduced by the verifier, fixed. - A created branch's OID is carried into every child it gets, and attach_partition takes expected_parent_oid, checked inside the ATTACH's transaction under the locks it takes. A branch replaced while its subtree is being built gains nothing: the child attach rolls back stale. (V-004) - The detach pin outlives every exit. The wait is still bounded by the DDL timeout, but on expiry the statement is cancelled (aio: task cancellation; sync: pg_cancel_backend on the published pid) and awaited to completion before the holder rolls back, so a late name-addressed DETACH can no longer fire after a swap commits. (F-003) - Identity synchronisation models the sequence instead of guessing: pg_sequence plus pg_sequence_last_value give the next value it would issue, and only ids on that arithmetic path, ahead of it and inside the declared range can ever be reissued -- so an off-path or out-of-range id is left alone (no more setval 22003), and the extreme of the reachable ones is chased with MAX ascending, MIN descending. A cycling sequence, or one whose remaining path is entirely taken, is refused with RowMoveRefusedError and rolls the move back whole rather than leaving a destination that cannot take its next insert. (V-001) - The compensating restore carries both identities -- the DEFAULT partition's OID, captured when its first batch moved, and the planned target's -- so a relation that took the DEFAULT's name receives nothing and the rows stay where they were verified. (F-011) - A missing OID is a stale plan, never a licence to carry on by name: a create whose repository returns none resolves it immediately, and a recovery lookup that resolves to nothing raises PlanStaleError. (V-003) - The stale NO ACTION comment in catalog_queries.py now matches the runtime contract. (F-001) Verified: ruff and mypy strict clean; 2401 unit tests; 517 integration tests on each of PostgreSQL 15, 16 and 17 (new live coverage: a branch replaced before its children, a DEFAULT replaced before a failing attach, cycling and too-narrow and off-path identity destinations, and a pinned detach whose statement is cancelled on timeout).
… into re-attached subtrees Follow-up to the fourth verification pass (REVIEW-PR25-VERIFICATION-ROUND4): the three residuals, each reproduced by the verifier, fixed. No new findings were raised. - Identity synchronisation reads seqcache. A called sequence with a cache has already handed the block below pg_sequence_last_value to whichever session drew it, where setval cannot reach it; a moved id inside that block is refused (RowMoveRefusedError naming the cache size) instead of colliding with that session's next insert. An id outside the block still moves. (V-001) - Each identity is read exactly once. A create goes through _created_identity, which refuses a repository that reports no OID -- the protocol returns it from the creating transaction, and a second look-up by name is precisely what would let a replacement answer. The already-exists recovery reads get_relation_oid once and treats None as a stale plan. (V-003) - _attach_detached passes the planned branch's OID into _converge_detached, so the subtree of a detached branch coming back is attached into the relation the plan chose, by identity. (V-004) The sync pin's post-deadline wait is documented rather than changed: it waits for the worker rather than releasing the pin under it, so the bound is the statement's own server-side timeout and the error surfaced is the statement's, not a synthetic TimeoutError. Verified: ruff and mypy strict clean; 2411 unit tests; 520 integration tests on each of PostgreSQL 15, 16 and 17 (new live coverage: a CACHE 5 destination refused while a session holds the block, and a re-attached branch replaced before its missing bucket is created).
…t the newest block Follow-up to the fifth verification pass (REVIEW-PR25-VERIFICATION-ROUND5), which left one finding open. pg_sequence_last_value publishes only the newest allocation, so a session that drew an earlier block still holds values below it -- invisible to every query, and beyond setval's reach. The cache guard no longer derives a single block from the catalog value: for a called sequence with CACHE > 1 every value already allocated, on the sequence's own path up to last_value, counts as possibly held, and a row carrying one refuses the move. A never-called sequence (the ordinary unpartition destination, created LIKE ... INCLUDING ALL) is untouched, and a cached sequence no row collides with still moves. (V-001) Verified: ruff and mypy strict clean; 2413 unit tests; 521 integration tests on each of PostgreSQL 15, 16 and 17, including the verifier's two-session reproduction -- session A draws 1..5, session B draws 6..10 and moves the catalog to 10, and a row carrying 2 is refused with nothing moved.
…e cached region at START A cycling sequence restarts at the far end of its range, which need not lie on the residue class its increments were walking: after a wrap it can issue values it previously skipped, and its last_value can move behind a cached block another session is still holding. The refusal is now taken first and over the whole declared range, whatever the residue -- the forward-leg collision probe could never have seen those values. The cached allocated region is what the sequence has actually issued, so it now runs from seqstart to last_value rather than from the declared endpoint. A row carrying an id from before the destination's START is nobody's to reissue and moves again. Live tests cover the wraparound (two sessions, INCREMENT 3 ... CYCLE CACHE 2) and the pre-START move; unit twins assert each probe. The generated sync test mirror is regenerated, picking up the two-session cached-block test that a previous regeneration missed.
…destination's own rows The sequence checks ran after the DML and asked the destination itself, so they could not tell a moved id from one the destination already held. A row its own sequence issued -- an ordinary row of a cycling destination, or the first cached block of a fresh one -- refused a move whose only row was safely out of the sequence's reach. The move statement now hands over what it placed: its INSERT returns the target's identity columns and an enclosing INSERT parks them in a temporary relation for the length of the transaction. The cycling range, the cached allocated region and the forward collision that drives setval all read that relation. One statement, so the set is exactly what moved. A destination with no identity column emits the statement it emitted before. An identity column the source does not carry is skipped: the sequence fills it as it would for any ordinary insert, so the move takes nothing from it and capturing its freshly allocated ids would only refuse the move on the sequence's own values.
… under a name of our own A sequence is not transactional: setval stands whatever becomes of the transaction around it. Advancing one identity column and then refusing on the next therefore left the first sequence past ids that rolled back with the move -- and a bounded one could be spent by a move that never happened. Every column is now decided first and the advancements collected; only when all of them pass are the setvals issued. The relation a move parks its identity values in is named per move (pg_partsmith_moved_ plus a fresh suffix) instead of once for the library. The temporary schema belongs to the session, and a caller sharing the pool may be holding names in it: the fixed name made an internal detail a session-visible collision (42P07) that failed the move. Live tests cover both: a destination whose second identity refuses what the first would have accepted, asserting the first sequence never moved; and a one-connection engine where the caller holds the old fixed name and keeps its row. The rollback that ordering cannot undo -- a sequence left ahead of ids no longer there, which skips values rather than repeating them -- is documented rather than implied.
Feeding a coding assistant the whole site is expensive and it still misses the parts that matter. docs/agents.md holds what an agent needs to write correct pg-partsmith code in one place -- scope, mental model, wiring, the complete service API with which methods take the lock, the configuration vocabulary, the rules that break code when broken, the mistakes models actually make -- and ends with a table saying which page to fetch for everything it does not carry.
Reading these docs through a language model meant scraping HTML or pasting the whole site. Every page now sits next to its own Markdown -- /agents/ is served beside /agents.md -- written into the built site by scripts/emit_markdown.py, and a control above each page copies that Markdown, opens it as plain text, or carries it into ChatGPT, Claude or Perplexity. The control is a theme override (theme.custom_dir), so it costs zensical nothing: base_url and page.url are all the script needs to find the Markdown of the page it sits on, and every colour comes from the theme's own custom properties, which is what makes it follow the palette toggle. Handlers are delegated from document because instant navigation swaps the content in place. A section index is the one page whose Markdown is not at its source path: reference/index.md is served at /reference/, so its Markdown goes to /reference.md, and the emitter refuses two pages that would claim one name.
The API reference is written as directives to a docstring renderer, so its Markdown is a list of instructions and not the API: copying it handed a model `::: pg_partsmith.entities.TablePartitionConfig` where it expected the class. A page now declines with `copy_page: false` in its front matter -- the control is not rendered there, and scripts/emit_markdown.py writes no Markdown for it, since a file nothing links to is worse than no file when its content would mislead. The emitter reads that one key rather than the front matter whole: the docs build carries no YAML parser, and one key is all that is at stake.
The page written for a language model was reachable only by finding it in the nav, which is the one place someone pasting docs into a chat window is not looking. The site's front page and the README now open with it. In the docs it is an admonition type of its own, `!!! agents`: the theme draws an admonition as a tinted block with a masked icon, so a new type costs three rules and an icon. Both colours are the theme's accent rather than a literal, which is what makes the block follow the palette toggle instead of holding one colour through both. The README uses a GitHub alert, which PyPI does not render -- the long description shows it as an ordinary quote with the marker visible. That is the trade for a coloured callout where the README is actually read.
The paragraph on non-transactional sequences said the one thing ordering cannot undo is a rollback after the move was accepted. A failure partway through issuing the setvals is the same class and was not covered: a role holding UPDATE on one of a destination's sequences and not the next fails the second with 42501, and the first stays where it was put. Both are named now, along with why the ordering is worth having when it cannot cover either -- what it prevents is a semantic refusal spending a sequence, which is the case that recurs. A role that cannot write its own destination's sequences is a broken grant, not something the library can order its way out of, and a sequence left ahead skips values rather than repeating them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pg-partsmith 1.0.0: the core is rebuilt around four separated concerns — a partition scheme (the shape of the tree), boundaries (how an axis is cut into windows and named), a lifecycle policy (when windows are created, detached and dropped) and a maintenance plan (a pure, inspectable diff between the desired and the actual tree that the executor applies statement by statement). The ordinary flat configuration (
partition_column+granularity+create_ahead_count+retention_count) keeps working unchanged; everything else is spelled out throughscheme=/lifecycle=/leaves=.The design followed a reading of how ten production systems manage PostgreSQL partitions (GlitchTip, GitLab, Centrifugo, PGMQ, Hatchet, pg-trx-outbox, Hookdeck Outpost, ColdFront, pg_partman, pg_clickhouse) and every PostgreSQL claim the library relies on was verified on real 15/16/17 servers — see
docs/design/rfc-0001-partition-schemes.md,docs/design/oss-research.mdanddocs/design/postgresql-semantics.md.What ships
RangePartitioning/HashPartitioning/ListPartitioning, nested to any depth (RANGE → LIST → HASH,LIST → RANGE, rootHASH/LIST), composite keys, per-level naming with 63-byte name budgets checked at construction.TimeBoundaries(calendar, tz, codec — UUIDv7, epoch),NumericBoundaries(step)for integer axes with the cursor read frommax(key)or the identity sequence,IntegerSequencefor GitLab-style sliding LIST.CreateAhead/CreateUntil/CreateNextIf;KeepNewest/KeepFor/KeepBehind/ExpireIfwithAllOf/AnyOf/Not; predicates over gathered facts (SizeAbove,RowsAbove,WindowAgeAbove,SqlPredicate,Callback,Unreferenced);DetachMode;DropAfter(grace, when)/DropNever. Facts are measured only when a policy asks for them.service.plan()is read-only and lock-free;service.apply(plan)runs one statement per transaction, revalidates OIDs before anything destructive, and records topology conflicts as issues instead of aborting. Findings carry reasons and severities; plans round-trip through JSON.LocalLeaves(tablespace, storage_parameters, inherit_privileges)andForeignLeaves(server, options)(pg_clickhouse / postgres_fdw shape).service.partition_data()drains a DEFAULT partition window by window in batches;service.unpartition()moves everything back into one table.Unreferenced()retention,23503detach refusals recorded as issues, measured lock levels on referencing tables reported on the plan.DETACH CONCURRENTLYis finished by the next tick. The tree is now read overpg_inherits(a recursive CTE) becausepg_partition_tree()omits a half-detached partition — and locks every member; inspection no longer takes any relation lock.pg_partsmith.syncis generated frompg_partsmith.aiobyscripts/sync_mirror.py; the sync integration suite byscripts/sync_tests_mirror.py. Review the aio package; the sync package is its mechanical image.Breaking changes
Listed in full under
CHANGELOG.md → [Unreleased] → ⚠ BREAKING CHANGESand, with before/after snippets, indocs/guide/migration.mdanddocs/design/rfc-0001-partition-schemes.md(migration matrix). The short version: the service no longer takes aperiod_calculator(it lives inTimeBoundaries);HashSubpartitionSpec/ListSubpartitionSpec/root_layoutbecome schemes; hooks receive aPartitionInfo; the repository / metadata protocols are reshaped; the capability protocols andpg_partsmith.subpartition_plan/pruning_rulesare gone; an attached partition off the scheme's grid is never pruned any more.Suggested reading order
docs/design/rfc-0001-partition-schemes.md— the model and the decisions.scheme.py,boundaries.py,lifecycle.py,topology.py,plan.py,planner.py,leaves.py,entities.py.aio/metadata.py,aio/services/{inspection,validation,execution,migration}.py,aio/repositories/{creator,remover}.py,aio/service.py,catalog_queries.py.tests/unit/(2312) andtests/integration/aio/(the sync twins are generated).docs/index.md, thengetting-started/first-table.md.Type of change
Checklist
make checkpasses locally (ruff+mypystrict).CHANGELOG.mdupdated under[Unreleased].zensical buildclean; links and anchors checked).Release
Merging this cuts 1.0.0: the branch carries a
Release-As: 1.0.0footer (chore: cut 1.0.0) and the footer is repeated below so a squash merge keeps it. release-please then opens the release PR; PyPI publishing follows the release.Related issues
—
Release-As: 1.0.0