-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
[CCR] Retry when no index shard stats can be found #34852
Merged
martijnvg
merged 6 commits into
elastic:master
from
martijnvg:ccr_retry_when_no_index_stats_are_found
Oct 26, 2018
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
31bc047
[CCR] Retry when no index shard stats can be found
martijnvg 190106f
added a comment
martijnvg 4b2fb62
instead of just throwing IndexNotFoundException, throw a ShardNotFoun…
martijnvg b946e30
removed comment
martijnvg 9fa3414
Merge remote-tracking branch 'es/master' into ccr_retry_when_no_index…
martijnvg 66a0907
Merge remote-tracking branch 'es/master' into ccr_retry_when_no_index…
martijnvg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/RestartIndexFollowingIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.ccr; | ||
|
||
import org.elasticsearch.common.xcontent.XContentType; | ||
import org.elasticsearch.index.IndexSettings; | ||
import org.elasticsearch.xpack.CcrIntegTestCase; | ||
import org.elasticsearch.xpack.core.ccr.action.PutFollowAction; | ||
|
||
import java.util.Locale; | ||
|
||
import static java.util.Collections.singletonMap; | ||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; | ||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
public class RestartIndexFollowingIT extends CcrIntegTestCase { | ||
|
||
@Override | ||
protected int numberOfNodesPerCluster() { | ||
return 1; | ||
} | ||
|
||
public void testFollowIndex() throws Exception { | ||
final String leaderIndexSettings = getIndexSettings(1, 0, | ||
singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true")); | ||
singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true"); | ||
assertAcked(leaderClient().admin().indices().prepareCreate("index1").setSource(leaderIndexSettings, XContentType.JSON)); | ||
ensureLeaderGreen("index1"); | ||
|
||
final PutFollowAction.Request followRequest = putFollow("index1", "index2"); | ||
followerClient().execute(PutFollowAction.INSTANCE, followRequest).get(); | ||
|
||
final long firstBatchNumDocs = randomIntBetween(2, 64); | ||
logger.info("Indexing [{}] docs as first batch", firstBatchNumDocs); | ||
for (int i = 0; i < firstBatchNumDocs; i++) { | ||
final String source = String.format(Locale.ROOT, "{\"f\":%d}", i); | ||
leaderClient().prepareIndex("index1", "doc", Integer.toString(i)).setSource(source, XContentType.JSON).get(); | ||
} | ||
|
||
assertBusy(() -> { | ||
assertThat(followerClient().prepareSearch("index2").get().getHits().totalHits, equalTo(firstBatchNumDocs)); | ||
}); | ||
|
||
getFollowerCluster().fullRestart(); | ||
ensureFollowerGreen("index2"); | ||
|
||
final long secondBatchNumDocs = randomIntBetween(2, 64); | ||
for (int i = 0; i < secondBatchNumDocs; i++) { | ||
leaderClient().prepareIndex("index1", "doc").setSource("{}", XContentType.JSON).get(); | ||
} | ||
|
||
assertBusy(() -> { | ||
assertThat(followerClient().prepareSearch("index2").get().getHits().totalHits, | ||
equalTo(firstBatchNumDocs + secondBatchNumDocs)); | ||
}); | ||
} | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Oh, actually, one comment; can you leave a comment here about this, since it's slightly different retry logic from elsewhere.