-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Layered Tables, Schema Management
-
None
-
Storage Engines - Foundations
-
220.074
-
None
-
None
Background
Creating a layered table through the table URI enqueues two CREATE entries for the same table into the shared metadata queue. The layered create path enqueues once while the column group is being built, and the table create path enqueues again after the column groups are complete, because only the later snapshot captures the full metadata. The FIXME-WT-14725 comment above the layered-path enqueue already notes the duplicated work. A create through the layered URI enqueues once.
The duplicates are harmless today because the shared metadata operations are idempotent puts, but every consumer that reasons about "the table's queued create" (step-up replay, the step-down assertions, and the drop-time cancellation from WT-18318) has to tolerate more than one entry per table.
Proposal
Do not enqueue the duplicate in the first place. A layered tree created as a table's column group source leaves the shared metadata operation to the table create, whose snapshot also covers the column group. The table's metadata row is inserted before its column groups are created, so its presence identifies that case unambiguously: a layered table URI already owns the matching layered URI, so a standalone create of that layered URI would fail EEXIST first.
The layered create path is currently the only site holding the stable constituent's create configuration, which a step-up needs to recreate a constituent the creating leader era never had. Both create paths therefore build that configuration through a shared helper, so the single surviving enqueue still carries it.
This establishes the invariant that the queue holds at most one unpublished CREATE per table, and lets the WT-18318 drop-time cancellation remove a single entry instead of sweeping the list.
Evidence
With a stable schema epoch set, creating one table and checkpointing below its epoch defers one queued operation for a layered URI create and two for a table URI create (observed via the checkpoint_disagg_metadata_unstable statistic). A create, drop and recreate defers three and five respectively. After the change both URI forms defer one and three.