Skip to content

Commit

Permalink
Correctly logging watcher history write failures
Browse files Browse the repository at this point in the history
  • Loading branch information
masseyke committed Nov 3, 2023
1 parent 4952f98 commit ae6fd99
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.elasticsearch.bootstrap.BootstrapCheck;
import org.elasticsearch.client.internal.Client;
import org.elasticsearch.client.internal.OriginSettingClient;
import org.elasticsearch.cluster.metadata.DataStream;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.IndexTemplateMetadata;
Expand Down Expand Up @@ -423,7 +424,7 @@ public void afterBulk(long executionId, BulkRequest request, BulkResponse respon
.collect(Collectors.toMap(BulkItemResponse::getId, BulkItemResponse::getFailureMessage));
Map<String, String> historyFailures = Arrays.stream(response.getItems())
.filter(BulkItemResponse::isFailed)
.filter(r -> r.getIndex().startsWith(HistoryStoreField.INDEX_PREFIX))
.filter(r -> r.getIndex().startsWith(DataStream.BACKING_INDEX_PREFIX + HistoryStoreField.DATA_STREAM))
.collect(Collectors.toMap(BulkItemResponse::getId, BulkItemResponse::getFailureMessage));
if (triggeredFailures.isEmpty() == false) {
String failure = String.join(", ", triggeredFailures.values());
Expand All @@ -444,7 +445,7 @@ public void afterBulk(long executionId, BulkRequest request, BulkResponse respon

Map<String, String> overwrittenIds = Arrays.stream(response.getItems())
.filter(BulkItemResponse::isFailed)
.filter(r -> r.getIndex().startsWith(HistoryStoreField.INDEX_PREFIX))
.filter(r -> r.getIndex().startsWith(DataStream.BACKING_INDEX_PREFIX + HistoryStoreField.DATA_STREAM))
.filter(r -> r.getVersion() > 1)
.collect(Collectors.toMap(BulkItemResponse::getId, BulkItemResponse::getFailureMessage));
if (overwrittenIds.isEmpty() == false) {
Expand Down

0 comments on commit ae6fd99

Please sign in to comment.