Update incoming recoveries stats when shadow replica is reinitialized (#20612)
When an active shadow replica is reinitialized during primary promotion, the recovery stats that are used by the allocation decider settings `cluster.routing.allocation.node_concurrent_recoveries` and `cluster.routing.allocation.node_concurrent_incoming_recoveries` have to be updated.
This commit is contained in:
parent
45469a5570
commit
d55bd707a3
|
@ -706,6 +706,7 @@ public class RoutingNodes implements Iterable<RoutingNode> {
|
|||
updateAssigned(candidate, reinitializedShard);
|
||||
inactivePrimaryCount++;
|
||||
inactiveShardCount++;
|
||||
addRecovery(reinitializedShard);
|
||||
return reinitializedShard;
|
||||
}
|
||||
|
||||
|
|
|
@ -206,10 +206,14 @@ public class IndicesClusterStateServiceRandomUpdatesTests extends AbstractIndice
|
|||
break;
|
||||
}
|
||||
String name = "index_" + randomAsciiOfLength(15).toLowerCase(Locale.ROOT);
|
||||
CreateIndexRequest request = new CreateIndexRequest(name, Settings.builder()
|
||||
Settings.Builder settingsBuilder = Settings.builder()
|
||||
.put(SETTING_NUMBER_OF_SHARDS, randomIntBetween(1, 3))
|
||||
.put(SETTING_NUMBER_OF_REPLICAS, randomInt(2))
|
||||
.build()).waitForActiveShards(ActiveShardCount.NONE);
|
||||
.put(SETTING_NUMBER_OF_REPLICAS, randomInt(2));
|
||||
if (randomBoolean()) {
|
||||
settingsBuilder.put(IndexMetaData.SETTING_SHADOW_REPLICAS, true)
|
||||
.put(IndexMetaData.SETTING_SHARED_FILESYSTEM, true);
|
||||
}
|
||||
CreateIndexRequest request = new CreateIndexRequest(name, settingsBuilder.build()).waitForActiveShards(ActiveShardCount.NONE);
|
||||
state = cluster.createIndex(state, request);
|
||||
assertTrue(state.metaData().hasIndex(name));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue