Skip to content

Commit 1a9302c

Browse files
arteamDaveCTurner
andauthored
Remove deprecated xpack.searchable.snapshot.allocate_on_rolling_restart setting (#114202)
The setting was created as an escape-hatch in case #66369 had some unintended side-effects. It has been deprecated since #84959 (8.2.0). --------- Co-authored-by: David Turner <david.turner@elastic.co>
1 parent 0be75e1 commit 1a9302c

File tree

4 files changed

+25
-60
lines changed

4 files changed

+25
-60
lines changed

docs/changelog/114202.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
pr: 114202
2+
summary: Remove deprecated `xpack.searchable.snapshot.allocate_on_rolling_restart` setting
3+
area: Snapshot/Restore
4+
type: breaking
5+
issues: []
6+
breaking:
7+
title: Remove deprecated `xpack.searchable.snapshot.allocate_on_rolling_restart` setting
8+
area: 'Cluster and node setting'
9+
details: >-
10+
The `xpack.searchable.snapshot.allocate_on_rolling_restart` setting was created as an escape-hatch just in case
11+
relying on the `cluster.routing.allocation.enable=primaries` setting for allocating searchable snapshots during
12+
rolling restarts had some unintended side-effects. It has been deprecated since 8.2.0.
13+
impact: Remove `xpack.searchable.snapshot.allocate_on_rolling_restart` from your settings if present.
14+
notable: false

x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotEnableAllocationDeciderIntegTests.java

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import org.elasticsearch.snapshots.SnapshotId;
1616
import org.elasticsearch.test.ESIntegTestCase;
1717
import org.elasticsearch.xpack.searchablesnapshots.BaseSearchableSnapshotsIntegTestCase;
18-
import org.elasticsearch.xpack.searchablesnapshots.allocation.decider.SearchableSnapshotEnableAllocationDecider;
1918
import org.hamcrest.Matchers;
2019

2120
import java.util.List;
@@ -31,9 +30,7 @@ public void testAllocationDisabled() throws Exception {
3130
final String restoredIndexName = setupMountedIndex();
3231
int numPrimaries = getNumShards(restoredIndexName).numPrimaries;
3332
setEnableAllocation(EnableAllocationDecider.Allocation.PRIMARIES);
34-
if (randomBoolean()) {
35-
setAllocateOnRollingRestart(false);
36-
}
33+
3734
Set<String> indexNodes = internalCluster().nodesInclude(restoredIndexName);
3835
for (String indexNode : indexNodes) {
3936
internalCluster().restartNode(indexNode);
@@ -43,16 +40,13 @@ public void testAllocationDisabled() throws Exception {
4340
.actionGet();
4441
assertThat(response.getUnassignedShards(), Matchers.equalTo(numPrimaries));
4542

46-
setAllocateOnRollingRestart(true);
43+
setEnableAllocation(null);
4744
ensureGreen(restoredIndexName);
4845
}
4946

5047
public void testAllocateOnRollingRestartEnabled() throws Exception {
5148
final String restoredIndexName = setupMountedIndex();
52-
if (randomBoolean()) {
53-
setEnableAllocation(EnableAllocationDecider.Allocation.PRIMARIES);
54-
}
55-
setAllocateOnRollingRestart(true);
49+
setEnableAllocation(null);
5650
Set<String> indexNodes = internalCluster().nodesInclude(restoredIndexName);
5751
for (String indexNode : indexNodes) {
5852
internalCluster().restartNode(indexNode);
@@ -74,14 +68,7 @@ private String setupMountedIndex() throws Exception {
7468
}
7569

7670
public void setEnableAllocation(EnableAllocationDecider.Allocation allocation) {
77-
setSetting(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING, allocation.name());
78-
}
79-
80-
public void setAllocateOnRollingRestart(boolean allocateOnRollingRestart) {
81-
setSetting(
82-
SearchableSnapshotEnableAllocationDecider.SEARCHABLE_SNAPSHOTS_ALLOCATE_ON_ROLLING_RESTART,
83-
Boolean.toString(allocateOnRollingRestart)
84-
);
71+
setSetting(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING, allocation != null ? allocation.name() : null);
8572
}
8673

8774
private void setSetting(Setting<?> setting, String value) {

x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshots.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ public List<Setting<?>> getSettings() {
304304
CacheService.SNAPSHOT_CACHE_SYNC_INTERVAL_SETTING,
305305
CacheService.SNAPSHOT_CACHE_MAX_FILES_TO_SYNC_AT_ONCE_SETTING,
306306
CacheService.SNAPSHOT_CACHE_SYNC_SHUTDOWN_TIMEOUT,
307-
SearchableSnapshotEnableAllocationDecider.SEARCHABLE_SNAPSHOTS_ALLOCATE_ON_ROLLING_RESTART,
308307
BlobStoreCacheMaintenanceService.SNAPSHOT_SNAPSHOT_CLEANUP_INTERVAL_SETTING,
309308
BlobStoreCacheMaintenanceService.SNAPSHOT_SNAPSHOT_CLEANUP_KEEP_ALIVE_SETTING,
310309
BlobStoreCacheMaintenanceService.SNAPSHOT_SNAPSHOT_CLEANUP_BATCH_SIZE_SETTING,

x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/decider/SearchableSnapshotEnableAllocationDecider.java

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -15,50 +15,26 @@
1515
import org.elasticsearch.cluster.routing.allocation.decider.Decision;
1616
import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider;
1717
import org.elasticsearch.common.settings.ClusterSettings;
18-
import org.elasticsearch.common.settings.Setting;
1918
import org.elasticsearch.common.settings.Settings;
20-
import org.elasticsearch.core.UpdateForV9;
2119

2220
public class SearchableSnapshotEnableAllocationDecider extends AllocationDecider {
2321

2422
static final String NAME = "searchable_snapshots_enable";
2523

26-
/**
27-
* This setting describes whether searchable snapshots are allocated during rolling restarts. For now, whether a rolling restart is
28-
* ongoing is determined by cluster.routing.allocation.enable=primaries. Notice that other values for that setting except "all" mean
29-
* that no searchable snapshots are allocated anyway.
30-
*/
31-
@UpdateForV9(owner = UpdateForV9.Owner.DISTRIBUTED_COORDINATION)
32-
// xpack.searchable.snapshot.allocate_on_rolling_restart was only temporary, remove it in the next major
33-
public static final Setting<Boolean> SEARCHABLE_SNAPSHOTS_ALLOCATE_ON_ROLLING_RESTART = Setting.boolSetting(
34-
"xpack.searchable.snapshot.allocate_on_rolling_restart",
35-
false,
36-
Setting.Property.Dynamic,
37-
Setting.Property.NodeScope,
38-
Setting.Property.Deprecated
39-
);
40-
4124
private volatile EnableAllocationDecider.Allocation enableAllocation;
42-
private volatile boolean allocateOnRollingRestart;
4325

4426
public SearchableSnapshotEnableAllocationDecider(Settings settings, ClusterSettings clusterSettings) {
4527
this.enableAllocation = EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.get(settings);
46-
this.allocateOnRollingRestart = SEARCHABLE_SNAPSHOTS_ALLOCATE_ON_ROLLING_RESTART.get(settings);
4728
clusterSettings.addSettingsUpdateConsumer(
4829
EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING,
4930
this::setEnableAllocation
5031
);
51-
clusterSettings.addSettingsUpdateConsumer(SEARCHABLE_SNAPSHOTS_ALLOCATE_ON_ROLLING_RESTART, this::setAllocateOnRollingRestart);
5232
}
5333

5434
private void setEnableAllocation(EnableAllocationDecider.Allocation allocation) {
5535
this.enableAllocation = allocation;
5636
}
5737

58-
private void setAllocateOnRollingRestart(boolean allocateOnRollingRestart) {
59-
this.allocateOnRollingRestart = allocateOnRollingRestart;
60-
}
61-
6238
@Override
6339
public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) {
6440
return canAllocate(shardRouting, allocation);
@@ -73,25 +49,14 @@ public Decision canAllocate(ShardRouting shardRouting, RoutingAllocation allocat
7349
final IndexMetadata indexMetadata = allocation.metadata().getIndexSafe(shardRouting.index());
7450
if (indexMetadata.isSearchableSnapshot()) {
7551
EnableAllocationDecider.Allocation enableAllocationCopy = this.enableAllocation;
76-
boolean allocateOnRollingRestartCopy = this.allocateOnRollingRestart;
7752
if (enableAllocationCopy == EnableAllocationDecider.Allocation.PRIMARIES) {
78-
if (allocateOnRollingRestartCopy == false) {
79-
return allocation.decision(
80-
Decision.NO,
81-
NAME,
82-
"no allocations of searchable snapshots allowed during rolling restart due to [%s=%s] and [%s=false]",
83-
EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(),
84-
enableAllocationCopy,
85-
SEARCHABLE_SNAPSHOTS_ALLOCATE_ON_ROLLING_RESTART.getKey()
86-
);
87-
} else {
88-
return allocation.decision(
89-
Decision.YES,
90-
NAME,
91-
"allocate on rolling restart enabled [%s=true]",
92-
SEARCHABLE_SNAPSHOTS_ALLOCATE_ON_ROLLING_RESTART.getKey()
93-
);
94-
}
53+
return allocation.decision(
54+
Decision.NO,
55+
NAME,
56+
"no allocations of searchable snapshots allowed during rolling restart due to [%s=%s]",
57+
EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(),
58+
enableAllocationCopy
59+
);
9560
} else {
9661
return allocation.decision(
9762
Decision.YES,

0 commit comments

Comments
 (0)