-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Use CcrRepository
to init follower index
#35719
Use CcrRepository
to init follower index
#35719
Conversation
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.
Getting close...
...ck/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/TransportPutFollowAction.java
Outdated
Show resolved
Hide resolved
...ck/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/TransportPutFollowAction.java
Outdated
Show resolved
Hide resolved
...ck/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/TransportPutFollowAction.java
Outdated
Show resolved
Hide resolved
imdBuilder.setRoutingNumShards(leaderIndexMetaData.getRoutingNumShards()); | ||
// We assert that insync allocation ids are not empty in `PrimaryShardAllocator` | ||
for (IntObjectCursor<Set<String>> entry : leaderIndexMetaData.getInSyncAllocationIds()) { | ||
imdBuilder.putInSyncAllocationIds(entry.key, entry.value); |
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.
we could just put a dummy value in here
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.
I used UUIDS in the change.
x-pack/plugin/src/test/resources/rest-api-spec/api/ccr.follow.json
Outdated
Show resolved
Hide resolved
@elasticmachine run elasticsearch-ci/2 |
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
ActionListener<PutFollowAction.Response> originalListener, | ||
RestoreService.RestoreCompletionResponse response) { | ||
final ActionListener<PutFollowAction.Response> listener; | ||
if (request.waitForActiveShards() == ActiveShardCount.NONE) { |
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.
let's use .equals()
instead of ==
(even though it's not strictly needed, it's less bugprone if we were to refactor this in the future)
imdBuilder.setRoutingNumShards(leaderIndexMetaData.getRoutingNumShards()); | ||
// We assert that insync allocation ids are not empty in `PrimaryShardAllocator` | ||
for (IntObjectCursor<Set<String>> entry : leaderIndexMetaData.getInSyncAllocationIds()) { | ||
imdBuilder.putInSyncAllocationIds(entry.key, Collections.singleton(UUIDs.randomBase64UUID())); |
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.
let's use a special id "ccr_restore" instead (nicer for debugging purposes)
@elasticmachine run elasticsearch-ci/packaging-sample |
This commit modifies the put follow index action to use a CcrRepository when creating a follower index. It routes the logic through the snapshot/restore process. A wait_for_active_shards parameter can be used to configure how long to wait before returning the response.
This commit modifies the put follow index action to use a CcrRepository when creating a follower index. It routes the logic through the snapshot/restore process. A wait_for_active_shards parameter can be used to configure how long to wait before returning the response.
This commit modifies the put follow index action to use a
CcrRepository
when creating a follower index. It simplyroutes the logic through the snapshot/restore process. The restored
shards are still empty in this commit.