Module org.elasticsearch.server
Class BroadcastRequestSplitHelper
java.lang.Object
org.elasticsearch.action.support.replication.BroadcastRequestSplitHelper
This class implements the logic to "split", rather forward, Broadcast requests like refresh and flush
to the target nodes after a Resharding operation. It also implements the logic to combine responses from
source and target shards.
The logic to split indexing requests is different because each document id has to be inspected to route it
to the correct shard post Resharding. That logic is implemented in
ShardBulkSplitHelper-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends ReplicationRequest<T>>
Tuple<ReplicationResponse, Exception> combineSplitResponses(T originalRequest, Map<ShardId, T> splitRequests, Map<ShardId, Tuple<ReplicationResponse, Exception>> responses) static <T extends ReplicationRequest<T>>
Map<ShardId, T> splitRequest(T request, ProjectMetadata project, BiFunction<ShardId, SplitShardCountSummary, T> targetRequestFactory) Given a stale Replication Request, like flush or refresh, split it into multiple requests, one for the source shard and one for the target shard.
-
Method Details
-
splitRequest
public static <T extends ReplicationRequest<T>> Map<ShardId,T> splitRequest(T request, ProjectMetadata project, BiFunction<ShardId, SplitShardCountSummary, T> targetRequestFactory) Given a stale Replication Request, like flush or refresh, split it into multiple requests, one for the source shard and one for the target shard. SeeShardBulkSplitHelperfor how we splitBulkShardRequestWe are here because there was a mismatch between the SplitShardCountSummary in the request and that on the primary shard node. Note thatIndexReshardingMetadatacannot be NULL here because it is evaluated inReplicationSplitHelper.needsSplitCoordination(Logger, ReplicationRequest, IndexMetadata)with the same metadata before arriving here. The request would have been rejected there if there was no Resharding metadata found. TODO: We assume here that the request is exactly 1 reshard split behind the current state. We might either revise this assumption or enforce it in a follow up -
combineSplitResponses
public static <T extends ReplicationRequest<T>> Tuple<ReplicationResponse,Exception> combineSplitResponses(T originalRequest, Map<ShardId, T> splitRequests, Map<ShardId, Tuple<ReplicationResponse, Exception>> responses)
-