mirror of
https://github.com/rustfs/rustfs.git
synced 2026-12-03 06:36:35 +00:00
perf(lock): give exclusive retries a bounded anchor wait
Let a responsive anchor settle contention before asking other voters. Try parallel quorum after an anchor-only refusal and dispatch the remaining quorum together if the anchor stays silent. Clip each voter wait at dispatch and allocate retry state on contention. Retain merged transport, admission, and breaker timing defaults. Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> Signed-off-by: Hauser Zhi <housemecn@gmail.com>
This commit is contained in:
@@ -17,7 +17,7 @@ A timed-out request is no longer cancelled. Cancelling sends `RST_STREAM`, and e
|
||||
|
||||
Three consecutive lock-acquisition timeouts open a request-level per-peer breaker. While open, new `lock` and `lock_batch` calls fail fast as retryable contention; after the backoff window one half-open probe is admitted. The breaker does not block release or refresh traffic, and it is separate from channel eviction. A per-peer in-flight admission limit also bounds requests that were already admitted before the breaker opened.
|
||||
|
||||
Single-resource distributed acquisition bounds each peer's contention wait to one second, but keeps pending responses and partial grants in the same quorum round until a response proves that round cannot reach quorum or the caller's remaining acquisition budget expires. A delayed response can still complete a healthy quorum; it does not restart acquisition with a fresh lock ID merely because delivery took longer than the peer's contention wait. Explicit contention failures retain rollback and retry behavior. Grants whose conservative lease deadline has expired before quorum are rolled back. Cancelling acquisition transfers both confirmed grants and pending replies to background cleanup. The caller's total deadline, read/write quorums, and fast quorum return remain unchanged.
|
||||
In multi-voter single-resource acquisition, the first round caps each peer's contention wait at one second. Exclusive retries allow a longer peer wait and give the first voter time to arbitrate before fanning out. If that voter stays silent, the coordinator contacts enough remaining voters in parallel, reserving at least half the round for fallback. If only the first voter refuses, the next retry uses ordinary parallel quorum so a stale or contended voter cannot block the remaining quorum. Each dispatch caps the peer wait at the remaining round budget. Pending responses and partial grants stay in the same round until a response proves that quorum is impossible or the caller's acquisition budget expires. A delayed response can still complete a healthy quorum; it does not restart acquisition with a fresh lock ID merely because delivery took longer than the peer's contention wait. Explicit contention failures retain rollback and retry behavior. Grants whose conservative lease deadline has expired before quorum are rolled back. Cancelling acquisition transfers both confirmed grants and pending replies to background cleanup. The caller's total deadline, read/write quorums, and fast quorum return remain unchanged.
|
||||
|
||||
Unlock cleanup that remains unconfirmed after three quick retries continues in the background with a deferred schedule (1s, 2s, 4s, 8s, 16s). Exhausting that schedule means cleanup was not confirmed; it does not prove that the peer still holds the lock. A server-side lease bounds any grant that remains.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user