From 45b884e9cb83e042d07ed592a92b8c996a9a8f5b Mon Sep 17 00:00:00 2001 From: carlosdelest Date: Tue, 14 May 2024 17:45:30 +0200 Subject: [PATCH] Remove unnecessary code in BulkShardRequest --- .../action/bulk/BulkShardRequest.java | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/action/bulk/BulkShardRequest.java b/server/src/main/java/org/elasticsearch/action/bulk/BulkShardRequest.java index 85b7fc03ff667..bd929b9a2204e 100644 --- a/server/src/main/java/org/elasticsearch/action/bulk/BulkShardRequest.java +++ b/server/src/main/java/org/elasticsearch/action/bulk/BulkShardRequest.java @@ -15,7 +15,6 @@ import org.elasticsearch.action.support.replication.ReplicatedWriteRequest; import org.elasticsearch.action.support.replication.ReplicationRequest; import org.elasticsearch.action.update.UpdateRequest; -import org.elasticsearch.cluster.metadata.InferenceFieldMetadata; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.util.set.Sets; @@ -23,7 +22,6 @@ import org.elasticsearch.transport.RawIndexingDataTransportRequest; import java.io.IOException; -import java.util.Map; import java.util.Set; public final class BulkShardRequest extends ReplicatedWriteRequest @@ -35,8 +33,6 @@ public final class BulkShardRequest extends ReplicatedWriteRequest inferenceFieldMap = null; - public BulkShardRequest(StreamInput in) throws IOException { super(in); items = in.readArray(i -> i.readOptionalWriteable(inpt -> new BulkItemRequest(shardId, inpt)), BulkItemRequest[]::new); @@ -48,30 +44,6 @@ public BulkShardRequest(ShardId shardId, RefreshPolicy refreshPolicy, BulkItemRe setRefreshPolicy(refreshPolicy); } - /** - * Public for test - * Set the transient metadata indicating that this request requires running inference before proceeding. - */ - public void setInferenceFieldMap(Map fieldInferenceMap) { - this.inferenceFieldMap = fieldInferenceMap; - } - - /** - * Consumes the inference metadata to execute inference on the bulk items just once. - */ - public Map consumeInferenceFieldMap() { - Map ret = inferenceFieldMap; - inferenceFieldMap = null; - return ret; - } - - /** - * Public for test - */ - public Map getInferenceFieldMap() { - return inferenceFieldMap; - } - public long totalSizeInBytes() { long totalSizeInBytes = 0; for (int i = 0; i < items.length; i++) { @@ -113,10 +85,6 @@ public String[] indices() { @Override public void writeTo(StreamOutput out) throws IOException { - if (inferenceFieldMap != null) { - // Inferencing metadata should have been consumed as part of the ShardBulkInferenceActionFilter processing - throw new IllegalStateException("Inference metadata should have been consumed before writing to the stream"); - } super.writeTo(out); out.writeArray((o, item) -> { if (item != null) {