From a2a4e7cacf7b229a5d30cb428511cca55af97082 Mon Sep 17 00:00:00 2001 From: Simon Cooper Date: Thu, 9 Jan 2025 10:38:47 +0000 Subject: [PATCH] Remove the 8.15 transport conditions for event ingested range setting (#119502) --- .../cluster/ClusterStateDiffIT.java | 3 +- .../TransportSimulateIndexTemplateAction.java | 6 +- .../action/shard/ShardStateAction.java | 2 +- .../cluster/metadata/IndexMetadata.java | 31 +--------- .../metadata/MetadataCreateIndexService.java | 11 +--- .../metadata/MetadataIndexStateService.java | 4 +- .../MetadataIndexTemplateService.java | 2 +- .../snapshots/RestoreService.java | 29 ++------- .../reroute/ClusterRerouteResponseTests.java | 3 +- .../CanMatchPreFilterSearchPhaseTests.java | 5 +- .../cluster/ClusterStateTests.java | 2 +- .../MetadataCreateIndexServiceTests.java | 41 +------------ .../ClusterSerializationTests.java | 60 +------------------ .../ClusterStateCreationUtils.java | 7 +-- 14 files changed, 27 insertions(+), 179 deletions(-) diff --git a/server/src/internalClusterTest/java/org/elasticsearch/cluster/ClusterStateDiffIT.java b/server/src/internalClusterTest/java/org/elasticsearch/cluster/ClusterStateDiffIT.java index e8e4eb7562462..15b4a557b2b8b 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/cluster/ClusterStateDiffIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/cluster/ClusterStateDiffIT.java @@ -9,7 +9,6 @@ package org.elasticsearch.cluster; -import org.elasticsearch.TransportVersion; import org.elasticsearch.Version; import org.elasticsearch.cluster.block.ClusterBlock; import org.elasticsearch.cluster.block.ClusterBlocks; @@ -565,7 +564,7 @@ public IndexMetadata randomCreate(String name) { settingsBuilder.put(randomSettings(Settings.EMPTY)).put(IndexMetadata.SETTING_VERSION_CREATED, randomWriteVersion()); builder.settings(settingsBuilder); builder.numberOfShards(randomIntBetween(1, 10)).numberOfReplicas(randomInt(10)); - builder.eventIngestedRange(IndexLongFieldRange.UNKNOWN, TransportVersion.current()); + builder.eventIngestedRange(IndexLongFieldRange.UNKNOWN); int aliasCount = randomInt(10); for (int i = 0; i < aliasCount; i++) { builder.putAlias(randomAlias()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/post/TransportSimulateIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/post/TransportSimulateIndexTemplateAction.java index 5f98852148ed4..d3d557b598b3a 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/post/TransportSimulateIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/post/TransportSimulateIndexTemplateAction.java @@ -214,8 +214,7 @@ public static ClusterState resolveTemporaryState( .build(); final IndexMetadata indexMetadata = IndexMetadata.builder(indexName) - // handle mixed-cluster states by passing in minTransportVersion to reset event.ingested range to UNKNOWN if an older version - .eventIngestedRange(getEventIngestedRange(indexName, simulatedState), simulatedState.getMinTransportVersion()) + .eventIngestedRange(getEventIngestedRange(indexName, simulatedState)) .settings(dummySettings) .build(); return ClusterState.builder(simulatedState) @@ -304,8 +303,7 @@ public static Template resolveTemplate( dummySettings.put(templateSettings); final IndexMetadata indexMetadata = IndexMetadata.builder(indexName) - // handle mixed-cluster states by passing in minTransportVersion to reset event.ingested range to UNKNOWN if an older version - .eventIngestedRange(getEventIngestedRange(indexName, simulatedState), simulatedState.getMinTransportVersion()) + .eventIngestedRange(getEventIngestedRange(indexName, simulatedState)) .settings(dummySettings) .build(); diff --git a/server/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java b/server/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java index bd438d66549aa..ed6ca57d67b25 100644 --- a/server/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java +++ b/server/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java @@ -754,7 +754,7 @@ public ClusterState execute(BatchExecutionContext batchE metadataBuilder.put( IndexMetadata.builder(metadataBuilder.getSafe(updatedTimeRangesEntry.getKey())) .timestampRange(timeRanges.timestampRange()) - .eventIngestedRange(timeRanges.eventIngestedRange(), maybeUpdatedState.getMinTransportVersion()) + .eventIngestedRange(timeRanges.eventIngestedRange()) ); } maybeUpdatedState = ClusterState.builder(maybeUpdatedState).metadata(metadataBuilder).build(); diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadata.java b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadata.java index 056292177646b..b2e0233463bf5 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadata.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadata.java @@ -1703,12 +1703,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeOptionalDouble(indexWriteLoadForecast); out.writeOptionalLong(shardSizeInBytesForecast); } - if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) { - eventIngestedRange.writeTo(out); - } else { - assert eventIngestedRange == IndexLongFieldRange.UNKNOWN - : "eventIngestedRange should be UNKNOWN until all nodes are on the new version but is " + eventIngestedRange; - } + eventIngestedRange.writeTo(out); } @Override @@ -1813,11 +1808,7 @@ public static IndexMetadata readFrom(StreamInput in, @Nullable Function mappingsMetadata = new HashMap<>(); DocumentMapper docMapper = documentMapperSupplier.get(); diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexStateService.java b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexStateService.java index 95d1c37ec41ae..f4318eb017eb3 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexStateService.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexStateService.java @@ -885,7 +885,7 @@ static Tuple> closeRoutingTable( final IndexMetadata.Builder updatedMetadata = IndexMetadata.builder(indexMetadata).state(IndexMetadata.State.CLOSE); metadata.put( updatedMetadata.timestampRange(IndexLongFieldRange.NO_SHARDS) - .eventIngestedRange(IndexLongFieldRange.NO_SHARDS, currentState.getMinTransportVersion()) + .eventIngestedRange(IndexLongFieldRange.NO_SHARDS) .settingsVersion(indexMetadata.getSettingsVersion() + 1) .settings(Settings.builder().put(indexMetadata.getSettings()).put(VERIFIED_BEFORE_CLOSE_SETTING.getKey(), true)) ); @@ -1133,7 +1133,7 @@ private ClusterState openIndices(final Index[] indices, final ClusterState curre .settingsVersion(indexMetadata.getSettingsVersion() + 1) .settings(updatedSettings) .timestampRange(IndexLongFieldRange.NO_SHARDS) - .eventIngestedRange(IndexLongFieldRange.NO_SHARDS, currentState.getMinTransportVersion()) + .eventIngestedRange(IndexLongFieldRange.NO_SHARDS) .build(); // The index might be closed because we couldn't import it due to an old incompatible diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateService.java b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateService.java index 7f8b87d2d3f48..569526ca1d9ba 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateService.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateService.java @@ -1784,7 +1784,7 @@ private static void validateCompositeTemplate( .put( IndexMetadata.builder(temporaryIndexName) // necessary to pass asserts in ClusterState constructor - .eventIngestedRange(IndexLongFieldRange.UNKNOWN, state.getMinTransportVersion()) + .eventIngestedRange(IndexLongFieldRange.UNKNOWN) .settings(finalResolvedSettings) ) .build() diff --git a/server/src/main/java/org/elasticsearch/snapshots/RestoreService.java b/server/src/main/java/org/elasticsearch/snapshots/RestoreService.java index 38e72ee874035..f260c7aad30e5 100644 --- a/server/src/main/java/org/elasticsearch/snapshots/RestoreService.java +++ b/server/src/main/java/org/elasticsearch/snapshots/RestoreService.java @@ -11,7 +11,6 @@ import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.TransportVersion; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest; import org.elasticsearch.action.support.IndicesOptions; @@ -1399,11 +1398,7 @@ public ClusterState execute(ClusterState currentState) { currentState.metadata() ); - final IndexMetadata.Builder indexMdBuilder = restoreToCreateNewIndex( - snapshotIndexMetadata, - renamedIndexName, - currentState.getMinTransportVersion() - ); + final IndexMetadata.Builder indexMdBuilder = restoreToCreateNewIndex(snapshotIndexMetadata, renamedIndexName); if (request.includeAliases() == false && snapshotIndexMetadata.getAliases().isEmpty() == false && isSystemIndex(snapshotIndexMetadata) == false) { @@ -1421,11 +1416,7 @@ && isSystemIndex(snapshotIndexMetadata) == false) { } else { // Index exists and it's closed - open it in metadata and start recovery validateExistingClosedIndex(currentIndexMetadata, snapshotIndexMetadata, renamedIndexName, partial); - final IndexMetadata.Builder indexMdBuilder = restoreOverClosedIndex( - snapshotIndexMetadata, - currentIndexMetadata, - currentState.getMinTransportVersion() - ); + final IndexMetadata.Builder indexMdBuilder = restoreOverClosedIndex(snapshotIndexMetadata, currentIndexMetadata); if (request.includeAliases() == false && isSystemIndex(snapshotIndexMetadata) == false) { // Remove all snapshot aliases @@ -1800,11 +1791,7 @@ private static IndexMetadata convertLegacyIndex( return convertedIndexMetadataBuilder.build(); } - private static IndexMetadata.Builder restoreToCreateNewIndex( - IndexMetadata snapshotIndexMetadata, - String renamedIndexName, - TransportVersion minClusterTransportVersion - ) { + private static IndexMetadata.Builder restoreToCreateNewIndex(IndexMetadata snapshotIndexMetadata, String renamedIndexName) { return IndexMetadata.builder(snapshotIndexMetadata) .state(IndexMetadata.State.OPEN) .index(renamedIndexName) @@ -1812,14 +1799,10 @@ private static IndexMetadata.Builder restoreToCreateNewIndex( Settings.builder().put(snapshotIndexMetadata.getSettings()).put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID()) ) .timestampRange(IndexLongFieldRange.NO_SHARDS) - .eventIngestedRange(IndexLongFieldRange.NO_SHARDS, minClusterTransportVersion); + .eventIngestedRange(IndexLongFieldRange.NO_SHARDS); } - private static IndexMetadata.Builder restoreOverClosedIndex( - IndexMetadata snapshotIndexMetadata, - IndexMetadata currentIndexMetadata, - TransportVersion minTransportVersion - ) { + private static IndexMetadata.Builder restoreOverClosedIndex(IndexMetadata snapshotIndexMetadata, IndexMetadata currentIndexMetadata) { final IndexMetadata.Builder indexMdBuilder = IndexMetadata.builder(snapshotIndexMetadata) .state(IndexMetadata.State.OPEN) .version(Math.max(snapshotIndexMetadata.getVersion(), 1 + currentIndexMetadata.getVersion())) @@ -1828,7 +1811,7 @@ private static IndexMetadata.Builder restoreOverClosedIndex( .settingsVersion(Math.max(snapshotIndexMetadata.getSettingsVersion(), 1 + currentIndexMetadata.getSettingsVersion())) .aliasesVersion(Math.max(snapshotIndexMetadata.getAliasesVersion(), 1 + currentIndexMetadata.getAliasesVersion())) .timestampRange(IndexLongFieldRange.NO_SHARDS) - .eventIngestedRange(IndexLongFieldRange.NO_SHARDS, minTransportVersion) + .eventIngestedRange(IndexLongFieldRange.NO_SHARDS) .index(currentIndexMetadata.getIndex().getName()) .settings( Settings.builder() diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/reroute/ClusterRerouteResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/reroute/ClusterRerouteResponseTests.java index aada157e8ca80..a73e9635a53b3 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/reroute/ClusterRerouteResponseTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/reroute/ClusterRerouteResponseTests.java @@ -9,7 +9,6 @@ package org.elasticsearch.action.admin.cluster.reroute; -import org.elasticsearch.TransportVersion; import org.elasticsearch.TransportVersions; import org.elasticsearch.Version; import org.elasticsearch.cluster.ClusterName; @@ -347,7 +346,7 @@ private static ClusterState createClusterState() { .put(IndexMetadata.SETTING_VERSION_CREATED, IndexVersion.current()) .build() ) - .eventIngestedRange(IndexLongFieldRange.UNKNOWN, TransportVersion.current()) + .eventIngestedRange(IndexLongFieldRange.UNKNOWN) .build(), false ) diff --git a/server/src/test/java/org/elasticsearch/action/search/CanMatchPreFilterSearchPhaseTests.java b/server/src/test/java/org/elasticsearch/action/search/CanMatchPreFilterSearchPhaseTests.java index 69872b5e4b546..1460270c48293 100644 --- a/server/src/test/java/org/elasticsearch/action/search/CanMatchPreFilterSearchPhaseTests.java +++ b/server/src/test/java/org/elasticsearch/action/search/CanMatchPreFilterSearchPhaseTests.java @@ -10,7 +10,6 @@ package org.elasticsearch.action.search; import org.apache.lucene.util.BytesRef; -import org.elasticsearch.TransportVersion; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.OriginalIndices; import org.elasticsearch.action.search.CanMatchNodeResponse.ResponseOrFailure; @@ -1462,7 +1461,7 @@ private void addIndexMinMaxTimestamps(Index index, String fieldName, long minTim indexMetadataBuilder.timestampRange(timestampRange); fields.put(index, new DateFieldRangeInfo(new DateFieldMapper.DateFieldType(fieldName), null, null, null)); } else if (fieldName.equals(IndexMetadata.EVENT_INGESTED_FIELD_NAME)) { - indexMetadataBuilder.eventIngestedRange(timestampRange, TransportVersion.current()); + indexMetadataBuilder.eventIngestedRange(timestampRange); fields.put(index, new DateFieldRangeInfo(null, null, new DateFieldMapper.DateFieldType(fieldName), null)); } @@ -1502,7 +1501,7 @@ private void addIndexMinMaxForTimestampAndEventIngested( .numberOfShards(1) .numberOfReplicas(0) .timestampRange(tsTimestampRange) - .eventIngestedRange(eventIngestedTimestampRange, TransportVersion.current()); + .eventIngestedRange(eventIngestedTimestampRange); Metadata.Builder metadataBuilder = Metadata.builder(clusterState.metadata()).put(indexMetadataBuilder); clusterState = ClusterState.builder(clusterState).metadata(metadataBuilder).build(); diff --git a/server/src/test/java/org/elasticsearch/cluster/ClusterStateTests.java b/server/src/test/java/org/elasticsearch/cluster/ClusterStateTests.java index 668aea70c23f2..5c1aed9457e81 100644 --- a/server/src/test/java/org/elasticsearch/cluster/ClusterStateTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/ClusterStateTests.java @@ -1115,7 +1115,7 @@ private ClusterState buildClusterState() throws IOException { .putRolloverInfo(new RolloverInfo("rolloveAlias", new ArrayList<>(), 1L)) .stats(new IndexMetadataStats(IndexWriteLoad.builder(1).build(), 120, 1)) .indexWriteLoadForecast(8.0) - .eventIngestedRange(IndexLongFieldRange.UNKNOWN, TransportVersions.V_8_0_0) + .eventIngestedRange(IndexLongFieldRange.UNKNOWN) .build(); return ClusterState.builder(ClusterName.DEFAULT) diff --git a/server/src/test/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexServiceTests.java b/server/src/test/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexServiceTests.java index 633a678733f07..3623683532c59 100644 --- a/server/src/test/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexServiceTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexServiceTests.java @@ -13,7 +13,6 @@ import org.apache.lucene.util.automaton.RegExp; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.ResourceAlreadyExistsException; -import org.elasticsearch.TransportVersion; import org.elasticsearch.TransportVersions; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.alias.Alias; @@ -1258,16 +1257,7 @@ public void testBuildIndexMetadata() { Settings indexSettings = indexSettings(IndexVersion.current(), 1, 0).build(); List aliases = List.of(AliasMetadata.builder("alias1").build()); - IndexMetadata indexMetadata = buildIndexMetadata( - "test", - aliases, - () -> null, - indexSettings, - 4, - sourceIndexMetadata, - false, - TransportVersion.current() - ); + IndexMetadata indexMetadata = buildIndexMetadata("test", aliases, () -> null, indexSettings, 4, sourceIndexMetadata, false); assertThat(indexMetadata.getAliases().size(), is(1)); assertThat(indexMetadata.getAliases().keySet().iterator().next(), is("alias1")); @@ -1276,35 +1266,6 @@ public void testBuildIndexMetadata() { assertThat(indexMetadata.getEventIngestedRange(), equalTo(IndexLongFieldRange.NO_SHARDS)); } - public void testBuildIndexMetadataWithTransportVersionBeforeEventIngestedRangeAdded() { - IndexMetadata sourceIndexMetadata = IndexMetadata.builder("parent") - .settings(Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, IndexVersion.current()).build()) - .numberOfShards(1) - .numberOfReplicas(0) - .primaryTerm(0, 3L) - .build(); - - Settings indexSettings = indexSettings(IndexVersion.current(), 1, 0).build(); - List aliases = List.of(AliasMetadata.builder("alias1").build()); - IndexMetadata indexMetadata = buildIndexMetadata( - "test", - aliases, - () -> null, - indexSettings, - 4, - sourceIndexMetadata, - false, - TransportVersions.V_8_0_0 - ); - - assertThat(indexMetadata.getAliases().size(), is(1)); - assertThat(indexMetadata.getAliases().keySet().iterator().next(), is("alias1")); - assertThat("The source index primary term must be used", indexMetadata.primaryTerm(0), is(3L)); - assertThat(indexMetadata.getTimestampRange(), equalTo(IndexLongFieldRange.NO_SHARDS)); - // on versions before event.ingested was added to cluster state, it should default to UNKNOWN, not NO_SHARDS - assertThat(indexMetadata.getEventIngestedRange(), equalTo(IndexLongFieldRange.UNKNOWN)); - } - public void testGetIndexNumberOfRoutingShardsWithNullSourceIndex() { Settings indexSettings = Settings.builder() .put(IndexMetadata.SETTING_VERSION_CREATED, IndexVersion.current()) diff --git a/server/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java b/server/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java index 293d74f27ae37..0c7af66a7190e 100644 --- a/server/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java @@ -51,7 +51,6 @@ import java.util.List; import java.util.Map; -import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.nullValue; @@ -70,7 +69,7 @@ public void testClusterStateSerialization() throws Exception { .settings(settings(IndexVersion.current())) .numberOfShards(10) .numberOfReplicas(1) - .eventIngestedRange(eventIngestedRangeInput, TransportVersions.V_8_15_0); + .eventIngestedRange(eventIngestedRangeInput); ClusterStateTestRecord result = createAndSerializeClusterState(indexMetadataBuilder, TransportVersion.current()); @@ -86,63 +85,6 @@ public void testClusterStateSerialization() throws Exception { } } - public void testClusterStateSerializationWithTimestampRangesWithOlderTransportVersion() throws Exception { - TransportVersion versionBeforeEventIngestedInClusterState = randomFrom( - TransportVersions.V_8_0_0, - TransportVersionUtils.getPreviousVersion(TransportVersions.V_8_15_0) - ); - { - IndexLongFieldRange eventIngestedRangeInput = randomFrom( - IndexLongFieldRange.UNKNOWN, - IndexLongFieldRange.NO_SHARDS, - IndexLongFieldRange.EMPTY, - IndexLongFieldRange.NO_SHARDS.extendWithShardRange(0, 1, ShardLongFieldRange.of(100000, 200000)) - ); - - IndexMetadata.Builder indexMetadataBuilder = IndexMetadata.builder("test") - .settings(settings(IndexVersion.current())) - .numberOfShards(10) - .numberOfReplicas(1) - .eventIngestedRange(eventIngestedRangeInput, versionBeforeEventIngestedInClusterState); - - ClusterStateTestRecord result = createAndSerializeClusterState(indexMetadataBuilder, versionBeforeEventIngestedInClusterState); - - assertThat(result.serializedClusterState().getClusterName().value(), equalTo(result.clusterState().getClusterName().value())); - assertThat(result.serializedClusterState().routingTable().toString(), equalTo(result.clusterState().routingTable().toString())); - - IndexLongFieldRange eventIngestedRangeOutput = result.serializedClusterState() - .getMetadata() - .index("test") - .getEventIngestedRange(); - // should always come back as UNKNOWN when an older transport version is passed in - assertSame(IndexLongFieldRange.UNKNOWN, eventIngestedRangeOutput); - } - { - // UNKNOWN is the only allowed state for event.ingested range in older versions, so this serialization test should fail - IndexLongFieldRange eventIngestedRangeInput = randomFrom( - IndexLongFieldRange.NO_SHARDS, - IndexLongFieldRange.EMPTY, - IndexLongFieldRange.NO_SHARDS.extendWithShardRange(0, 1, ShardLongFieldRange.of(100000, 200000)) - ); - - IndexMetadata.Builder indexMetadataBuilder = IndexMetadata.builder("test") - .settings(settings(IndexVersion.current())) - .numberOfShards(10) - .numberOfReplicas(1) - .eventIngestedRange(eventIngestedRangeInput, TransportVersion.current()); - - AssertionError assertionError = expectThrows( - AssertionError.class, - () -> createAndSerializeClusterState(indexMetadataBuilder, versionBeforeEventIngestedInClusterState) - ); - - assertThat( - assertionError.getMessage(), - containsString("eventIngestedRange should be UNKNOWN until all nodes are on the new version") - ); - } - } - /** * @param clusterState original ClusterState created by helper method * @param serializedClusterState serialized version of the clusterState diff --git a/test/framework/src/main/java/org/elasticsearch/action/support/replication/ClusterStateCreationUtils.java b/test/framework/src/main/java/org/elasticsearch/action/support/replication/ClusterStateCreationUtils.java index a11291e846ec1..950c54ddb1d22 100644 --- a/test/framework/src/main/java/org/elasticsearch/action/support/replication/ClusterStateCreationUtils.java +++ b/test/framework/src/main/java/org/elasticsearch/action/support/replication/ClusterStateCreationUtils.java @@ -10,7 +10,6 @@ package org.elasticsearch.action.support.replication; import org.elasticsearch.TransportVersion; -import org.elasticsearch.TransportVersions; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetadata; @@ -151,7 +150,7 @@ public static ClusterState state( .settings(indexSettings(IndexVersion.current(), 1, numberOfReplicas).put(SETTING_CREATION_DATE, System.currentTimeMillis())) .primaryTerm(0, primaryTerm) .timestampRange(timeFieldRange) - .eventIngestedRange(timeFieldRange, timeFieldRange == IndexLongFieldRange.UNKNOWN ? null : TransportVersions.V_8_15_0) + .eventIngestedRange(timeFieldRange) .build(); IndexShardRoutingTable.Builder indexShardRoutingBuilder = new IndexShardRoutingTable.Builder(shardId); @@ -284,7 +283,7 @@ public static ClusterState state(final int numberOfNodes, final String[] indices .settings( indexSettings(IndexVersion.current(), numberOfPrimaries, 0).put(SETTING_CREATION_DATE, System.currentTimeMillis()) ) - .eventIngestedRange(IndexLongFieldRange.UNKNOWN, randomFrom(TransportVersions.V_8_0_0, TransportVersions.V_8_15_0)) + .eventIngestedRange(IndexLongFieldRange.UNKNOWN) .build(); IndexRoutingTable.Builder indexRoutingTable = IndexRoutingTable.builder(indexMetadata.getIndex()); @@ -390,7 +389,7 @@ public static ClusterState stateWithAssignedPrimariesAndReplicas( ) ) .timestampRange(IndexLongFieldRange.UNKNOWN) - .eventIngestedRange(IndexLongFieldRange.UNKNOWN, null) + .eventIngestedRange(IndexLongFieldRange.UNKNOWN) .build(); metadataBuilder.put(indexMetadata, false).generateClusterUuidIfNeeded(); IndexRoutingTable.Builder indexRoutingTableBuilder = IndexRoutingTable.builder(indexMetadata.getIndex());