Skip to content

Commit 3b3a948

Browse files
committed
Move Remote Store Migration from DocRep to GA.
Modify remote store migration setting name. Signed-off-by: Gaurav Bafna <[email protected]>
1 parent 1b36ee4 commit 3b3a948

File tree

10 files changed

+15
-48
lines changed

10 files changed

+15
-48
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2222
- [Query Insights] Add exporter support for top n queries ([#12982](https://github.com/opensearch-project/OpenSearch/pull/12982))
2323
- [Query Insights] Add X-Opaque-Id to search request metadata for top n queries ([#13374](https://github.com/opensearch-project/OpenSearch/pull/13374))
2424
- Add support for query level resource usage tracking ([#13172](https://github.com/opensearch-project/OpenSearch/pull/13172))
25+
- Move Remote Store Migration from DocRep to GA ([#14100](https://github.com/opensearch-project/OpenSearch/pull/14100))
2526

2627
### Dependencies
2728
- Bump `com.github.spullara.mustache.java:compiler` from 0.9.10 to 0.9.13 ([#13329](https://github.com/opensearch-project/OpenSearch/pull/13329), [#13559](https://github.com/opensearch-project/OpenSearch/pull/13559))

server/src/internalClusterTest/java/org/opensearch/remotemigration/MigrationBaseTestCase.java

-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.opensearch.cluster.routing.RoutingNode;
2222
import org.opensearch.common.UUIDs;
2323
import org.opensearch.common.settings.Settings;
24-
import org.opensearch.common.util.FeatureFlags;
2524
import org.opensearch.repositories.fs.ReloadableFsRepository;
2625
import org.opensearch.test.OpenSearchIntegTestCase;
2726
import org.junit.Before;
@@ -87,11 +86,6 @@ protected Settings nodeSettings(int nodeOrdinal) {
8786
}
8887
}
8988

90-
@Override
91-
protected Settings featureFlagSettings() {
92-
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.REMOTE_STORE_MIGRATION_EXPERIMENTAL, "true").build();
93-
}
94-
9589
protected void setFailRate(String repoName, int value) throws ExecutionException, InterruptedException {
9690
GetRepositoriesRequest gr = new GetRepositoriesRequest(new String[] { repoName });
9791
GetRepositoriesResponse res = client().admin().cluster().getRepositories(gr).get();

server/src/internalClusterTest/java/org/opensearch/remotemigration/ResizeIndexMigrationTestCase.java

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.opensearch.action.admin.indices.shrink.ResizeType;
1313
import org.opensearch.action.support.ActiveShardCount;
1414
import org.opensearch.common.settings.Settings;
15+
import org.opensearch.common.util.FeatureFlags;
1516
import org.opensearch.indices.replication.common.ReplicationType;
1617
import org.opensearch.test.OpenSearchIntegTestCase;
1718

@@ -27,6 +28,11 @@ public class ResizeIndexMigrationTestCase extends MigrationBaseTestCase {
2728
private final static String DOC_REP_DIRECTION = "docrep";
2829
private final static String MIXED_MODE = "mixed";
2930

31+
@Override
32+
protected Settings featureFlagSettings() {
33+
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.REMOTE_STORE_MIGRATION_EXPERIMENTAL, "true").build();
34+
}
35+
3036
/*
3137
* This test will verify the resize request failure, when cluster mode is mixed
3238
* and index is on DocRep node, and migration to remote store is in progress.

server/src/main/java/org/opensearch/cluster/ClusterModule.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@
8484
import org.opensearch.common.settings.Setting;
8585
import org.opensearch.common.settings.Setting.Property;
8686
import org.opensearch.common.settings.Settings;
87-
import org.opensearch.common.util.FeatureFlags;
8887
import org.opensearch.common.util.concurrent.ThreadContext;
8988
import org.opensearch.common.util.set.Sets;
9089
import org.opensearch.core.ParseField;
@@ -384,9 +383,7 @@ public static Collection<AllocationDecider> createAllocationDeciders(
384383
addAllocationDecider(deciders, new AwarenessAllocationDecider(settings, clusterSettings));
385384
addAllocationDecider(deciders, new NodeLoadAwareAllocationDecider(settings, clusterSettings));
386385
addAllocationDecider(deciders, new TargetPoolAllocationDecider());
387-
if (FeatureFlags.isEnabled(FeatureFlags.REMOTE_STORE_MIGRATION_EXPERIMENTAL_SETTING)) {
388-
addAllocationDecider(deciders, new RemoteStoreMigrationAllocationDecider(settings, clusterSettings));
389-
}
386+
addAllocationDecider(deciders, new RemoteStoreMigrationAllocationDecider(settings, clusterSettings));
390387

391388
clusterPlugins.stream()
392389
.flatMap(p -> p.createAllocationDeciders(settings, clusterSettings).stream())

server/src/main/java/org/opensearch/common/util/FeatureFlags.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424
public class FeatureFlags {
2525
/**
26-
* Gates the visibility of the remote store migration support from docrep .
26+
* Gates the visibility of the remote store to docrep migration.
2727
*/
2828
public static final String REMOTE_STORE_MIGRATION_EXPERIMENTAL = "opensearch.experimental.feature.remote_store.migration.enabled";
2929

server/src/main/java/org/opensearch/node/remotestore/RemoteStoreNodeService.java

+4-14
Original file line numberDiff line numberDiff line change
@@ -42,31 +42,21 @@ public class RemoteStoreNodeService {
4242
private final Supplier<RepositoriesService> repositoriesService;
4343
private final ThreadPool threadPool;
4444
public static final Setting<CompatibilityMode> REMOTE_STORE_COMPATIBILITY_MODE_SETTING = new Setting<>(
45-
"remote_store.compatibility_mode",
45+
"cluster.remote_store.compatibility_mode",
4646
CompatibilityMode.STRICT.name(),
4747
CompatibilityMode::parseString,
48-
value -> {
49-
if (value == CompatibilityMode.MIXED
50-
&& FeatureFlags.isEnabled(FeatureFlags.REMOTE_STORE_MIGRATION_EXPERIMENTAL_SETTING) == false) {
51-
throw new IllegalArgumentException(
52-
" mixed mode is under an experimental feature and can be activated only by enabling "
53-
+ REMOTE_STORE_MIGRATION_EXPERIMENTAL
54-
+ " feature flag in the JVM options "
55-
);
56-
}
57-
},
5848
Setting.Property.Dynamic,
5949
Setting.Property.NodeScope
6050
);
6151

6252
public static final Setting<Direction> MIGRATION_DIRECTION_SETTING = new Setting<>(
63-
"migration.direction",
53+
"cluster.migration.direction",
6454
Direction.NONE.name(),
6555
Direction::parseString,
6656
value -> {
67-
if (value != Direction.NONE && FeatureFlags.isEnabled(FeatureFlags.REMOTE_STORE_MIGRATION_EXPERIMENTAL_SETTING) == false) {
57+
if (value == Direction.DOCREP && FeatureFlags.isEnabled(FeatureFlags.REMOTE_STORE_MIGRATION_EXPERIMENTAL_SETTING) == false) {
6858
throw new IllegalArgumentException(
69-
" migration.direction is under an experimental feature and can be activated only by enabling "
59+
" remote store to docrep migration.direction is under an experimental feature and can be activated only by enabling "
7060
+ REMOTE_STORE_MIGRATION_EXPERIMENTAL
7161
+ " feature flag in the JVM options "
7262
);

server/src/test/java/org/opensearch/cluster/ClusterModuleTests.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
import org.opensearch.common.settings.Setting.Property;
6969
import org.opensearch.common.settings.Settings;
7070
import org.opensearch.common.settings.SettingsModule;
71-
import org.opensearch.common.util.FeatureFlags;
7271
import org.opensearch.common.util.concurrent.ThreadContext;
7372
import org.opensearch.gateway.GatewayAllocator;
7473
import org.opensearch.plugins.ClusterPlugin;
@@ -253,11 +252,9 @@ public void testAllocationDeciderOrder() {
253252
ShardsLimitAllocationDecider.class,
254253
AwarenessAllocationDecider.class,
255254
NodeLoadAwareAllocationDecider.class,
256-
TargetPoolAllocationDecider.class
255+
TargetPoolAllocationDecider.class,
256+
RemoteStoreMigrationAllocationDecider.class
257257
);
258-
if (FeatureFlags.isEnabled(FeatureFlags.REMOTE_STORE_MIGRATION_EXPERIMENTAL_SETTING)) {
259-
expectedDeciders.add(RemoteStoreMigrationAllocationDecider.class);
260-
}
261258
Collection<AllocationDecider> deciders = ClusterModule.createAllocationDeciders(
262259
Settings.EMPTY,
263260
new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS),

server/src/test/java/org/opensearch/cluster/coordination/JoinTaskExecutorTests.java

-7
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,6 @@ public void testRemoteStoreNodeJoiningNonRemoteStoreClusterMixedMode() {
420420
.put(MIGRATION_DIRECTION_SETTING.getKey(), RemoteStoreNodeService.Direction.REMOTE_STORE)
421421
.put(REMOTE_STORE_COMPATIBILITY_MODE_SETTING.getKey(), "mixed")
422422
.build();
423-
final Settings nodeSettings = Settings.builder().put(REMOTE_STORE_MIGRATION_EXPERIMENTAL, "true").build();
424-
FeatureFlags.initializeFeatureFlags(nodeSettings);
425423
Metadata metadata = Metadata.builder().persistentSettings(settings).build();
426424
ClusterState currentState = ClusterState.builder(ClusterName.DEFAULT)
427425
.nodes(DiscoveryNodes.builder().add(existingNode).localNodeId(existingNode.getId()).build())
@@ -439,8 +437,6 @@ public void testAllTypesNodeJoiningRemoteStoreClusterMixedMode() {
439437
.put(MIGRATION_DIRECTION_SETTING.getKey(), RemoteStoreNodeService.Direction.REMOTE_STORE)
440438
.put(REMOTE_STORE_COMPATIBILITY_MODE_SETTING.getKey(), "mixed")
441439
.build();
442-
final Settings nodeSettings = Settings.builder().put(REMOTE_STORE_MIGRATION_EXPERIMENTAL, "true").build();
443-
FeatureFlags.initializeFeatureFlags(nodeSettings);
444440
Metadata metadata = Metadata.builder().persistentSettings(settings).build();
445441
ClusterState currentState = ClusterState.builder(ClusterName.DEFAULT)
446442
.nodes(
@@ -888,9 +884,6 @@ public void testUpdatesClusterStateWithMultiNodeClusterAndSameRepository() throw
888884
}
889885

890886
public void testNodeJoinInMixedMode() {
891-
Settings nodeSettings = Settings.builder().put(REMOTE_STORE_MIGRATION_EXPERIMENTAL, "true").build();
892-
FeatureFlags.initializeFeatureFlags(nodeSettings);
893-
894887
List<Version> versions = allOpenSearchVersions();
895888
assert versions.size() >= 2 : "test requires at least two open search versions";
896889
Version baseVersion = versions.get(versions.size() - 2);

server/src/test/java/org/opensearch/cluster/routing/allocation/RemoteStoreMigrationAllocationDeciderTests.java

-8
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
import org.opensearch.common.UUIDs;
5555
import org.opensearch.common.settings.ClusterSettings;
5656
import org.opensearch.common.settings.Settings;
57-
import org.opensearch.common.util.FeatureFlags;
5857
import org.opensearch.core.index.shard.ShardId;
5958
import org.opensearch.indices.replication.common.ReplicationType;
6059
import org.opensearch.node.remotestore.RemoteStoreNodeService;
@@ -68,7 +67,6 @@
6867
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REMOTE_STORE_ENABLED;
6968
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REMOTE_TRANSLOG_STORE_REPOSITORY;
7069
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REPLICATION_TYPE;
71-
import static org.opensearch.common.util.FeatureFlags.REMOTE_STORE_MIGRATION_EXPERIMENTAL;
7270
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_CLUSTER_STATE_REPOSITORY_NAME_ATTRIBUTE_KEY;
7371
import static org.opensearch.node.remotestore.RemoteStoreNodeService.Direction.NONE;
7472
import static org.opensearch.node.remotestore.RemoteStoreNodeService.Direction.REMOTE_STORE;
@@ -81,8 +79,6 @@ public class RemoteStoreMigrationAllocationDeciderTests extends OpenSearchAlloca
8179
private final static String TEST_INDEX = "test_index";
8280
private final static String TEST_REPO = "test_repo";
8381

84-
private final Settings directionEnabledNodeSettings = Settings.builder().put(REMOTE_STORE_MIGRATION_EXPERIMENTAL, "true").build();
85-
8682
private final Settings strictModeCompatibilitySettings = Settings.builder()
8783
.put(REMOTE_STORE_COMPATIBILITY_MODE_SETTING.getKey(), RemoteStoreNodeService.CompatibilityMode.STRICT)
8884
.build();
@@ -111,7 +107,6 @@ public class RemoteStoreMigrationAllocationDeciderTests extends OpenSearchAlloca
111107
private ShardId shardId = new ShardId(TEST_INDEX, "_na_", 0);
112108

113109
private void beforeAllocation(String direction) {
114-
FeatureFlags.initializeFeatureFlags(directionEnabledNodeSettings);
115110
if (isRemoteStoreBackedIndex == null) {
116111
isRemoteStoreBackedIndex = randomBoolean();
117112
}
@@ -584,9 +579,6 @@ private Settings getCustomSettings(String direction, String compatibilityMode, I
584579

585580
// index metadata settings
586581
builder.put(indexMetadataBuilder.build().getSettings());
587-
588-
builder.put(directionEnabledNodeSettings);
589-
590582
return builder.build();
591583
}
592584

server/src/test/java/org/opensearch/cluster/routing/allocation/decider/FilterAllocationDeciderTests.java

-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
import org.opensearch.common.settings.IndexScopedSettings;
5252
import org.opensearch.common.settings.Setting;
5353
import org.opensearch.common.settings.Settings;
54-
import org.opensearch.common.util.FeatureFlags;
5554
import org.opensearch.node.remotestore.RemoteStoreNodeService;
5655
import org.opensearch.snapshots.EmptySnapshotsInfoService;
5756
import org.opensearch.test.gateway.TestGatewayAllocator;
@@ -64,7 +63,6 @@
6463
import static org.opensearch.cluster.routing.ShardRoutingState.INITIALIZING;
6564
import static org.opensearch.cluster.routing.ShardRoutingState.STARTED;
6665
import static org.opensearch.cluster.routing.ShardRoutingState.UNASSIGNED;
67-
import static org.opensearch.common.util.FeatureFlags.REMOTE_STORE_MIGRATION_EXPERIMENTAL;
6866
import static org.opensearch.node.remotestore.RemoteStoreNodeService.MIGRATION_DIRECTION_SETTING;
6967
import static org.opensearch.node.remotestore.RemoteStoreNodeService.REMOTE_STORE_COMPATIBILITY_MODE_SETTING;
7068

@@ -416,7 +414,6 @@ public void testWildcardIPFilter() {
416414
public void testMixedModeRemoteStoreAllocation() {
417415
// For mixed mode remote store direction cluster's existing indices replica creation ,
418416
// we don't consider filter allocation decider for replica of existing indices
419-
FeatureFlags.initializeFeatureFlags(Settings.builder().put(REMOTE_STORE_MIGRATION_EXPERIMENTAL, "true").build());
420417
ClusterSettings clusterSettings = new ClusterSettings(Settings.builder().build(), ClusterSettings.BUILT_IN_CLUSTER_SETTINGS);
421418
Settings initialSettings = Settings.builder()
422419
.put("cluster.routing.allocation.exclude._id", "node2")

0 commit comments

Comments
 (0)