Skip to content

Commit

Permalink
Resolve listener passed to WriteActionReplicasProxy#failShardIfNeeded…
Browse files Browse the repository at this point in the history
… when replica not failed

Signed-off-by: Marc Handalian <[email protected]>
  • Loading branch information
mch2 committed Feb 6, 2024
1 parent 3cbf54e commit cbe8679
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,8 @@ public void failShardIfNeeded(
exception,
listener
);
} else {
listener.onResponse(null);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,10 @@ public void testPrimaryClosedDoesNotFailShard() {
new PrimaryShardClosedException(shardId),
ActionListener.wrap(callbackCount::incrementAndGet)
);
// emptyArray ensures no failure call is invoked
MatcherAssert.assertThat(transport.getCapturedRequestsAndClear(), emptyArray());
MatcherAssert.assertThat(callbackCount.get(), equalTo(0));
// listener should get invoked
MatcherAssert.assertThat(callbackCount.get(), equalTo(1));
}

private class TestAction extends TransportWriteAction<TestRequest, TestRequest, TestResponse> {
Expand Down

0 comments on commit cbe8679

Please sign in to comment.