Skip to content

Commit d085661

Browse files
authored
Add feature flag for undesired allocation tracker (#137717)
1 parent 0de0dce commit d085661

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/UndesiredAllocationsTracker.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.elasticsearch.common.settings.ClusterSettings;
1717
import org.elasticsearch.common.settings.Setting;
1818
import org.elasticsearch.common.time.TimeProvider;
19+
import org.elasticsearch.common.util.FeatureFlag;
1920
import org.elasticsearch.core.TimeValue;
2021
import org.elasticsearch.index.shard.ShardId;
2122
import org.elasticsearch.logging.LogManager;
@@ -40,6 +41,7 @@ public class UndesiredAllocationsTracker {
4041
private static final Logger logger = LogManager.getLogger(UndesiredAllocationsTracker.class);
4142

4243
private static final TimeValue FIVE_MINUTES = timeValueMinutes(5);
44+
private static final FeatureFlag UNDESIRED_ALLOCATION_TRACKER_ENABLED = new FeatureFlag("undesired_allocation_tracker");
4345

4446
/**
4547
* Warning logs will be periodically written if we see a shard that's been in an undesired allocation for this long
@@ -68,7 +70,7 @@ public class UndesiredAllocationsTracker {
6870
*/
6971
public static final Setting<Integer> MAX_UNDESIRED_ALLOCATIONS_TO_TRACK = Setting.intSetting(
7072
"cluster.routing.allocation.desired_balance.undesired_duration_logging.max_to_track",
71-
0,
73+
UNDESIRED_ALLOCATION_TRACKER_ENABLED.isEnabled() ? 10 : 0,
7274
0,
7375
100,
7476
Setting.Property.Dynamic,

0 commit comments

Comments
 (0)