Repository navigation
fix(lockservice): recover rejected routes and quiesce departed owners - #28474
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.
Reviewed the complete eight-file change at exact head 07a73ab, including the surrounding lock-admission, transaction-reference, allocator cleanup and RPC discovery implementations. No confirmed merge-blocking finding.
The targeted design preserves the important separation between route availability and transaction safety: rejected remote routes are detached only for the exact invalidated bind/ref generation, without releasing the old transaction's reference or re-enabling its keeper traffic. Lock, RemoteLock and ForwardLock all drop their existing transaction/read locks before entering the common transition; the ref is pinned through detachment and close occurs outside the mutation locks. A newer route or a valid same-key reacquisition is preserved. The successful admission path adds no work, and removal uses the group/table lookup rather than a table scan.
On DN, raw membership absence suppresses futile transport probes but is not treated as an authoritative negative active-transaction response. Cleanup retains first-disconnect time and revalidates ctl identity, recovery epoch, inactive timestamp and state generation after the unlocked RPC phase. Resume/fresh fencing cannot be overwritten by the old observation; in-flight commits and persistent unknown-commit fences retain their independent protections. Cancellation, repeated absence, reappearance, expiry and ctl replacement are covered by deterministic tests, alongside rejected-route consumer and exactly-once/outside-lock close controls.
Validation: exact-head CI run 34308439242 reports successful Linux UT, SCA, shared build, coverage and complementary proxy/pessimistic BVT jobs. I also reviewed the checked-in baseline/intervention, focused race and integrated two-CN replacement evidence, including its explicitly documented unsuccessful historical attempts and limits. I did not independently rerun the native package or destructive multi-process harness in this review. The shortened CN lease, two 65-second write windows and deterministic expiry tests are not a default-lease/24-hour/15-minute field soak; the documented immutable-image acceptance gate should remain a separate requirement before closing #27707.
Merge Queue Status
This pull request spent 3 minutes 11 seconds in the queue, with no time running CI. ReasonPull request #28474 has been dequeued Queue conditions are not satisfied:
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Requeued — the merge queue status continues in this comment ↓. |
iamlinjunhong
left a comment
There was a problem hiding this comment.
P1 — inactive markers without a commit control are never expired.
In pkg/lockservice/lock_table_allocator.go:811-812, cleanCommitStateOnce skips every snapshot with snapshot.ctl == nil before reaching applyCommitCleanup. However, the snapshot map is also populated from inactiveService, so a marker can outlive its ctl (for example, after the ctl becomes empty and is deleted, or after AddInvalidService). That marker is then never deleted at retention expiry, and Valid continues returning ErrCannotCommitOnInvalidCN for the service indefinitely. The new regression test pkg/lockservice/lock_table_allocator_recovery_test.go:306-316 explicitly creates marker-only and expects it to expire; this control flow cannot satisfy that expectation. Route ctl-less snapshots through marker expiry without issuing an RPC.
|
@iamlinjunhong I checked the P1 against the reviewed head
The existing test at lines 306–316 checks both requirements: every probe must target Fresh exact-head execution on September 10, with no code/test edits: Both runs also log |
Merge Queue Status
This pull request spent 15 minutes 19 seconds in the queue, with no time running CI. Waiting for any of
All conditions
ReasonPull request #28474 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Tick the box to put this pull request back in the merge queue (same as
|
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related issue #27707 (follow-up to #28474; startup failure observed while validating #28459) ## What this PR does / why we need it: The lockservice commit cleaner used a raw HAKeeper membership miss as proof that a CN was inactive. During CN/HAKeeper startup ordering, the allocator can already have admitted a bind while the first membership snapshot is not yet published. The cleaner then installed `inactiveService`, and the next commit returned `cannot commit an orphan transaction on invalid cn` even though the CN was live. This is the root cause of the apparently flaky ArrowLoad UT failure; #28459 itself does not touch this lifecycle code. This change separates discovery uncertainty from retirement evidence: * a missing owner is recorded only in a cleanup-only retention marker and never fences `Valid`; positive admission, bind keepalive, an authoritative probe, or `Resume` clears that marker; * exact allocator-bind retirement still establishes an admission fence before deleting the bind, including generation zero; * timeout retirement snapshots controller identity and recovery epoch, so a stale validation cannot remove or re-fence a bind after `Resume`, controller replacement, or epoch saturation; * the cleanup-only marker gives controllers with no allocator bind a bounded expiry path, while existing inactive fences and orphan tombstones remain authoritative. ### Test plan * `GOTMPDIR=/home/xupeng/go-tmp ./.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=180s -run '^TestArrowLoadRolloutRollbackDrain$' ./pkg/tests/arrowload` * `GOTMPDIR=/home/xupeng/go-tmp ./.agents/skills/mo-dev/scripts/mo-cgo-test -short -count=1 -timeout=360s ./pkg/lockservice` * `GOTMPDIR=/home/xupeng/go-tmp ./.agents/skills/mo-dev/scripts/mo-cgo-test -short -race -count=1 -timeout=420s ./pkg/lockservice` * lifecycle and unhappy-path selections (absent owner, pending/live bind, orphan/fence preservation, cleanup expiry, Resume interleaving, controller creation/replacement, and epoch saturation) passed with `-race -count=100`; * `golangci-lint run -c .golangci.yml ./pkg/lockservice/...` passed with 0 issues; `git diff --check` passed. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…matrixorigin#28474) ## 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#27707 Keep the issue open until the complete fixed image passes the field acceptance gate below; merging this PR alone is not the closure criterion. ## What this PR does / why we need it: This follow-up closes two recovery gaps left after matrixorigin#28115 and matrixorigin#28343, without weakening their transaction fences: - **DN departed-owner recovery:** check the local raw CN inventory before GetActiveTxn. If no endpoint exists, retain admission/cannot-commit fences but skip futile RPCs, backend resets and repeated missing-owner errors. Recheck membership every normal sweep, including pending-admission CNs. - **Safe eventual expiry:** preserve the first disconnect timestamp rather than extending the 24-hour retention on each failure. Cleanup validates ctl identity, recovery epoch, transaction watermark and inactive timestamp against Resume, fresh state and replacement ctl. In-flight Commit and persistent unknown-Commit fences keep their independent lifetime protection. - **CN route recovery:** a stale allocator reply can republish an invalidated exact bind after keeper detachment. New requests then reject before reaching the RPC refresh path, while the keeper correctly skips the invalidated ref. Rejection now detaches only that exact cached route, allowing subsequent discovery to fetch the converged bind. Lock, ForwardLock and RemoteLock-on-Shared-proxy use the same helper. - **Preserved ownership:** old transactions remain fenced; invalidated refs remain until their consumers release them. The helper pins ref lifetime through constant-time route detachment, preserves newer/metadata-distinct routes and same-key valid reacquisition, and closes outside mutation locks. No wire/API/storage-format change, new retry layer/background worker, pressure-policy change or configuration-default change. Validation: - Deterministic expiry/Resume/Commit/ctl-replacement and missing-membership counterexamples; negative controls fail on unfixed behavior. - Actual Lock and forwarded/proxied handler rejection; cancellation, new route/allocator/routing metadata, ref release/reacquisition, and close ownership controls. - Individual adaptive race stress, including 100 repetitions for the route and membership recovery tests. - Delivery integrates main `f0c31cd4b8` at `56fe252fd7`; CI checks out the PR head, so the current dependency graph is tested explicitly. PR head `07a73ab3e7` differs from the tested revision only in the evidence document. - Integrated owning package: `-short -count=1` passed (86.463s); `-short -race -count=1` passed (91.534s). All ten exact route/membership/expiry race tests were remeasured and repeated individually (nine at 100 repetitions, persistent-disconnect expiry at 47); all passed. - `make build`, `make err-check`, and repository-configured owning-package golangci passed (0 lint issues). - Full-repository `make static-check-analysis GOLANGCI_LINT_CONCURRENCY=2` passed (exit 0): err-check, all-package molint and all-package golangci; golangci reported 0 issues under unchanged repository rules/exclusions (11m21s). - Additional repository license-header check passed (exit 0): 5,264 files checked, 0 invalid, 0 modified. - Integrated real LogService + DN + two CN processes (`dn-expiry-compare-vrbvaws6`, exit 0), two sequential CN replacements: both 65-second windows completed 33 SQL commits. Departed-owner DN error counters stayed `[6] -> [6]` and `[6,6] -> [6,6]`; the second transition had one transient 20702, then progress. Old uncommitted values stayed invisible, both DN fences remained, and the original locked row could be rewritten/committed and read from the other CN. All test-owned processes exited, with no CN fatal/panic. Binary SHA-256: `0d65214a27aafbfd5cc0d574b71ecdbde0ba7f9539ec82bae92986b9f256f4c8`. Limits are explicit: the real test keeps default 24-hour DN retention and 20-second cleaner cadence but uses a 10-second CN remote-lock lease. It is not a default-10-minute-lease test, a 24-hour soak or a field 15-minute acceptance run. The non-short `TestIssue3288` deadline also fails at the clean investigation baseline; no assertion was weakened. Owning-package molint diagnostics match the clean baseline. Full evidence and the closure checklist are in `docs/design/evidence/27707_dn_inactive_expiry.md`. Field acceptance before issue closure: use an immutable image containing the complete fix, replace both CNs with active remote-lock transactions, verify completed rollout/SQL and original-row recovery/data safety, and keep each departed owner's error counters flat for at least 15 minutes after membership convergence. This PR intentionally does not auto-close the issue. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…n#28649) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related issue matrixorigin#27707 (follow-up to matrixorigin#28474; startup failure observed while validating matrixorigin#28459) ## What this PR does / why we need it: The lockservice commit cleaner used a raw HAKeeper membership miss as proof that a CN was inactive. During CN/HAKeeper startup ordering, the allocator can already have admitted a bind while the first membership snapshot is not yet published. The cleaner then installed `inactiveService`, and the next commit returned `cannot commit an orphan transaction on invalid cn` even though the CN was live. This is the root cause of the apparently flaky ArrowLoad UT failure; matrixorigin#28459 itself does not touch this lifecycle code. This change separates discovery uncertainty from retirement evidence: * a missing owner is recorded only in a cleanup-only retention marker and never fences `Valid`; positive admission, bind keepalive, an authoritative probe, or `Resume` clears that marker; * exact allocator-bind retirement still establishes an admission fence before deleting the bind, including generation zero; * timeout retirement snapshots controller identity and recovery epoch, so a stale validation cannot remove or re-fence a bind after `Resume`, controller replacement, or epoch saturation; * the cleanup-only marker gives controllers with no allocator bind a bounded expiry path, while existing inactive fences and orphan tombstones remain authoritative. ### Test plan * `GOTMPDIR=/home/xupeng/go-tmp ./.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=180s -run '^TestArrowLoadRolloutRollbackDrain$' ./pkg/tests/arrowload` * `GOTMPDIR=/home/xupeng/go-tmp ./.agents/skills/mo-dev/scripts/mo-cgo-test -short -count=1 -timeout=360s ./pkg/lockservice` * `GOTMPDIR=/home/xupeng/go-tmp ./.agents/skills/mo-dev/scripts/mo-cgo-test -short -race -count=1 -timeout=420s ./pkg/lockservice` * lifecycle and unhappy-path selections (absent owner, pending/live bind, orphan/fence preservation, cleanup expiry, Resume interleaving, controller creation/replacement, and epoch saturation) passed with `-race -count=100`; * `golangci-lint run -c .golangci.yml ./pkg/lockservice/...` passed with 0 issues; `git diff --check` passed. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…matrixorigin#28474) ## 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#27707 Keep the issue open until the complete fixed image passes the field acceptance gate below; merging this PR alone is not the closure criterion. ## What this PR does / why we need it: This follow-up closes two recovery gaps left after matrixorigin#28115 and matrixorigin#28343, without weakening their transaction fences: - **DN departed-owner recovery:** check the local raw CN inventory before GetActiveTxn. If no endpoint exists, retain admission/cannot-commit fences but skip futile RPCs, backend resets and repeated missing-owner errors. Recheck membership every normal sweep, including pending-admission CNs. - **Safe eventual expiry:** preserve the first disconnect timestamp rather than extending the 24-hour retention on each failure. Cleanup validates ctl identity, recovery epoch, transaction watermark and inactive timestamp against Resume, fresh state and replacement ctl. In-flight Commit and persistent unknown-Commit fences keep their independent lifetime protection. - **CN route recovery:** a stale allocator reply can republish an invalidated exact bind after keeper detachment. New requests then reject before reaching the RPC refresh path, while the keeper correctly skips the invalidated ref. Rejection now detaches only that exact cached route, allowing subsequent discovery to fetch the converged bind. Lock, ForwardLock and RemoteLock-on-Shared-proxy use the same helper. - **Preserved ownership:** old transactions remain fenced; invalidated refs remain until their consumers release them. The helper pins ref lifetime through constant-time route detachment, preserves newer/metadata-distinct routes and same-key valid reacquisition, and closes outside mutation locks. No wire/API/storage-format change, new retry layer/background worker, pressure-policy change or configuration-default change. Validation: - Deterministic expiry/Resume/Commit/ctl-replacement and missing-membership counterexamples; negative controls fail on unfixed behavior. - Actual Lock and forwarded/proxied handler rejection; cancellation, new route/allocator/routing metadata, ref release/reacquisition, and close ownership controls. - Individual adaptive race stress, including 100 repetitions for the route and membership recovery tests. - Delivery integrates main `f0c31cd4b8` at `56fe252fd7`; CI checks out the PR head, so the current dependency graph is tested explicitly. PR head `07a73ab3e7` differs from the tested revision only in the evidence document. - Integrated owning package: `-short -count=1` passed (86.463s); `-short -race -count=1` passed (91.534s). All ten exact route/membership/expiry race tests were remeasured and repeated individually (nine at 100 repetitions, persistent-disconnect expiry at 47); all passed. - `make build`, `make err-check`, and repository-configured owning-package golangci passed (0 lint issues). - Full-repository `make static-check-analysis GOLANGCI_LINT_CONCURRENCY=2` passed (exit 0): err-check, all-package molint and all-package golangci; golangci reported 0 issues under unchanged repository rules/exclusions (11m21s). - Additional repository license-header check passed (exit 0): 5,264 files checked, 0 invalid, 0 modified. - Integrated real LogService + DN + two CN processes (`dn-expiry-compare-vrbvaws6`, exit 0), two sequential CN replacements: both 65-second windows completed 33 SQL commits. Departed-owner DN error counters stayed `[6] -> [6]` and `[6,6] -> [6,6]`; the second transition had one transient 20702, then progress. Old uncommitted values stayed invisible, both DN fences remained, and the original locked row could be rewritten/committed and read from the other CN. All test-owned processes exited, with no CN fatal/panic. Binary SHA-256: `0d65214a27aafbfd5cc0d574b71ecdbde0ba7f9539ec82bae92986b9f256f4c8`. Limits are explicit: the real test keeps default 24-hour DN retention and 20-second cleaner cadence but uses a 10-second CN remote-lock lease. It is not a default-10-minute-lease test, a 24-hour soak or a field 15-minute acceptance run. The non-short `TestIssue3288` deadline also fails at the clean investigation baseline; no assertion was weakened. Owning-package molint diagnostics match the clean baseline. Full evidence and the closure checklist are in `docs/design/evidence/27707_dn_inactive_expiry.md`. Field acceptance before issue closure: use an immutable image containing the complete fix, replace both CNs with active remote-lock transactions, verify completed rollout/SQL and original-row recovery/data safety, and keep each departed owner's error counters flat for at least 15 minutes after membership convergence. This PR intentionally does not auto-close the issue. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…n#28649) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related issue matrixorigin#27707 (follow-up to matrixorigin#28474; startup failure observed while validating matrixorigin#28459) ## What this PR does / why we need it: The lockservice commit cleaner used a raw HAKeeper membership miss as proof that a CN was inactive. During CN/HAKeeper startup ordering, the allocator can already have admitted a bind while the first membership snapshot is not yet published. The cleaner then installed `inactiveService`, and the next commit returned `cannot commit an orphan transaction on invalid cn` even though the CN was live. This is the root cause of the apparently flaky ArrowLoad UT failure; matrixorigin#28459 itself does not touch this lifecycle code. This change separates discovery uncertainty from retirement evidence: * a missing owner is recorded only in a cleanup-only retention marker and never fences `Valid`; positive admission, bind keepalive, an authoritative probe, or `Resume` clears that marker; * exact allocator-bind retirement still establishes an admission fence before deleting the bind, including generation zero; * timeout retirement snapshots controller identity and recovery epoch, so a stale validation cannot remove or re-fence a bind after `Resume`, controller replacement, or epoch saturation; * the cleanup-only marker gives controllers with no allocator bind a bounded expiry path, while existing inactive fences and orphan tombstones remain authoritative. ### Test plan * `GOTMPDIR=/home/xupeng/go-tmp ./.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=180s -run '^TestArrowLoadRolloutRollbackDrain$' ./pkg/tests/arrowload` * `GOTMPDIR=/home/xupeng/go-tmp ./.agents/skills/mo-dev/scripts/mo-cgo-test -short -count=1 -timeout=360s ./pkg/lockservice` * `GOTMPDIR=/home/xupeng/go-tmp ./.agents/skills/mo-dev/scripts/mo-cgo-test -short -race -count=1 -timeout=420s ./pkg/lockservice` * lifecycle and unhappy-path selections (absent owner, pending/live bind, orphan/fence preservation, cleanup expiry, Resume interleaving, controller creation/replacement, and epoch saturation) passed with `-race -count=100`; * `golangci-lint run -c .golangci.yml ./pkg/lockservice/...` passed with 0 issues; `git diff --check` passed. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…matrixorigin#28474) ## 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#27707 Keep the issue open until the complete fixed image passes the field acceptance gate below; merging this PR alone is not the closure criterion. ## What this PR does / why we need it: This follow-up closes two recovery gaps left after matrixorigin#28115 and matrixorigin#28343, without weakening their transaction fences: - **DN departed-owner recovery:** check the local raw CN inventory before GetActiveTxn. If no endpoint exists, retain admission/cannot-commit fences but skip futile RPCs, backend resets and repeated missing-owner errors. Recheck membership every normal sweep, including pending-admission CNs. - **Safe eventual expiry:** preserve the first disconnect timestamp rather than extending the 24-hour retention on each failure. Cleanup validates ctl identity, recovery epoch, transaction watermark and inactive timestamp against Resume, fresh state and replacement ctl. In-flight Commit and persistent unknown-Commit fences keep their independent lifetime protection. - **CN route recovery:** a stale allocator reply can republish an invalidated exact bind after keeper detachment. New requests then reject before reaching the RPC refresh path, while the keeper correctly skips the invalidated ref. Rejection now detaches only that exact cached route, allowing subsequent discovery to fetch the converged bind. Lock, ForwardLock and RemoteLock-on-Shared-proxy use the same helper. - **Preserved ownership:** old transactions remain fenced; invalidated refs remain until their consumers release them. The helper pins ref lifetime through constant-time route detachment, preserves newer/metadata-distinct routes and same-key valid reacquisition, and closes outside mutation locks. No wire/API/storage-format change, new retry layer/background worker, pressure-policy change or configuration-default change. Validation: - Deterministic expiry/Resume/Commit/ctl-replacement and missing-membership counterexamples; negative controls fail on unfixed behavior. - Actual Lock and forwarded/proxied handler rejection; cancellation, new route/allocator/routing metadata, ref release/reacquisition, and close ownership controls. - Individual adaptive race stress, including 100 repetitions for the route and membership recovery tests. - Delivery integrates main `f0c31cd4b8` at `56fe252fd7`; CI checks out the PR head, so the current dependency graph is tested explicitly. PR head `07a73ab3e7` differs from the tested revision only in the evidence document. - Integrated owning package: `-short -count=1` passed (86.463s); `-short -race -count=1` passed (91.534s). All ten exact route/membership/expiry race tests were remeasured and repeated individually (nine at 100 repetitions, persistent-disconnect expiry at 47); all passed. - `make build`, `make err-check`, and repository-configured owning-package golangci passed (0 lint issues). - Full-repository `make static-check-analysis GOLANGCI_LINT_CONCURRENCY=2` passed (exit 0): err-check, all-package molint and all-package golangci; golangci reported 0 issues under unchanged repository rules/exclusions (11m21s). - Additional repository license-header check passed (exit 0): 5,264 files checked, 0 invalid, 0 modified. - Integrated real LogService + DN + two CN processes (`dn-expiry-compare-vrbvaws6`, exit 0), two sequential CN replacements: both 65-second windows completed 33 SQL commits. Departed-owner DN error counters stayed `[6] -> [6]` and `[6,6] -> [6,6]`; the second transition had one transient 20702, then progress. Old uncommitted values stayed invisible, both DN fences remained, and the original locked row could be rewritten/committed and read from the other CN. All test-owned processes exited, with no CN fatal/panic. Binary SHA-256: `0d65214a27aafbfd5cc0d574b71ecdbde0ba7f9539ec82bae92986b9f256f4c8`. Limits are explicit: the real test keeps default 24-hour DN retention and 20-second cleaner cadence but uses a 10-second CN remote-lock lease. It is not a default-10-minute-lease test, a 24-hour soak or a field 15-minute acceptance run. The non-short `TestIssue3288` deadline also fails at the clean investigation baseline; no assertion was weakened. Owning-package molint diagnostics match the clean baseline. Full evidence and the closure checklist are in `docs/design/evidence/27707_dn_inactive_expiry.md`. Field acceptance before issue closure: use an immutable image containing the complete fix, replace both CNs with active remote-lock transactions, verify completed rollout/SQL and original-row recovery/data safety, and keep each departed owner's error counters flat for at least 15 minutes after membership convergence. This PR intentionally does not auto-close the issue. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…n#28649) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related issue matrixorigin#27707 (follow-up to matrixorigin#28474; startup failure observed while validating matrixorigin#28459) ## What this PR does / why we need it: The lockservice commit cleaner used a raw HAKeeper membership miss as proof that a CN was inactive. During CN/HAKeeper startup ordering, the allocator can already have admitted a bind while the first membership snapshot is not yet published. The cleaner then installed `inactiveService`, and the next commit returned `cannot commit an orphan transaction on invalid cn` even though the CN was live. This is the root cause of the apparently flaky ArrowLoad UT failure; matrixorigin#28459 itself does not touch this lifecycle code. This change separates discovery uncertainty from retirement evidence: * a missing owner is recorded only in a cleanup-only retention marker and never fences `Valid`; positive admission, bind keepalive, an authoritative probe, or `Resume` clears that marker; * exact allocator-bind retirement still establishes an admission fence before deleting the bind, including generation zero; * timeout retirement snapshots controller identity and recovery epoch, so a stale validation cannot remove or re-fence a bind after `Resume`, controller replacement, or epoch saturation; * the cleanup-only marker gives controllers with no allocator bind a bounded expiry path, while existing inactive fences and orphan tombstones remain authoritative. ### Test plan * `GOTMPDIR=/home/xupeng/go-tmp ./.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=180s -run '^TestArrowLoadRolloutRollbackDrain$' ./pkg/tests/arrowload` * `GOTMPDIR=/home/xupeng/go-tmp ./.agents/skills/mo-dev/scripts/mo-cgo-test -short -count=1 -timeout=360s ./pkg/lockservice` * `GOTMPDIR=/home/xupeng/go-tmp ./.agents/skills/mo-dev/scripts/mo-cgo-test -short -race -count=1 -timeout=420s ./pkg/lockservice` * lifecycle and unhappy-path selections (absent owner, pending/live bind, orphan/fence preservation, cleanup expiry, Resume interleaving, controller creation/replacement, and epoch saturation) passed with `-race -count=100`; * `golangci-lint run -c .golangci.yml ./pkg/lockservice/...` passed with 0 issues; `git diff --check` passed. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
issue #27707
Keep the issue open until the complete fixed image passes the field acceptance gate below; merging this PR alone is not the closure criterion.
What this PR does / why we need it:
This follow-up closes two recovery gaps left after #28115 and #28343, without weakening their transaction fences:
No wire/API/storage-format change, new retry layer/background worker, pressure-policy change or configuration-default change.
Validation:
f0c31cd4b8at56fe252fd7; CI checks out the PR head, so the current dependency graph is tested explicitly. PR head07a73ab3e7differs from the tested revision only in the evidence document.-short -count=1passed (86.463s);-short -race -count=1passed (91.534s). All ten exact route/membership/expiry race tests were remeasured and repeated individually (nine at 100 repetitions, persistent-disconnect expiry at 47); all passed.make build,make err-check, and repository-configured owning-package golangci passed (0 lint issues).make static-check-analysis GOLANGCI_LINT_CONCURRENCY=2passed (exit 0): err-check, all-package molint and all-package golangci; golangci reported 0 issues under unchanged repository rules/exclusions (11m21s).dn-expiry-compare-vrbvaws6, exit 0), two sequential CN replacements: both 65-second windows completed 33 SQL commits. Departed-owner DN error counters stayed[6] -> [6]and[6,6] -> [6,6]; the second transition had one transient 20702, then progress. Old uncommitted values stayed invisible, both DN fences remained, and the original locked row could be rewritten/committed and read from the other CN. All test-owned processes exited, with no CN fatal/panic. Binary SHA-256:0d65214a27aafbfd5cc0d574b71ecdbde0ba7f9539ec82bae92986b9f256f4c8.Limits are explicit: the real test keeps default 24-hour DN retention and 20-second cleaner cadence but uses a 10-second CN remote-lock lease. It is not a default-10-minute-lease test, a 24-hour soak or a field 15-minute acceptance run. The non-short
TestIssue3288deadline also fails at the clean investigation baseline; no assertion was weakened. Owning-package molint diagnostics match the clean baseline. Full evidence and the closure checklist are indocs/design/evidence/27707_dn_inactive_expiry.md.Field acceptance before issue closure: use an immutable image containing the complete fix, replace both CNs with active remote-lock transactions, verify completed rollout/SQL and original-row recovery/data safety, and keep each departed owner's error counters flat for at least 15 minutes after membership convergence. This PR intentionally does not auto-close the issue.