* fix: retain released lock version watermarks
* fix(lock_manager): scope release records to lease identities
Keep a stable acquisition ID in opaque renewal tokens so release history cannot reject a valid lease from a different primary when generation counters overlap. Preserve earlier releases across new acquisitions and ownership eviction.
Carry the maximum lease expiry with releases, prevent renewals from shortening that bound, reject expired inserts, and reclaim release records after expiry. Track replication and handoff before sending copies so local-only leases need no release records.
Add regressions for fresh-primary failover, equal and lower generation counters, reordered releases and renewals, bounded retention, local-only workloads, ownership eviction, legacy release metadata, and gRPC release handling.
* lock_manager: name the release replay tests after the behavior they check
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(lock_manager): serialize lease handoff with local mutations
Hold per-key mutation admission through a fresh lease snapshot, the transfer RPC, and source demotion or removal. A release that wins first suppresses the transfer; a release arriving during handoff waits and is forwarded to the new primary afterward.
Keep incoming replication outside the gate to avoid callback cycles. Retain source authority on transfer errors and apply transfer completion only to the lease that was sent.
Add real gRPC regressions for releases during both handoff branches and replay after release, plus coverage for fresh snapshots, transfer errors, unrelated keys, and replacement leases.
* fix(lock_manager): retry handoffs without retaining renewal authority
Deliver a source-held lease to the current owner before forwarding renewal or unlock. Freeze local authority before sending a transfer, including when the receiver may have committed despite an RPC error. Retry without requiring a membership change, with backoff and shutdown cancellation.
Recheck ownership after a background handoff and preserve the copy until the latest owner receives it. Replicate the effective installed expiry instead of a shorter transfer input.
Replace timing assumptions with a same-key admission contention hook. Cover pre-handoff releases, lost acknowledgements, retry cleanup, owner changes, and effective expiry. Document why identityless legacy releases cannot safely delete slash-format leases with overlapping generation counters.
* test(filer): set up DLM handoff before the peer lock transfer check
Ring-change transfers now go through Dlm.TransferFn, which
SetupDlmReplication installs; without it the lock stays pending on the
old filer and the peer-auth transfer test cannot see it move.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(lock_manager): bound the handoff and unlock completion waits
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(filer): give the handoff retry expiry subtest a one-second lease
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(lock_manager): serve lock and unlock here when a handoff ends with this node as primary
transferToOwnerLocked now returns the primary it observed after the
handoff. LockWithTimeout and Unlock redirected to the primary read before
the transfer, so a ring that moved back during the handoff sent the client
away from the node that holds the lease.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(lock_manager): bound the admission probes in the handoff tests
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(filer): keep the holder's renew token while its lock handoff is pending
A failed transfer RPC or a frozen lease answered the lock request with an
error and an empty RenewToken. The client treats that as a rejection and
drops its token, so it can no longer renew the lease once the handoff
completes. Report transfer failures as LockHandoffPending and echo the
caller's token for that error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(lock_manager): return lease expiry from Lock, Unlock and InsertLock
The DLM was the only production caller of these methods and used private
twins (lockWithExpiry, unlock, insertLock) to get the effective expiry.
Return it from the public methods instead and drop the twins.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(lock_manager): share the copy acceptance checks between InsertLock and InsertBackupLock
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(lock_manager): drive handoff tests through TransferLockToOwner
TransferLock and its helpers were only reachable from tests. Remove them
so the tests exercise the production handoff path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(lock_manager): share the routing and handoff prologue of LockWithTimeout and Unlock
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Master <Master@node0.8m510.lpad-pg0.utah.cloudlab.us>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>