diff --git a/build.gradle b/build.gradle index 47652b111c926..91bd07cdbba6b 100644 --- a/build.gradle +++ b/build.gradle @@ -189,8 +189,8 @@ tasks.register("verifyVersions") { * after the backport of the backcompat code is complete. */ -boolean bwc_tests_enabled = true -String bwc_tests_disabled_issue = "" /* place a PR link here when committing bwc changes */ +boolean bwc_tests_enabled = false +String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/69239" /* place a PR link here when committing bwc changes */ /* * FIPS 140-2 behavior was fixed in 7.11.0. Before that there is no way to run elasticsearch in a * JVM that is properly configured to be in fips mode with BCFIPS. For now we need to disable diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ilm/RolloverAction.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ilm/RolloverAction.java index 268d73c5a2f42..0dfc576e5468f 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ilm/RolloverAction.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ilm/RolloverAction.java @@ -23,7 +23,7 @@ public class RolloverAction implements LifecycleAction, ToXContentObject { public static final String NAME = "rollover"; private static final ParseField MAX_SIZE_FIELD = new ParseField("max_size"); - private static final ParseField MAX_SINGLE_PRIMARY_SIZE_FIELD = new ParseField("max_single_primary_size"); + private static final ParseField MAX_PRIMARY_SHARD_SIZE_FIELD = new ParseField("max_primary_shard_size"); private static final ParseField MAX_AGE_FIELD = new ParseField("max_age"); private static final ParseField MAX_DOCS_FIELD = new ParseField("max_docs"); @@ -35,8 +35,8 @@ public class RolloverAction implements LifecycleAction, ToXContentObject { (p, c) -> ByteSizeValue.parseBytesSizeValue(p.text(), MAX_SIZE_FIELD.getPreferredName()), MAX_SIZE_FIELD, ValueType.VALUE); PARSER.declareField(ConstructingObjectParser.optionalConstructorArg(), - (p, c) -> ByteSizeValue.parseBytesSizeValue(p.text(), MAX_SINGLE_PRIMARY_SIZE_FIELD.getPreferredName()), - MAX_SINGLE_PRIMARY_SIZE_FIELD, ValueType.VALUE); + (p, c) -> ByteSizeValue.parseBytesSizeValue(p.text(), MAX_PRIMARY_SHARD_SIZE_FIELD.getPreferredName()), + MAX_PRIMARY_SHARD_SIZE_FIELD, ValueType.VALUE); PARSER.declareField(ConstructingObjectParser.optionalConstructorArg(), (p, c) -> TimeValue.parseTimeValue(p.text(), MAX_AGE_FIELD.getPreferredName()), MAX_AGE_FIELD, ValueType.VALUE); @@ -44,7 +44,7 @@ public class RolloverAction implements LifecycleAction, ToXContentObject { } private final ByteSizeValue maxSize; - private final ByteSizeValue maxSinglePrimarySize; + private final ByteSizeValue maxPrimaryShardSize; private final TimeValue maxAge; private final Long maxDocs; @@ -52,12 +52,12 @@ public static RolloverAction parse(XContentParser parser) { return PARSER.apply(parser, null); } - public RolloverAction(ByteSizeValue maxSize, ByteSizeValue maxSinglePrimarySize, TimeValue maxAge, Long maxDocs) { - if (maxSize == null && maxSinglePrimarySize == null && maxAge == null && maxDocs == null) { + public RolloverAction(ByteSizeValue maxSize, ByteSizeValue maxPrimaryShardSize, TimeValue maxAge, Long maxDocs) { + if (maxSize == null && maxPrimaryShardSize == null && maxAge == null && maxDocs == null) { throw new IllegalArgumentException("At least one rollover condition must be set."); } this.maxSize = maxSize; - this.maxSinglePrimarySize = maxSinglePrimarySize; + this.maxPrimaryShardSize = maxPrimaryShardSize; this.maxAge = maxAge; this.maxDocs = maxDocs; } @@ -66,8 +66,8 @@ public ByteSizeValue getMaxSize() { return maxSize; } - public ByteSizeValue getMaxSinglePrimarySize() { - return maxSinglePrimarySize; + public ByteSizeValue getMaxPrimaryShardSize() { + return maxPrimaryShardSize; } public TimeValue getMaxAge() { @@ -89,8 +89,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws if (maxSize != null) { builder.field(MAX_SIZE_FIELD.getPreferredName(), maxSize.getStringRep()); } - if (maxSinglePrimarySize != null) { - builder.field(MAX_SINGLE_PRIMARY_SIZE_FIELD.getPreferredName(), maxSinglePrimarySize.getStringRep()); + if (maxPrimaryShardSize != null) { + builder.field(MAX_PRIMARY_SHARD_SIZE_FIELD.getPreferredName(), maxPrimaryShardSize.getStringRep()); } if (maxAge != null) { builder.field(MAX_AGE_FIELD.getPreferredName(), maxAge.getStringRep()); @@ -104,7 +104,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws @Override public int hashCode() { - return Objects.hash(maxSize, maxSinglePrimarySize, maxAge, maxDocs); + return Objects.hash(maxSize, maxPrimaryShardSize, maxAge, maxDocs); } @Override @@ -117,7 +117,7 @@ public boolean equals(Object obj) { } RolloverAction other = (RolloverAction) obj; return Objects.equals(maxSize, other.maxSize) && - Objects.equals(maxSinglePrimarySize, other.maxSinglePrimarySize) && + Objects.equals(maxPrimaryShardSize, other.maxPrimaryShardSize) && Objects.equals(maxAge, other.maxAge) && Objects.equals(maxDocs, other.maxDocs); } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ilm/ShrinkAction.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ilm/ShrinkAction.java index 3612ef0a2d8d6..21697da92d1f4 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ilm/ShrinkAction.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ilm/ShrinkAction.java @@ -23,7 +23,7 @@ public class ShrinkAction implements LifecycleAction, ToXContentObject { public static final String NAME = "shrink"; private static final ParseField NUMBER_OF_SHARDS_FIELD = new ParseField("number_of_shards"); - private static final ParseField MAX_SINGLE_PRIMARY_SIZE = new ParseField("max_single_primary_size"); + private static final ParseField MAX_PRIMARY_SHARD_SIZE = new ParseField("max_primary_shard_size"); private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>(NAME, true, a -> new ShrinkAction((Integer) a[0], (ByteSizeValue) a[1])); @@ -31,29 +31,29 @@ public class ShrinkAction implements LifecycleAction, ToXContentObject { static { PARSER.declareInt(ConstructingObjectParser.optionalConstructorArg(), NUMBER_OF_SHARDS_FIELD); PARSER.declareField(ConstructingObjectParser.optionalConstructorArg(), - (p, c) -> ByteSizeValue.parseBytesSizeValue(p.text(), MAX_SINGLE_PRIMARY_SIZE.getPreferredName()), - MAX_SINGLE_PRIMARY_SIZE, ObjectParser.ValueType.STRING); + (p, c) -> ByteSizeValue.parseBytesSizeValue(p.text(), MAX_PRIMARY_SHARD_SIZE.getPreferredName()), + MAX_PRIMARY_SHARD_SIZE, ObjectParser.ValueType.STRING); } private Integer numberOfShards; - private ByteSizeValue maxSinglePrimarySize; + private ByteSizeValue maxPrimaryShardSize; public static ShrinkAction parse(XContentParser parser) throws IOException { return PARSER.parse(parser, null); } - public ShrinkAction(@Nullable Integer numberOfShards, ByteSizeValue maxSinglePrimarySize) { - if (numberOfShards != null && maxSinglePrimarySize != null) { - throw new IllegalArgumentException("Cannot set both [number_of_shards] and [max_single_primary_size]"); + public ShrinkAction(@Nullable Integer numberOfShards, ByteSizeValue maxPrimaryShardSize) { + if (numberOfShards != null && maxPrimaryShardSize != null) { + throw new IllegalArgumentException("Cannot set both [number_of_shards] and [max_primary_shard_size]"); } - if (numberOfShards == null && maxSinglePrimarySize == null) { - throw new IllegalArgumentException("Either [number_of_shards] or [max_single_primary_size] must be set"); + if (numberOfShards == null && maxPrimaryShardSize == null) { + throw new IllegalArgumentException("Either [number_of_shards] or [max_primary_shard_size] must be set"); } - if (maxSinglePrimarySize != null) { - if (maxSinglePrimarySize.getBytes() <= 0) { - throw new IllegalArgumentException("[max_single_primary_size] must be greater than 0"); + if (maxPrimaryShardSize != null) { + if (maxPrimaryShardSize.getBytes() <= 0) { + throw new IllegalArgumentException("[max_primary_shard_size] must be greater than 0"); } - this.maxSinglePrimarySize = maxSinglePrimarySize; + this.maxPrimaryShardSize = maxPrimaryShardSize; } else { if (numberOfShards <= 0) { throw new IllegalArgumentException("[" + NUMBER_OF_SHARDS_FIELD.getPreferredName() + "] must be greater than 0"); @@ -66,8 +66,8 @@ Integer getNumberOfShards() { return numberOfShards; } - ByteSizeValue getMaxSinglePrimarySize() { - return maxSinglePrimarySize; + ByteSizeValue getMaxPrimaryShardSize() { + return maxPrimaryShardSize; } @Override @@ -81,8 +81,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws if (numberOfShards != null) { builder.field(NUMBER_OF_SHARDS_FIELD.getPreferredName(), numberOfShards); } - if (maxSinglePrimarySize != null) { - builder.field(MAX_SINGLE_PRIMARY_SIZE.getPreferredName(), maxSinglePrimarySize); + if (maxPrimaryShardSize != null) { + builder.field(MAX_PRIMARY_SHARD_SIZE.getPreferredName(), maxPrimaryShardSize); } builder.endObject(); return builder; @@ -95,12 +95,12 @@ public boolean equals(Object o) { ShrinkAction that = (ShrinkAction) o; return Objects.equals(numberOfShards, that.numberOfShards) && - Objects.equals(maxSinglePrimarySize, that.maxSinglePrimarySize); + Objects.equals(maxPrimaryShardSize, that.maxPrimaryShardSize); } @Override public int hashCode() { - return Objects.hash(numberOfShards, maxSinglePrimarySize); + return Objects.hash(numberOfShards, maxPrimaryShardSize); } @Override diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/ResizeRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/ResizeRequest.java index f68d0778af4a4..157076ffaa304 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/ResizeRequest.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/ResizeRequest.java @@ -35,7 +35,7 @@ public class ResizeRequest extends TimedRequest implements Validatable, ToXConte private final String targetIndex; private Settings settings = Settings.EMPTY; private Set aliases = new HashSet<>(); - private ByteSizeValue maxSinglePrimarySize; + private ByteSizeValue maxPrimaryShardSize; /** * Creates a new resize request @@ -79,17 +79,17 @@ public Set getAliases() { } /** - * Sets the max single primary shard size of the target index + * Sets the max primary shard size of the target index */ - public void setMaxSinglePrimarySize(ByteSizeValue maxSinglePrimarySize) { - this.maxSinglePrimarySize = maxSinglePrimarySize; + public void setMaxPrimaryShardSize(ByteSizeValue maxPrimaryShardSize) { + this.maxPrimaryShardSize = maxPrimaryShardSize; } /** - * Return the max single primary shard size of the target index + * Return the max primary shard size of the target index */ - public ByteSizeValue getMaxSinglePrimarySize() { - return maxSinglePrimarySize; + public ByteSizeValue getMaxPrimaryShardSize() { + return maxPrimaryShardSize; } @Override diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/rollover/RolloverRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/rollover/RolloverRequest.java index 1202ee84e9a53..a34b3e5807e6e 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/rollover/RolloverRequest.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/rollover/RolloverRequest.java @@ -10,7 +10,7 @@ import org.elasticsearch.action.admin.indices.rollover.Condition; import org.elasticsearch.action.admin.indices.rollover.MaxAgeCondition; import org.elasticsearch.action.admin.indices.rollover.MaxDocsCondition; -import org.elasticsearch.action.admin.indices.rollover.MaxSinglePrimarySizeCondition; +import org.elasticsearch.action.admin.indices.rollover.MaxPrimaryShardSizeCondition; import org.elasticsearch.action.admin.indices.rollover.MaxSizeCondition; import org.elasticsearch.client.TimedRequest; import org.elasticsearch.client.indices.CreateIndexRequest; @@ -111,12 +111,12 @@ public RolloverRequest addMaxIndexSizeCondition(ByteSizeValue size) { /** * Adds a size-based condition to check if the size of the largest primary shard is at least size. */ - public RolloverRequest addMaxSinglePrimarySizeCondition(ByteSizeValue size) { - MaxSinglePrimarySizeCondition maxSinglePrimarySizeCondition = new MaxSinglePrimarySizeCondition(size); - if (this.conditions.containsKey(maxSinglePrimarySizeCondition.name())) { - throw new IllegalArgumentException(maxSinglePrimarySizeCondition + " condition is already set"); + public RolloverRequest addMaxPrimaryShardSizeCondition(ByteSizeValue size) { + MaxPrimaryShardSizeCondition maxPrimaryShardSizeCondition = new MaxPrimaryShardSizeCondition(size); + if (this.conditions.containsKey(maxPrimaryShardSizeCondition.name())) { + throw new IllegalArgumentException(maxPrimaryShardSizeCondition + " condition is already set"); } - this.conditions.put(maxSinglePrimarySizeCondition.name(), maxSinglePrimarySizeCondition); + this.conditions.put(maxPrimaryShardSizeCondition.name(), maxPrimaryShardSizeCondition); return this; } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java index c2f51b43b656b..4c81a29e39789 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java @@ -958,7 +958,7 @@ public void testRollover() throws IOException { rolloverRequest.getCreateIndexRequest().mapping(mappings, XContentType.JSON); rolloverRequest.dryRun(false); rolloverRequest.addMaxIndexSizeCondition(new ByteSizeValue(1, ByteSizeUnit.MB)); - rolloverRequest.addMaxSinglePrimarySizeCondition(new ByteSizeValue(1, ByteSizeUnit.MB)); + rolloverRequest.addMaxPrimaryShardSizeCondition(new ByteSizeValue(1, ByteSizeUnit.MB)); RolloverResponse rolloverResponse = execute(rolloverRequest, highLevelClient().indices()::rollover, highLevelClient().indices()::rolloverAsync); assertTrue(rolloverResponse.isRolledOver()); @@ -968,7 +968,7 @@ public void testRollover() throws IOException { assertTrue(conditionStatus.get("[max_docs: 1]")); assertTrue(conditionStatus.get("[max_age: 1ms]")); assertFalse(conditionStatus.get("[max_size: 1mb]")); - assertFalse(conditionStatus.get("[max_single_primary_size: 1mb]")); + assertFalse(conditionStatus.get("[max_primary_shard_size: 1mb]")); assertEquals("test", rolloverResponse.getOldIndex()); assertEquals("test_new", rolloverResponse.getNewIndex()); } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesRequestConvertersTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesRequestConvertersTests.java index 957d2040bf2fb..8c6449402576c 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesRequestConvertersTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesRequestConvertersTests.java @@ -646,7 +646,7 @@ private void resizeTest(ResizeType resizeType, CheckedFunction - // end::shrink-index-request-maxSinglePrimarySize + // tag::shrink-index-request-maxPrimaryShardSize + request.setMaxPrimaryShardSize(new ByteSizeValue(50, ByteSizeUnit.GB)); // <1> + // end::shrink-index-request-maxPrimaryShardSize } // tag::shrink-index-request-aliases request.getTargetIndexRequest().alias(new Alias("target_alias")); // <1> @@ -1802,7 +1802,7 @@ public void testRolloverIndex() throws Exception { request.addMaxIndexAgeCondition(new TimeValue(7, TimeUnit.DAYS)); // <2> request.addMaxIndexDocsCondition(1000); // <3> request.addMaxIndexSizeCondition(new ByteSizeValue(5, ByteSizeUnit.GB)); // <4> - request.addMaxSinglePrimarySizeCondition(new ByteSizeValue(2, ByteSizeUnit.GB)); // <5> + request.addMaxPrimaryShardSizeCondition(new ByteSizeValue(2, ByteSizeUnit.GB)); // <5> // end::rollover-index-request // tag::rollover-index-request-timeout diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/ilm/RolloverActionTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/ilm/RolloverActionTests.java index 624eb90409db1..881bff070c675 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/ilm/RolloverActionTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/ilm/RolloverActionTests.java @@ -34,14 +34,14 @@ static RolloverAction randomInstance() { ByteSizeUnit maxSizeUnit = randomFrom(ByteSizeUnit.values()); ByteSizeValue maxSize = randomBoolean() ? null : new ByteSizeValue(randomNonNegativeLong() / maxSizeUnit.toBytes(1), maxSizeUnit); - ByteSizeUnit maxSinglePrimarySizeUnit = randomFrom(ByteSizeUnit.values()); - ByteSizeValue maxSinglePrimarySize = randomBoolean() - ? null : new ByteSizeValue(randomNonNegativeLong() / maxSinglePrimarySizeUnit.toBytes(1), maxSinglePrimarySizeUnit); + ByteSizeUnit maxPrimaryShardSizeUnit = randomFrom(ByteSizeUnit.values()); + ByteSizeValue maxPrimaryShardSize = randomBoolean() + ? null : new ByteSizeValue(randomNonNegativeLong() / maxPrimaryShardSizeUnit.toBytes(1), maxPrimaryShardSizeUnit); TimeValue maxAge = randomBoolean() ? null : TimeValue.parseTimeValue(randomPositiveTimeValue(), "rollover_action_test"); - Long maxDocs = (maxSize == null && maxSinglePrimarySize == null && maxAge == null || randomBoolean()) + Long maxDocs = (maxSize == null && maxPrimaryShardSize == null && maxAge == null || randomBoolean()) ? randomNonNegativeLong() : null; - return new RolloverAction(maxSize, maxSinglePrimarySize, maxAge, maxDocs); + return new RolloverAction(maxSize, maxPrimaryShardSize, maxAge, maxDocs); } public void testNoConditions() { diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/ilm/ShrinkActionTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/ilm/ShrinkActionTests.java index 4ea164ea3caad..10b5cc6b0601c 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/ilm/ShrinkActionTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/ilm/ShrinkActionTests.java @@ -45,13 +45,13 @@ public void testNonPositiveShardNumber() { assertThat(e.getMessage(), equalTo("[number_of_shards] must be greater than 0")); } - public void testMaxSinglePrimarySize() { - ByteSizeValue maxSinglePrimarySize1 = new ByteSizeValue(10); - Exception e1 = expectThrows(Exception.class, () -> new ShrinkAction(randomIntBetween(1, 100), maxSinglePrimarySize1)); - assertThat(e1.getMessage(), equalTo("Cannot set both [number_of_shards] and [max_single_primary_size]")); - - ByteSizeValue maxSinglePrimarySize2 = new ByteSizeValue(0); - Exception e2 = expectThrows(Exception.class, () -> new org.elasticsearch.client.ilm.ShrinkAction(null, maxSinglePrimarySize2)); - assertThat(e2.getMessage(), equalTo("[max_single_primary_size] must be greater than 0")); + public void testMaxPrimaryShardSize() { + ByteSizeValue maxPrimaryShardSize1 = new ByteSizeValue(10); + Exception e1 = expectThrows(Exception.class, () -> new ShrinkAction(randomIntBetween(1, 100), maxPrimaryShardSize1)); + assertThat(e1.getMessage(), equalTo("Cannot set both [number_of_shards] and [max_primary_shard_size]")); + + ByteSizeValue maxPrimaryShardSize2 = new ByteSizeValue(0); + Exception e2 = expectThrows(Exception.class, () -> new org.elasticsearch.client.ilm.ShrinkAction(null, maxPrimaryShardSize2)); + assertThat(e2.getMessage(), equalTo("[max_primary_shard_size] must be greater than 0")); } } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/rollover/RolloverRequestTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/rollover/RolloverRequestTests.java index e8b4d3d20644d..7f6d3a7644ce7 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/rollover/RolloverRequestTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/rollover/RolloverRequestTests.java @@ -11,7 +11,7 @@ import org.elasticsearch.action.admin.indices.rollover.Condition; import org.elasticsearch.action.admin.indices.rollover.MaxAgeCondition; import org.elasticsearch.action.admin.indices.rollover.MaxDocsCondition; -import org.elasticsearch.action.admin.indices.rollover.MaxSinglePrimarySizeCondition; +import org.elasticsearch.action.admin.indices.rollover.MaxPrimaryShardSizeCondition; import org.elasticsearch.action.admin.indices.rollover.MaxSizeCondition; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; @@ -39,14 +39,14 @@ public void testConstructorAndFieldAssignments() { MaxAgeCondition maxAgeCondition = new MaxAgeCondition(new TimeValue(10)); MaxDocsCondition maxDocsCondition = new MaxDocsCondition(10000L); MaxSizeCondition maxSizeCondition = new MaxSizeCondition(new ByteSizeValue(2000)); - MaxSinglePrimarySizeCondition maxSinglePrimarySizeCondition = new MaxSinglePrimarySizeCondition(new ByteSizeValue(3000)); + MaxPrimaryShardSizeCondition maxPrimaryShardSizeCondition = new MaxPrimaryShardSizeCondition(new ByteSizeValue(3000)); Condition[] expectedConditions = new Condition[]{ - maxAgeCondition, maxDocsCondition, maxSizeCondition, maxSinglePrimarySizeCondition + maxAgeCondition, maxDocsCondition, maxSizeCondition, maxPrimaryShardSizeCondition }; rolloverRequest.addMaxIndexAgeCondition(maxAgeCondition.value()); rolloverRequest.addMaxIndexDocsCondition(maxDocsCondition.value()); rolloverRequest.addMaxIndexSizeCondition(maxSizeCondition.value()); - rolloverRequest.addMaxSinglePrimarySizeCondition(maxSinglePrimarySizeCondition.value()); + rolloverRequest.addMaxPrimaryShardSizeCondition(maxPrimaryShardSizeCondition.value()); List> requestConditions = new ArrayList<>(rolloverRequest.getConditions().values()); assertThat(requestConditions, containsInAnyOrder(expectedConditions)); } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/rollover/RolloverResponseTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/rollover/RolloverResponseTests.java index 842fc546c65ae..eed509a6a407d 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/rollover/RolloverResponseTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/rollover/RolloverResponseTests.java @@ -11,7 +11,7 @@ import org.elasticsearch.action.admin.indices.rollover.Condition; import org.elasticsearch.action.admin.indices.rollover.MaxAgeCondition; import org.elasticsearch.action.admin.indices.rollover.MaxDocsCondition; -import org.elasticsearch.action.admin.indices.rollover.MaxSinglePrimarySizeCondition; +import org.elasticsearch.action.admin.indices.rollover.MaxPrimaryShardSizeCondition; import org.elasticsearch.action.admin.indices.rollover.MaxSizeCondition; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; @@ -35,7 +35,7 @@ public class RolloverResponseTests extends ESTestCase { conditionSuppliers.add(() -> new MaxAgeCondition(new TimeValue(randomNonNegativeLong()))); conditionSuppliers.add(() -> new MaxDocsCondition(randomNonNegativeLong())); conditionSuppliers.add(() -> new MaxSizeCondition(new ByteSizeValue(randomNonNegativeLong()))); - conditionSuppliers.add(() -> new MaxSinglePrimarySizeCondition(new ByteSizeValue(randomNonNegativeLong()))); + conditionSuppliers.add(() -> new MaxPrimaryShardSizeCondition(new ByteSizeValue(randomNonNegativeLong()))); } public void testFromXContent() throws IOException { diff --git a/docs/java-rest/high-level/indices/shrink_index.asciidoc b/docs/java-rest/high-level/indices/shrink_index.asciidoc index 465f954f263f2..3e6ec1f551429 100644 --- a/docs/java-rest/high-level/indices/shrink_index.asciidoc +++ b/docs/java-rest/high-level/indices/shrink_index.asciidoc @@ -56,9 +56,9 @@ include-tagged::{doc-tests-file}[{api}-request-settings] ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- -include-tagged::{doc-tests-file}[{api}-request-maxSinglePrimarySize] +include-tagged::{doc-tests-file}[{api}-request-maxPrimaryShardSize] -------------------------------------------------- -<1> The max single primary shard size of the target index +<1> The max primary shard size of the target index ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- diff --git a/docs/reference/ilm/actions/ilm-rollover.asciidoc b/docs/reference/ilm/actions/ilm-rollover.asciidoc index f995544631991..813341f95133e 100644 --- a/docs/reference/ilm/actions/ilm-rollover.asciidoc +++ b/docs/reference/ilm/actions/ilm-rollover.asciidoc @@ -20,11 +20,11 @@ To roll over an <>, the alias and its write index must meet the following conditions: * The index name must match the pattern '^.*-\\d+$', for example (`my-index-000001`). -* The `index.lifecycle.rollover_alias` must be configured as the alias to roll over. +* The `index.lifecycle.rollover_alias` must be configured as the alias to roll over. * The index must be the <> for the alias. -For example, if `my-index-000001` has the alias `my_data`, -the following settings must be configured. +For example, if `my-index-000001` has the alias `my_data`, +the following settings must be configured. [source,console] -------------------------------------------------- @@ -45,7 +45,7 @@ PUT my-index-000001 [[ilm-rollover-options]] ==== Options -You must specify at least one rollover condition. +You must specify at least one rollover condition. An empty rollover action is invalid. `max_age`:: @@ -65,13 +65,13 @@ The document count does *not* include documents in replica shards. `max_size`:: (Optional, <>) Triggers roll over when the index reaches a certain size. -This is the total size of all primary shards in the index. +This is the total size of all primary shards in the index. Replicas are not counted toward the maximum index size. + -TIP: To see the current index size, use the <> API. +TIP: To see the current index size, use the <> API. The `pri.store.size` value shows the combined size of all primary shards. -`max_single_primary_size`:: +`max_primary_shard_size`:: (Optional, <>) Triggers roll over when the largest primary shard in the index reaches a certain size. This is the maximum size of the primary shards in the index. As with `max_size`, @@ -129,7 +129,7 @@ PUT _ilm/policy/my_policy } } -------------------------------------------------- - + [ilm-rollover-age-ex]] ===== Roll over based on index age @@ -156,9 +156,9 @@ PUT _ilm/policy/my_policy [ilm-rollover-conditions-ex]] ===== Roll over using multiple conditions -When you specify multiple rollover conditions, +When you specify multiple rollover conditions, the index is rolled over when _any_ of the conditions are met. -This example rolls the index over if it is at least 7 days old or at least 100 gigabytes. +This example rolls the index over if it is at least 7 days old or at least 100 gigabytes. [source,console] -------------------------------------------------- @@ -182,10 +182,10 @@ PUT _ilm/policy/my_policy [ilm-rollover-block-ex]] ===== Rollover condition blocks phase transition -The rollover action only completes if one of its conditions is met. +The rollover action only completes if one of its conditions is met. This means that any subsequent phases are blocked until rollover succeeds. -For example, the following policy deletes the index one day after it rolls over. +For example, the following policy deletes the index one day after it rolls over. It does not delete the index one day after it was created. [source,console] diff --git a/docs/reference/ilm/actions/ilm-shrink.asciidoc b/docs/reference/ilm/actions/ilm-shrink.asciidoc index 49d81a56f6e32..5f13ec9aace74 100644 --- a/docs/reference/ilm/actions/ilm-shrink.asciidoc +++ b/docs/reference/ilm/actions/ilm-shrink.asciidoc @@ -43,11 +43,11 @@ managed indices. (Optional, integer) Number of shards to shrink to. Must be a factor of the number of shards in the source index. This parameter conflicts with -`max_single_primary_size`, only one of them may be set. +`max_primary_shard_size`, only one of them may be set. -`max_single_primary_size`:: +`max_primary_shard_size`:: (Optional, <>) -The max single primary shard size for the target index. Used to find the optimum number of shards for the target index. +The max primary shard size for the target index. Used to find the optimum number of shards for the target index. When this parameter is set, each shard's storage in the target index will not be greater than the parameter. The shards count of the target index will still be a factor of the source index's shards count, but if the parameter is less than the single shard size in the source index, the shards count for the target index will be equal to the source index's shards count. @@ -84,7 +84,7 @@ PUT _ilm/policy/my_policy [[ilm-shrink-size-ex]] ===== Calculate the number of shards of the new shrunken index based on the storage of the -source index and the `max_single_primary_size` parameter +source index and the `max_primary_shard_size` parameter [source,console] -------------------------------------------------- @@ -95,7 +95,7 @@ PUT _ilm/policy/my_policy "warm": { "actions": { "shrink" : { - "max_single_primary_size": "50gb" + "max_primary_shard_size": "50gb" } } } diff --git a/docs/reference/indices/rollover-index.asciidoc b/docs/reference/indices/rollover-index.asciidoc index 88a78841c1f53..0489d034912fe 100644 --- a/docs/reference/indices/rollover-index.asciidoc +++ b/docs/reference/indices/rollover-index.asciidoc @@ -19,7 +19,7 @@ POST /alias1/_rollover/my-index-000002 "max_age": "7d", "max_docs": 1000, "max_size": "5gb", - "max_single_primary_size": "2gb" + "max_primary_shard_size": "2gb" } } ---- @@ -165,7 +165,7 @@ Replicas are not counted toward the maximum index size. TIP: To see the current index size, use the <> API. The `pri.store.size` value shows the combined size of all primary shards. -`max_single_primary_size`:: +`max_primary_shard_size`:: (Optional, <>) Maximum primary shard size. This is the maximum size of the primary shards in the index. As with `max_size`, @@ -204,7 +204,7 @@ POST /logs_write/_rollover <2> "max_age": "7d", "max_docs": 1000, "max_size": "5gb", - "max_single_primary_size": "2gb" + "max_primary_shard_size": "2gb" } } -------------------------------------------------- @@ -230,7 +230,7 @@ The API returns the following response: "[max_age: 7d]": false, "[max_docs: 1000]": true, "[max_size: 5gb]": false, - "[max_single_primary_size: 2gb]": false + "[max_primary_shard_size: 2gb]": false } } -------------------------------------------------- @@ -264,7 +264,7 @@ POST /my-data-stream/_rollover <2> "max_age": "7d", "max_docs": 1000, "max_size": "5gb", - "max_single_primary_size": "2gb" + "max_primary_shard_size": "2gb" } } -------------------------------------------------- @@ -298,7 +298,7 @@ The API returns the following response: "[max_age: 7d]": false, "[max_docs: 1000]": true, "[max_size: 5gb]": false, - "[max_single_primary_size: 2gb]": false + "[max_primary_shard_size: 2gb]": false } } -------------------------------------------------- @@ -345,7 +345,7 @@ POST /logs_write/_rollover "max_age": "7d", "max_docs": 1000, "max_size": "5gb", - "max_single_primary_size": "2gb" + "max_primary_shard_size": "2gb" }, "settings": { "index.number_of_shards": 2 @@ -376,7 +376,7 @@ POST /my_alias/_rollover/my_new_index_name "max_age": "7d", "max_docs": 1000, "max_size": "5gb", - "max_single_primary_size": "2gb" + "max_primary_shard_size": "2gb" } } -------------------------------------------------- @@ -474,7 +474,7 @@ POST /logs_write/_rollover?dry_run "max_age": "7d", "max_docs": 1000, "max_size": "5gb", - "max_single_primary_size": "2gb" + "max_primary_shard_size": "2gb" } } -------------------------------------------------- diff --git a/docs/reference/indices/shrink-index.asciidoc b/docs/reference/indices/shrink-index.asciidoc index d81b913a2ac1b..55f6a8732f295 100644 --- a/docs/reference/indices/shrink-index.asciidoc +++ b/docs/reference/indices/shrink-index.asciidoc @@ -231,9 +231,9 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=target-index-aliases] include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=target-index-settings] -`max_single_primary_size`:: +`max_primary_shard_size`:: (Optional, <>) -The max single primary shard size for the target index. Used to find the optimum number of shards for the target index. +The max primary shard size for the target index. Used to find the optimum number of shards for the target index. When this parameter is set, each shard's storage in the target index will not be greater than the parameter. The shards count of the target index will still be a factor of the source index's shards count, but if the parameter is less than the single shard size in the source index, the shards count for the target index will be equal to the source index's shards count. diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.rollover/35_max_single_primary_size_condition.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.rollover/35_max_primary_shard_size_condition.yml similarity index 60% rename from rest-api-spec/src/main/resources/rest-api-spec/test/indices.rollover/35_max_single_primary_size_condition.yml rename to rest-api-spec/src/main/resources/rest-api-spec/test/indices.rollover/35_max_primary_shard_size_condition.yml index cfdcd54969b6b..1f07d9fff7134 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.rollover/35_max_single_primary_size_condition.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.rollover/35_max_primary_shard_size_condition.yml @@ -1,8 +1,8 @@ --- -"Rollover with max_single_primary_size condition": +"Rollover with max_primary_shard_size condition": - skip: version: " - 7.11.99" - reason: max_single_primary_size condition was introduced in 7.12.0 + reason: max_primary_shard_size condition was introduced in 7.12.0 # create index with alias and replica - do: @@ -21,28 +21,28 @@ body: { "foo": "hello world" } refresh: true - # perform alias rollover with a large max_single_primary_size, no action. + # perform alias rollover with a large max_primary_shard_size, no action. - do: indices.rollover: alias: "logs_search" wait_for_active_shards: 1 body: conditions: - max_single_primary_size: 100mb + max_primary_shard_size: 100mb - - match: { conditions: { "[max_single_primary_size: 100mb]": false } } + - match: { conditions: { "[max_primary_shard_size: 100mb]": false } } - match: { rolled_over: false } - # perform alias rollover with a small max_single_primary_size, got action. + # perform alias rollover with a small max_primary_shard_size, got action. - do: indices.rollover: alias: "logs_search" wait_for_active_shards: 1 body: conditions: - max_single_primary_size: 10b + max_primary_shard_size: 10b - - match: { conditions: { "[max_single_primary_size: 10b]": true } } + - match: { conditions: { "[max_primary_shard_size: 10b]": true } } - match: { rolled_over: true } # perform alias rollover on an empty index, no action. @@ -52,7 +52,7 @@ wait_for_active_shards: 1 body: conditions: - max_single_primary_size: 1b + max_primary_shard_size: 1b - - match: { conditions: { "[max_single_primary_size: 1b]": false } } + - match: { conditions: { "[max_primary_shard_size: 1b]": false } } - match: { rolled_over: false } diff --git a/server/src/internalClusterTest/java/org/elasticsearch/action/admin/indices/rollover/RolloverIT.java b/server/src/internalClusterTest/java/org/elasticsearch/action/admin/indices/rollover/RolloverIT.java index aef284b565b8f..f4e41e2388757 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/action/admin/indices/rollover/RolloverIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/action/admin/indices/rollover/RolloverIT.java @@ -434,7 +434,7 @@ public void testRolloverMaxSize() throws Exception { } } - public void testRolloverMaxSinglePrimarySize() throws Exception { + public void testRolloverMaxPrimaryShardSize() throws Exception { assertAcked(prepareCreate("test-1").addAlias(new Alias("test_alias")).get()); int numDocs = randomIntBetween(10, 20); for (int i = 0; i < numDocs; i++) { @@ -443,35 +443,35 @@ public void testRolloverMaxSinglePrimarySize() throws Exception { flush("test-1"); refresh("test_alias"); - // A large max_single_primary_size + // A large max_primary_shard_size { final RolloverResponse response = client().admin().indices() .prepareRolloverIndex("test_alias") - .addMaxSinglePrimarySizeCondition(new ByteSizeValue(randomIntBetween(100, 50 * 1024), ByteSizeUnit.MB)) + .addMaxPrimaryShardSizeCondition(new ByteSizeValue(randomIntBetween(100, 50 * 1024), ByteSizeUnit.MB)) .get(); assertThat(response.getOldIndex(), equalTo("test-1")); assertThat(response.getNewIndex(), equalTo("test-000002")); - assertThat("No rollover with a large max_single_primary_size condition", response.isRolledOver(), equalTo(false)); + assertThat("No rollover with a large max_primary_shard_size condition", response.isRolledOver(), equalTo(false)); final IndexMetadata oldIndex = client().admin().cluster().prepareState().get().getState().metadata().index("test-1"); assertThat(oldIndex.getRolloverInfos().size(), equalTo(0)); } - // A small max_single_primary_size + // A small max_primary_shard_size { - ByteSizeValue maxSinglePrimarySizeCondition = new ByteSizeValue(randomIntBetween(1, 20), ByteSizeUnit.BYTES); + ByteSizeValue maxPrimaryShardSizeCondition = new ByteSizeValue(randomIntBetween(1, 20), ByteSizeUnit.BYTES); long beforeTime = client().threadPool().absoluteTimeInMillis() - 1000L; final RolloverResponse response = client().admin().indices() .prepareRolloverIndex("test_alias") - .addMaxSinglePrimarySizeCondition(maxSinglePrimarySizeCondition) + .addMaxPrimaryShardSizeCondition(maxPrimaryShardSizeCondition) .get(); assertThat(response.getOldIndex(), equalTo("test-1")); assertThat(response.getNewIndex(), equalTo("test-000002")); - assertThat("Should rollover with a small max_single_primary_size condition", response.isRolledOver(), equalTo(true)); + assertThat("Should rollover with a small max_primary_shard_size condition", response.isRolledOver(), equalTo(true)); final IndexMetadata oldIndex = client().admin().cluster().prepareState().get().getState().metadata().index("test-1"); List> metConditions = oldIndex.getRolloverInfos().get("test_alias").getMetConditions(); assertThat(metConditions.size(), equalTo(1)); assertThat(metConditions.get(0).toString(), - equalTo(new MaxSinglePrimarySizeCondition(maxSinglePrimarySizeCondition).toString())); + equalTo(new MaxPrimaryShardSizeCondition(maxPrimaryShardSizeCondition).toString())); assertThat(oldIndex.getRolloverInfos().get("test_alias").getTime(), is(both(greaterThanOrEqualTo(beforeTime)).and(lessThanOrEqualTo(client().threadPool().absoluteTimeInMillis() + 1000L)))); } @@ -480,7 +480,7 @@ public void testRolloverMaxSinglePrimarySize() throws Exception { { final RolloverResponse response = client().admin().indices() .prepareRolloverIndex("test_alias") - .addMaxSinglePrimarySizeCondition(new ByteSizeValue(randomNonNegativeLong(), ByteSizeUnit.BYTES)) + .addMaxPrimaryShardSizeCondition(new ByteSizeValue(randomNonNegativeLong(), ByteSizeUnit.BYTES)) .get(); assertThat(response.getOldIndex(), equalTo("test-000002")); assertThat(response.getNewIndex(), equalTo("test-000003")); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/Condition.java b/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/Condition.java index bfd9ec0ce992d..5065fdc540ea0 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/Condition.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/Condition.java @@ -75,13 +75,13 @@ public static class Stats { public final long numDocs; public final long indexCreated; public final ByteSizeValue indexSize; - public final ByteSizeValue maxSinglePrimarySize; + public final ByteSizeValue maxPrimaryShardSize; - public Stats(long numDocs, long indexCreated, ByteSizeValue indexSize, ByteSizeValue maxSinglePrimarySize) { + public Stats(long numDocs, long indexCreated, ByteSizeValue indexSize, ByteSizeValue maxPrimaryShardSize) { this.numDocs = numDocs; this.indexCreated = indexCreated; this.indexSize = indexSize; - this.maxSinglePrimarySize = maxSinglePrimarySize; + this.maxPrimaryShardSize = maxPrimaryShardSize; } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/MaxSinglePrimarySizeCondition.java b/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/MaxPrimaryShardSizeCondition.java similarity index 78% rename from server/src/main/java/org/elasticsearch/action/admin/indices/rollover/MaxSinglePrimarySizeCondition.java rename to server/src/main/java/org/elasticsearch/action/admin/indices/rollover/MaxPrimaryShardSizeCondition.java index 2821dcb47b007..53e7072e90031 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/MaxSinglePrimarySizeCondition.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/MaxPrimaryShardSizeCondition.java @@ -22,22 +22,22 @@ * A size-based condition for the primary shards within an index. * Evaluates to true if the size of the largest primary shard is at least {@link #value}. */ -public class MaxSinglePrimarySizeCondition extends Condition { - public static final String NAME = "max_single_primary_size"; +public class MaxPrimaryShardSizeCondition extends Condition { + public static final String NAME = "max_primary_shard_size"; - public MaxSinglePrimarySizeCondition(ByteSizeValue value) { + public MaxPrimaryShardSizeCondition(ByteSizeValue value) { super(NAME); this.value = value; } - public MaxSinglePrimarySizeCondition(StreamInput in) throws IOException { + public MaxPrimaryShardSizeCondition(StreamInput in) throws IOException { super(NAME); this.value = new ByteSizeValue(in.readVLong(), ByteSizeUnit.BYTES); } @Override public Result evaluate(Stats stats) { - return new Result(this, stats.maxSinglePrimarySize.getBytes() >= value.getBytes()); + return new Result(this, stats.maxPrimaryShardSize.getBytes() >= value.getBytes()); } @Override @@ -57,9 +57,9 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws return builder.field(NAME, value.getStringRep()); } - public static MaxSinglePrimarySizeCondition fromXContent(XContentParser parser) throws IOException { + public static MaxPrimaryShardSizeCondition fromXContent(XContentParser parser) throws IOException { if (parser.nextToken() == XContentParser.Token.VALUE_STRING) { - return new MaxSinglePrimarySizeCondition(ByteSizeValue.parseBytesSizeValue(parser.text(), NAME)); + return new MaxPrimaryShardSizeCondition(ByteSizeValue.parseBytesSizeValue(parser.text(), NAME)); } else { throw new IllegalArgumentException("invalid token: " + parser.currentToken()); } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequest.java b/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequest.java index 2e5a21d5bff3f..248c8c162d16c 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequest.java @@ -44,7 +44,7 @@ public class RolloverRequest extends AcknowledgedRequest implem private static final ParseField MAX_AGE_CONDITION = new ParseField(MaxAgeCondition.NAME); private static final ParseField MAX_DOCS_CONDITION = new ParseField(MaxDocsCondition.NAME); private static final ParseField MAX_SIZE_CONDITION = new ParseField(MaxSizeCondition.NAME); - private static final ParseField MAX_SINGLE_PRIMARY_SIZE_CONDITION = new ParseField(MaxSinglePrimarySizeCondition.NAME); + private static final ParseField MAX_PRIMARY_SHARD_SIZE_CONDITION = new ParseField(MaxPrimaryShardSizeCondition.NAME); static { CONDITION_PARSER.declareString((conditions, s) -> @@ -59,9 +59,9 @@ public class RolloverRequest extends AcknowledgedRequest implem new MaxSizeCondition(ByteSizeValue.parseBytesSizeValue(s, MaxSizeCondition.NAME))), MAX_SIZE_CONDITION); CONDITION_PARSER.declareString((conditions, s) -> - conditions.put(MaxSinglePrimarySizeCondition.NAME, - new MaxSinglePrimarySizeCondition(ByteSizeValue.parseBytesSizeValue(s, MaxSinglePrimarySizeCondition.NAME))), - MAX_SINGLE_PRIMARY_SIZE_CONDITION); + conditions.put(MaxPrimaryShardSizeCondition.NAME, + new MaxPrimaryShardSizeCondition(ByteSizeValue.parseBytesSizeValue(s, MaxPrimaryShardSizeCondition.NAME))), + MAX_PRIMARY_SHARD_SIZE_CONDITION); PARSER.declareField((parser, request, context) -> CONDITION_PARSER.parse(parser, request.conditions, null), CONDITIONS, ObjectParser.ValueType.OBJECT); @@ -206,12 +206,12 @@ public void addMaxIndexSizeCondition(ByteSizeValue size) { /** * Adds a size-based condition to check if the size of the largest primary shard is at least size. */ - public void addMaxSinglePrimarySizeCondition(ByteSizeValue size) { - MaxSinglePrimarySizeCondition maxSinglePrimarySizeCondition = new MaxSinglePrimarySizeCondition(size); - if (this.conditions.containsKey(maxSinglePrimarySizeCondition.name)) { - throw new IllegalArgumentException(maxSinglePrimarySizeCondition + " condition is already set"); + public void addMaxPrimaryShardSizeCondition(ByteSizeValue size) { + MaxPrimaryShardSizeCondition maxPrimaryShardSizeCondition = new MaxPrimaryShardSizeCondition(size); + if (this.conditions.containsKey(maxPrimaryShardSizeCondition.name)) { + throw new IllegalArgumentException(maxPrimaryShardSizeCondition + " condition is already set"); } - this.conditions.put(maxSinglePrimarySizeCondition.name, maxSinglePrimarySizeCondition); + this.conditions.put(maxPrimaryShardSizeCondition.name, maxPrimaryShardSizeCondition); } public boolean isDryRun() { diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequestBuilder.java b/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequestBuilder.java index 86dfdb8de5bc3..a258f650c1405 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequestBuilder.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequestBuilder.java @@ -47,8 +47,8 @@ public RolloverRequestBuilder addMaxIndexSizeCondition(ByteSizeValue size) { return this; } - public RolloverRequestBuilder addMaxSinglePrimarySizeCondition(ByteSizeValue size) { - this.request.addMaxSinglePrimarySizeCondition(size); + public RolloverRequestBuilder addMaxPrimaryShardSizeCondition(ByteSizeValue size) { + this.request.addMaxPrimaryShardSizeCondition(size); return this; } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverAction.java index 9d6a8c70d8e7d..9f017e7f48f59 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverAction.java @@ -239,7 +239,7 @@ static Condition.Stats buildStats(@Nullable final IndexMetadata metadata, .map(stats -> stats.getPrimaries().getDocs()) .orElse(null); - final long maxSinglePrimarySize = indexStats.stream() + final long maxPrimaryShardSize = indexStats.stream() .map(IndexStats::getShards) .filter(Objects::nonNull) .flatMap(Arrays::stream) @@ -252,7 +252,7 @@ static Condition.Stats buildStats(@Nullable final IndexMetadata metadata, docsStats == null ? 0 : docsStats.getCount(), metadata.getCreationDate(), new ByteSizeValue(docsStats == null ? 0 : docsStats.getTotalSizeInBytes()), - new ByteSizeValue(maxSinglePrimarySize) + new ByteSizeValue(maxPrimaryShardSize) ); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/ResizeRequest.java b/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/ResizeRequest.java index 46e3a5fdc3e60..fdb578a4232b0 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/ResizeRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/ResizeRequest.java @@ -36,22 +36,22 @@ public class ResizeRequest extends AcknowledgedRequest implements IndicesRequest, ToXContentObject { public static final ObjectParser PARSER = new ObjectParser<>("resize_request"); - private static final ParseField MAX_SINGLE_PRIMARY_SIZE = new ParseField("max_single_primary_size"); + private static final ParseField MAX_PRIMARY_SHARD_SIZE = new ParseField("max_primary_shard_size"); static { PARSER.declareField((parser, request, context) -> request.getTargetIndexRequest().settings(parser.map()), new ParseField("settings"), ObjectParser.ValueType.OBJECT); PARSER.declareField((parser, request, context) -> request.getTargetIndexRequest().aliases(parser.map()), new ParseField("aliases"), ObjectParser.ValueType.OBJECT); - PARSER.declareField(ResizeRequest::setMaxSinglePrimarySize, - (p, c) -> ByteSizeValue.parseBytesSizeValue(p.text(), MAX_SINGLE_PRIMARY_SIZE.getPreferredName()), - MAX_SINGLE_PRIMARY_SIZE, ObjectParser.ValueType.STRING); + PARSER.declareField(ResizeRequest::setMaxPrimaryShardSize, + (p, c) -> ByteSizeValue.parseBytesSizeValue(p.text(), MAX_PRIMARY_SHARD_SIZE.getPreferredName()), + MAX_PRIMARY_SHARD_SIZE, ObjectParser.ValueType.STRING); } private CreateIndexRequest targetIndexRequest; private String sourceIndex; private ResizeType type = ResizeType.SHRINK; private Boolean copySettings = true; - private ByteSizeValue maxSinglePrimarySize; + private ByteSizeValue maxPrimaryShardSize; public ResizeRequest(StreamInput in) throws IOException { super(in); @@ -61,7 +61,7 @@ public ResizeRequest(StreamInput in) throws IOException { copySettings = in.readOptionalBoolean(); if (in.getVersion().onOrAfter(Version.V_7_12_0)) { if (in.readBoolean()) { - maxSinglePrimarySize = new ByteSizeValue(in); + maxPrimaryShardSize = new ByteSizeValue(in); } } } @@ -88,8 +88,8 @@ public ActionRequestValidationException validate() { if (type == ResizeType.SPLIT && IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.exists(targetIndexRequest.settings()) == false) { validationException = addValidationError("index.number_of_shards is required for split operations", validationException); } - if (maxSinglePrimarySize != null && maxSinglePrimarySize.getBytes() <= 0) { - validationException = addValidationError("max_single_primary_size must be greater than 0", validationException); + if (maxPrimaryShardSize != null && maxPrimaryShardSize.getBytes() <= 0) { + validationException = addValidationError("max_primary_shard_size must be greater than 0", validationException); } assert copySettings == null || copySettings; return validationException; @@ -107,7 +107,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeEnum(type); out.writeOptionalBoolean(copySettings); if (out.getVersion().onOrAfter(Version.V_7_12_0)) { - out.writeOptionalWriteable(maxSinglePrimarySize); + out.writeOptionalWriteable(maxPrimaryShardSize); } } @@ -192,22 +192,22 @@ public Boolean getCopySettings() { } /** - * Sets the max single primary shard size of the target index. + * Sets the max primary shard size of the target index. * It's used to calculate an optimum shards number of the target index according to storage of * the source index, each shard's storage of the target index will not be greater than this parameter, * while the shards number of the target index still be a factor of the source index's shards number. * - * @param maxSinglePrimarySize the max single primary shard size of the target index + * @param maxPrimaryShardSize the max primary shard size of the target index */ - public void setMaxSinglePrimarySize(ByteSizeValue maxSinglePrimarySize) { - this.maxSinglePrimarySize = maxSinglePrimarySize; + public void setMaxPrimaryShardSize(ByteSizeValue maxPrimaryShardSize) { + this.maxPrimaryShardSize = maxPrimaryShardSize; } /** - * Returns the max single primary shard size of the target index + * Returns the max primary shard size of the target index */ - public ByteSizeValue getMaxSinglePrimarySize() { - return maxSinglePrimarySize; + public ByteSizeValue getMaxPrimaryShardSize() { + return maxPrimaryShardSize; } @Override @@ -226,8 +226,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws } } builder.endObject(); - if (maxSinglePrimarySize != null) { - builder.field(MAX_SINGLE_PRIMARY_SIZE.getPreferredName(), maxSinglePrimarySize); + if (maxPrimaryShardSize != null) { + builder.field(MAX_PRIMARY_SHARD_SIZE.getPreferredName(), maxPrimaryShardSize); } } builder.endObject(); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/ResizeRequestBuilder.java b/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/ResizeRequestBuilder.java index 4251c7cfb536b..641e68bc37a30 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/ResizeRequestBuilder.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/ResizeRequestBuilder.java @@ -71,10 +71,10 @@ public ResizeRequestBuilder setResizeType(ResizeType type) { } /** - * Sets the max single primary shard size of the target index. + * Sets the max primary shard size of the target index. */ - public ResizeRequestBuilder setMaxSinglePrimarySize(ByteSizeValue maxSinglePrimarySize) { - this.request.setMaxSinglePrimarySize(maxSinglePrimarySize); + public ResizeRequestBuilder setMaxPrimaryShardSize(ByteSizeValue maxPrimaryShardSize) { + this.request.setMaxPrimaryShardSize(maxPrimaryShardSize); return this; } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/TransportResizeAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/TransportResizeAction.java index 6322da823ae97..954d32ae83bb1 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/TransportResizeAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/TransportResizeAction.java @@ -127,29 +127,29 @@ static CreateIndexClusterStateUpdateRequest prepareCreateIndexRequest(final Resi targetIndexSettingsBuilder.remove(IndexMetadata.SETTING_HISTORY_UUID); final Settings targetIndexSettings = targetIndexSettingsBuilder.build(); final int numShards; - ByteSizeValue maxSinglePrimarySize = resizeRequest.getMaxSinglePrimarySize(); + ByteSizeValue maxPrimaryShardSize = resizeRequest.getMaxPrimaryShardSize(); if (IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.exists(targetIndexSettings)) { - if (resizeRequest.getResizeType() == ResizeType.SHRINK && maxSinglePrimarySize != null) { - throw new IllegalArgumentException("Cannot set both index.number_of_shards and max_single_primary_size" + + if (resizeRequest.getResizeType() == ResizeType.SHRINK && maxPrimaryShardSize != null) { + throw new IllegalArgumentException("Cannot set both index.number_of_shards and max_primary_shard_size" + " for the target index"); } numShards = IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.get(targetIndexSettings); } else { assert resizeRequest.getResizeType() != ResizeType.SPLIT : "split must specify the number of shards explicitly"; if (resizeRequest.getResizeType() == ResizeType.SHRINK) { - if (maxSinglePrimarySize != null) { + if (maxPrimaryShardSize != null) { int sourceIndexShardsNum = sourceMetadata.getNumberOfShards(); long sourceIndexStorageBytes = indexStoreStats.getSizeInBytes(); - long maxSinglePrimarySizeBytes = maxSinglePrimarySize.getBytes(); - long minShardsNum = sourceIndexStorageBytes / maxSinglePrimarySizeBytes; - if (minShardsNum * maxSinglePrimarySizeBytes < sourceIndexStorageBytes) { + long maxPrimaryShardSizeBytes = maxPrimaryShardSize.getBytes(); + long minShardsNum = sourceIndexStorageBytes / maxPrimaryShardSizeBytes; + if (minShardsNum * maxPrimaryShardSizeBytes < sourceIndexStorageBytes) { minShardsNum = minShardsNum + 1; } if (minShardsNum > sourceIndexShardsNum) { - logger.info("By setting max_single_primary_size to [{}], the target index [{}] will contain [{}] shards," + + logger.info("By setting max_primary_shard_size to [{}], the target index [{}] will contain [{}] shards," + " which will be greater than [{}] shards in the source index [{}]," + " using [{}] for the shard count of the target index [{}]", - maxSinglePrimarySize.toString(), targetIndexName, minShardsNum, sourceIndexShardsNum, + maxPrimaryShardSize.toString(), targetIndexName, minShardsNum, sourceIndexShardsNum, sourceMetadata.getIndex().getName(), sourceIndexShardsNum, targetIndexName); numShards = sourceIndexShardsNum; } else { diff --git a/server/src/main/java/org/elasticsearch/indices/IndicesModule.java b/server/src/main/java/org/elasticsearch/indices/IndicesModule.java index bc154106c2b04..c090a8a2163f8 100644 --- a/server/src/main/java/org/elasticsearch/indices/IndicesModule.java +++ b/server/src/main/java/org/elasticsearch/indices/IndicesModule.java @@ -11,7 +11,7 @@ import org.elasticsearch.action.admin.indices.rollover.Condition; import org.elasticsearch.action.admin.indices.rollover.MaxAgeCondition; import org.elasticsearch.action.admin.indices.rollover.MaxDocsCondition; -import org.elasticsearch.action.admin.indices.rollover.MaxSinglePrimarySizeCondition; +import org.elasticsearch.action.admin.indices.rollover.MaxPrimaryShardSizeCondition; import org.elasticsearch.action.admin.indices.rollover.MaxSizeCondition; import org.elasticsearch.action.resync.TransportResyncReplicationAction; import org.elasticsearch.common.ParseField; @@ -78,7 +78,7 @@ public static List getNamedWriteables() { new NamedWriteableRegistry.Entry(Condition.class, MaxAgeCondition.NAME, MaxAgeCondition::new), new NamedWriteableRegistry.Entry(Condition.class, MaxDocsCondition.NAME, MaxDocsCondition::new), new NamedWriteableRegistry.Entry(Condition.class, MaxSizeCondition.NAME, MaxSizeCondition::new), - new NamedWriteableRegistry.Entry(Condition.class, MaxSinglePrimarySizeCondition.NAME, MaxSinglePrimarySizeCondition::new) + new NamedWriteableRegistry.Entry(Condition.class, MaxPrimaryShardSizeCondition.NAME, MaxPrimaryShardSizeCondition::new) ); } @@ -90,8 +90,8 @@ public static List getNamedXContents() { MaxDocsCondition.fromXContent(p)), new NamedXContentRegistry.Entry(Condition.class, new ParseField(MaxSizeCondition.NAME), (p, c) -> MaxSizeCondition.fromXContent(p)), - new NamedXContentRegistry.Entry(Condition.class, new ParseField(MaxSinglePrimarySizeCondition.NAME), (p, c) -> - MaxSinglePrimarySizeCondition.fromXContent(p)) + new NamedXContentRegistry.Entry(Condition.class, new ParseField(MaxPrimaryShardSizeCondition.NAME), (p, c) -> + MaxPrimaryShardSizeCondition.fromXContent(p)) ); } diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/rollover/ConditionTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/rollover/ConditionTests.java index 0b843c022d087..35c36440032b9 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/rollover/ConditionTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/rollover/ConditionTests.java @@ -61,19 +61,19 @@ public void testMaxSize() { assertThat(result.matched, equalTo(true)); } - public void testMaxSinglePrimarySize() { - MaxSinglePrimarySizeCondition maxSinglePrimarySizeCondition = - new MaxSinglePrimarySizeCondition(ByteSizeValue.ofMb(randomIntBetween(10, 20))); + public void testMaxPrimaryShardSize() { + MaxPrimaryShardSizeCondition maxPrimaryShardSizeCondition = + new MaxPrimaryShardSizeCondition(ByteSizeValue.ofMb(randomIntBetween(10, 20))); - Condition.Result result = maxSinglePrimarySizeCondition.evaluate(new Condition.Stats(randomNonNegativeLong(), + Condition.Result result = maxPrimaryShardSizeCondition.evaluate(new Condition.Stats(randomNonNegativeLong(), randomNonNegativeLong(), randomByteSize(), ByteSizeValue.ofMb(0))); assertThat(result.matched, equalTo(false)); - result = maxSinglePrimarySizeCondition.evaluate(new Condition.Stats(randomNonNegativeLong(), randomNonNegativeLong(), + result = maxPrimaryShardSizeCondition.evaluate(new Condition.Stats(randomNonNegativeLong(), randomNonNegativeLong(), randomByteSize(), ByteSizeValue.ofMb(randomIntBetween(0, 9)))); assertThat(result.matched, equalTo(false)); - result = maxSinglePrimarySizeCondition.evaluate(new Condition.Stats(randomNonNegativeLong(), randomNonNegativeLong(), + result = maxPrimaryShardSizeCondition.evaluate(new Condition.Stats(randomNonNegativeLong(), randomNonNegativeLong(), randomByteSize(), ByteSizeValue.ofMb(randomIntBetween(20, 1000)))); assertThat(result.matched, equalTo(true)); } @@ -91,10 +91,10 @@ public void testEqualsAndHashCode() { EqualsHashCodeTestUtils.checkEqualsAndHashCode(maxSizeCondition, condition -> new MaxSizeCondition(condition.value), condition -> new MaxSizeCondition(randomByteSize())); - MaxSinglePrimarySizeCondition maxSinglePrimarySizeCondition = new MaxSinglePrimarySizeCondition(randomByteSize()); - EqualsHashCodeTestUtils.checkEqualsAndHashCode(maxSinglePrimarySizeCondition, - condition -> new MaxSinglePrimarySizeCondition(condition.value), - condition -> new MaxSinglePrimarySizeCondition(randomByteSize())); + MaxPrimaryShardSizeCondition maxPrimaryShardSizeCondition = new MaxPrimaryShardSizeCondition(randomByteSize()); + EqualsHashCodeTestUtils.checkEqualsAndHashCode(maxPrimaryShardSizeCondition, + condition -> new MaxPrimaryShardSizeCondition(condition.value), + condition -> new MaxPrimaryShardSizeCondition(randomByteSize())); } private static ByteSizeValue randomByteSize() { diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequestTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequestTests.java index 726529eb11982..ced6901b6daaa 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequestTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequestTests.java @@ -57,7 +57,7 @@ public void testConditionsParsing() throws Exception { .field("max_age", "10d") .field("max_docs", 100) .field("max_size", "45gb") - .field("max_single_primary_size", "55gb") + .field("max_primary_shard_size", "55gb") .endObject() .endObject(); request.fromXContent(createParser(builder)); @@ -69,9 +69,9 @@ public void testConditionsParsing() throws Exception { assertThat(maxDocsCondition.value, equalTo(100L)); MaxSizeCondition maxSizeCondition = (MaxSizeCondition)conditions.get(MaxSizeCondition.NAME); assertThat(maxSizeCondition.value.getBytes(), equalTo(ByteSizeUnit.GB.toBytes(45))); - MaxSinglePrimarySizeCondition maxSinglePrimarySizeCondition = - (MaxSinglePrimarySizeCondition)conditions.get(MaxSinglePrimarySizeCondition.NAME); - assertThat(maxSinglePrimarySizeCondition.value.getBytes(), equalTo(ByteSizeUnit.GB.toBytes(55))); + MaxPrimaryShardSizeCondition maxPrimaryShardSizeCondition = + (MaxPrimaryShardSizeCondition)conditions.get(MaxPrimaryShardSizeCondition.NAME); + assertThat(maxPrimaryShardSizeCondition.value.getBytes(), equalTo(ByteSizeUnit.GB.toBytes(55))); } public void testParsingWithIndexSettings() throws Exception { diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/rollover/RolloverResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/rollover/RolloverResponseTests.java index c1eaf06538efa..b4c97fc0957bd 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/rollover/RolloverResponseTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/rollover/RolloverResponseTests.java @@ -45,7 +45,7 @@ private static Map randomResults(boolean allowNoItems) { conditionSuppliers.add(() -> new MaxAgeCondition(new TimeValue(randomNonNegativeLong()))); conditionSuppliers.add(() -> new MaxDocsCondition(randomNonNegativeLong())); conditionSuppliers.add(() -> new MaxSizeCondition(new ByteSizeValue(randomNonNegativeLong()))); - conditionSuppliers.add(() -> new MaxSinglePrimarySizeCondition(new ByteSizeValue(randomNonNegativeLong()))); + conditionSuppliers.add(() -> new MaxPrimaryShardSizeCondition(new ByteSizeValue(randomNonNegativeLong()))); } @Override diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverActionTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverActionTests.java index 90a03cd3929e8..69a62059ed385 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverActionTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverActionTests.java @@ -100,9 +100,9 @@ public void testEvaluateConditions() { MaxAgeCondition maxAgeCondition = new MaxAgeCondition(TimeValue.timeValueHours(2)); MaxDocsCondition maxDocsCondition = new MaxDocsCondition(100L); MaxSizeCondition maxSizeCondition = new MaxSizeCondition(ByteSizeValue.ofMb(randomIntBetween(10, 100))); - MaxSinglePrimarySizeCondition maxSinglePrimarySizeCondition = - new MaxSinglePrimarySizeCondition(ByteSizeValue.ofMb(randomIntBetween(10, 100))); - final Set> conditions = Set.of(maxAgeCondition, maxDocsCondition, maxSizeCondition, maxSinglePrimarySizeCondition); + MaxPrimaryShardSizeCondition maxPrimaryShardSizeCondition = + new MaxPrimaryShardSizeCondition(ByteSizeValue.ofMb(randomIntBetween(10, 100))); + final Set> conditions = Set.of(maxAgeCondition, maxDocsCondition, maxSizeCondition, maxPrimaryShardSizeCondition); long matchMaxDocs = randomIntBetween(100, 1000); long notMatchMaxDocs = randomIntBetween(0, 99); @@ -135,7 +135,7 @@ public void testEvaluateConditions() { assertThat(entry.getValue(), equalTo(false)); } else if (entry.getKey().equals(maxSizeCondition.toString())) { assertThat(entry.getValue(), equalTo(false)); - } else if (entry.getKey().equals(maxSinglePrimarySizeCondition.toString())) { + } else if (entry.getKey().equals(maxPrimaryShardSizeCondition.toString())) { assertThat(entry.getValue(), equalTo(false)); } else { fail("unknown condition result found " + entry.getKey()); @@ -147,9 +147,9 @@ public void testEvaluateWithoutStats() { MaxAgeCondition maxAgeCondition = new MaxAgeCondition(TimeValue.timeValueHours(randomIntBetween(1, 3))); MaxDocsCondition maxDocsCondition = new MaxDocsCondition(randomNonNegativeLong()); MaxSizeCondition maxSizeCondition = new MaxSizeCondition(new ByteSizeValue(randomNonNegativeLong())); - MaxSinglePrimarySizeCondition maxSinglePrimarySizeCondition = - new MaxSinglePrimarySizeCondition(new ByteSizeValue(randomNonNegativeLong())); - final Set> conditions = Set.of(maxAgeCondition, maxDocsCondition, maxSizeCondition, maxSinglePrimarySizeCondition); + MaxPrimaryShardSizeCondition maxPrimaryShardSizeCondition = + new MaxPrimaryShardSizeCondition(new ByteSizeValue(randomNonNegativeLong())); + final Set> conditions = Set.of(maxAgeCondition, maxDocsCondition, maxSizeCondition, maxPrimaryShardSizeCondition); final Settings settings = Settings.builder() .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) @@ -172,7 +172,7 @@ public void testEvaluateWithoutStats() { assertThat(entry.getValue(), equalTo(false)); } else if (entry.getKey().equals(maxSizeCondition.toString())) { assertThat(entry.getValue(), equalTo(false)); - } else if (entry.getKey().equals(maxSinglePrimarySizeCondition.toString())) { + } else if (entry.getKey().equals(maxPrimaryShardSizeCondition.toString())) { assertThat(entry.getValue(), equalTo(false)); } else { fail("unknown condition result found " + entry.getKey()); @@ -184,9 +184,9 @@ public void testEvaluateWithoutMetadata() { MaxAgeCondition maxAgeCondition = new MaxAgeCondition(TimeValue.timeValueHours(2)); MaxDocsCondition maxDocsCondition = new MaxDocsCondition(100L); MaxSizeCondition maxSizeCondition = new MaxSizeCondition(ByteSizeValue.ofMb(randomIntBetween(10, 100))); - MaxSinglePrimarySizeCondition maxSinglePrimarySizeCondition = - new MaxSinglePrimarySizeCondition(ByteSizeValue.ofMb(randomIntBetween(10, 100))); - final Set> conditions = Set.of(maxAgeCondition, maxDocsCondition, maxSizeCondition, maxSinglePrimarySizeCondition); + MaxPrimaryShardSizeCondition maxPrimaryShardSizeCondition = + new MaxPrimaryShardSizeCondition(ByteSizeValue.ofMb(randomIntBetween(10, 100))); + final Set> conditions = Set.of(maxAgeCondition, maxDocsCondition, maxSizeCondition, maxPrimaryShardSizeCondition); final Settings settings = Settings.builder() .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/shrink/ResizeRequestTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/shrink/ResizeRequestTests.java index 99218d1545083..aae0fd992902a 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/shrink/ResizeRequestTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/shrink/ResizeRequestTests.java @@ -59,9 +59,9 @@ public void testToXContent() throws IOException { } { ResizeRequest request = new ResizeRequest("target", "source"); - request.setMaxSinglePrimarySize(new ByteSizeValue(100, ByteSizeUnit.MB)); + request.setMaxPrimaryShardSize(new ByteSizeValue(100, ByteSizeUnit.MB)); String actualRequestBody = Strings.toString(request); - assertEquals("{\"settings\":{},\"aliases\":{},\"max_single_primary_size\":\"100mb\"}", actualRequestBody); + assertEquals("{\"settings\":{},\"aliases\":{},\"max_primary_shard_size\":\"100mb\"}", actualRequestBody); } { ResizeRequest request = new ResizeRequest(); diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/shrink/TransportResizeActionTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/shrink/TransportResizeActionTests.java index b358595a70140..b9ecba19c795b 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/shrink/TransportResizeActionTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/shrink/TransportResizeActionTests.java @@ -230,19 +230,19 @@ public void testCalculateTargetShardsNum() { assertEquals(TransportResizeAction.calTargetShardsNum(60, 31), 60); } - public void testShrinkWithMaxSinglePrimarySize() { + public void testShrinkWithMaxPrimaryShardSize() { int sourceIndexShardsNum = randomIntBetween(2, 42); IndexMetadata state = createClusterState("source", sourceIndexShardsNum, randomIntBetween(0, 10), Settings.builder().put("index.blocks.write", true).build()).metadata().index("source"); ResizeRequest resizeRequest = new ResizeRequest("target", "source"); - resizeRequest.setMaxSinglePrimarySize(new ByteSizeValue(10)); + resizeRequest.setMaxPrimaryShardSize(new ByteSizeValue(10)); resizeRequest.getTargetIndexRequest() .settings(Settings.builder().put("index.number_of_shards", 2).build()); assertTrue( expectThrows(IllegalArgumentException.class, () -> TransportResizeAction.prepareCreateIndexRequest(resizeRequest, state, new StoreStats(between(1, 100), between(1, 100)), (i) -> new DocsStats(Integer.MAX_VALUE, between(1, 1000), between(1, 100)), "target") - ).getMessage().startsWith("Cannot set both index.number_of_shards and max_single_primary_size for the target index")); + ).getMessage().startsWith("Cannot set both index.number_of_shards and max_primary_shard_size for the target index")); // create one that won't fail ClusterState clusterState = ClusterState.builder(createClusterState("source", 10, 0, @@ -263,9 +263,9 @@ public void testShrinkWithMaxSinglePrimarySize() { int numSourceShards = clusterState.metadata().index("source").getNumberOfShards(); DocsStats stats = new DocsStats(between(0, (IndexWriter.MAX_DOCS) / numSourceShards), between(1, 1000), between(1, 10000)); - // each shard's storage will not be greater than the `max_single_primary_size` + // each shard's storage will not be greater than the `max_primary_shard_size` ResizeRequest target1 = new ResizeRequest("target", "source"); - target1.setMaxSinglePrimarySize(new ByteSizeValue(2)); + target1.setMaxPrimaryShardSize(new ByteSizeValue(2)); StoreStats storeStats = new StoreStats(10, between(1, 100)); final int targetIndexShardsNum1 = 5; final ActiveShardCount activeShardCount1 = ActiveShardCount.from(targetIndexShardsNum1); @@ -279,10 +279,10 @@ public void testShrinkWithMaxSinglePrimarySize() { assertEquals("shrink_index", request1.cause()); assertEquals(request1.waitForActiveShards(), activeShardCount1); - // if `max_single_primary_size` is less than the single shard size of the source index, + // if `max_primary_shard_size` is less than the single shard size of the source index, // the shards number of the target index will be equal to the source index's shards number ResizeRequest target2 = new ResizeRequest("target2", "source"); - target2.setMaxSinglePrimarySize(new ByteSizeValue(1)); + target2.setMaxPrimaryShardSize(new ByteSizeValue(1)); StoreStats storeStats2 = new StoreStats(100, between(1, 100)); final int targetIndexShardsNum2 = 10; final ActiveShardCount activeShardCount2 = ActiveShardCount.from(targetIndexShardsNum2); diff --git a/server/src/test/java/org/elasticsearch/cluster/metadata/IndexMetadataTests.java b/server/src/test/java/org/elasticsearch/cluster/metadata/IndexMetadataTests.java index 7a6d1458b0a47..0fb98333f3537 100644 --- a/server/src/test/java/org/elasticsearch/cluster/metadata/IndexMetadataTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/metadata/IndexMetadataTests.java @@ -10,7 +10,7 @@ import org.elasticsearch.action.admin.indices.rollover.MaxAgeCondition; import org.elasticsearch.action.admin.indices.rollover.MaxDocsCondition; -import org.elasticsearch.action.admin.indices.rollover.MaxSinglePrimarySizeCondition; +import org.elasticsearch.action.admin.indices.rollover.MaxPrimaryShardSizeCondition; import org.elasticsearch.action.admin.indices.rollover.MaxSizeCondition; import org.elasticsearch.action.admin.indices.rollover.RolloverInfo; import org.elasticsearch.common.Strings; @@ -86,7 +86,7 @@ public void testIndexMetadataSerialization() throws IOException { new MaxAgeCondition(TimeValue.timeValueMillis(randomNonNegativeLong())), new MaxDocsCondition(randomNonNegativeLong()), new MaxSizeCondition(new ByteSizeValue(randomNonNegativeLong())), - new MaxSinglePrimarySizeCondition(new ByteSizeValue(randomNonNegativeLong())) + new MaxPrimaryShardSizeCondition(new ByteSizeValue(randomNonNegativeLong())) ), randomNonNegativeLong())).build(); assertEquals(system, metadata.isSystem()); diff --git a/server/src/test/java/org/elasticsearch/index/shard/RemoveCorruptedShardDataCommandTests.java b/server/src/test/java/org/elasticsearch/index/shard/RemoveCorruptedShardDataCommandTests.java index d868076b7b41e..480570e34ab04 100644 --- a/server/src/test/java/org/elasticsearch/index/shard/RemoveCorruptedShardDataCommandTests.java +++ b/server/src/test/java/org/elasticsearch/index/shard/RemoveCorruptedShardDataCommandTests.java @@ -15,7 +15,7 @@ import org.elasticsearch.action.admin.indices.rollover.Condition; import org.elasticsearch.action.admin.indices.rollover.MaxAgeCondition; import org.elasticsearch.action.admin.indices.rollover.MaxDocsCondition; -import org.elasticsearch.action.admin.indices.rollover.MaxSinglePrimarySizeCondition; +import org.elasticsearch.action.admin.indices.rollover.MaxPrimaryShardSizeCondition; import org.elasticsearch.action.admin.indices.rollover.MaxSizeCondition; import org.elasticsearch.action.admin.indices.rollover.RolloverInfo; import org.elasticsearch.cli.MockTerminal; @@ -119,7 +119,7 @@ public void setup() throws IOException { Condition rolloverCondition = randomFrom( new MaxAgeCondition(new TimeValue(randomNonNegativeLong())), new MaxDocsCondition(randomNonNegativeLong()), - new MaxSinglePrimarySizeCondition(new ByteSizeValue(randomNonNegativeLong())), + new MaxPrimaryShardSizeCondition(new ByteSizeValue(randomNonNegativeLong())), new MaxSizeCondition(new ByteSizeValue(randomNonNegativeLong())) ); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/RolloverAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/RolloverAction.java index 151880b638f67..c0664ea57fab8 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/RolloverAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/RolloverAction.java @@ -35,7 +35,7 @@ public class RolloverAction implements LifecycleAction { public static final String NAME = "rollover"; public static final String INDEXING_COMPLETE_STEP_NAME = "set-indexing-complete"; public static final ParseField MAX_SIZE_FIELD = new ParseField("max_size"); - public static final ParseField MAX_SINGLE_PRIMARY_SIZE_FIELD = new ParseField("max_single_primary_size"); + public static final ParseField MAX_PRIMARY_SHARD_SIZE_FIELD = new ParseField("max_primary_shard_size"); public static final ParseField MAX_DOCS_FIELD = new ParseField("max_docs"); public static final ParseField MAX_AGE_FIELD = new ParseField("max_age"); public static final String LIFECYCLE_ROLLOVER_ALIAS = "index.lifecycle.rollover_alias"; @@ -50,8 +50,8 @@ public class RolloverAction implements LifecycleAction { (p, c) -> ByteSizeValue.parseBytesSizeValue(p.text(), MAX_SIZE_FIELD.getPreferredName()), MAX_SIZE_FIELD, ValueType.VALUE); PARSER.declareField(ConstructingObjectParser.optionalConstructorArg(), - (p, c) -> ByteSizeValue.parseBytesSizeValue(p.text(), MAX_SINGLE_PRIMARY_SIZE_FIELD.getPreferredName()), - MAX_SINGLE_PRIMARY_SIZE_FIELD, ValueType.VALUE); + (p, c) -> ByteSizeValue.parseBytesSizeValue(p.text(), MAX_PRIMARY_SHARD_SIZE_FIELD.getPreferredName()), + MAX_PRIMARY_SHARD_SIZE_FIELD, ValueType.VALUE); PARSER.declareField(ConstructingObjectParser.optionalConstructorArg(), (p, c) -> TimeValue.parseTimeValue(p.text(), MAX_AGE_FIELD.getPreferredName()), MAX_AGE_FIELD, ValueType.VALUE); @@ -59,7 +59,7 @@ public class RolloverAction implements LifecycleAction { } private final ByteSizeValue maxSize; - private final ByteSizeValue maxSinglePrimarySize; + private final ByteSizeValue maxPrimaryShardSize; private final Long maxDocs; private final TimeValue maxAge; @@ -67,13 +67,13 @@ public static RolloverAction parse(XContentParser parser) { return PARSER.apply(parser, null); } - public RolloverAction(@Nullable ByteSizeValue maxSize, @Nullable ByteSizeValue maxSinglePrimarySize, @Nullable TimeValue maxAge, + public RolloverAction(@Nullable ByteSizeValue maxSize, @Nullable ByteSizeValue maxPrimaryShardSize, @Nullable TimeValue maxAge, @Nullable Long maxDocs) { - if (maxSize == null && maxSinglePrimarySize == null && maxAge == null && maxDocs == null) { + if (maxSize == null && maxPrimaryShardSize == null && maxAge == null && maxDocs == null) { throw new IllegalArgumentException("At least one rollover condition must be set."); } this.maxSize = maxSize; - this.maxSinglePrimarySize = maxSinglePrimarySize; + this.maxPrimaryShardSize = maxPrimaryShardSize; this.maxAge = maxAge; this.maxDocs = maxDocs; } @@ -85,9 +85,9 @@ public RolloverAction(StreamInput in) throws IOException { maxSize = null; } if (in.getVersion().onOrAfter(Version.V_7_13_0) && in.readBoolean()) { - maxSinglePrimarySize = new ByteSizeValue(in); + maxPrimaryShardSize = new ByteSizeValue(in); } else { - maxSinglePrimarySize = null; + maxPrimaryShardSize = null; } maxAge = in.readOptionalTimeValue(); maxDocs = in.readOptionalVLong(); @@ -101,10 +101,10 @@ public void writeTo(StreamOutput out) throws IOException { maxSize.writeTo(out); } if (out.getVersion().onOrAfter(Version.V_7_13_0)) { - boolean hasMaxSinglePrimarySize = maxSinglePrimarySize != null; - out.writeBoolean(hasMaxSinglePrimarySize); - if (hasMaxSinglePrimarySize) { - maxSinglePrimarySize.writeTo(out); + boolean hasMaxPrimaryShardSize = maxPrimaryShardSize != null; + out.writeBoolean(hasMaxPrimaryShardSize); + if (hasMaxPrimaryShardSize) { + maxPrimaryShardSize.writeTo(out); } } out.writeOptionalTimeValue(maxAge); @@ -120,8 +120,8 @@ public ByteSizeValue getMaxSize() { return maxSize; } - public ByteSizeValue getMaxSinglePrimarySize() { - return maxSinglePrimarySize; + public ByteSizeValue getMaxPrimaryShardSize() { + return maxPrimaryShardSize; } public TimeValue getMaxAge() { @@ -138,8 +138,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws if (maxSize != null) { builder.field(MAX_SIZE_FIELD.getPreferredName(), maxSize.getStringRep()); } - if (maxSinglePrimarySize != null) { - builder.field(MAX_SINGLE_PRIMARY_SIZE_FIELD.getPreferredName(), maxSinglePrimarySize.getStringRep()); + if (maxPrimaryShardSize != null) { + builder.field(MAX_PRIMARY_SHARD_SIZE_FIELD.getPreferredName(), maxPrimaryShardSize.getStringRep()); } if (maxAge != null) { builder.field(MAX_AGE_FIELD.getPreferredName(), maxAge.getStringRep()); @@ -167,7 +167,7 @@ public List toSteps(Client client, String phase, Step.StepKey nextStepKey) StepKey setIndexingCompleteStepKey = new StepKey(phase, NAME, INDEXING_COMPLETE_STEP_NAME); WaitForRolloverReadyStep waitForRolloverReadyStep = new WaitForRolloverReadyStep(waitForRolloverReadyStepKey, rolloverStepKey, - client, maxSize, maxSinglePrimarySize, maxAge, maxDocs); + client, maxSize, maxPrimaryShardSize, maxAge, maxDocs); RolloverStep rolloverStep = new RolloverStep(rolloverStepKey, waitForActiveShardsKey, client); WaitForActiveShardsStep waitForActiveShardsStep = new WaitForActiveShardsStep(waitForActiveShardsKey, updateDateStepKey); UpdateRolloverLifecycleDateStep updateDateStep = new UpdateRolloverLifecycleDateStep(updateDateStepKey, setIndexingCompleteStepKey, @@ -179,7 +179,7 @@ public List toSteps(Client client, String phase, Step.StepKey nextStepKey) @Override public int hashCode() { - return Objects.hash(maxSize, maxSinglePrimarySize, maxAge, maxDocs); + return Objects.hash(maxSize, maxPrimaryShardSize, maxAge, maxDocs); } @Override @@ -192,7 +192,7 @@ public boolean equals(Object obj) { } RolloverAction other = (RolloverAction) obj; return Objects.equals(maxSize, other.maxSize) && - Objects.equals(maxSinglePrimarySize, other.maxSinglePrimarySize) && + Objects.equals(maxPrimaryShardSize, other.maxPrimaryShardSize) && Objects.equals(maxAge, other.maxAge) && Objects.equals(maxDocs, other.maxDocs); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ShrinkAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ShrinkAction.java index 398f276a1ceb3..59eed5885b8b0 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ShrinkAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ShrinkAction.java @@ -39,7 +39,7 @@ public class ShrinkAction implements LifecycleAction { public static final String NAME = "shrink"; public static final String SHRUNKEN_INDEX_PREFIX = "shrink-"; public static final ParseField NUMBER_OF_SHARDS_FIELD = new ParseField("number_of_shards"); - private static final ParseField MAX_SINGLE_PRIMARY_SIZE = new ParseField("max_single_primary_size"); + private static final ParseField MAX_PRIMARY_SHARD_SIZE = new ParseField("max_primary_shard_size"); public static final String CONDITIONAL_SKIP_SHRINK_STEP = BranchingStep.NAME + "-check-prerequisites"; public static final String CONDITIONAL_DATASTREAM_CHECK_KEY = BranchingStep.NAME + "-on-datastream-check"; @@ -49,29 +49,29 @@ public class ShrinkAction implements LifecycleAction { static { PARSER.declareInt(ConstructingObjectParser.optionalConstructorArg(), NUMBER_OF_SHARDS_FIELD); PARSER.declareField(ConstructingObjectParser.optionalConstructorArg(), - (p, c) -> ByteSizeValue.parseBytesSizeValue(p.text(), MAX_SINGLE_PRIMARY_SIZE.getPreferredName()), - MAX_SINGLE_PRIMARY_SIZE, ObjectParser.ValueType.STRING); + (p, c) -> ByteSizeValue.parseBytesSizeValue(p.text(), MAX_PRIMARY_SHARD_SIZE.getPreferredName()), + MAX_PRIMARY_SHARD_SIZE, ObjectParser.ValueType.STRING); } private Integer numberOfShards; - private ByteSizeValue maxSinglePrimarySize; + private ByteSizeValue maxPrimaryShardSize; public static ShrinkAction parse(XContentParser parser) throws IOException { return PARSER.parse(parser, null); } - public ShrinkAction(@Nullable Integer numberOfShards, @Nullable ByteSizeValue maxSinglePrimarySize) { - if (numberOfShards != null && maxSinglePrimarySize != null) { - throw new IllegalArgumentException("Cannot set both [number_of_shards] and [max_single_primary_size]"); + public ShrinkAction(@Nullable Integer numberOfShards, @Nullable ByteSizeValue maxPrimaryShardSize) { + if (numberOfShards != null && maxPrimaryShardSize != null) { + throw new IllegalArgumentException("Cannot set both [number_of_shards] and [max_primary_shard_size]"); } - if (numberOfShards == null && maxSinglePrimarySize == null) { - throw new IllegalArgumentException("Either [number_of_shards] or [max_single_primary_size] must be set"); + if (numberOfShards == null && maxPrimaryShardSize == null) { + throw new IllegalArgumentException("Either [number_of_shards] or [max_primary_shard_size] must be set"); } - if (maxSinglePrimarySize != null) { - if (maxSinglePrimarySize.getBytes() <= 0) { - throw new IllegalArgumentException("[max_single_primary_size] must be greater than 0"); + if (maxPrimaryShardSize != null) { + if (maxPrimaryShardSize.getBytes() <= 0) { + throw new IllegalArgumentException("[max_primary_shard_size] must be greater than 0"); } - this.maxSinglePrimarySize = maxSinglePrimarySize; + this.maxPrimaryShardSize = maxPrimaryShardSize; } else { if (numberOfShards <= 0) { throw new IllegalArgumentException("[" + NUMBER_OF_SHARDS_FIELD.getPreferredName() + "] must be greater than 0"); @@ -84,14 +84,14 @@ public ShrinkAction(StreamInput in) throws IOException { if (in.getVersion().onOrAfter(Version.V_7_12_0)) { if (in.readBoolean()) { this.numberOfShards = in.readVInt(); - this.maxSinglePrimarySize = null; + this.maxPrimaryShardSize = null; } else { this.numberOfShards = null; - this.maxSinglePrimarySize = new ByteSizeValue(in); + this.maxPrimaryShardSize = new ByteSizeValue(in); } } else { this.numberOfShards = in.readVInt(); - this.maxSinglePrimarySize = null; + this.maxPrimaryShardSize = null; } } @@ -99,8 +99,8 @@ Integer getNumberOfShards() { return numberOfShards; } - ByteSizeValue getMaxSinglePrimarySize() { - return maxSinglePrimarySize; + ByteSizeValue getMaxPrimaryShardSize() { + return maxPrimaryShardSize; } @Override @@ -111,7 +111,7 @@ public void writeTo(StreamOutput out) throws IOException { if (hasNumberOfShards) { out.writeVInt(numberOfShards); } else { - maxSinglePrimarySize.writeTo(out); + maxPrimaryShardSize.writeTo(out); } } else { out.writeVInt(numberOfShards); @@ -129,8 +129,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws if (numberOfShards != null) { builder.field(NUMBER_OF_SHARDS_FIELD.getPreferredName(), numberOfShards); } - if (maxSinglePrimarySize != null) { - builder.field(MAX_SINGLE_PRIMARY_SIZE.getPreferredName(), maxSinglePrimarySize); + if (maxPrimaryShardSize != null) { + builder.field(MAX_PRIMARY_SHARD_SIZE.getPreferredName(), maxPrimaryShardSize); } builder.endObject(); return builder; @@ -180,7 +180,7 @@ public List toSteps(Client client, String phase, Step.StepKey nextStepKey) UpdateSettingsStep readOnlyStep = new UpdateSettingsStep(readOnlyKey, setSingleNodeKey, client, readOnlySettings); SetSingleNodeAllocateStep setSingleNodeStep = new SetSingleNodeAllocateStep(setSingleNodeKey, allocationRoutedKey, client); CheckShrinkReadyStep checkShrinkReadyStep = new CheckShrinkReadyStep(allocationRoutedKey, shrinkKey); - ShrinkStep shrink = new ShrinkStep(shrinkKey, enoughShardsKey, client, numberOfShards, maxSinglePrimarySize, + ShrinkStep shrink = new ShrinkStep(shrinkKey, enoughShardsKey, client, numberOfShards, maxPrimaryShardSize, SHRUNKEN_INDEX_PREFIX); ShrunkShardsAllocatedStep allocated = new ShrunkShardsAllocatedStep(enoughShardsKey, copyMetadataKey, SHRUNKEN_INDEX_PREFIX); CopyExecutionStateStep copyMetadata = new CopyExecutionStateStep(copyMetadataKey, dataStreamCheckBranchingKey, @@ -212,12 +212,12 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) return false; ShrinkAction that = (ShrinkAction) o; return Objects.equals(numberOfShards, that.numberOfShards) && - Objects.equals(maxSinglePrimarySize, that.maxSinglePrimarySize); + Objects.equals(maxPrimaryShardSize, that.maxPrimaryShardSize); } @Override public int hashCode() { - return Objects.hash(numberOfShards, maxSinglePrimarySize); + return Objects.hash(numberOfShards, maxPrimaryShardSize); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ShrinkStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ShrinkStep.java index d01e9326b1222..a17d55873ac93 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ShrinkStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ShrinkStep.java @@ -24,14 +24,14 @@ public class ShrinkStep extends AsyncActionStep { public static final String NAME = "shrink"; private Integer numberOfShards; - private ByteSizeValue maxSinglePrimarySize; + private ByteSizeValue maxPrimaryShardSize; private String shrunkIndexPrefix; public ShrinkStep(StepKey key, StepKey nextStepKey, Client client, Integer numberOfShards, - ByteSizeValue maxSinglePrimarySize, String shrunkIndexPrefix) { + ByteSizeValue maxPrimaryShardSize, String shrunkIndexPrefix) { super(key, nextStepKey, client); this.numberOfShards = numberOfShards; - this.maxSinglePrimarySize = maxSinglePrimarySize; + this.maxPrimaryShardSize = maxPrimaryShardSize; this.shrunkIndexPrefix = shrunkIndexPrefix; } @@ -39,8 +39,8 @@ public Integer getNumberOfShards() { return numberOfShards; } - public ByteSizeValue getMaxSinglePrimarySize() { - return maxSinglePrimarySize; + public ByteSizeValue getMaxPrimaryShardSize() { + return maxPrimaryShardSize; } String getShrunkIndexPrefix() { @@ -70,7 +70,7 @@ public void performAction(IndexMetadata indexMetadata, ClusterState currentState String shrunkenIndexName = shrunkIndexPrefix + indexMetadata.getIndex().getName(); ResizeRequest resizeRequest = new ResizeRequest(shrunkenIndexName, indexMetadata.getIndex().getName()) .masterNodeTimeout(getMasterTimeout(currentState)); - resizeRequest.setMaxSinglePrimarySize(maxSinglePrimarySize); + resizeRequest.setMaxPrimaryShardSize(maxPrimaryShardSize); resizeRequest.getTargetIndexRequest().settings(relevantTargetSettings); getClient().admin().indices().resizeIndex(resizeRequest, ActionListener.wrap(response -> { @@ -84,7 +84,7 @@ public void performAction(IndexMetadata indexMetadata, ClusterState currentState @Override public int hashCode() { - return Objects.hash(super.hashCode(), numberOfShards, maxSinglePrimarySize, shrunkIndexPrefix); + return Objects.hash(super.hashCode(), numberOfShards, maxPrimaryShardSize, shrunkIndexPrefix); } @Override @@ -98,7 +98,7 @@ public boolean equals(Object obj) { ShrinkStep other = (ShrinkStep) obj; return super.equals(obj) && Objects.equals(numberOfShards, other.numberOfShards) && - Objects.equals(maxSinglePrimarySize, other.maxSinglePrimarySize) && + Objects.equals(maxPrimaryShardSize, other.maxPrimaryShardSize) && Objects.equals(shrunkIndexPrefix, other.shrunkIndexPrefix); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/WaitForRolloverReadyStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/WaitForRolloverReadyStep.java index 7e7a452d9ff7d..7a9b9ee53d049 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/WaitForRolloverReadyStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/WaitForRolloverReadyStep.java @@ -35,15 +35,15 @@ public class WaitForRolloverReadyStep extends AsyncWaitStep { public static final String NAME = "check-rollover-ready"; private final ByteSizeValue maxSize; - private final ByteSizeValue maxSinglePrimarySize; + private final ByteSizeValue maxPrimaryShardSize; private final TimeValue maxAge; private final Long maxDocs; public WaitForRolloverReadyStep(StepKey key, StepKey nextStepKey, Client client, - ByteSizeValue maxSize, ByteSizeValue maxSinglePrimarySize, TimeValue maxAge, Long maxDocs) { + ByteSizeValue maxSize, ByteSizeValue maxPrimaryShardSize, TimeValue maxAge, Long maxDocs) { super(key, nextStepKey, client); this.maxSize = maxSize; - this.maxSinglePrimarySize = maxSinglePrimarySize; + this.maxPrimaryShardSize = maxPrimaryShardSize; this.maxAge = maxAge; this.maxDocs = maxDocs; } @@ -144,8 +144,8 @@ public void evaluateCondition(Metadata metadata, Index index, Listener listener, if (maxSize != null) { rolloverRequest.addMaxIndexSizeCondition(maxSize); } - if (maxSinglePrimarySize != null) { - rolloverRequest.addMaxSinglePrimarySizeCondition(maxSinglePrimarySize); + if (maxPrimaryShardSize != null) { + rolloverRequest.addMaxPrimaryShardSizeCondition(maxPrimaryShardSize); } if (maxAge != null) { rolloverRequest.addMaxIndexAgeCondition(maxAge); @@ -162,8 +162,8 @@ ByteSizeValue getMaxSize() { return maxSize; } - ByteSizeValue getMaxSinglePrimarySize() { - return maxSinglePrimarySize; + ByteSizeValue getMaxPrimaryShardSize() { + return maxPrimaryShardSize; } TimeValue getMaxAge() { @@ -176,7 +176,7 @@ Long getMaxDocs() { @Override public int hashCode() { - return Objects.hash(super.hashCode(), maxSize, maxSinglePrimarySize, maxAge, maxDocs); + return Objects.hash(super.hashCode(), maxSize, maxPrimaryShardSize, maxAge, maxDocs); } @Override @@ -190,7 +190,7 @@ public boolean equals(Object obj) { WaitForRolloverReadyStep other = (WaitForRolloverReadyStep) obj; return super.equals(obj) && Objects.equals(maxSize, other.maxSize) && - Objects.equals(maxSinglePrimarySize, other.maxSinglePrimarySize) && + Objects.equals(maxPrimaryShardSize, other.maxPrimaryShardSize) && Objects.equals(maxAge, other.maxAge) && Objects.equals(maxDocs, other.maxDocs); } diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/RolloverActionTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/RolloverActionTests.java index d315db1c47310..e349f2050dbe8 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/RolloverActionTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/RolloverActionTests.java @@ -32,14 +32,14 @@ public static RolloverAction randomInstance() { ByteSizeUnit maxSizeUnit = randomFrom(ByteSizeUnit.values()); ByteSizeValue maxSize = randomBoolean() ? null : new ByteSizeValue(randomNonNegativeLong() / maxSizeUnit.toBytes(1), maxSizeUnit); - ByteSizeUnit maxSinglePrimarySizeUnit = randomFrom(ByteSizeUnit.values()); - ByteSizeValue maxSinglePrimarySize = randomBoolean() ? null : - new ByteSizeValue(randomNonNegativeLong() / maxSinglePrimarySizeUnit.toBytes(1), maxSinglePrimarySizeUnit); + ByteSizeUnit maxPrimaryShardSizeUnit = randomFrom(ByteSizeUnit.values()); + ByteSizeValue maxPrimaryShardSize = randomBoolean() ? null : + new ByteSizeValue(randomNonNegativeLong() / maxPrimaryShardSizeUnit.toBytes(1), maxPrimaryShardSizeUnit); Long maxDocs = randomBoolean() ? null : randomNonNegativeLong(); TimeValue maxAge = (maxDocs == null && maxSize == null || randomBoolean()) ? TimeValue.parseTimeValue(randomPositiveTimeValue(), "rollover_action_test") : null; - return new RolloverAction(maxSize, maxSinglePrimarySize, maxAge, maxDocs); + return new RolloverAction(maxSize, maxPrimaryShardSize, maxAge, maxDocs); } @Override @@ -50,7 +50,7 @@ protected Reader instanceReader() { @Override protected RolloverAction mutateInstance(RolloverAction instance) throws IOException { ByteSizeValue maxSize = instance.getMaxSize(); - ByteSizeValue maxSinglePrimarySize = instance.getMaxSinglePrimarySize(); + ByteSizeValue maxPrimaryShardSize = instance.getMaxPrimaryShardSize(); TimeValue maxAge = instance.getMaxAge(); Long maxDocs = instance.getMaxDocs(); switch (between(0, 3)) { @@ -61,9 +61,9 @@ protected RolloverAction mutateInstance(RolloverAction instance) throws IOExcept }); break; case 1: - maxSinglePrimarySize = randomValueOtherThan(maxSinglePrimarySize, () -> { - ByteSizeUnit maxSinglePrimarySizeUnit = randomFrom(ByteSizeUnit.values()); - return new ByteSizeValue(randomNonNegativeLong() / maxSinglePrimarySizeUnit.toBytes(1), maxSinglePrimarySizeUnit); + maxPrimaryShardSize = randomValueOtherThan(maxPrimaryShardSize, () -> { + ByteSizeUnit maxPrimaryShardSizeUnit = randomFrom(ByteSizeUnit.values()); + return new ByteSizeValue(randomNonNegativeLong() / maxPrimaryShardSizeUnit.toBytes(1), maxPrimaryShardSizeUnit); }); break; case 2: @@ -76,7 +76,7 @@ protected RolloverAction mutateInstance(RolloverAction instance) throws IOExcept default: throw new AssertionError("Illegal randomisation branch"); } - return new RolloverAction(maxSize, maxSinglePrimarySize, maxAge, maxDocs); + return new RolloverAction(maxSize, maxPrimaryShardSize, maxAge, maxDocs); } public void testNoConditions() { @@ -113,7 +113,7 @@ public void testToSteps() { assertEquals(fourthStep.getKey(), thirdStep.getNextStepKey()); assertEquals(fifthStep.getKey(), fourthStep.getNextStepKey()); assertEquals(action.getMaxSize(), firstStep.getMaxSize()); - assertEquals(action.getMaxSinglePrimarySize(), firstStep.getMaxSinglePrimarySize()); + assertEquals(action.getMaxPrimaryShardSize(), firstStep.getMaxPrimaryShardSize()); assertEquals(action.getMaxAge(), firstStep.getMaxAge()); assertEquals(action.getMaxDocs(), firstStep.getMaxDocs()); assertEquals(nextStepKey, fifthStep.getNextStepKey()); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ShrinkActionTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ShrinkActionTests.java index c3ef0d6388571..1ea3438c4e964 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ShrinkActionTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ShrinkActionTests.java @@ -48,7 +48,7 @@ protected ShrinkAction mutateInstance(ShrinkAction action) { if (action.getNumberOfShards() != null) { return new ShrinkAction(action.getNumberOfShards() + randomIntBetween(1, 2), null); } else { - return new ShrinkAction(null, new ByteSizeValue(action.getMaxSinglePrimarySize().getBytes() + 1)); + return new ShrinkAction(null, new ByteSizeValue(action.getMaxPrimaryShardSize().getBytes() + 1)); } } @@ -62,14 +62,14 @@ public void testNonPositiveShardNumber() { assertThat(e.getMessage(), equalTo("[number_of_shards] must be greater than 0")); } - public void testMaxSinglePrimarySize() { - ByteSizeValue maxSinglePrimarySize1 = new ByteSizeValue(10); - Exception e1 = expectThrows(Exception.class, () -> new ShrinkAction(randomIntBetween(1, 100), maxSinglePrimarySize1)); - assertThat(e1.getMessage(), equalTo("Cannot set both [number_of_shards] and [max_single_primary_size]")); + public void testMaxPrimaryShardSize() { + ByteSizeValue maxPrimaryShardSize1 = new ByteSizeValue(10); + Exception e1 = expectThrows(Exception.class, () -> new ShrinkAction(randomIntBetween(1, 100), maxPrimaryShardSize1)); + assertThat(e1.getMessage(), equalTo("Cannot set both [number_of_shards] and [max_primary_shard_size]")); - ByteSizeValue maxSinglePrimarySize2 = new ByteSizeValue(0); - Exception e2 = expectThrows(Exception.class, () -> new ShrinkAction(null, maxSinglePrimarySize2)); - assertThat(e2.getMessage(), equalTo("[max_single_primary_size] must be greater than 0")); + ByteSizeValue maxPrimaryShardSize2 = new ByteSizeValue(0); + Exception e2 = expectThrows(Exception.class, () -> new ShrinkAction(null, maxPrimaryShardSize2)); + assertThat(e2.getMessage(), equalTo("[max_primary_shard_size] must be greater than 0")); } public void testPerformActionWithSkip() { diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ShrinkStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ShrinkStepTests.java index 67533bbd733fd..094618eaaf99d 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ShrinkStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ShrinkStepTests.java @@ -33,14 +33,14 @@ public ShrinkStep createRandomInstance() { StepKey stepKey = randomStepKey(); StepKey nextStepKey = randomStepKey(); Integer numberOfShards = null; - ByteSizeValue maxSinglePrimarySize = null; + ByteSizeValue maxPrimaryShardSize = null; if (randomBoolean()) { numberOfShards = randomIntBetween(1, 20); } else { - maxSinglePrimarySize = new ByteSizeValue(between(1,100)); + maxPrimaryShardSize = new ByteSizeValue(between(1,100)); } String shrunkIndexPrefix = randomAlphaOfLength(10); - return new ShrinkStep(stepKey, nextStepKey, client, numberOfShards, maxSinglePrimarySize, shrunkIndexPrefix); + return new ShrinkStep(stepKey, nextStepKey, client, numberOfShards, maxPrimaryShardSize, shrunkIndexPrefix); } @Override @@ -48,7 +48,7 @@ public ShrinkStep mutateInstance(ShrinkStep instance) { StepKey key = instance.getKey(); StepKey nextKey = instance.getNextStepKey(); Integer numberOfShards = instance.getNumberOfShards(); - ByteSizeValue maxSinglePrimarySize = instance.getMaxSinglePrimarySize(); + ByteSizeValue maxPrimaryShardSize = instance.getMaxPrimaryShardSize(); String shrunkIndexPrefix = instance.getShrunkIndexPrefix(); switch (between(0, 3)) { @@ -62,8 +62,8 @@ public ShrinkStep mutateInstance(ShrinkStep instance) { if (numberOfShards != null) { numberOfShards = numberOfShards + 1; } - if (maxSinglePrimarySize != null) { - maxSinglePrimarySize = new ByteSizeValue(maxSinglePrimarySize.getBytes() + 1); + if (maxPrimaryShardSize != null) { + maxPrimaryShardSize = new ByteSizeValue(maxPrimaryShardSize.getBytes() + 1); } break; case 3: @@ -73,13 +73,13 @@ public ShrinkStep mutateInstance(ShrinkStep instance) { throw new AssertionError("Illegal randomisation branch"); } - return new ShrinkStep(key, nextKey, instance.getClient(), numberOfShards, maxSinglePrimarySize, shrunkIndexPrefix); + return new ShrinkStep(key, nextKey, instance.getClient(), numberOfShards, maxPrimaryShardSize, shrunkIndexPrefix); } @Override public ShrinkStep copyInstance(ShrinkStep instance) { return new ShrinkStep(instance.getKey(), instance.getNextStepKey(), instance.getClient(), instance.getNumberOfShards(), - instance.getMaxSinglePrimarySize(), instance.getShrunkIndexPrefix()); + instance.getMaxPrimaryShardSize(), instance.getShrunkIndexPrefix()); } public void testPerformAction() throws Exception { @@ -118,7 +118,7 @@ public void testPerformAction() throws Exception { assertThat(request.getTargetIndexRequest().settings() .getAsInt(IndexMetadata.SETTING_NUMBER_OF_SHARDS, -1), equalTo(step.getNumberOfShards())); } - request.setMaxSinglePrimarySize(step.getMaxSinglePrimarySize()); + request.setMaxPrimaryShardSize(step.getMaxPrimaryShardSize()); listener.onResponse(new ResizeResponse(true, true, sourceIndexMetadata.getIndex().getName())); return null; }).when(indicesClient).resizeIndex(Mockito.any(), Mockito.any()); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/WaitForRolloverReadyStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/WaitForRolloverReadyStepTests.java index 62d019cbd1adb..645f6ecd96ea7 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/WaitForRolloverReadyStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/WaitForRolloverReadyStepTests.java @@ -13,7 +13,7 @@ import org.elasticsearch.action.admin.indices.rollover.Condition; import org.elasticsearch.action.admin.indices.rollover.MaxAgeCondition; import org.elasticsearch.action.admin.indices.rollover.MaxDocsCondition; -import org.elasticsearch.action.admin.indices.rollover.MaxSinglePrimarySizeCondition; +import org.elasticsearch.action.admin.indices.rollover.MaxPrimaryShardSizeCondition; import org.elasticsearch.action.admin.indices.rollover.MaxSizeCondition; import org.elasticsearch.action.admin.indices.rollover.RolloverInfo; import org.elasticsearch.action.admin.indices.rollover.RolloverRequest; @@ -52,14 +52,14 @@ protected WaitForRolloverReadyStep createRandomInstance() { ByteSizeUnit maxSizeUnit = randomFrom(ByteSizeUnit.values()); ByteSizeValue maxSize = randomBoolean() ? null : new ByteSizeValue(randomNonNegativeLong() / maxSizeUnit.toBytes(1), maxSizeUnit); - ByteSizeUnit maxSinglePrimarySizeUnit = randomFrom(ByteSizeUnit.values()); - ByteSizeValue maxSinglePrimarySize = randomBoolean() ? null : - new ByteSizeValue(randomNonNegativeLong() / maxSinglePrimarySizeUnit.toBytes(1), maxSinglePrimarySizeUnit); + ByteSizeUnit maxPrimaryShardSizeUnit = randomFrom(ByteSizeUnit.values()); + ByteSizeValue maxPrimaryShardSize = randomBoolean() ? null : + new ByteSizeValue(randomNonNegativeLong() / maxPrimaryShardSizeUnit.toBytes(1), maxPrimaryShardSizeUnit); Long maxDocs = randomBoolean() ? null : randomNonNegativeLong(); TimeValue maxAge = (maxDocs == null && maxSize == null || randomBoolean()) ? TimeValue.parseTimeValue(randomPositiveTimeValue(), "rollover_action_test") : null; - return new WaitForRolloverReadyStep(stepKey, nextStepKey, client, maxSize, maxSinglePrimarySize, maxAge, maxDocs); + return new WaitForRolloverReadyStep(stepKey, nextStepKey, client, maxSize, maxPrimaryShardSize, maxAge, maxDocs); } @Override @@ -67,7 +67,7 @@ protected WaitForRolloverReadyStep mutateInstance(WaitForRolloverReadyStep insta Step.StepKey key = instance.getKey(); Step.StepKey nextKey = instance.getNextStepKey(); ByteSizeValue maxSize = instance.getMaxSize(); - ByteSizeValue maxSinglePrimarySize = instance.getMaxSinglePrimarySize(); + ByteSizeValue maxPrimaryShardSize = instance.getMaxPrimaryShardSize(); TimeValue maxAge = instance.getMaxAge(); Long maxDocs = instance.getMaxDocs(); @@ -85,9 +85,9 @@ protected WaitForRolloverReadyStep mutateInstance(WaitForRolloverReadyStep insta }); break; case 3: - maxSinglePrimarySize = randomValueOtherThan(maxSinglePrimarySize, () -> { - ByteSizeUnit maxSinglePrimarySizeUnit = randomFrom(ByteSizeUnit.values()); - return new ByteSizeValue(randomNonNegativeLong() / maxSinglePrimarySizeUnit.toBytes(1), maxSinglePrimarySizeUnit); + maxPrimaryShardSize = randomValueOtherThan(maxPrimaryShardSize, () -> { + ByteSizeUnit maxPrimaryShardSizeUnit = randomFrom(ByteSizeUnit.values()); + return new ByteSizeValue(randomNonNegativeLong() / maxPrimaryShardSizeUnit.toBytes(1), maxPrimaryShardSizeUnit); }); break; case 4: @@ -99,13 +99,13 @@ protected WaitForRolloverReadyStep mutateInstance(WaitForRolloverReadyStep insta default: throw new AssertionError("Illegal randomisation branch"); } - return new WaitForRolloverReadyStep(key, nextKey, instance.getClient(), maxSize, maxSinglePrimarySize, maxAge, maxDocs); + return new WaitForRolloverReadyStep(key, nextKey, instance.getClient(), maxSize, maxPrimaryShardSize, maxAge, maxDocs); } @Override protected WaitForRolloverReadyStep copyInstance(WaitForRolloverReadyStep instance) { return new WaitForRolloverReadyStep(instance.getKey(), instance.getNextStepKey(), instance.getClient(), - instance.getMaxSize(), instance.getMaxSinglePrimarySize(), instance.getMaxAge(), instance.getMaxDocs()); + instance.getMaxSize(), instance.getMaxPrimaryShardSize(), instance.getMaxAge(), instance.getMaxDocs()); } private static void assertRolloverIndexRequest(RolloverRequest request, String rolloverTarget, Set> expectedConditions) { @@ -234,8 +234,8 @@ private void mockRolloverIndexCall(String rolloverTarget, WaitForRolloverReadySt if (step.getMaxSize() != null) { expectedConditions.add(new MaxSizeCondition(step.getMaxSize())); } - if (step.getMaxSinglePrimarySize() != null) { - expectedConditions.add(new MaxSinglePrimarySizeCondition(step.getMaxSinglePrimarySize())); + if (step.getMaxPrimaryShardSize() != null) { + expectedConditions.add(new MaxPrimaryShardSizeCondition(step.getMaxPrimaryShardSize())); } if (step.getMaxAge() != null) { expectedConditions.add(new MaxAgeCondition(step.getMaxAge())); @@ -406,8 +406,8 @@ public void testPerformActionNotComplete() { if (step.getMaxSize() != null) { expectedConditions.add(new MaxSizeCondition(step.getMaxSize())); } - if (step.getMaxSinglePrimarySize() != null) { - expectedConditions.add(new MaxSinglePrimarySizeCondition(step.getMaxSinglePrimarySize())); + if (step.getMaxPrimaryShardSize() != null) { + expectedConditions.add(new MaxPrimaryShardSizeCondition(step.getMaxPrimaryShardSize())); } if (step.getMaxAge() != null) { expectedConditions.add(new MaxAgeCondition(step.getMaxAge())); @@ -460,8 +460,8 @@ public void testPerformActionFailure() { if (step.getMaxSize() != null) { expectedConditions.add(new MaxSizeCondition(step.getMaxSize())); } - if (step.getMaxSinglePrimarySize() != null) { - expectedConditions.add(new MaxSinglePrimarySizeCondition(step.getMaxSinglePrimarySize())); + if (step.getMaxPrimaryShardSize() != null) { + expectedConditions.add(new MaxPrimaryShardSizeCondition(step.getMaxPrimaryShardSize())); } if (step.getMaxAge() != null) { expectedConditions.add(new MaxAgeCondition(step.getMaxAge())); diff --git a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java index 58c5b2ee363ac..c88727fd32f0d 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java @@ -229,7 +229,7 @@ public void testRolloverActionWithIndexingComplete() throws Exception { }, 30, TimeUnit.SECONDS); } - public void testRolloverActionWithMaxSinglePrimarySize() throws Exception { + public void testRolloverActionWithMaxPrimaryShardSize() throws Exception { String originalIndex = index + "-000001"; String secondIndex = index + "-000002"; createIndexWithSettings(client(), originalIndex, alias, Settings.builder()