Skip to content

Commit 1c136bb

Browse files
committed
Add tier preference when mounting (#63204)
This commit adds a tier preference when mounting a searchable snapshot. This sets a preference that a searchable snapshot is mounted to a node with the cold role if one exists, then the warm role, then the hot role, assuming that no other allocation rules are in place. This means that by default, searchable snapshots are mounted to a node with the cold role. Note that depending on how we implement frozen functionality of searchable snapshots (not pre-cached/not fully-cached), we might need to adjust this to prefer frozen if mounting a not pre-cached/fully-cached searchable snapshot versus mounting a pre-cached/fully-cached searchable snapshot. This is a later concern since neither this nor the frozen role are implemented currently.
1 parent 4ef8673 commit 1c136bb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
import org.elasticsearch.snapshots.SnapshotId;
3434
import org.elasticsearch.threadpool.ThreadPool;
3535
import org.elasticsearch.transport.TransportService;
36+
import org.elasticsearch.xpack.cluster.routing.allocation.DataTierAllocationDecider;
37+
import org.elasticsearch.xpack.core.DataTier;
3638
import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotAction;
3739
import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotRequest;
3840
import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotAllocator;
@@ -182,6 +184,11 @@ protected void masterOperation(
182184
Settings.builder()
183185
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) // can be overridden
184186
.put(IndexMetadata.SETTING_AUTO_EXPAND_REPLICAS, false) // can be overridden
187+
// prefer to allocate to the cold tier, then the warm tier, then the hot tier
188+
.put(
189+
DataTierAllocationDecider.INDEX_ROUTING_PREFER,
190+
String.join(",", DataTier.DATA_COLD, DataTier.DATA_WARM, DataTier.DATA_HOT)
191+
)
185192
.put(request.indexSettings())
186193
.put(buildIndexSettings(request.repositoryName(), snapshotId, indexId))
187194
.build()

0 commit comments

Comments
 (0)