Skip to content

Commit

Permalink
Fix bulk NPE when retrying failure redirect after cluster block (elas…
Browse files Browse the repository at this point in the history
…tic#107598) (elastic#107793)

This PR fixes a bug in the bulk operation when retrying blocked cluster states before 
executing a failure store write by correctly wrapping the retry runnable to keep it from 
prematurely returning a null response.
  • Loading branch information
jbaiera authored Apr 23, 2024
1 parent 44de6cb commit 4813129
Show file tree
Hide file tree
Showing 3 changed files with 203 additions and 55 deletions.
5 changes: 5 additions & 0 deletions docs/changelog/107598.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 107598
summary: Fix bulk NPE when retrying failure redirect after cluster block
area: Data streams
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ private void doRedirectFailures() {
assert failureStoreRedirects.isEmpty() != true : "Attempting to redirect failures, but none were present in the queue";
final ClusterState clusterState = observer.setAndGetObservedState();
// If the cluster is blocked at this point, discard the failure store redirects and complete the response with the original failures
if (handleBlockExceptions(clusterState, ActionRunnable.run(listener, this::doRedirectFailures), this::discardRedirectsAndFinish)) {
if (handleBlockExceptions(
clusterState,
ActionRunnable.wrap(listener, (l) -> this.doRedirectFailures()),
this::discardRedirectsAndFinish
)) {
return;
}
Map<ShardId, List<BulkItemRequest>> requestsByShard = drainAndGroupRedirectsByShards(clusterState);
Expand Down
Loading

0 comments on commit 4813129

Please sign in to comment.