Repository navigation
fix(lockservice): balance row waiter and range ownership lifetimes - #30321
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? |
|
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: d664560b22948860dfdbff26b0bea85c714f5fe6
Assessment: request_changes
Reviewed the complete delta and ownership lifecycle. The waiter and range-ledger fixes are coherent and pass functional and race validation, but mutation normalization introduces a confirmed performance regression in ordinary proxy row unlocks.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
- P2
pkg/lockservice/lock_table_local.go:481: With EnableRemoteLocalProxy enabled, a transaction accumulates 64 singleton Shared row locks and releases its last proxy memberships. The proxy sends conditional mutations with nil ReplaceTo even though there are no ranges or replacement holders.
Impact: Every row now incurs grouping, key copying and additional table-lock work. The real two-service benchmark measured median Unlock latency increasing from 97.948 to 124.322 microseconds (+26.9%), allocations from 272 to 735, and bytes from 49,805 to 78,753 per operation. Preserve lightweight conditional row cleanup and reserve range grouping and replacement staging for cases that require them.
Evidence: lock_table_proxy.go:456-482 establishes the production trigger. Identical base/head benchmarks used five samples of 200 operations, excluding acquisition from timing. Artifacts under /home/xupeng/.local/state/mo-bot/jobs/7832f4aba2391cc5dca14c5e/attempt-1: review_proxy_benchmark_test.go, proxy-benchmark-{base,head}.log, proxy-benchmark-summary.json; receipts checks/1792090519224317676-129.json and checks/1792090513540377864-4.json. Frozen-base overlay inputs and receipt/log hashes are reconciled in validation-audit.json.
Validation:
-
Isolation preflight passed. Verified 192 native inputs and 62 artifact hashes, repository build-owner execution, and unchanged source.
-
Full pkg/lockservice passed normally (67.088s) and under the race detector (70.393s).
-
Each of the six new regressions passed 100 independently selected race runs; go vet passed.
-
Frozen-base controls reproduced leaked waiter references and incomplete range bookkeeping; the candidate passed those regressions.
-
Ordinary mutation-free benchmark controls retained identical allocation counts and median latency changes between -4.1% and +1.6%.
-
Command/source/exit receipts, test selections and retained logs independently reconciled in attempt-1/validation-audit.json; detailed review recorded in attempt-1/review-analysis.md.
Limitations:
-
Benchmarks measure host service/RPC behavior, not production cluster throughput or SQL workload latency.
-
The linked issue body and original workload artifacts were not supplied. Author-only claims were not treated as executed evidence; supplied CI success metadata was not independently audited against raw CI logs.
d664560 to
906ac10
Compare
|
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: 906ac10f45fabc7924038b77e552a52cd93d5f2c
Assessment: approve
Reviewed the complete five-file delta, callers, lifecycle ownership, tests and supplied review concerns. Waiter retirement now follows resource identity, range holders receive complete cleanup ledgers, and proxy handoffs stage bookkeeping before publishing ownership. The design preserves existing responsibility owners and removes obsolete retry state. The previous allocation regression is resolved; the remaining measured proxy lookup cost is justified by correct range handling. No actionable findings remain.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1
Validation:
-
Verified the frozen head and unchanged source. Isolation preflight passed. Recovered native prerequisites through the current repository build owner and verified 192 inputs and 62 artifacts; earlier setup diagnostics were not counted as product-test results.
-
The complete pkg/lockservice suite passed normally with -vet=all in 67.147 seconds and under -race in 70.995 seconds: 662 root tests passed in each run. All seven new regression tests also passed 100 individually selected race repetitions each.
-
Frozen-base production-file overlays reproduced waiter-reference leaks and incomplete range bookkeeping with the candidate tests; the candidate passed both controls. Coverage includes cancellation, admission errors, bookkeeping failure, multiple replacements, retry and two-service proxy behavior.
-
Controlled component benchmarks closed the prior singleton allocation concern: 736 to 273 allocations and approximately 124 to 103 microseconds. Larger candidate/base comparisons measured singleton proxy unlock at 103.5 versus 95.6 microseconds (+8.2%), with equal allocation counts. Mutation-free unlock measured 3.024 versus 2.976 microseconds, with identical bytes and allocations. Range cleanup/handoff remained approximately unchanged against the prior implementation.
-
Reconciled 25 command/source/exit receipts with retained logs and overlay inputs in /home/xupeng/.local/state/mo-bot/jobs/4c67c638d0e7073c5a578216/attempt-1/validation-audit.json. The final audit also passed, receipt checks/1792117432298949464-2.json. Detailed design and coverage assessment is retained in review-record.json.
-
The supplied frozen-head CI snapshot reports successful substantive build, unit, static-analysis, coverage and multi-CN BVT checks; these status records supplement the independently executed local checks.
Limitations:
-
The linked issue's original body/workload artifacts and raw CI logs were not supplied; review used the supplied PR contract, comments, frozen sources and independently retained execution evidence.
-
Performance measurements are service/component benchmarks using controlled production-file overlays, not production SQL throughput measurements. Shared-row admission samples varied and showed a roughly 6% median increase without additional allocations.
-
No historical mixed-version deployment was executed; compatibility assessment covered unchanged protocol structures and existing version/binding guards.
Merge Queue Status
This pull request spent 2 hours 20 minutes 33 seconds in the queue, with no time running CI. ReasonThe merge conditions cannot be satisfied due to failing checks
HintYou may have to fix your CI before adding the pull request to the queue again. Waiting for any of
All conditions
Tick the box to put this pull request back in the merge queue (same as
|
…1471a957d47f888314ee4f9f05921905b9048f7
What type of PR is this?
Which issue(s) this PR fixes:
What this PR does / why we need it:
A notified multi-row request could restart its already acquired prefix, replace its waiter at the same offset, and strand the previous caller reference. Row requests joining a Shared range also recorded only one physical endpoint, so unlock could retain a finished transaction as a holder or leave an endpoint referencing released state.
Preserve the conflict offset and retire replaced waiters by identity before handling admission errors. Record the complete physical range pair before publishing a row request as a new holder, and clear the unlock pairing marker after processing each range. Normalize proxy handoff mutations from logical rows to physical lock groups so every selected replacement retains complete ownership, including when several cached rows have merged into one range. Existing queue admission, fairness, and notification rules are preserved. Ordinary row admission gains no additional lookup; joining a range resolves its paired endpoint once per new holder. Range grouping and replacement ledger staging apply only where a physical range or ownership handoff requires them. Conditional singleton-row cleanup avoids grouping and key copies, and completes under one table lock.
Validation on macOS arm64, Go 1.27.1, using the repository CGo wrapper:
pkg/lockservicetests pass in normal mode (68.534s) and race mode (71.176s).go vet, incrementalgolangci-lint(0 issues), formatting, and diff checks pass.CI results are pending. The issue remains open for reporter verification after merge.
Review follow-up in
906ac10f45fabc7924038b77e552a52cd93d5f2c: keep ordinary conditional proxy row cleanup lightweight while preserving range normalization, first-mutation precedence, Skip, lost-response replay, and the commit timestamp frontier. Rebased onto official maina85d90efc996dfa2621211ec592be4721fd3cb61.Current repair validation (Darwin/arm64, Go 1.27.1, repository CGo wrapper): full
pkg/lockservicenormal tests with-vet=allpass (67.532s), full race tests pass (72.376s), and each of five affected regressions passes 100 focused race runs. Incremental lint reports 0 issues; formatting and diff checks pass. Independent gpt-6-astra medium design and overall review, including rebase reconciliation, completed without unresolved material findings. Focused race100 evidence is reused across the rebase because its production and test inputs are unchanged; full package checks and benchmarks were refreshed.The committed proxy benchmarks use two real services and time only Unlock after 64 separate Shared singleton acquisitions. Original PR unlock implementation and repaired implementation use identical benchmark inputs and rebased dependencies, one warm-up followed by five measured rounds of 200 operations per case:
Run
.agents/skills/mo-dev/scripts/mo-cgo-test -run '^$' -bench '^(BenchmarkProxySingletonRowsUnlock|BenchmarkProxyMergedRangeUnlock|BenchmarkUnlockWithoutConflict)$' -benchtime=200x -count=1for warm-up, then repeat with-count=5for measured samples. These are local service/RPC measurements, not production SQL throughput. New-head CI remains pending after publication.