Range-lock conflicts can strand waiters in stale queues A waiter that moves to a new…
- User
Range-lock conflicts can strand waiters in stale queues
A waiter that moves to a new range conflict must no longer remain in stale queues. Cleanup must preserve unrelated lock state, wake the next eligible waiter when necessary, and continue to work when the previous key disappeared or was recreated.
Interface
No new interfaces are introduced.
- Assistant
Now let me read
waiter.goand thelockContextdefinition: - Assistant
Now let me check for other
waiterQueueimplementations and thedoLockerror path usage ofcloseWaiter: - Assistant
Now add
closeRangeWaitertolock.go, next tocloseWaiter: - Assistant
Now wire it into
handleLockConflictLockedinlock_table_local.go: - Assistant
Let me check
log.gofor the logging helper conventions, since I referenced a new helper: - Assistant
I'll keep the inline log rather than introduce a helper:
- Assistant
Now add the
logRangeLastWaitKeyRemovedhelper tolog.go, following the file's conventions: - Assistant
Now build and run the package tests:
- Assistant
Now let me look at the existing test
TestCannotHungIfRangeConflictWithRowMultiTimesand helpers, to model a regression test: - Assistant
Now I'll add a regression test. First check test helpers (
newTestRows,runLockServiceTests, waiter_queue test style): - Assistant
Now add the tests. First, the queue-level
removetest: - Assistant
Now add the
closeRangeWaiterunit test and the strand regression test at the end oflock_table_local_test.go: - Assistant
All new tests pass. Let me verify the regression test actually catches the bug — temporarily revert the fix in
handleLockConflictLocked: - Assistant
The test fails against the old code, confirming it catches the strand. Restoring the fix:
- Assistant
Now run the full lockservice test suite:
- Assistant
While the suite runs, let me review the final state of the changed code:
- Assistant
The changes look good. Waiting for the full suite to complete:
- Assistant
The diff looks correct. Now I'll wait for the background test suite to finish:
- Assistant
The earlier full-suite run (against the pre-reorder code) failed as expected on the same bug. First, remove the now-duplicated old cleanup block later in the function:
- Assistant
Now rerun the previously failing test plus the new ones:
- Assistant
Race detector is clean. Waiting for the full suite:
- Assistant
While waiting, let me re-verify the final diff of
lock_table_local.goin full: - Assistant
The diff is clean. Now waiting for the full-suite result before concluding.
- Assistant
Deadlock/orphan tests pass. Waiting on the full suite to complete — I'll summarize once it reports.
- Assistant
The full suite is still running in the background; the monitor will report when it finishes. Status so far:
- Fix implemented and all targeted tests pass (including with
-race) go vetandgofmtclean- Awaiting final confirmation from the full
pkg/lockservicesuite
- Fix implemented and all targeted tests pass (including with
- Assistant
Full
pkg/lockservicesuite passes (ok ... 117.605s, exit 0). The fix is complete.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.