-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Remove _primary and _replica shard preferences #26791
Changes from 2 commits
3edc889
adc7aa0
c442730
e5b2b24
8866933
0460a0f
5f2cd43
9c022a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse; | ||
import org.elasticsearch.action.index.IndexRequestBuilder; | ||
import org.elasticsearch.action.search.SearchPhaseExecutionException; | ||
import org.elasticsearch.action.search.SearchRequestBuilder; | ||
import org.elasticsearch.cli.MockTerminal; | ||
import org.elasticsearch.cluster.ClusterState; | ||
import org.elasticsearch.cluster.routing.GroupShardsIterator; | ||
|
@@ -210,7 +211,10 @@ public void testCorruptTranslogTruncation() throws Exception { | |
logger.info("--> starting the replica node to test recovery"); | ||
internalCluster().startNode(); | ||
ensureGreen("test"); | ||
assertHitCount(client().prepareSearch("test").setPreference("_replica").setQuery(matchAllQuery()).get(), numDocsToKeep); | ||
for(String node : internalCluster().nodesInclude("test")){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add extra spacing like:
Your IDE can help with this. |
||
SearchRequestBuilder q = client().prepareSearch("test").setPreference("_only_nodes:" + node).setQuery(matchAllQuery()); | ||
assertHitCount(q.get(), numDocsToKeep); | ||
} | ||
final RecoveryResponse recoveryResponse = client().admin().indices().prepareRecoveries("test").setActiveOnly(false).get(); | ||
final RecoveryState replicaRecoveryState = recoveryResponse.shardRecoveryStates().get("test").stream() | ||
.filter(recoveryState -> recoveryState.getPrimary() == false).findFirst().get(); | ||
|
@@ -308,7 +312,9 @@ public void testCorruptTranslogTruncationOfReplica() throws Exception { | |
logger.info("--> starting the replica node to test recovery"); | ||
internalCluster().startNode(); | ||
ensureGreen("test"); | ||
assertHitCount(client().prepareSearch("test").setPreference("_replica").setQuery(matchAllQuery()).get(), totalDocs); | ||
for(String node : internalCluster().nodesInclude("test")){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra spacing here:
|
||
assertHitCount(client().prepareSearch("test").setPreference("_only_nodes:"+node).setQuery(matchAllQuery()).get(), totalDocs); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spacing here:
|
||
} | ||
|
||
final RecoveryResponse recoveryResponse = client().admin().indices().prepareRecoveries("test").setActiveOnly(false).get(); | ||
final RecoveryState replicaRecoveryState = recoveryResponse.shardRecoveryStates().get("test").stream() | ||
|
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.
This can be replaced with
expectThrows
.