|
|
@@ -39,6 +39,8 @@ import org.elasticsearch.indices.IndicesService;
|
|
|
import org.elasticsearch.indices.recovery.RecoveryState;
|
|
|
import org.elasticsearch.snapshots.SnapshotId;
|
|
|
import org.elasticsearch.snapshots.SnapshotInfo;
|
|
|
+import org.elasticsearch.xpack.cluster.routing.allocation.DataTierAllocationDecider;
|
|
|
+import org.elasticsearch.xpack.core.DataTier;
|
|
|
import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotAction;
|
|
|
import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotRequest;
|
|
|
import org.elasticsearch.xpack.core.searchablesnapshots.SearchableSnapshotShardStats;
|
|
|
@@ -72,6 +74,7 @@ import static org.elasticsearch.index.IndexSettings.INDEX_SOFT_DELETES_SETTING;
|
|
|
import static org.elasticsearch.index.query.QueryBuilders.matchQuery;
|
|
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
|
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
|
|
+import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.DATA_TIERS_PREFERENCE;
|
|
|
import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants.SNAPSHOT_DIRECTORY_FACTORY_KEY;
|
|
|
import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants.SNAPSHOT_RECOVERY_STATE_FACTORY_KEY;
|
|
|
import static org.hamcrest.Matchers.anyOf;
|
|
|
@@ -166,6 +169,14 @@ public class SearchableSnapshotsIntegTests extends BaseSearchableSnapshotsIntegT
|
|
|
} else {
|
|
|
expectedReplicas = 0;
|
|
|
}
|
|
|
+ final String expectedDataTiersPreference;
|
|
|
+ if (randomBoolean()) {
|
|
|
+ expectedDataTiersPreference = String.join(",", randomSubsetOf(DataTier.ALL_DATA_TIERS));
|
|
|
+ indexSettingsBuilder.put(DataTierAllocationDecider.INDEX_ROUTING_PREFER, expectedDataTiersPreference);
|
|
|
+ } else {
|
|
|
+ expectedDataTiersPreference = DATA_TIERS_PREFERENCE;
|
|
|
+ }
|
|
|
+
|
|
|
final MountSearchableSnapshotRequest req = new MountSearchableSnapshotRequest(
|
|
|
restoredIndexName,
|
|
|
fsRepoName,
|
|
|
@@ -194,6 +205,7 @@ public class SearchableSnapshotsIntegTests extends BaseSearchableSnapshotsIntegT
|
|
|
assertTrue(SearchableSnapshots.SNAPSHOT_INDEX_ID_SETTING.exists(settings));
|
|
|
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));
|
|
|
|
|
|
assertTotalHits(restoredIndexName, originalAllHits, originalBarHits);
|
|
|
assertRecoveryStats(restoredIndexName, preWarmEnabled);
|