-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add assertion on number of recovered ops
This commit adds an assertion to the number of ops recovered from the translog in the recovery of disconnected replica test.
- Loading branch information
1 parent
81a1e1c
commit 8960522
Showing
3 changed files
with
16 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,7 +218,7 @@ boolean isTranslogReadyForSequenceNumberBasedRecovery(final Translog.View transl | |
} | ||
return tracker.getCheckpoint() >= endingSeqNo; | ||
} | ||
return false; | ||
return true; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
} | ||
|
||
/** | ||
|
@@ -417,7 +417,7 @@ void phase2(final Translog.Snapshot snapshot) throws IOException { | |
logger.trace("{} recovery [phase2] to {}: sending transaction log operations", request.shardId(), request.targetNode()); | ||
|
||
// send all the snapshot's translog operations to the target | ||
final int totalOperations = sendSnapshot(snapshot); | ||
final int totalOperations = sendSnapshot(request.startingSeqNo(), snapshot); | ||
|
||
stopWatch.stop(); | ||
logger.trace("{} recovery [phase2] to {}: took [{}]", request.shardId(), request.targetNode(), stopWatch.totalTime()); | ||
|
@@ -465,15 +465,17 @@ public void finalizeRecovery() { | |
} | ||
|
||
/** | ||
* Send the given snapshot's operations to this handler's target node. | ||
* Send the given snapshot's operations with a sequence number greater than the specified staring sequence number to this handler's | ||
* target node. | ||
* <p> | ||
* Operations are bulked into a single request depending on an operation count limit or size-in-bytes limit. | ||
* | ||
* @param snapshot the translog snapshot to replay operations from | ||
* @param startingSeqNo the sequence number for which only operations with a sequence number greater than this will be sent | ||
* @param snapshot the translog snapshot to replay operations from | ||
* @return the total number of translog operations that were sent | ||
* @throws IOException if an I/O exception occurred reading the translog snapshot | ||
*/ | ||
protected int sendSnapshot(final Translog.Snapshot snapshot) throws IOException { | ||
protected int sendSnapshot(final long startingSeqNo, final Translog.Snapshot snapshot) throws IOException { | ||
int ops = 0; | ||
long size = 0; | ||
int totalOperations = 0; | ||
|
@@ -490,6 +492,7 @@ protected int sendSnapshot(final Translog.Snapshot snapshot) throws IOException | |
throw new IndexShardClosedException(request.shardId()); | ||
} | ||
cancellableThreads.checkForCancel(); | ||
if (operation.seqNo() < startingSeqNo) continue; | ||
This comment has been minimized.
Sorry, something went wrong.
bleskes
Contributor
|
||
operations.add(operation); | ||
ops++; | ||
size += operation.estimateSize(); | ||
|
This file contains 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
This file contains 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
why is this changed?