Skip to content
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

Merged
merged 108 commits into from
Jan 29, 2019

Conversation

Tim-Brooks
Copy link
Contributor

@Tim-Brooks Tim-Brooks commented Nov 20, 2018

This commit modifies the put follow index action to use a
CcrRepository when creating a follower index. It simply
routes the logic through the snapshot/restore process. The restored
shards are still empty in this commit.

@Tim-Brooks Tim-Brooks added >non-issue v7.0.0 :Distributed Indexing/CCR Issues around the Cross Cluster State Replication features v6.6.0 labels Nov 20, 2018
Copy link
Contributor

@ywelsch ywelsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting close...

docs/reference/ccr/apis/follow/put-follow.asciidoc 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);
Copy link
Contributor

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

Copy link
Contributor Author

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.

@Tim-Brooks
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/2

Copy link
Contributor

@ywelsch ywelsch left a 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) {
Copy link
Contributor

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()));
Copy link
Contributor

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)

@Tim-Brooks
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/packaging-sample

@Tim-Brooks Tim-Brooks merged commit 00ace36 into elastic:master Jan 29, 2019
Tim-Brooks added a commit to Tim-Brooks/elasticsearch that referenced this pull request Jan 29, 2019
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.
Tim-Brooks added a commit that referenced this pull request Jan 31, 2019
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.
@Tim-Brooks Tim-Brooks deleted the ccr_recover_from_repository branch December 18, 2019 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/CCR Issues around the Cross Cluster State Replication features >non-issue v6.7.0 v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants