Repository navigation
perf(disttae): skip impossible single-block workspace delete scans - #29027
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? |
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
The workspace-scan guard otherwise preserves the prior behavior and locking contract, but the new test file violates a mandatory repository policy.
P2 - Use the repository-required Apache license header (pkg/vm/engine/disttae/txn_delete_scan_test.go:1)
This new Go file contains only an abbreviated four-line notice. .licenserc.yml requires the repository's complete Apache-2.0 header for every Go file, and the exact-head license check rejects this file. Replace it with the standard full header used by neighboring Go files so the mandatory static-analysis gate can pass.
590a7e6 to
e187b4d
Compare
e187b4d to
1f02054
Compare
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
The sole prior blocker—the incomplete Apache-2.0 header in txn_delete_scan_test.go—is fixed, and the repository license checker accepts the package. No prior blocker was withdrawn, downgraded, or remains. Range-diff confirms the production change is unchanged after the rebase, and relevant base dependencies did not change. The guard retains locking and skips only a scan that cannot match raw workspace INSERT row IDs; no correctness, compatibility, concurrency, resource, performance, unhappy-path, or test-coverage finding remains.
## What type of PR is this? - [x] Improvement - [x] Test and CI ## Which issue(s) this PR fixes: #28419 ## What this PR does / why we need it: Improve UT cost attribution and the existing infrastructure without removing test cases or increasing cluster concurrency. - Reuse Makefile-prepared native artifacts only after the existing provenance verifier validates source, platform and build mode. Direct script calls and stale artifacts still run `make cgo`. - Reclaim completed optional embedded-prebuild slots instead of waiting for the oldest child. Preserve bounded child ownership, cancellation, diagnostics and run-local artifact cleanup. - Keep the original full-scope `go test` as the sole embedded test executor, including its timeout and output-drain behavior. Prebuild remains cache warming and is **off by default**. - Make HAKeeper client attempts inherit the existing startup deadline and make retry waiting cancellation-aware. Healthy retry cadence and readiness criteria are unchanged. - Distinguish explicitly released cluster admission from a package-exit upper bound and incomplete captures. Do not attribute later startless captures to terminated processes. - Align the script's diagnostic timeout default with the existing Makefile 120-minute default. This does not increase the Makefile budget and is not a speedup claim. The long Arrow admission waits in two historical CI runs overlapped DML holder work. Summing those waits is not a valid estimate of suite time savings. The separate transaction optimization in #29027 addresses actual holder work; this PR does not change DML tests or production transaction behavior. ### Validation Local macOS/arm64, Go 1.26.4: - Full `optools`: PASS (50.666s); `go vet`, shell syntax and diff checks pass. - Full `embed`: normal PASS (41.787s), race PASS (61.698s); readiness helper race stress ×100 passes. - Authoritative-execution/cancellation contracts: race ×8/×20 pass. - Native build/provenance contracts and holder-generation regressions pass. - Real native preparation: after `make cgo`, verified reuse takes 0.51s without another make; redundant incremental make control takes 4.46s. Local evidence only. - Separate GPT-6 medium design and final infrastructure review: approved, no remaining source blockers. Existing case selection, data, assertions, race mode and package concurrency are preserved. ### Performance and limits No whole-suite Linux speedup is claimed. Optional scheduling defaults remain unchanged; promotion requires comparable complete-run wall-time and memory evidence. No CI wait or merge is requested by this delivery. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
XuPeng-SH
left a comment
There was a problem hiding this comment.
Force re-review for exact head 1f02054.
Scope reviewed: the production guard, the dedicated differential/benchmark/lifecycle tests, and the complete design/evidence document.
- The guard remains inside deleteTableWrites under the original mutex and deferred unlock. It returns early only for one delete block, more than one transaction write, and a sole block key outside TxnWorkspaceSegment; all other cases execute the original scan unchanged.
- The namespace proof is aligned with the existing raw workspace row-ID allocator and the original scan's mandatory first-row block-membership check. The guard does not change deleteBatch, persisted-uncommitted bookkeeping, selection mutation, range filtering, or cleanup.
- The frozen reference implementation is independent of the new predicate and compares counters, selections, batch contents, false-valued keys, mixed/persisted/workspace cases, range misses, metadata/DELETE/ALTER exclusions, repeated calls, and caller-level mixed ownership/deleted-block effects.
- The benchmark controls include sparse workspaces, single-block eligibility, multi-block fallback, unrelated and mixed blocks, and workspace-key fallback. The design explicitly records constant guard overhead and does not claim universal or whole-suite speedup.
- The former license-header blocker is fixed. Required CI is green, including Ubuntu UT/race, SCA, coverage, shared build, and BVT checks; the PR is mergeable with no conflict and is only behind the base branch.
No evidence-backed P0/P1/P2 blocker found. Comment-only because this PR is authored by the review requester.
…igin#29026) ## What type of PR is this? - [x] Improvement - [x] Test and CI ## Which issue(s) this PR fixes: matrixorigin#28419 ## What this PR does / why we need it: Improve UT cost attribution and the existing infrastructure without removing test cases or increasing cluster concurrency. - Reuse Makefile-prepared native artifacts only after the existing provenance verifier validates source, platform and build mode. Direct script calls and stale artifacts still run `make cgo`. - Reclaim completed optional embedded-prebuild slots instead of waiting for the oldest child. Preserve bounded child ownership, cancellation, diagnostics and run-local artifact cleanup. - Keep the original full-scope `go test` as the sole embedded test executor, including its timeout and output-drain behavior. Prebuild remains cache warming and is **off by default**. - Make HAKeeper client attempts inherit the existing startup deadline and make retry waiting cancellation-aware. Healthy retry cadence and readiness criteria are unchanged. - Distinguish explicitly released cluster admission from a package-exit upper bound and incomplete captures. Do not attribute later startless captures to terminated processes. - Align the script's diagnostic timeout default with the existing Makefile 120-minute default. This does not increase the Makefile budget and is not a speedup claim. The long Arrow admission waits in two historical CI runs overlapped DML holder work. Summing those waits is not a valid estimate of suite time savings. The separate transaction optimization in matrixorigin#29027 addresses actual holder work; this PR does not change DML tests or production transaction behavior. ### Validation Local macOS/arm64, Go 1.26.4: - Full `optools`: PASS (50.666s); `go vet`, shell syntax and diff checks pass. - Full `embed`: normal PASS (41.787s), race PASS (61.698s); readiness helper race stress ×100 passes. - Authoritative-execution/cancellation contracts: race ×8/×20 pass. - Native build/provenance contracts and holder-generation regressions pass. - Real native preparation: after `make cgo`, verified reuse takes 0.51s without another make; redundant incremental make control takes 4.46s. Local evidence only. - Separate GPT-6 medium design and final infrastructure review: approved, no remaining source blockers. Existing case selection, data, assertions, race mode and package concurrency are preserved. ### Performance and limits No whole-suite Linux speedup is claimed. Optional scheduling defaults remain unchanged; promotion requires comparable complete-run wall-time and memory evidence. No CI wait or merge is requested by this delivery. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…atrixorigin#29027) ## What type of PR is this? - [x] Improvement ## Which issue(s) this PR fixes: matrixorigin#28419 ## What this PR does / why we need it: Avoid a provably irrelevant transaction workspace scan for deletion from a single persisted block. Raw in-memory INSERT row IDs use `TxnWorkspaceSegment`. With exactly one delete block outside that namespace, none of those raw writes can pass the existing block-membership filter. When the workspace has more than one entry, return after this constant-sized check; otherwise retain the original scan. Keep the existing transaction lock on every call, the complete scan body, and all caller-side committed/spilled/in-memory delete bookkeeping unchanged. This was found while profiling slow DML work holding embedded-cluster admission. It changes product work, not test workload: no test data, existing case, assertion, timeout, race instrumentation, or topology is removed or weakened. The final fast path deliberately handles only one block. Broader map-scanning prototypes regressed sparse or mixed multi-block microbenchmarks and were rejected. Multi-block deletes use the original path plus a constant-time eligibility check; no new index or invalidation state is introduced. ### Validation - Frozen pre-change differential oracle and explicit selection/counter expectations cover persisted/workspace/mixed/empty inputs, excluded entries, inconsistent row/block maps and repeated selections. - Caller regression preserves committed outgoing rows, spilled deletion bookkeeping and in-memory selections; restores its runtime binding after the test. - Existing merge, rollback, PK-write and embedded SQL DML coverage is retained. - Final `disttae` package: normal PASS (9.101s), race PASS (12.370s). The subsequently corrected test-only reference matches the pre-change method statement-for-statement after removing comments and renaming; focused differential/caller race validation PASS (2.809s). - Full unchanged DML race: baseline PASS (163.773s), final candidate PASS (84.203s). Both runs execute the complete package without a case filter. - Exact runtime manifests match: 104 identities (25 top-level, 79 subtests), one run and one pass per identity; no missing/extra/duplicate cases, failures or skips. Final DML normal also PASS (29.207s). - Final unchanged composite subtest, race `-count=2`: PASS twice (15.16s, 14.91s); no data or assertion changes. - Exact-reference microbenchmarks: three samples each, zero allocations. Dense persisted single-block scan about 16.5µs → 25ns. Mixed two-block control about 16.5µs in both versions; unrelated boundary controls retain a small constant overhead (tens of ns), not zero overhead in every workload. - Single workspace-block fallback benchmark passes with zero allocations; shared-machine timing is noisy, so no precise speedup or non-regression bound is claimed for that control. Its original scan remains unchanged. - Separate GPT-6 medium design and final overall review: approved, with the fallback-timing limitation disclosed. CI has not been awaited. ### Performance and limits Measurements use macOS/arm64 and Go 1.26.4. Target and complete DML-package results are local evidence, not an estimate for the entire Linux racing-UT suite. Admission wait time overlaps other work and is not added to savings. Zero overhead for every possible workload is not claimed. | Local race execution | Baseline | Final candidate | |---|---:|---:| | Full DML package | 163.773s | 84.203s | | Unchanged composite-key chunk-boundary subtest within that run | 42.34s | 8.83s | The complete-package comparison is one sequential A/B pair, about 79.57s (48.6%) lower package execution time locally, excluding compilation. It is not a whole-suite CI prediction. The separately reviewed design is in `docs/design/WORKSPACE_DELETE_SCAN_GUARD.md`. There is no format/API change or migration; reverting the isolated optimization restores the original algorithm.
…igin#29026) ## What type of PR is this? - [x] Improvement - [x] Test and CI ## Which issue(s) this PR fixes: matrixorigin#28419 ## What this PR does / why we need it: Improve UT cost attribution and the existing infrastructure without removing test cases or increasing cluster concurrency. - Reuse Makefile-prepared native artifacts only after the existing provenance verifier validates source, platform and build mode. Direct script calls and stale artifacts still run `make cgo`. - Reclaim completed optional embedded-prebuild slots instead of waiting for the oldest child. Preserve bounded child ownership, cancellation, diagnostics and run-local artifact cleanup. - Keep the original full-scope `go test` as the sole embedded test executor, including its timeout and output-drain behavior. Prebuild remains cache warming and is **off by default**. - Make HAKeeper client attempts inherit the existing startup deadline and make retry waiting cancellation-aware. Healthy retry cadence and readiness criteria are unchanged. - Distinguish explicitly released cluster admission from a package-exit upper bound and incomplete captures. Do not attribute later startless captures to terminated processes. - Align the script's diagnostic timeout default with the existing Makefile 120-minute default. This does not increase the Makefile budget and is not a speedup claim. The long Arrow admission waits in two historical CI runs overlapped DML holder work. Summing those waits is not a valid estimate of suite time savings. The separate transaction optimization in matrixorigin#29027 addresses actual holder work; this PR does not change DML tests or production transaction behavior. ### Validation Local macOS/arm64, Go 1.26.4: - Full `optools`: PASS (50.666s); `go vet`, shell syntax and diff checks pass. - Full `embed`: normal PASS (41.787s), race PASS (61.698s); readiness helper race stress ×100 passes. - Authoritative-execution/cancellation contracts: race ×8/×20 pass. - Native build/provenance contracts and holder-generation regressions pass. - Real native preparation: after `make cgo`, verified reuse takes 0.51s without another make; redundant incremental make control takes 4.46s. Local evidence only. - Separate GPT-6 medium design and final infrastructure review: approved, no remaining source blockers. Existing case selection, data, assertions, race mode and package concurrency are preserved. ### Performance and limits No whole-suite Linux speedup is claimed. Optional scheduling defaults remain unchanged; promotion requires comparable complete-run wall-time and memory evidence. No CI wait or merge is requested by this delivery. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…atrixorigin#29027) ## What type of PR is this? - [x] Improvement ## Which issue(s) this PR fixes: matrixorigin#28419 ## What this PR does / why we need it: Avoid a provably irrelevant transaction workspace scan for deletion from a single persisted block. Raw in-memory INSERT row IDs use `TxnWorkspaceSegment`. With exactly one delete block outside that namespace, none of those raw writes can pass the existing block-membership filter. When the workspace has more than one entry, return after this constant-sized check; otherwise retain the original scan. Keep the existing transaction lock on every call, the complete scan body, and all caller-side committed/spilled/in-memory delete bookkeeping unchanged. This was found while profiling slow DML work holding embedded-cluster admission. It changes product work, not test workload: no test data, existing case, assertion, timeout, race instrumentation, or topology is removed or weakened. The final fast path deliberately handles only one block. Broader map-scanning prototypes regressed sparse or mixed multi-block microbenchmarks and were rejected. Multi-block deletes use the original path plus a constant-time eligibility check; no new index or invalidation state is introduced. ### Validation - Frozen pre-change differential oracle and explicit selection/counter expectations cover persisted/workspace/mixed/empty inputs, excluded entries, inconsistent row/block maps and repeated selections. - Caller regression preserves committed outgoing rows, spilled deletion bookkeeping and in-memory selections; restores its runtime binding after the test. - Existing merge, rollback, PK-write and embedded SQL DML coverage is retained. - Final `disttae` package: normal PASS (9.101s), race PASS (12.370s). The subsequently corrected test-only reference matches the pre-change method statement-for-statement after removing comments and renaming; focused differential/caller race validation PASS (2.809s). - Full unchanged DML race: baseline PASS (163.773s), final candidate PASS (84.203s). Both runs execute the complete package without a case filter. - Exact runtime manifests match: 104 identities (25 top-level, 79 subtests), one run and one pass per identity; no missing/extra/duplicate cases, failures or skips. Final DML normal also PASS (29.207s). - Final unchanged composite subtest, race `-count=2`: PASS twice (15.16s, 14.91s); no data or assertion changes. - Exact-reference microbenchmarks: three samples each, zero allocations. Dense persisted single-block scan about 16.5µs → 25ns. Mixed two-block control about 16.5µs in both versions; unrelated boundary controls retain a small constant overhead (tens of ns), not zero overhead in every workload. - Single workspace-block fallback benchmark passes with zero allocations; shared-machine timing is noisy, so no precise speedup or non-regression bound is claimed for that control. Its original scan remains unchanged. - Separate GPT-6 medium design and final overall review: approved, with the fallback-timing limitation disclosed. CI has not been awaited. ### Performance and limits Measurements use macOS/arm64 and Go 1.26.4. Target and complete DML-package results are local evidence, not an estimate for the entire Linux racing-UT suite. Admission wait time overlaps other work and is not added to savings. Zero overhead for every possible workload is not claimed. | Local race execution | Baseline | Final candidate | |---|---:|---:| | Full DML package | 163.773s | 84.203s | | Unchanged composite-key chunk-boundary subtest within that run | 42.34s | 8.83s | The complete-package comparison is one sequential A/B pair, about 79.57s (48.6%) lower package execution time locally, excluding compilation. It is not a whole-suite CI prediction. The separately reviewed design is in `docs/design/WORKSPACE_DELETE_SCAN_GUARD.md`. There is no format/API change or migration; reverting the isolated optimization restores the original algorithm.
What type of PR is this?
Which issue(s) this PR fixes:
#28419
What this PR does / why we need it:
Avoid a provably irrelevant transaction workspace scan for deletion from a single persisted block.
Raw in-memory INSERT row IDs use
TxnWorkspaceSegment. With exactly one delete block outside that namespace, none of those raw writes can pass the existing block-membership filter. When the workspace has more than one entry, return after this constant-sized check; otherwise retain the original scan. Keep the existing transaction lock on every call, the complete scan body, and all caller-side committed/spilled/in-memory delete bookkeeping unchanged.This was found while profiling slow DML work holding embedded-cluster admission. It changes product work, not test workload: no test data, existing case, assertion, timeout, race instrumentation, or topology is removed or weakened.
The final fast path deliberately handles only one block. Broader map-scanning prototypes regressed sparse or mixed multi-block microbenchmarks and were rejected. Multi-block deletes use the original path plus a constant-time eligibility check; no new index or invalidation state is introduced.
Validation
disttaepackage: normal PASS (9.101s), race PASS (12.370s). The subsequently corrected test-only reference matches the pre-change method statement-for-statement after removing comments and renaming; focused differential/caller race validation PASS (2.809s).-count=2: PASS twice (15.16s, 14.91s); no data or assertion changes.Performance and limits
Measurements use macOS/arm64 and Go 1.26.4. Target and complete DML-package results are local evidence, not an estimate for the entire Linux racing-UT suite. Admission wait time overlaps other work and is not added to savings. Zero overhead for every possible workload is not claimed.
The complete-package comparison is one sequential A/B pair, about 79.57s (48.6%) lower package execution time locally, excluding compilation. It is not a whole-suite CI prediction.
The separately reviewed design is in
docs/design/WORKSPACE_DELETE_SCAN_GUARD.md. There is no format/API change or migration; reverting the isolated optimization restores the original algorithm.