@@ -298,9 +298,9 @@ public int countShards(IndexMetadata indexMetadata) {
298298 * @return The total number of new shards to be created for this group.
299299 */
300300 public int newShardsTotal (Settings indexSettings ) {
301- final boolean frozen = FROZEN_GROUP .equals (INDEX_SETTING_SHARD_LIMIT_GROUP .get (indexSettings ));
302- final int numberOfShards = (frozen == (this == FROZEN )) ? INDEX_NUMBER_OF_SHARDS_SETTING .get (indexSettings ) : 0 ;
303- final int numberOfReplicas = (frozen == (this == FROZEN ))
301+ final boolean isFrozenLimitGroup = FROZEN_GROUP .equals (INDEX_SETTING_SHARD_LIMIT_GROUP .get (indexSettings ));
302+ final int numberOfShards = (isFrozenLimitGroup == (this == FROZEN )) ? INDEX_NUMBER_OF_SHARDS_SETTING .get (indexSettings ) : 0 ;
303+ final int numberOfReplicas = (isFrozenLimitGroup == (this == FROZEN ))
304304 ? IndexMetadata .INDEX_NUMBER_OF_REPLICAS_SETTING .get (indexSettings )
305305 : 0 ;
306306 return newShardsTotal (numberOfShards , numberOfReplicas );
@@ -313,13 +313,13 @@ public int newShardsTotal(Settings indexSettings) {
313313 * @return The number of new replica shards to be created for this group.
314314 */
315315 public int newShardsTotal (Settings indexSettings , int updatedReplicas ) {
316- final boolean frozen = FROZEN_GROUP .equals (INDEX_SETTING_SHARD_LIMIT_GROUP .get (indexSettings ));
316+ final boolean isFrozenLimitGroup = FROZEN_GROUP .equals (INDEX_SETTING_SHARD_LIMIT_GROUP .get (indexSettings ));
317317 final int shards = INDEX_NUMBER_OF_SHARDS_SETTING .get (indexSettings );
318318 final int replicas = IndexMetadata .INDEX_NUMBER_OF_REPLICAS_SETTING .get (indexSettings );
319319 final int replicaIncrease = updatedReplicas - replicas ;
320320 return switch (this ) {
321- case NORMAL -> frozen ? 0 : shards * replicaIncrease ;
322- case FROZEN -> frozen ? shards * replicaIncrease : 0 ;
321+ case NORMAL -> isFrozenLimitGroup ? 0 : shards * replicaIncrease ;
322+ case FROZEN -> isFrozenLimitGroup ? shards * replicaIncrease : 0 ;
323323 case INDEX -> 0 ;
324324 case SEARCH -> shards * replicaIncrease ;
325325 };
0 commit comments