Repository navigation
[4.2-dev] perf(branch): resolve creation timestamps before catalog replay - #32925
mergify[bot] merged 10 commits into
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? |
|
Queue requested — the merge queue status continues in this comment ↓. |
|
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: 9045579f6480b2956003fde9692710161ad0d974
Assessment: request_changes
Reviewed against 4.2-dev at 71e2233. The catalog lookup reuses the snapshot reader, and the SQL regression preserved the destination update across ALTER. The new block-read cleanup can consume the request deadline before missing-file recovery gets a chance to run.
Model: gpt-6.2-sol / xhigh
Session: 01a1f0a0-5126-78f3-9ab8-ef4e87f2f119 · slot 0 · generation 3
- P2
pkg/vm/engine/disttae/logtailreplay/change_handle.go:875: A historical replay read returns ErrFileNotFound while another block read in the same prefetch window is still pending on the request context.
Impact: Replay waits for the pending read before returning the missing-file error. If that read consumes the remaining deadline, DATA BRANCH MERGE can time out even when the snapshot reader could have recovered the catalog row.
Evidence: The base-versus-candidate probe in recovery-probe.log returned ErrFileNotFound with a live parent context on the base and with context deadline exceeded on the candidate. The candidate submits reads on the parent context at line 806 and still joins every submitted job after recording the error. pkg/frontend/data_branch.go:2926 then returns the context error before the ID-based fallback. Give the prefetch window a cancellable child context and cancel pending reads when a terminal error is known. Drain and clean up the jobs, then return the original error while the parent remains usable for recovery.
Validation:
-
Focused logtail replay, checkpoint, engine and SQL tests passed. The SQL run exercised both Reader and CollectChanges paths and verified conflict SKIP after ALTER. See focused-proxy.log and checks/1795080186354533764-2.json.
-
The full logtailreplay package passed under -race. The coalescing, dispatch and replacement-lineage tests each passed 100 targeted race repetitions. See replay-race-proxy.log, race-stress-*.log and their receipts.
-
The missing-file probe reproduced the deadline regression against a 4.2-dev control. See recovery-probe.log and checks/1795080161233967019-2.json. An earlier probe build had a missing test import, recorded in recovery-probe-build.log.
-
Focused object I/O error and commit-timestamp tests passed. The same-binary row-collapse benchmark reduced allocations from 49,042 to 16,273 per operation on disjoint keys and from 56,913 to 15,954 on paired keys. See objectio-focused.log, collapse-bench.log and their receipts.
-
Diff hygiene, runtime preflight and the native prerequisite build passed. Frozen exact-head CI also records successful Ubuntu unit tests, Linux arm64 SCA and multi-CN BVT.
Limitations:
-
The recovery probe used controlled FileService reads and the replay entry point. The SQL regression exercised the ordinary merge path.
-
The reported QA timing came from one run per CN on a hotfix-based image. The local benchmark measured row collapse only.
Stop the read window when a block or its metadata cannot be read. Drain submitted jobs and preserve the original error so snapshot fallback can still use the caller context.
…alog-merge-opt-42dev
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-reviewed 2819d44 against 4.2-dev 1aa4d1a. The previous metadata-versus-payload ordering case is addressed: a completed current plan can dispatch its payload while later metadata is pending. There is still a blocker in the termination of those speculative workers: cancellation does not necessarily release a real FileService metadata read, so synchronous cleanup can delay both a completed window and the missing-file recovery path. The inline comment contains a deterministic reproduction at the replay boundary using the real S3FS disk cache.
The repro uses test-only barriers to park an actual disk-cache entry update and observe its existing wait; it is not an end-to-end SQL or production timing measurement. Current-head Linux CI is green. Earlier focused functional and race evidence for unchanged closures was reused.
|
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: 2819d441a9c97b2d97a44efc2742970fe69685f1
Assessment: request_changes
The snapshot-first lookup reuses the catalog reader and preserves the existing replay and ID fallback. The earlier dispatch and error-ordering cases are addressed. Speculative metadata still puts an unrelated disk-cache update on the response and recovery paths.
Model: gpt-6.2-sol / xhigh
Session: 01a1f0a0-5126-78f3-9ab8-ef4e87f2f119 · slot 0 · generation 3
- P2
pkg/vm/engine/disttae/logtailreplay/change_handle.go:550: A later object's speculative metadata read misses the memory cache and reaches a disk-cache range entry that another goroutine is updating. The current payload window has already completed or found a missing file.
Impact: Replay waits for the unrelated cache writer before returning the completed window or its original error. If the request deadline expires during that wait, DATA BRANCH MERGE skips the snapshot fallback and can time out again.
Evidence: The deferred finishBlockPlanPrefetch cancels its child context and then receives from every pending worker. FastLoadObjectMeta reaches S3FS.Read and DiskCache.Read, where waitUpdateComplete at pkg/fileservice/disk_cache.go:676 waits on a condition variable with no cancellation condition. pkg/frontend/data_branch.go:2926 returns the parent context error before the ID fallback. The merge base has no later-object metadata workers in this payload window. The same-head reproduction in review_comments:4645497161 observed both successful payloads and ErrFileNotFound held behind the real cache wait. Keep speculative cache I/O off the synchronous return path, or make the relevant wait interruptible while preserving worker ownership and ordered errors.
Validation:
-
Verified the assigned head, target and merge base against the frozen patch and checked source cleanliness and diff whitespace. See scope.stdout and checks/1795231365593565931-2.json.
-
Traced the cache-writer wait and fallback in current source, and reconciled them with the exact-head real S3FS and disk-cache reproduction reported in review_comments:4645497161.
-
Reused frozen exact-head CI results for the Linux build, unit tests, coverage, arm64 SCA, and proxy and pessimistic multi-CN BVT. Earlier review reports cover the SQL merge and ALTER conflict regression and focused race cases on unchanged paths.
Limitations:
-
The real-cache reproduction was reported at the replay boundary. This attempt did not independently rerun it or exercise the final SQL fallback.
-
The reported QA timings came from one run per CN on a hotfix-based image. The earlier row-collapse benchmark measures that component only. The linked issue was available, and the related PR discussions were outside the frozen evidence.
…alog-merge-opt-42dev
…ates Wake contending readers and cache fills when their context ends. Keep the update slot owned by its writer and verify replay returns both a completed payload window and the original missing-file error.
|
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: 431ff78e6d9ead61966bdd6e8ce42faa63024cfb
Assessment: approve
The snapshot-first catalog lookup reuses the existing Reader and preserves historical replay and ID-based fallback. The latest disk-cache change resolves the prior recovery blocker. Canceled readers and cache fills leave the wait while the active writer retains its update slot.
Model: gpt-6.2-sol / xhigh
Session: 01a1f0a0-5126-78f3-9ab8-ef4e87f2f119 · slot 0 · generation 3
Validation:
-
Verified the frozen patch, pinned review policy, native prerequisites, and private /tmp and loopback preflight.
-
Focused race-enabled tests passed for disk-cache cancellation, replay dispatch, coalesced reads, replacement lineage, row collapse, and checkpoint metadata. The cache and replay cancellation tests each passed ten repetitions.
-
The embedded SQL checkpoint regression passed through both Reader and CollectChanges paths. It verified repeat merge, conflict SKIP after ALTER, insertion, and deletion. Checkpoint reuse tests also passed across distinct ranges and filters.
-
The frozen head passed Linux unit tests, arm64 static analysis, and proxy and pessimistic multi-CN BVT.
Limitations:
- The QA speedup was an author-reported hotfix comparison with one run per CN. Local checks establish correctness and cancellation behavior on the 4.2-dev port.
✅ Merged into
|
…ailure (#32992) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to #32708. Follow-up to #32707 and the 4.2-dev review finding in #32925. ## What this PR does / why we need it: Historical catalog replay reads metadata in parallel. If a required object was missing, replay waited for all later reads before checking the error. A slow read could exhaust the request deadline and prevent DATA BRANCH MERGE from using the existing snapshot fallback. Wait for metadata plans in object order. Once a required plan fails, cancel and join the later reads using a child context. Preserve the original error and the request context. Keep the existing bound on parallel reads. The regression exercises a missing first or second object's metadata with a later read held open. Both cases exhausted the caller deadline before the fix. The fixed version passed 100 runs under the race detector, including the existing data-block cases. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
Follow-up to #32705 for #32708. The
maincounterpart is #32707.What this PR does / why we need it:
A DATA BRANCH MERGE of one renamed row in a six-row table spent most of its time replaying historical
mo_catalog.mo_tableschanges. Four scans encountered the same missing historical object before falling back to a snapshot Reader. The original catalog row was already readable by its compound primary key at the required snapshot.WHEN CONFLICT SKIPeven when ALTER rewrites the catalog row.On a QA cluster running the 4.2.8 hotfix line, a six-row one-update MERGE in the same older database took 62.946 s on the current QA CN and 0.834 s on one isolated CN with these optimizations. This is a one-run result per CN. The baseline spent 56.10 s on four catalog replays. The optimized run resolved both table creation timestamps via snapshot reads in 4.08 ms and 0.12 ms, and its result matched all six expected rows.
Validation
Passed locally on Go 1.26.4 / macOS arm64:
objectio,objectio/ioutil,tae/logtail,disttae/logtailreplay, andvm/enginepackage tests.frontend,vm/engine/test, andtests/dmltests for DATA BRANCH, PK filtering, checkpoint ranges and metadata reuse, and stale-read recovery.The QA timing was measured on the hotfix-based image. GitHub CI covers this 4.2-dev port on its own base.