|
20 | 20 | import org.elasticsearch.common.collect.List;
|
21 | 21 | import org.elasticsearch.common.settings.ClusterSettings;
|
22 | 22 | import org.elasticsearch.common.settings.Settings;
|
| 23 | +import org.elasticsearch.node.Node; |
23 | 24 | import org.elasticsearch.plugins.Plugin;
|
24 | 25 | import org.elasticsearch.test.ESIntegTestCase;
|
25 | 26 | import org.elasticsearch.xpack.autoscaling.LocalStateAutoscaling;
|
@@ -161,6 +162,49 @@ private void testScaleFromEmptyWarm(boolean allocatable) throws Exception {
|
161 | 162 |
|
162 | 163 | }
|
163 | 164 |
|
| 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 | + |
164 | 208 | /**
|
165 | 209 | * Verify that the list of roles includes all data roles to ensure we consider adding future data roles.
|
166 | 210 | */
|
|
0 commit comments