|
@@ -19,6 +19,7 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
|
|
|
import org.elasticsearch.cluster.node.DiscoveryNodeRole;
|
|
|
import org.elasticsearch.common.settings.ClusterSettings;
|
|
|
import org.elasticsearch.common.settings.Settings;
|
|
|
+import org.elasticsearch.node.Node;
|
|
|
import org.elasticsearch.test.ESIntegTestCase;
|
|
|
import org.elasticsearch.test.NodeRoles;
|
|
|
import org.elasticsearch.xpack.autoscaling.action.GetAutoscalingCapacityAction;
|
|
@@ -146,6 +147,49 @@ public class ReactiveStorageIT extends AutoscalingStorageIntegTestCase {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public void testScaleFromEmptyLegacy() {
|
|
|
+ internalCluster().startMasterOnlyNode();
|
|
|
+ internalCluster().startNode(
|
|
|
+ NodeRoles.onlyRole(
|
|
|
+ Settings.builder().put(Node.NODE_ATTRIBUTES.getKey() + "data_tier", "hot").build(),
|
|
|
+ DataTier.DATA_HOT_NODE_ROLE
|
|
|
+ )
|
|
|
+ );
|
|
|
+ putAutoscalingPolicy("hot", DataTier.DATA_HOT);
|
|
|
+ putAutoscalingPolicy("warm", DataTier.DATA_WARM);
|
|
|
+ putAutoscalingPolicy("cold", DataTier.DATA_COLD);
|
|
|
+
|
|
|
+ final String indexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
|
|
|
+ assertAcked(
|
|
|
+ prepareCreate(indexName).setSettings(
|
|
|
+ Settings.builder()
|
|
|
+ .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
|
|
+ .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 6)
|
|
|
+ .put(INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), "0ms")
|
|
|
+ .put(IndexMetadata.INDEX_ROUTING_INCLUDE_GROUP_SETTING.getKey() + "data_tier", "hot")
|
|
|
+ .build()
|
|
|
+ )
|
|
|
+ );
|
|
|
+ refresh();
|
|
|
+ assertThat(capacity().results().get("warm").requiredCapacity().total().storage().getBytes(), Matchers.equalTo(0L));
|
|
|
+ assertThat(capacity().results().get("cold").requiredCapacity().total().storage().getBytes(), Matchers.equalTo(0L));
|
|
|
+
|
|
|
+ assertAcked(
|
|
|
+ client().admin()
|
|
|
+ .indices()
|
|
|
+ .updateSettings(
|
|
|
+ new UpdateSettingsRequest(indexName).settings(
|
|
|
+ Settings.builder().put(IndexMetadata.INDEX_ROUTING_INCLUDE_GROUP_SETTING.getKey() + "data_tier", "warm")
|
|
|
+ )
|
|
|
+ )
|
|
|
+ .actionGet()
|
|
|
+ );
|
|
|
+
|
|
|
+ assertThat(capacity().results().get("warm").requiredCapacity().total().storage().getBytes(), Matchers.greaterThan(0L));
|
|
|
+ // this is not desirable, but one of the caveats of not using data tiers in the ILM policy.
|
|
|
+ assertThat(capacity().results().get("cold").requiredCapacity().total().storage().getBytes(), Matchers.greaterThan(0L));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Verify that the list of roles includes all data roles to ensure we consider adding future data roles.
|
|
|
*/
|