Skip to content

Commit

Permalink
A dropped IndexRequest should return an IndexResponse, not an UpdateR…
Browse files Browse the repository at this point in the history
…esponse
  • Loading branch information
romseygeek committed Sep 28, 2023
1 parent a698f4d commit b357de4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.ingest.IngestActionForwarder;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.HandledTransportAction;
import org.elasticsearch.action.support.WriteResponse;
import org.elasticsearch.action.support.replication.ReplicationResponse;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.action.update.UpdateResponse;
import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.ClusterStateObserver;
Expand Down Expand Up @@ -936,7 +936,7 @@ synchronized void markItemAsDropped(int slot) {
BulkItemResponse.success(
slot,
indexRequest.opType(),
new UpdateResponse(
new IndexResponse(
new ShardId(indexRequest.index(), IndexMetadata.INDEX_UUID_NA_VALUE, 0),
id,
SequenceNumbers.UNASSIGNED_SEQ_NO,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public IndexResponse(ShardId shardId, String id, long seqNo, long primaryTerm, l
this(shardId, id, seqNo, primaryTerm, version, created ? Result.CREATED : Result.UPDATED);
}

private IndexResponse(ShardId shardId, String id, long seqNo, long primaryTerm, long version, Result result) {
super(shardId, id, seqNo, primaryTerm, version, assertCreatedOrUpdated(result));
public IndexResponse(ShardId shardId, String id, long seqNo, long primaryTerm, long version, Result result) {
super(shardId, id, seqNo, primaryTerm, version, assertCreatedOrUpdatedOrNoop(result));
}

private static Result assertCreatedOrUpdated(Result result) {
assert result == Result.CREATED || result == Result.UPDATED;
private static Result assertCreatedOrUpdatedOrNoop(Result result) {
assert result == Result.CREATED || result == Result.UPDATED || result == Result.NOOP;
return result;
}

Expand Down

0 comments on commit b357de4

Please sign in to comment.