Skip to content

Commit 906dba8

Browse files
Autoscaling test scale from empty with node attrs (#68730)
Autoscaling expects data tiers to be used exclusively both for node roles and in ILM policies. This commit adds a test demonstrating that as well as documentation for the behavior.
1 parent 8f227a9 commit 906dba8

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

docs/reference/autoscaling/deciders/reactive-storage-decider.asciidoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,11 @@ the current data set. It signals that additional storage capacity is necessary
77
when existing capacity has been exceeded (reactively).
88

99
The reactive storage decider is enabled for all policies governing data nodes and has no configuration options.
10+
11+
The decider relies partially on using <<data-tier-allocation,data tier preference>>
12+
allocation rather than node attributes. In particular, scaling a data tier into
13+
existence (starting the first node in a tier) will result in starting a node in
14+
any data tier that is empty if not using allocation based on data tier preference.
15+
Using the <<ilm-migrate,ILM migrate>> action to migrate between tiers is the
16+
preferred way of allocating to tiers and fully supports scaling a tier into
17+
existence.

x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/storage/ReactiveStorageIT.java

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.elasticsearch.common.collect.List;
2121
import org.elasticsearch.common.settings.ClusterSettings;
2222
import org.elasticsearch.common.settings.Settings;
23+
import org.elasticsearch.node.Node;
2324
import org.elasticsearch.plugins.Plugin;
2425
import org.elasticsearch.test.ESIntegTestCase;
2526
import org.elasticsearch.xpack.autoscaling.LocalStateAutoscaling;
@@ -161,6 +162,49 @@ private void testScaleFromEmptyWarm(boolean allocatable) throws Exception {
161162

162163
}
163164

165+
public void testScaleFromEmptyLegacy() {
166+
internalCluster().startMasterOnlyNode();
167+
internalCluster().startNode(
168+
NodeRoles.onlyRole(
169+
Settings.builder().put(Node.NODE_ATTRIBUTES.getKey() + "data_tier", "hot").build(),
170+
DataTier.DATA_HOT_NODE_ROLE
171+
)
172+
);
173+
putAutoscalingPolicy("hot", DataTier.DATA_HOT);
174+
putAutoscalingPolicy("warm", DataTier.DATA_WARM);
175+
putAutoscalingPolicy("cold", DataTier.DATA_COLD);
176+
177+
final String indexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
178+
assertAcked(
179+
prepareCreate(indexName).setSettings(
180+
Settings.builder()
181+
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
182+
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 6)
183+
.put(INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), "0ms")
184+
.put(IndexMetadata.INDEX_ROUTING_INCLUDE_GROUP_SETTING.getKey() + "data_tier", "hot")
185+
.build()
186+
)
187+
);
188+
refresh();
189+
assertThat(capacity().results().get("warm").requiredCapacity().total().storage().getBytes(), Matchers.equalTo(0L));
190+
assertThat(capacity().results().get("cold").requiredCapacity().total().storage().getBytes(), Matchers.equalTo(0L));
191+
192+
assertAcked(
193+
client().admin()
194+
.indices()
195+
.updateSettings(
196+
new UpdateSettingsRequest(indexName).settings(
197+
Settings.builder().put(IndexMetadata.INDEX_ROUTING_INCLUDE_GROUP_SETTING.getKey() + "data_tier", "warm")
198+
)
199+
)
200+
.actionGet()
201+
);
202+
203+
assertThat(capacity().results().get("warm").requiredCapacity().total().storage().getBytes(), Matchers.greaterThan(0L));
204+
// this is not desirable, but one of the caveats of not using data tiers in the ILM policy.
205+
assertThat(capacity().results().get("cold").requiredCapacity().total().storage().getBytes(), Matchers.greaterThan(0L));
206+
}
207+
164208
/**
165209
* Verify that the list of roles includes all data roles to ensure we consider adding future data roles.
166210
*/

0 commit comments

Comments
 (0)