4646import org .opensearch .common .settings .ClusterSettings ;
4747import org .opensearch .common .settings .IndexScopedSettings ;
4848import org .opensearch .common .settings .Settings ;
49- import org .opensearch .common .unit .TimeValue ;
5049import org .opensearch .common .util .FeatureFlags ;
5150import org .opensearch .common .xcontent .json .JsonXContent ;
5251import org .opensearch .core .xcontent .DeprecationHandler ;
5958import org .opensearch .indices .IndexCreationException ;
6059import org .opensearch .indices .IndicesService ;
6160import org .opensearch .indices .InvalidIndexContextException ;
62- import org .opensearch .indices .ShardLimitValidator ;
6361import org .opensearch .indices .SystemIndices ;
6462import org .opensearch .indices .replication .common .ReplicationType ;
6563import org .opensearch .node .remotestore .RemoteStoreNodeService ;
8583import java .util .function .BiConsumer ;
8684import java .util .function .Supplier ;
8785
88- import static org .opensearch .cluster .metadata .IndexMetadata .SETTING_REMOTE_SEGMENT_STORE_REPOSITORY ;
89- import static org .opensearch .cluster .metadata .IndexMetadata .SETTING_REMOTE_STORE_ENABLED ;
90- import static org .opensearch .cluster .metadata .IndexMetadata .SETTING_REMOTE_TRANSLOG_STORE_REPOSITORY ;
91- import static org .opensearch .cluster .metadata .IndexMetadata .SETTING_REPLICATION_TYPE ;
9286import static org .opensearch .cluster .metadata .IndexMetadata .SETTING_VERSION_CREATED ;
9387import static org .opensearch .cluster .metadata .MetadataCreateIndexService .aggregateIndexSettings ;
88+ import static org .opensearch .cluster .metadata .MetadataCreateIndexServiceTests .getRemoteNode ;
89+ import static org .opensearch .cluster .metadata .MetadataCreateIndexServiceTests .randomShardLimitService ;
90+ import static org .opensearch .cluster .metadata .MetadataCreateIndexServiceTests .verifyRemoteStoreIndexSettings ;
9491import static org .opensearch .index .IndexSettings .INDEX_MERGE_POLICY ;
9592import static org .opensearch .index .IndexSettings .INDEX_REFRESH_INTERVAL_SETTING ;
96- import static org .opensearch .index .IndexSettings .INDEX_REMOTE_TRANSLOG_BUFFER_INTERVAL_SETTING ;
9793import static org .opensearch .index .IndexSettings .INDEX_SOFT_DELETES_SETTING ;
9894import static org .opensearch .indices .ShardLimitValidatorTests .createTestShardLimitService ;
9995import static org .opensearch .node .remotestore .RemoteStoreNodeAttribute .REMOTE_STORE_CLUSTER_STATE_REPOSITORY_NAME_ATTRIBUTE_KEY ;
10096import static org .opensearch .node .remotestore .RemoteStoreNodeAttribute .REMOTE_STORE_SEGMENT_REPOSITORY_NAME_ATTRIBUTE_KEY ;
101- import static org .opensearch .node .remotestore .RemoteStoreNodeAttribute .REMOTE_STORE_TRANSLOG_REPOSITORY_NAME_ATTRIBUTE_KEY ;
10297import static org .opensearch .node .remotestore .RemoteStoreNodeService .MIGRATION_DIRECTION_SETTING ;
10398import static org .opensearch .node .remotestore .RemoteStoreNodeService .REMOTE_STORE_COMPATIBILITY_MODE_SETTING ;
10499import static org .hamcrest .Matchers .containsString ;
@@ -109,7 +104,6 @@ public class MetadataCreateIndexServiceFFEnabledTests extends OpenSearchTestCase
109104
110105 private CreateIndexClusterStateUpdateRequest request ;
111106 private IndicesService indicesServices ;
112- private RepositoriesService repositoriesService ;
113107 private Supplier <RepositoriesService > repositoriesServiceSupplier ;
114108
115109 @ BeforeClass
@@ -132,7 +126,6 @@ public void setup() throws Exception {
132126 super .setUp ();
133127 indicesServices = mock (IndicesService .class );
134128 repositoriesServiceSupplier = mock (Supplier .class );
135- repositoriesService = mock (RepositoriesService .class );
136129 }
137130
138131 @ Before
@@ -451,10 +444,6 @@ public void testApplyContextWithSettingsOverlap() throws IOException {
451444 });
452445 }
453446
454- private ShardLimitValidator randomShardLimitService () {
455- return createTestShardLimitService (randomIntBetween (10 , 10000 ), false );
456- }
457-
458447 private void withTemporaryClusterService (BiConsumer <ClusterService , ThreadPool > consumer ) {
459448 ThreadPool threadPool = new TestThreadPool (getTestName ());
460449 try {
@@ -465,33 +454,4 @@ private void withTemporaryClusterService(BiConsumer<ClusterService, ThreadPool>
465454 }
466455 }
467456
468- private void verifyRemoteStoreIndexSettings (
469- Settings indexSettings ,
470- String isRemoteSegmentEnabled ,
471- String remoteSegmentRepo ,
472- String remoteTranslogRepo ,
473- String replicationType ,
474- TimeValue translogBufferInterval
475- ) {
476- assertEquals (replicationType , indexSettings .get (SETTING_REPLICATION_TYPE ));
477- assertEquals (isRemoteSegmentEnabled , indexSettings .get (SETTING_REMOTE_STORE_ENABLED ));
478- assertEquals (remoteSegmentRepo , indexSettings .get (SETTING_REMOTE_SEGMENT_STORE_REPOSITORY ));
479- assertEquals (remoteTranslogRepo , indexSettings .get (SETTING_REMOTE_TRANSLOG_STORE_REPOSITORY ));
480- assertEquals (translogBufferInterval , indexSettings .get (INDEX_REMOTE_TRANSLOG_BUFFER_INTERVAL_SETTING .getKey ()));
481- }
482-
483- private DiscoveryNode getRemoteNode () {
484- Map <String , String > attributes = new HashMap <>();
485- attributes .put (REMOTE_STORE_CLUSTER_STATE_REPOSITORY_NAME_ATTRIBUTE_KEY , "my-cluster-rep-1" );
486- attributes .put (REMOTE_STORE_SEGMENT_REPOSITORY_NAME_ATTRIBUTE_KEY , "my-segment-repo-1" );
487- attributes .put (REMOTE_STORE_TRANSLOG_REPOSITORY_NAME_ATTRIBUTE_KEY , "my-translog-repo-1" );
488- return new DiscoveryNode (
489- UUIDs .base64UUID (),
490- buildNewFakeTransportAddress (),
491- attributes ,
492- DiscoveryNodeRole .BUILT_IN_ROLES ,
493- Version .CURRENT
494- );
495- }
496-
497457}
0 commit comments