Skip to content

Commit 0bced20

Browse files
committed
Also support multi-get requests
1 parent db73b39 commit 0bced20

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

server/src/main/java/org/elasticsearch/action/get/TransportShardMultiGetFomTranslogAction.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.elasticsearch.index.IndexService;
2525
import org.elasticsearch.index.engine.Engine;
2626
import org.elasticsearch.index.engine.InternalEngine;
27+
import org.elasticsearch.index.engine.ReadOnlyEngine;
2728
import org.elasticsearch.index.shard.IndexShard;
2829
import org.elasticsearch.index.shard.ShardId;
2930
import org.elasticsearch.indices.IndicesService;
@@ -102,7 +103,11 @@ protected void doExecute(Task task, Request request, ActionListener<Response> li
102103
if (engine == null) {
103104
throw new AlreadyClosedException("engine closed");
104105
}
105-
segmentGeneration = ((InternalEngine) engine).getLastUnsafeSegmentGenerationForGets();
106+
if (engine instanceof InternalEngine internalEngine) {
107+
segmentGeneration = internalEngine.getLastUnsafeSegmentGenerationForGets();
108+
} else if (engine instanceof ReadOnlyEngine readOnlyEngine) {
109+
segmentGeneration = readOnlyEngine.getLastUnsafeSegmentGenerationForGets();
110+
}
106111
}
107112
return new Response(multiGetShardResponse, indexShard.getOperationPrimaryTerm(), segmentGeneration);
108113
});

0 commit comments

Comments
 (0)