Repository navigation
fix ut - #25792
fix ut#25792
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? |
已经修改.
|
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-reviewed current head e0613dc after the cold-start QueryService regression was restored. The previous blocker is resolved.
The lockservice ownership closure is sound: waiterEvents takes one reference per blocked-list entry; checker removal, synchronous removal, and service close are serialized by the same mutex, so each events-owned reference is released exactly once. The synchronous path now removes that old-generation reference after wait completion and before reset/requeue, preventing the checker from observing a reused waiter. Lock-queue, active-transaction, events, and caller references remain independent and symmetric across success, timeout/cancellation, range-lock requeue, and close. Clearing the slice also drops stale backing-array references.
The QueryService test again keeps the backend cold and therefore covers concurrent backend creation and waiter wakeup. Response handlers are invoked serially by the draining loop, so removing the test mutex and sleep is valid. The Dispatch assertion that was removed depended on sender scheduling after an unbuffered-channel handoff; the retained remoteReceivers assertion directly proves registration.
Validation on the clean synthetic merge with current main: focused race tests passed for lockservice x20, cold QueryService x50, and Dispatch x50. Full owning-package race suites also passed for lockservice, queryservice, and dispatch. CI is green and the PR merges cleanly. No blocking findings.
Merge Queue Status
This pull request spent 1 hour 20 minutes 32 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. Tick the box to put this pull request back in the merge queue (same as
|
…1-dev (#25849) ## What type of PR is this? - [ ] API-change - [x] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Backport of #25447 to 4.1-dev. Fixes #25297 Fixes #25278 Related to #25279 ## What this PR does / why we need it: Backports the lockservice fix for owner-local remote lock deadlocks: - detects owner-local wait cycles rooted at the actual conflicting holders; - caps owner-side remote lock waits at two minutes by default; - retains remote lock metadata so rollback can release partially granted locks; - fixes deadlock detector enqueue bookkeeping and adds focused metrics; - removes completed synchronous waiters from the deadlock-event set before a waiter can be reused, and drops retained waiter references during shutdown (the relevant lockservice portion of #25792). Method_Lock is still protocol v1 and has no peer capability signal. The owner therefore keeps the dedicated ErrRemoteLockWaitTimeout internally but sends the existing ErrDeadLockDetected over v1. Every supported 4.1 origin recognizes that code as a whole-transaction rollback, so it issues remote unlock even for a partial multi-row grant during a rolling upgrade. The cherry-pick applies cleanly to the current 4.1-dev / v4.1.2 baseline. Follow-up #25469 remains unnecessary on this branch: 4.1 already releases the forwarded transaction lock with defer txn.Unlock() before entering the asynchronous wait path. ## Validation - go test -v ./pkg/lockservice -count=1 -timeout=20m — PASS (573.999s) - go build ./pkg/lockservice — PASS - go vet ./pkg/lockservice — PASS - focused waiter and V1 compatibility regression tests under -race -count=10 — PASS - go test ./pkg/frontend -run Test_isErrorRollbackWholeTxn -count=1 -timeout=5m (with repository CGO/rpath settings) — PASS The V1 compatibility test makes a two-row remote request acquire row 1 then time out on row 2, checks the legacy deadlock code, performs the old-origin whole-transaction unlock, and verifies row 1 is immediately lockable. --------- Co-authored-by: XuPeng-SH <[email protected]>
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#25735 matrixorigin#25734 matrixorigin#25729 ## What this PR does / why we need it: - 修复同步 lock waiter 返回后仍被 waiterEvents 持有的问题,及时移除并释放 events 引用,避免 waiter 复用时发生 data race。 - waiterEvents.close() 清空 waiter 列表,防止关闭后重复释放引用。 - 增加 waiter 生命周期、关闭和 range-lock 并发回归测试。 - 修正 QueryService 并发 UT:预热 MORPC backend,消除首次建连竞争导致的偶现失败。 - 删除 Dispatch UT 中不成立的异步时序断言,保留能够直接证明 receiver 已注册的断言。 - UT 使用非池化 waiter,避免污染全局 reuse checker。 --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: XuPeng-SH <[email protected]>
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#25735 matrixorigin#25734 matrixorigin#25729 ## What this PR does / why we need it: - 修复同步 lock waiter 返回后仍被 waiterEvents 持有的问题,及时移除并释放 events 引用,避免 waiter 复用时发生 data race。 - waiterEvents.close() 清空 waiter 列表,防止关闭后重复释放引用。 - 增加 waiter 生命周期、关闭和 range-lock 并发回归测试。 - 修正 QueryService 并发 UT:预热 MORPC backend,消除首次建连竞争导致的偶现失败。 - 删除 Dispatch UT 中不成立的异步时序断言,保留能够直接证明 receiver 已注册的断言。 - UT 使用非池化 waiter,避免污染全局 reuse checker。 --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: XuPeng-SH <[email protected]>
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#25735 matrixorigin#25734 matrixorigin#25729 ## What this PR does / why we need it: - 修复同步 lock waiter 返回后仍被 waiterEvents 持有的问题,及时移除并释放 events 引用,避免 waiter 复用时发生 data race。 - waiterEvents.close() 清空 waiter 列表,防止关闭后重复释放引用。 - 增加 waiter 生命周期、关闭和 range-lock 并发回归测试。 - 修正 QueryService 并发 UT:预热 MORPC backend,消除首次建连竞争导致的偶现失败。 - 删除 Dispatch UT 中不成立的异步时序断言,保留能够直接证明 receiver 已注册的断言。 - UT 使用非池化 waiter,避免污染全局 reuse checker。 --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: XuPeng-SH <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
issue #25735
#25734
#25729
What this PR does / why we need it: