Repository navigation
fix(tae): bound catalog recovery memory on main - #33090
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
This pull request is merged. |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 7a72d52f50f317bb1f46ff59744425fbc731b1ec
Assessment: request_changes
The replay design bounds temporary catalog input to one block and reuses the existing visibility and replay queue machinery. Source review found no confirmed product defect. The required execution evidence for failed-open cleanup and cancellation remains incomplete.
Model: gpt-6.2-sol / xhigh
Session: 01a1ed86-9b09-7303-8d78-76024e7bf652 · slot 3 · generation 0
- P2
pkg/vm/engine/tae/db/checkpoint/replay.go:393: Startup recovery is canceled after accepting catalog replay work, or a persisted catalog read fails during DB.Open.
Impact: The changed recovery path must drain accepted work before teardown and release the vector pools so startup can be retried. The available test evidence leaves those lifecycle guarantees unverified.
Evidence: The pinned race-validation policy requires identifiable selections and terminal results for changed lifecycle tests. The PR reports successful race coverage, but the frozen evidence contains no terminal output for TestReplayCatalogWaitsForAcceptedTasksOnCancellation or TestCatalogReplayReadFailureReleasesPools. Local checks 1795418785508509020-5 and 1795419017407883432-5 timed out before either test reported a result. Supply the existing exact-head race output for those two tests to close the gap.
Validation:
-
Verified the frozen patch, pinned policy, three discussion dispositions, native inputs and isolation preflight. See frozen-scope.stdout, scope-native.stdout, preflight.stdout and validation-reconciliation.json.
-
The focused race log recorded terminal passes for catalog, containers and tables. The enclosing command timed out before checkpoint and DB restart validation completed.
Limitations:
- The official 4.2.8 restart comparison and memory measurements are author-reported. The original production OOM trigger and production-scale memory behavior remain unverified.
|
Addressing the review's request for exact-head race output: I reran the two tests separately at commit GOWORK=off .agents/skills/mo-dev/scripts/mo-cgo-test \
-race -count=1 -timeout=180s -v \
-run '^TestReplayCatalogWaitsForAcceptedTasksOnCancellation$' \
./pkg/vm/engine/tae/db/checkpointTerminal test and package output (verbose logs omitted): GOWORK=off .agents/skills/mo-dev/scripts/mo-cgo-test \
-race -count=1 -timeout=180s -v \
-run '^TestCatalogReplayReadFailureReleasesPools$' \
./pkg/vm/engine/tae/db/testTerminal test and package output (verbose logs omitted): The cancellation test exercises Before committing this identical diff (SHA-256 |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 7a72d52f50f317bb1f46ff59744425fbc731b1ec
Assessment: approve
The author supplied passing exact-head race results for both tests requested in review 6017894079, closing the validation finding. Catalog replay now releases each scanned block after copying retained values into owned schemas, using the existing visibility checks and replay queue.
Model: gpt-6.2-sol / xhigh
Session: 01a1ee80-0d82-7030-a965-b51f496c3054 · slot 2 · generation 1
Validation:
-
The author’s exact-head race runs passed for TestReplayCatalogWaitsForAcceptedTasksOnCancellation and TestCatalogReplayReadFailureReleasesPools. The tests cover draining work already admitted when cancellation is observed, releasing both vector pools after repeated failed opens, and reopening successfully.
-
Verified that the reported 100- and 34-iteration race runs used a diff matching the frozen change. The current scope, pinned policy, and whitespace check passed. Receipts and retained results are indexed in review-validation.md.
-
The prior isolated race log records terminal passes for the selected catalog, containers, and tables tests.
Limitations:
- The cancellation test admits the blocked task before ReplayCatalog starts. The official 4.2.8 restart and memory results are author-reported. The original production OOM trigger and production-scale memory behavior remain unverified.
What type of PR is this?
Which issue(s) this PR fixes:
Refs #33072. Backports #33078 from
4.2-devtomain.What this PR does / why we need it:
TAE recovery accumulated each entire system table in off-heap batches before replaying the catalog. A large catalog therefore needed substantial transient memory in addition to its recovered schemas.
Scan visible catalog rows one block at a time using the existing snapshot and tombstone machinery, copy retained values into owned schemas, and submit validated tables to the existing database-sharded executor. Allow a blocked submission to withdraw on cancellation and wait for already-admitted tasks before returning. Release DB-owned vector pool buffers on failed open and normal close without invalidating checked-out vectors.
The main-branch port keeps its existing catalog type encoding, rename/object replay and persisted tombstone read paths. It also preserves the released
NextColSeqnum == 0ordinal fallback, including for evolved schemas, while rejecting non-ordinal sequence data that cannot safely be recovered without its high-water mark. The persisted format is unchanged.The original production OOM trigger is not established. This PR reduces a demonstrated recovery amplification; it does not establish that the original incident's full cause is fixed.
Validation
Complete owner-package tests under
-racefor catalog, containers, tables, checkpoint and DB; selected checkpoint/restart, snapshot, ALTER, rename, persisted-delete and transaction consumers under-race. Focused lifecycle and concurrent cases were each timed and repeated in one process according to the repository's adaptive race protocol. They cover block ownership, legacy missing/NULL sequence numbers, persisted tombstone cancellation, canceled queue admission, draining accepted work, pool close/borrow concurrency and failure cleanup followed by reopen. A no-wait mutation made theReplayCatalogdrain test fail. That test injects accepted work before the method call; it does not reproduce admission during the same scan.Incremental
go vet,molint,golangci-lint, formatting,git diff --checkandmake err-checkpassed on the changed package closure.Fresh official 4.2.8 deployment: create 10,000 tables with a primary-key column and 16 distinct default-valued columns each, drop 1,000, exercise ALTER/drop-and-add, rename, indexes, ENUM, generated columns, defaults, ON UPDATE, inserts, updates and deletes, force a global checkpoint, then cleanly stop log/TN/CN. Independently restart copies with
mainbase and this change. Each of six runs checks all 9,000 expected live tables, the complete 162,000-row column set, column names/ordinals/sequence values, and the expected default literals. Serialized type/default metadata is identical between base and candidate across all runs. Data and writes match; queries of both a pre-upgrade row and a post-upgrade row use the secondary index, as confirmed by EXPLAIN.Same 4.2.8 checkpoint, three fresh-process runs per version in A-B-B-A-A-B order, local warm filesystem and shared Docker Desktop arm64 host. Median measurements below are local observations, not a production forecast:
RSS and mpool are process-lifetime high-water marks captured before verification queries; the mpool metric refreshes every five seconds. Heap was sampled approximately every 100 ms and increased in this small sample. The end-to-end ready metric includes the local CN/log services. These results do not establish production throughput, tail latency or mixed-version rollout behavior.
A four-worker vector-pool borrow/return microbenchmark, six alternating runs per version, measured medians of 104.7 vs 96.4 ns/op, with overlapping ranges and one allocation per operation on both versions. This small local microbenchmark does not establish DML/DQL performance.
The 4.2.8 and main SQL metadata displays differ for collation; the main base and candidate outputs match. Cross-version collation semantics beyond the tested queries have not been established by this backport.