Skip to content

Commit

Permalink
Better latch countdown
Browse files Browse the repository at this point in the history
  • Loading branch information
jasontedor committed Jun 9, 2017
1 parent 73bc0d1 commit 76162e4
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1564,18 +1564,22 @@ public void onResponse(final Releasable releasable) {
if (state() == IndexShardState.RELOCATED) {
onFailure(new IndexShardRelocatedException(shardId));
}
boolean success = false;
try {
getEngine().seqNoService().markAllocationIdAsInSync(allocationId, localCheckpoint);
/*
* We could have blocked waiting for the replica to catch up that we fell idle and there will not be a
* background sync to the replica; mark our self as active to force a future background sync.
*/
active.compareAndSet(false, true);
latch.countDown();
success = true;
} catch (final InterruptedException e) {
onFailure(e);
} finally {
releasable.close();
if (success) {
latch.countDown();
}
}
}

Expand Down

0 comments on commit 76162e4

Please sign in to comment.