Skip to content

catalog: avoid full-catalog scans during OID allocation - #41323

Draft
aljoscha wants to merge 1 commit into
aljoscha/ddl-nested-catalog-mapsfrom
aljoscha/ddl-oid-occupancy
Draft

aljoscha wants to merge 1 commit into
aljoscha/ddl-nested-catalog-mapsfrom
aljoscha/ddl-oid-occupancy

Conversation

@aljoscha

@aljoscha aljoscha commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #41319.

Motivation

OID allocation scans the durable catalog to reconstruct occupied OIDs, even when a DDL statement changes one object.

Description

Retain OID reference counts with the shared decoded durable state and overlay pending transaction diffs during allocation. Snapshot decoding and incremental replay maintain the same index. Reference counts preserve occupancy when multiple rows share an OID, and pending retractions permit reuse. Temporary OIDs remain caller-supplied exclusions.

This changes no persisted format, allocation order, DDL revalidation or publication barrier. Allocation visits pending transaction history rather than all committed rows.

Verification

Regression coverage compares allocation with a full transaction-view scan. It covers all six indexed collections, cross-collection occupancy, snapshot decoding and replay, pending replacements/deletions, operation boundaries, uniqueness failures, temporary exclusions, wraparound and abort.

Full CI passed at 4b7d4e275256, including both new regression tests.

Performance

Comparison against parent eb24935d, followed by a repeat of the baseline. Same ARM64 node and 2-CPU/16-GiB limits. Mixed 5k/10k/30k catalogs, tables/views/indexes, 1/8 clients, two clean 20-second repetitions per cell. Profiled repetitions are excluded. Both arms use verified stable configuration with periodic configuration sync disabled after initialization.

The local cost falls: mean commit/transact_op time is 30.3–40.5% lower across all 18 cells. Allocation frames fall from 127/6,009 to 1/5,670 workload samples. Source and profile review found no corresponding full-map clone in occupancy maintenance. Sample membership is not CPU time per DDL, and unresolved frames remain.

End-to-end improvement is not demonstrated. Throughput is lower in 17/18 cells against the original baseline and 14/18 against its repeat. Each cell below shows throughput change versus original / repeated baseline:

Object Clients 5k 10k 30k
table 1 -6.0% / -4.4% -1.8% / +1.4% -35.3% / -31.5%
table 8 -0.1% / -11.4% -10.5% / -0.1% -11.3% / -5.1%
view 1 -3.6% / -6.1% +0.1% / +0.8% -22.5% / -18.2%
view 8 -5.7% / -12.4% -2.9% / +9.7% -11.6% / -10.0%
index 1 -1.9% / -8.7% -5.0% / -0.8% -19.0% / -15.2%
index 8 -4.4% / -10.0% -2.0% / +6.5% -5.3% / -10.5%

All six 30k cells have worse throughput and CREATE/DROP p95 against both baselines. At 30k/table/c1, baseline → candidate → repeated baseline throughput is 7.66 → 4.96 → 7.23 statements/s. CREATE p95 is 213 → 506 → 219 ms. Process-wide persist CAS mean latency also rises and recovers: 11.12 → 29.35 → 10.89 ms. This does not distinguish a patch effect from workload or shared-system conditions.

There is one candidate deployment, not an independently replicated causal experiment. Baseline throughput itself varies by −11.4% to +12.7% across cells. CPU is partial-window whole-cgroup usage with overlapping attribution bounds. No memory or exact CRDB-call reduction is established. The repeat's 30k/index/c1/repetition2 lacks usable CPU/timer coverage and is not treated as zero.

Keep this PR draft pending investigation of the end-to-end slowdown. The allocator scan removal alone is not a reason to promote it.

Release notes

None.

@aljoscha
aljoscha force-pushed the aljoscha/ddl-oid-occupancy branch from 04bb0bf to 4b7d4e2 Compare December 2, 2026 14:21

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant