Conversation
…art failure restoreFrom() swallows any Throwable from startRestore()/messenger.send() with just a log line, leaving the session's doneFuture pending forever. There is no timeout on this path, and because the session remains cached and un-done, a retry with the same snapshot (same leader) hits the reuse branch and returns the same dead future - the range is permanently stuck after a failed snapshot install. Complete the future exceptionally in the catch block, so callers observe the failure and a retry starts a fresh session. Control experiment: restoreFromStartFailureCompletesFutureExceptionally fails on the old code and passes with the fix; existing restore expectations unchanged (9/9). Fixes apache#303
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
KVRangeRestorer.restoreFrom()wraps snapshot-install setup intry { … } catch (Throwable t) { log.error(…) }and returns the session'sdoneFuture. IfstartRestore()— or the subsequentmessenger.send()— throws synchronously, the future is never completed.Root cause & impact
currentSession. A retry with the same snapshot from the same leader hits the reuse branch —existingSession.snapshot.equals(rangeSnapshot) && !doneFuture.isDone() && same leader— and returns the same dead future. The range is permanently stuck: it never applies anything and never retries.Snapshot install is mandatory on expansion/rebalance, so any transient synchronous failure here is a hard wedge.
Fix
Complete the future exceptionally in the catch block; the caller observes the failure and a retry starts a fresh session:
Test evidence
New
restoreFromStartFailureCompletesFutureExceptionally:startRestorethrows → the future must be completed exceptionally, and a retry with the same snapshot must start a fresh session (not reuse the dead one).Production validation
Deployed in a rolling 6-node cluster (wholesale
lib/replacement, one node at a time, zero rollbacks); cluster mesh, all 13 live client connections and cross-node delivery verified post-deploy. No wedged range (a range stuck in snapshot restore) observed before or after; the fix closes the permanent-wedge path should a synchronous start failure ever occur.Fixes #303