diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/BaseSearchableSnapshotsIntegTestCase.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/BaseSearchableSnapshotsIntegTestCase.java index 25d3a6a2e3a44..0cea30ee9d1c3 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/BaseSearchableSnapshotsIntegTestCase.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/BaseSearchableSnapshotsIntegTestCase.java @@ -30,7 +30,6 @@ import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexService; -import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.engine.Engine; import org.elasticsearch.index.engine.EngineTestCase; import org.elasticsearch.index.engine.ReadOnlyEngine; @@ -170,10 +169,7 @@ protected void mountSnapshot( repositoryName, snapshotName, indexName, - Settings.builder() - .put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), Boolean.FALSE.toString()) - .put(restoredIndexSettings) - .build(), + restoredIndexSettings, Strings.EMPTY_ARRAY, true, storage diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/ClusterStateApplierOrderingTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/ClusterStateApplierOrderingTests.java index 543f12b5277f5..8f0c3c3610bc8 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/ClusterStateApplierOrderingTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/ClusterStateApplierOrderingTests.java @@ -15,7 +15,6 @@ import org.elasticsearch.cluster.routing.UnassignedInfo; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.index.IndexSettings; import org.elasticsearch.snapshots.SnapshotInfo; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.InternalTestCluster; @@ -63,7 +62,6 @@ public void testRepositoriesServiceClusterStateApplierIsCalledBeforeIndicesClust Settings.Builder indexSettingsBuilder = Settings.builder() .put(SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), false) - .put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), Boolean.FALSE.toString()) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0); final MountSearchableSnapshotRequest req = new MountSearchableSnapshotRequest( diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/FrozenSearchableSnapshotsIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/FrozenSearchableSnapshotsIntegTests.java index 68b5b6cce4eb1..5c1688ed1e114 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/FrozenSearchableSnapshotsIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/FrozenSearchableSnapshotsIntegTests.java @@ -86,7 +86,11 @@ public void testCreateAndRestorePartialSearchableSnapshot() throws Exception { // Peer recovery always copies .liv files but we do not permit writing to searchable snapshot directories so this doesn't work, but // we can bypass this by forcing soft deletes to be used. TODO this restriction can be lifted when #55142 is resolved. - assertAcked(prepareCreate(indexName, Settings.builder().put(INDEX_SOFT_DELETES_SETTING.getKey(), true))); + final Settings.Builder originalIndexSettings = Settings.builder().put(INDEX_SOFT_DELETES_SETTING.getKey(), true); + if (randomBoolean()) { + originalIndexSettings.put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), randomFrom("false", "true", "checksum")); + } + assertAcked(prepareCreate(indexName, originalIndexSettings)); assertAcked(client().admin().indices().prepareAliases().addAlias(indexName, aliasName)); populateIndex(indexName, 10_000); @@ -141,9 +145,7 @@ public void testCreateAndRestorePartialSearchableSnapshot() throws Exception { logger.info("--> restoring partial index [{}] with cache enabled", restoredIndexName); - Settings.Builder indexSettingsBuilder = Settings.builder() - .put(SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), true) - .put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), Boolean.FALSE.toString()); + Settings.Builder indexSettingsBuilder = Settings.builder().put(SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), true); final List nonCachedExtensions; if (randomBoolean()) { nonCachedExtensions = randomSubsetOf(Arrays.asList("fdt", "fdx", "nvd", "dvd", "tip", "cfs", "dim")); @@ -164,6 +166,13 @@ public void testCreateAndRestorePartialSearchableSnapshot() throws Exception { } else { expectedReplicas = 0; } + final String indexCheckOnStartup; + if (randomBoolean()) { + indexCheckOnStartup = randomFrom("false", "true", "checksum"); + indexSettingsBuilder.put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), indexCheckOnStartup); + } else { + indexCheckOnStartup = "false"; + } final String expectedDataTiersPreference; expectedDataTiersPreference = getDataTiersPreference(MountSearchableSnapshotRequest.Storage.SHARED_CACHE); @@ -282,6 +291,7 @@ public void testCreateAndRestorePartialSearchableSnapshot() throws Exception { assertThat(DataTierAllocationDecider.INDEX_ROUTING_PREFER_SETTING.get(settings), equalTo(expectedDataTiersPreference)); assertTrue(SearchableSnapshotsConstants.SNAPSHOT_PARTIAL_SETTING.get(settings)); assertTrue(DiskThresholdDecider.SETTING_IGNORE_DISK_WATERMARKS.get(settings)); + assertThat(IndexSettings.INDEX_CHECK_ON_STARTUP.get(settings), equalTo("false")); checkSoftDeletesNotEagerlyLoaded(restoredIndexName); assertTotalHits(restoredIndexName, originalAllHits, originalBarHits); diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsCanMatchOnCoordinatorIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsCanMatchOnCoordinatorIntegTests.java index afd30cab94d09..587e298e45940 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsCanMatchOnCoordinatorIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsCanMatchOnCoordinatorIntegTests.java @@ -20,7 +20,6 @@ import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.Index; -import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.mapper.DateFieldMapper; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.shard.IndexLongFieldRange; @@ -125,7 +124,6 @@ public void testSearchableSnapshotShardsAreSkippedWithoutQueryingAnyNodeWhenThey // Force the searchable snapshot to be allocated in a particular node Settings restoredIndexSettings = Settings.builder() - .put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), Boolean.FALSE.toString()) .put(INDEX_ROUTING_REQUIRE_GROUP_SETTING.getConcreteSettingForNamespace("_name").getKey(), dataNodeHoldingSearchableSnapshot) .build(); @@ -260,7 +258,6 @@ public void testQueryPhaseIsExecutedInAnAvailableNodeWhenAllShardsCanBeSkipped() // Force the searchable snapshot to be allocated in a particular node Settings restoredIndexSettings = Settings.builder() - .put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), Boolean.FALSE.toString()) .put(INDEX_ROUTING_REQUIRE_GROUP_SETTING.getConcreteSettingForNamespace("_name").getKey(), dataNodeHoldingSearchableSnapshot) .build(); @@ -373,7 +370,6 @@ public void testSearchableSnapshotShardsThatHaveMatchingDataAreNotSkippedOnTheCo // Force the searchable snapshot to be allocated in a particular node Settings restoredIndexSettings = Settings.builder() - .put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), Boolean.FALSE.toString()) .put(INDEX_ROUTING_REQUIRE_GROUP_SETTING.getConcreteSettingForNamespace("_name").getKey(), dataNodeHoldingSearchableSnapshot) .build(); diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsIntegTests.java index de1f850076577..9149c44fb5fa4 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsIntegTests.java @@ -109,7 +109,11 @@ public void testCreateAndRestoreSearchableSnapshot() throws Exception { // Peer recovery always copies .liv files but we do not permit writing to searchable snapshot directories so this doesn't work, but // we can bypass this by forcing soft deletes to be used. TODO this restriction can be lifted when #55142 is resolved. - assertAcked(prepareCreate(indexName, Settings.builder().put(INDEX_SOFT_DELETES_SETTING.getKey(), true))); + final Settings.Builder originalIndexSettings = Settings.builder().put(INDEX_SOFT_DELETES_SETTING.getKey(), true); + if (randomBoolean()) { + originalIndexSettings.put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), randomFrom("false", "true", "checksum")); + } + assertAcked(prepareCreate(indexName, originalIndexSettings)); assertAcked(client().admin().indices().prepareAliases().addAlias(indexName, aliasName)); populateIndex(indexName, 10_000); @@ -166,8 +170,7 @@ public void testCreateAndRestoreSearchableSnapshot() throws Exception { logger.info("--> restoring index [{}] with cache [{}]", restoredIndexName, cacheEnabled ? "enabled" : "disabled"); Settings.Builder indexSettingsBuilder = Settings.builder() - .put(SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), cacheEnabled) - .put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), Boolean.FALSE.toString()); + .put(SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), cacheEnabled); boolean preWarmEnabled = false; if (cacheEnabled) { preWarmEnabled = randomBoolean(); @@ -246,6 +249,7 @@ public void testCreateAndRestoreSearchableSnapshot() throws Exception { assertThat(IndexMetadata.INDEX_AUTO_EXPAND_REPLICAS_SETTING.get(settings).toString(), equalTo("false")); assertThat(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.get(settings), equalTo(expectedReplicas)); assertThat(DataTierAllocationDecider.INDEX_ROUTING_PREFER_SETTING.get(settings), equalTo(expectedDataTiersPreference)); + assertThat(IndexSettings.INDEX_CHECK_ON_STARTUP.get(settings), equalTo("false")); checkSoftDeletesNotEagerlyLoaded(restoredIndexName); assertTotalHits(restoredIndexName, originalAllHits, originalBarHits); @@ -430,9 +434,7 @@ public void testCanMountSnapshotTakenWhileConcurrentlyIndexing() throws Exceptio logger.info("--> restoring index [{}]", restoredIndexName); - Settings.Builder indexSettingsBuilder = Settings.builder() - .put(SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), true) - .put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), Boolean.FALSE.toString()); + Settings.Builder indexSettingsBuilder = Settings.builder().put(SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), true); final MountSearchableSnapshotRequest req = new MountSearchableSnapshotRequest( restoredIndexName, fsRepoName, @@ -494,7 +496,7 @@ public void testMaxRestoreBytesPerSecIsUsed() throws Exception { repositoryName, snapshotName, indexName, - Settings.builder().put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), Boolean.FALSE.toString()).build(), + Settings.EMPTY, Strings.EMPTY_ARRAY, true, MountSearchableSnapshotRequest.Storage.FULL_COPY @@ -567,8 +569,7 @@ public void testMountedSnapshotHasNoReplicasByDefault() throws Exception { { logger.info("--> restoring index [{}] with default replica counts", restoredIndexName); Settings.Builder indexSettingsBuilder = Settings.builder() - .put(SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), true) - .put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), Boolean.FALSE.toString()); + .put(SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), true); final MountSearchableSnapshotRequest req = new MountSearchableSnapshotRequest( restoredIndexName, fsRepoName, @@ -602,7 +603,6 @@ public void testMountedSnapshotHasNoReplicasByDefault() throws Exception { logger.info("--> restoring index [{}] with specific replica count", restoredIndexName); Settings.Builder indexSettingsBuilder = Settings.builder() .put(SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), true) - .put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), Boolean.FALSE.toString()) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, replicaCount); final MountSearchableSnapshotRequest req = new MountSearchableSnapshotRequest( restoredIndexName, @@ -636,7 +636,6 @@ public void testMountedSnapshotHasNoReplicasByDefault() throws Exception { logger.info("--> restoring index [{}] with auto-expand replicas configured", restoredIndexName); Settings.Builder indexSettingsBuilder = Settings.builder() .put(SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), true) - .put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), Boolean.FALSE.toString()) .put(IndexMetadata.SETTING_AUTO_EXPAND_REPLICAS, replicaLimit == dataNodesCount ? "0-all" : "0-" + replicaLimit); final MountSearchableSnapshotRequest req = new MountSearchableSnapshotRequest( restoredIndexName, @@ -1094,6 +1093,62 @@ public void testSnapshotOfSearchableSnapshotCanBeRestoredBeforeRepositoryRegiste assertTotalHits(restoredIndexName, originalAllHits, originalBarHits); } + public void testCheckOnStartupCanBeOverridden() throws Exception { + final String suffix = getTestName().toLowerCase(Locale.ROOT); + + final String index = "index_" + suffix; + final Settings.Builder indexSettings = Settings.builder(); + indexSettings.put(INDEX_SOFT_DELETES_SETTING.getKey(), true); + + final String checkOnStartup = randomFrom("false", "true", "checksum", null); + if (checkOnStartup != null) { + indexSettings.put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), checkOnStartup); + } + createAndPopulateIndex(index, indexSettings); + + final String repository = "repository_" + suffix; + createRepository(repository, "fs"); + + final String snapshot = "snapshot_" + suffix; + createFullSnapshot(repository, snapshot); + assertAcked(client().admin().indices().prepareDelete(index)); + + { + final String mountedIndex = mountSnapshot(repository, snapshot, index, Settings.EMPTY); + assertThat( + client().admin() + .indices() + .prepareGetSettings(mountedIndex) + .get() + .getIndexToSettings() + .get(mountedIndex) + .get(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey()), + equalTo("false") + ); + assertAcked(client().admin().indices().prepareDelete(mountedIndex)); + } + { + final String overridingCheckOnStartup = randomValueOtherThan(checkOnStartup, () -> randomFrom("false", "true", "checksum")); + final String mountedIndex = mountSnapshot( + repository, + snapshot, + index, + Settings.builder().put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), overridingCheckOnStartup).build() + ); + assertThat( + client().admin() + .indices() + .prepareGetSettings(mountedIndex) + .get() + .getIndexToSettings() + .get(mountedIndex) + .get(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey()), + equalTo(overridingCheckOnStartup) + ); + assertAcked(client().admin().indices().prepareDelete(mountedIndex)); + } + } + private void assertSearchableSnapshotStats(String indexName, boolean cacheEnabled, List nonCachedExtensions) { final SearchableSnapshotsStatsResponse statsResponse = client().execute( SearchableSnapshotsStatsAction.INSTANCE, diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsLicenseIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsLicenseIntegTests.java index bb8d1e74b52b9..c158e381a3ac4 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsLicenseIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsLicenseIntegTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.index.IndexSettings; import org.elasticsearch.license.DeleteLicenseAction; import org.elasticsearch.license.License; import org.elasticsearch.license.LicensesMetadata; @@ -71,13 +70,12 @@ public void createAndMountSearchableSnapshot() throws Exception { assertAcked(client().admin().indices().prepareDelete(indexName)); - final Settings.Builder indexSettingsBuilder = Settings.builder().put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), false); final MountSearchableSnapshotRequest req = new MountSearchableSnapshotRequest( indexName, repoName, snapshotName, indexName, - indexSettingsBuilder.build(), + Settings.EMPTY, Strings.EMPTY_ARRAY, true, randomFrom(MountSearchableSnapshotRequest.Storage.values()) diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsSettingValidationIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsSettingValidationIntegTests.java index 44225f730b06c..610f30b875e84 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsSettingValidationIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsSettingValidationIntegTests.java @@ -11,7 +11,6 @@ import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.index.IndexSettings; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotAction; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotRequest; @@ -36,13 +35,12 @@ public void createAndMountSearchableSnapshot() throws Exception { assertAcked(client().admin().indices().prepareDelete(indexName)); - final Settings.Builder indexSettingsBuilder = Settings.builder().put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), false); final MountSearchableSnapshotRequest req = new MountSearchableSnapshotRequest( indexName, repoName, snapshotName, indexName, - indexSettingsBuilder.build(), + Settings.EMPTY, Strings.EMPTY_ARRAY, true, randomFrom(MountSearchableSnapshotRequest.Storage.values()) diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/AllocationFilteringIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/AllocationFilteringIntegTests.java index d92f7ca4808bb..27db67b82adaa 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/AllocationFilteringIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/AllocationFilteringIntegTests.java @@ -12,7 +12,6 @@ import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.core.Nullable; -import org.elasticsearch.index.IndexSettings; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotAction; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotRequest; @@ -60,7 +59,6 @@ private MountSearchableSnapshotRequest prepareMountRequest( final Settings.Builder indexSettingsBuilder = Settings.builder() .put(SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), true) - .put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), Boolean.FALSE.toString()) .put(mountedIndexSettings.build()); return new MountSearchableSnapshotRequest( diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/PartiallyCachedShardAllocationIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/PartiallyCachedShardAllocationIntegTests.java index 0f154cf158ef0..c499512231ae6 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/PartiallyCachedShardAllocationIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/PartiallyCachedShardAllocationIntegTests.java @@ -28,7 +28,6 @@ import org.elasticsearch.common.util.CollectionUtils; import org.elasticsearch.common.util.concurrent.ConcurrentCollections; import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.index.IndexSettings; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.transport.MockTransportService; import org.elasticsearch.transport.TransportService; @@ -88,8 +87,7 @@ private MountSearchableSnapshotRequest prepareMountRequest() throws InterruptedE assertAcked(client().admin().indices().prepareDelete(indexName)); final Settings.Builder indexSettingsBuilder = Settings.builder() - .put(SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), true) - .put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), Boolean.FALSE.toString()); + .put(SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), true); return new MountSearchableSnapshotRequest( indexName, diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportMountSearchableSnapshotAction.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportMountSearchableSnapshotAction.java index 0eb9c4b8ee72f..51296f757d088 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportMountSearchableSnapshotAction.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportMountSearchableSnapshotAction.java @@ -27,6 +27,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.ListenableFuture; import org.elasticsearch.index.IndexNotFoundException; +import org.elasticsearch.index.IndexSettings; import org.elasticsearch.indices.ShardLimitValidator; import org.elasticsearch.indices.SystemIndices; import org.elasticsearch.license.XPackLicenseState; @@ -228,9 +229,10 @@ protected void masterOperation( } } - Settings indexSettings = Settings.builder() + final Settings indexSettings = Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) // can be overridden .put(IndexMetadata.SETTING_AUTO_EXPAND_REPLICAS, false) // can be overridden + .put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), false) // can be overridden .put(DataTierAllocationDecider.INDEX_ROUTING_PREFER, getDataTiersPreference(request.storage())) .put(request.indexSettings()) .put(