Skip to content

Commit

Permalink
Need to set shard info to avoid an NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
romseygeek committed Sep 28, 2023
1 parent b357de4 commit 1cab3ba
Showing 1 changed file with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -932,20 +932,16 @@ synchronized void markItemAsDropped(int slot) {
IndexRequest indexRequest = getIndexWriteRequest(bulkRequest.requests().get(slot));
failedSlots.set(slot);
final String id = indexRequest.id() == null ? DROPPED_ITEM_WITH_AUTO_GENERATED_ID : indexRequest.id();
itemResponses.add(
BulkItemResponse.success(
slot,
indexRequest.opType(),
new IndexResponse(
new ShardId(indexRequest.index(), IndexMetadata.INDEX_UUID_NA_VALUE, 0),
id,
SequenceNumbers.UNASSIGNED_SEQ_NO,
SequenceNumbers.UNASSIGNED_PRIMARY_TERM,
indexRequest.version(),
DocWriteResponse.Result.NOOP
)
)
IndexResponse ir = new IndexResponse(
new ShardId(indexRequest.index(), IndexMetadata.INDEX_UUID_NA_VALUE, 0),
id,
SequenceNumbers.UNASSIGNED_SEQ_NO,
SequenceNumbers.UNASSIGNED_PRIMARY_TERM,
indexRequest.version(),
DocWriteResponse.Result.NOOP
);
ir.setShardInfo(new ReplicationResponse.ShardInfo(0, 0));
itemResponses.add(BulkItemResponse.success(slot, indexRequest.opType(), ir));
}

synchronized void markItemAsFailed(int slot, Exception e) {
Expand Down

0 comments on commit 1cab3ba

Please sign in to comment.