-
Notifications
You must be signed in to change notification settings - Fork 25.4k
Resharding: Route requests to source shard while target is pre-handoff #131306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resharding: Route requests to source shard while target is pre-handoff #131306
Conversation
…outeIndexingRequest Refresh branch
…outeIndexingRequest refresh
…outeIndexingRequest Refresh branch
Pinging @elastic/es-distributed-indexing (Team:Distributed Indexing) |
* @return Updated shardId | ||
*/ | ||
protected final int rerouteIfResharding(int shardId) { | ||
if (indexReshardingMetadata != null && indexReshardingMetadata.getSplit().isTargetShard(shardId)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should we check for indexReshardingMetadata.isSplit()
? It's technically possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
➕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possibly we should assert it is split, because I don't know right now what the correct behaviour here would be if it isn't. Good chance that we'll also need some logic here for any other resharding type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes i am okay with assert
return (indexReshardingMetadata.getSplit().sourceShard(shardId)); | ||
} | ||
} | ||
return (shardId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: why brackets? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (one comment)
* @return Updated shardId | ||
*/ | ||
protected final int rerouteIfResharding(int shardId) { | ||
if (indexReshardingMetadata != null && indexReshardingMetadata.getSplit().isTargetShard(shardId)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possibly we should assert it is split, because I don't know right now what the correct behaviour here would be if it isn't. Good chance that we'll also need some logic here for any other resharding type.
…outeIndexingRequest Refresh
…outeIndexingRequest Refresh branch
…outeIndexingRequest Refresh branch
…outeIndexingRequest Refresh
…outeIndexingRequest Refresh
*/ | ||
protected final int rerouteIfResharding(int shardId) { | ||
if (indexReshardingMetadata != null && indexReshardingMetadata.getSplit().isTargetShard(shardId)) { | ||
assert indexReshardingMetadata.isSplit() : "Index resharding state is not a split"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be before the line with getSplit()
?
This PR routes
DocWriteRequests
(index/delete/update requests) that are meant for the target shards, to source shards, when the target shard is not yet ready.The changes here should also handle bulk requests, because
BulkOperation#groupRequestsByShards
callsint shardId = docWriteRequest.route(indexRouting);
to obtain the shardId. Theroute()
codepath has been modified in this PR to handle resharding scenario.This PR does not address the following cases: