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

[BUG] OperationRoutingTests.testWeightedOperationRoutingWeightUndefinedForOneZone failure #5289

Merged
merged 4 commits into from
Nov 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,10 @@ public void testWeightedOperationRoutingWeightUndefinedForOneZone() throws Excep
try {
ClusterState state = clusterStateForWeightedRouting(indexNames, numShards, numReplicas);

Settings setting = Settings.builder().put("cluster.routing.allocation.awareness.attributes", "zone").build();
Settings setting = Settings.builder()
.put("cluster.routing.allocation.awareness.attributes", "zone")
.put("cluster.routing.allocation.awareness.force.zone.values", "a,b,c")
.build();

threadPool = new TestThreadPool("testThatOnlyNodesSupport");
clusterService = ClusterServiceUtils.createClusterService(threadPool);
Expand Down Expand Up @@ -932,8 +935,9 @@ public void testWeightedOperationRoutingWeightUndefinedForOneZone() throws Excep
);

for (ShardIterator it : groupIterator) {
List<ShardRouting> shardRoutings = Collections.singletonList(it.nextOrNull());
for (ShardRouting shardRouting : shardRoutings) {
while (it.remaining() > 0) {
ShardRouting shardRouting = it.nextOrNull();
assertNotNull(shardRouting);
selectedNodes.add(shardRouting.currentNodeId());
}
}
Expand All @@ -950,9 +954,8 @@ public void testWeightedOperationRoutingWeightUndefinedForOneZone() throws Excep
assertFalse(weighAwayNodesInUndefinedZone);

selectedNodes = new HashSet<>();
setting = Settings.builder().put("cluster.routing.allocation.awareness.attributes", "zone").build();

// Updating weighted round robin weights in cluster state
// Updating weighted round-robin weights in cluster state
weights = Map.of("a", 0.0, "b", 1.0);

state = setWeightedRoutingWeights(state, weights);
Expand All @@ -964,11 +967,13 @@ public void testWeightedOperationRoutingWeightUndefinedForOneZone() throws Excep
groupIterator = opRouting.searchShards(state, indexNames, null, null, collector, outstandingRequests);

for (ShardIterator it : groupIterator) {
List<ShardRouting> shardRoutings = Collections.singletonList(it.nextOrNull());
for (ShardRouting shardRouting : shardRoutings) {
while (it.remaining() > 0) {
ShardRouting shardRouting = it.nextOrNull();
assertNotNull(shardRouting);
selectedNodes.add(shardRouting.currentNodeId());
}
}

// tests that no shards are assigned to zone with weight zero
// tests shards are assigned to nodes in zone c
weighAwayNodesInUndefinedZone = true;
Expand Down