Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void testOldVersionGetXUniqueTokenFilter() throws IOException {
Settings settings = Settings.builder()
.put(
IndexMetadata.SETTING_VERSION_CREATED,
IndexVersionUtils.randomPreviousCompatibleVersion(random(), IndexVersions.UNIQUE_TOKEN_FILTER_POS_FIX)
IndexVersionUtils.randomPreviousCompatibleVersion(IndexVersions.UNIQUE_TOKEN_FILTER_POS_FIX)
)
.build();
IndexSettings idxSettings = IndexSettingsModule.newIndexSettings("index", settings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void setup() {
im -> MapperTestUtils.newMapperService(xContentRegistry(), createTempDir(), im.getSettings(), im.getIndex().getName())
);
indexVersion = randomBoolean()
? IndexVersionUtils.randomPreviousCompatibleVersion(random(), IndexVersions.TSID_CREATED_DURING_ROUTING)
? IndexVersionUtils.randomPreviousCompatibleVersion(IndexVersions.TSID_CREATED_DURING_ROUTING)
: IndexVersionUtils.randomVersionBetween(IndexVersions.TSID_CREATED_DURING_ROUTING, IndexVersion.current());
indexDimensionsTsidStrategyEnabledSetting = usually();
expectedIndexDimensionsTsidOptimizationEnabled = indexDimensionsTsidStrategyEnabledSetting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ public XContentBuilder getMapping() throws IOException {

@Override
public IndexVersion randomSupportedVersion() {
return IndexVersionUtils.randomCompatibleWriteVersion(random());
return IndexVersionUtils.randomCompatibleWriteVersion();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected void getGeoShapeMapping(XContentBuilder b) throws IOException {

@Override
protected IndexVersion randomSupportedVersion() {
return IndexVersionUtils.randomCompatibleWriteVersion(random());
return IndexVersionUtils.randomCompatibleWriteVersion();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ public void testParse3DPolygon() throws IOException, ParseException {

LinearRing shell = GEOMETRY_FACTORY.createLinearRing(shellCoordinates.toArray(new Coordinate[shellCoordinates.size()]));
Polygon expected = GEOMETRY_FACTORY.createPolygon(shell, null);
final IndexVersion version = IndexVersionUtils.randomPreviousCompatibleVersion(random(), IndexVersions.V_8_0_0);
final IndexVersion version = IndexVersionUtils.randomPreviousCompatibleVersion(IndexVersions.V_8_0_0);
final LegacyGeoShapeFieldMapper mapperBuilder = new LegacyGeoShapeFieldMapper.Builder("test", version, false, true).build(
MapperBuilderContext.root(false, false)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ public void testParseMixedDimensionPolyWithHoleStoredZ() throws IOException {
XContentParser parser = createParser(xContentBuilder);
parser.nextToken();

final IndexVersion version = IndexVersionUtils.randomPreviousCompatibleVersion(random(), IndexVersions.V_8_0_0);
final IndexVersion version = IndexVersionUtils.randomPreviousCompatibleVersion(IndexVersions.V_8_0_0);
final LegacyGeoShapeFieldMapper mapperBuilder = new LegacyGeoShapeFieldMapper.Builder("test", version, false, true).build(
MapperBuilderContext.root(false, false)
);
Expand All @@ -349,7 +349,7 @@ public void testParsePolyWithStoredZ() throws IOException {
XContentParser parser = createParser(xContentBuilder);
parser.nextToken();

final IndexVersion version = IndexVersionUtils.randomPreviousCompatibleVersion(random(), IndexVersions.V_8_0_0);
final IndexVersion version = IndexVersionUtils.randomPreviousCompatibleVersion(IndexVersions.V_8_0_0);
final LegacyGeoShapeFieldMapper mapperBuilder = new LegacyGeoShapeFieldMapper.Builder("test", version, false, true).build(
MapperBuilderContext.root(false, false)
);
Expand All @@ -365,7 +365,7 @@ public void testParseOpenPolygon() throws IOException {
XContentParser parser = createParser(xContentBuilder);
parser.nextToken();

final IndexVersion version = IndexVersionUtils.randomPreviousCompatibleVersion(random(), IndexVersions.V_8_0_0);
final IndexVersion version = IndexVersionUtils.randomPreviousCompatibleVersion(IndexVersions.V_8_0_0);
final LegacyGeoShapeFieldMapper defaultMapperBuilder = new LegacyGeoShapeFieldMapper.Builder("test", version, false, true).coerce(
false
).build(MapperBuilderContext.root(false, false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ protected boolean supportsMeta() {

@Override
protected IndexVersion getVersion() {
return IndexVersionUtils.randomPreviousCompatibleVersion(random(), IndexVersions.V_8_0_0);
return IndexVersionUtils.randomPreviousCompatibleVersion(IndexVersions.V_8_0_0);
}

public void testLegacySwitches() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void testSetStrategyName() {
}

public void testFetchSourceValue() throws IOException {
IndexVersion version = IndexVersionUtils.randomPreviousCompatibleVersion(random(), IndexVersions.V_8_0_0);
IndexVersion version = IndexVersionUtils.randomPreviousCompatibleVersion(IndexVersions.V_8_0_0);
MappedFieldType mapper = new LegacyGeoShapeFieldMapper.Builder("field", version, false, true).build(
MapperBuilderContext.root(false, false)
).fieldType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ public void testRangeQueries() throws Exception {
IndexSearcher shardSearcher = newSearcher(directoryReader);
shardSearcher.setQueryCache(null);

IndexVersion v = IndexVersionUtils.randomCompatibleVersion(random());
IndexVersion v = IndexVersionUtils.randomCompatibleVersion();
MemoryIndex memoryIndex = MemoryIndex.fromDocument(Collections.singleton(new IntPoint("int_field", 3)), new WhitespaceAnalyzer());
IndexSearcher percolateSearcher = memoryIndex.createSearcher();
Query query = fieldType.percolateQuery(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected boolean forbidPrivateIndexSettings() {
}

public void testCreateCloneIndex() {
IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion(random());
IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion();
int numPrimaryShards = randomIntBetween(1, 5);
prepareCreate("source").setSettings(
Settings.builder().put(indexSettings()).put("number_of_shards", numPrimaryShards).put("index.version.created", version)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ private static IndexMetadata indexMetadata(final Client client, final String ind
}

public void testCreateSplitIndex() {
IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion(random());
IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion();
prepareCreate("source").setSettings(
Settings.builder().put(indexSettings()).put("number_of_shards", 1).put("index.version.created", version)
).get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private ClusterState.Builder randomCoordinationMetadata(ClusterState clusterStat
}

private DiscoveryNode randomNode(String nodeId) {
Version nodeVersion = VersionUtils.randomVersion(random());
Version nodeVersion = VersionUtils.randomVersion();
IndexVersion indexVersion = randomVersion();
return DiscoveryNodeUtils.builder(nodeId)
.roles(emptySet())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void testCanRecoverFromStoreWithoutPeerRecoveryRetentionLease() throws Ex
Settings.builder()
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true)
.put(IndexMetadata.SETTING_VERSION_CREATED, IndexVersionUtils.randomCompatibleWriteVersion(random()))
.put(IndexMetadata.SETTING_VERSION_CREATED, IndexVersionUtils.randomCompatibleWriteVersion())
)
);
ensureGreen(INDEX_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected boolean forbidPrivateIndexSettings() {
return false;
}

private final IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion(random());
private final IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion();

private IndexRequestBuilder indexCity(String idx, String name, String... latLons) throws Exception {
XContentBuilder source = jsonBuilder().startObject().field("city", name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected boolean forbidPrivateIndexSettings() {
return false;
}

private final IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion(random());
private final IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion();

static Map<String, Integer> expectedDocCountsForGeoHash = null;
static Map<String, Integer> multiValuedExpectedDocCountsForGeoHash = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ public void testDateWithoutOrigin() throws Exception {
}

public void testManyDocsLin() throws Exception {
IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion(random());
IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion();
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
XContentBuilder xContentBuilder = jsonBuilder().startObject()
.startObject("_doc")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ public XContentBuilder getMapping() throws IOException {

@Override
public IndexVersion randomSupportedVersion() {
return IndexVersionUtils.randomCompatibleWriteVersion(random());
return IndexVersionUtils.randomCompatibleWriteVersion();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected boolean forbidPrivateIndexSettings() {

@Before
public void setupTestIndex() throws IOException {
IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion(random());
IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion();
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
.startObject()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected boolean forbidPrivateIndexSettings() {

@Override
protected void setupSuiteScopeCluster() throws Exception {
IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion(random());
IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion();
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();

assertAcked(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected boolean forbidPrivateIndexSettings() {
}

public void testDistanceSortingMVFields() throws Exception {
IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion(random());
IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion();
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
.startObject()
Expand Down Expand Up @@ -237,7 +237,7 @@ public void testDistanceSortingMVFields() throws Exception {
// Regression bug:
// https://github.com/elastic/elasticsearch/issues/2851
public void testDistanceSortingWithMissingGeoPoint() throws Exception {
IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion(random());
IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion();
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
.startObject()
Expand Down Expand Up @@ -299,7 +299,7 @@ public void testDistanceSortingWithMissingGeoPoint() throws Exception {
}

public void testDistanceSortingNestedFields() throws Exception {
IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion(random());
IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion();
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
.startObject()
Expand Down Expand Up @@ -551,7 +551,7 @@ public void testDistanceSortingNestedFields() throws Exception {
* Issue 3073
*/
public void testGeoDistanceFilter() throws IOException {
IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion(random());
IndexVersion version = IndexVersionUtils.randomCompatibleWriteVersion();
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
double lat = 40.720611;
double lon = -73.998776;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void testManyToManyGeoPoints() throws ExecutionException, InterruptedExce
* |___________________________
* 1 2 3 4 5 6 7
*/
IndexVersion version = randomBoolean() ? IndexVersion.current() : IndexVersionUtils.randomCompatibleWriteVersion(random());
IndexVersion version = randomBoolean() ? IndexVersion.current() : IndexVersionUtils.randomCompatibleWriteVersion();
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
assertAcked(prepareCreate("index").setSettings(settings).setMapping(LOCATION_FIELD, "type=geo_point"));
XContentBuilder d1Builder = jsonBuilder();
Expand Down Expand Up @@ -152,7 +152,7 @@ public void testSingeToManyAvgMedian() throws ExecutionException, InterruptedExc
* d1 = (0, 1), (0, 4), (0, 10); so avg. distance is 5, median distance is 4
* d2 = (0, 1), (0, 5), (0, 6); so avg. distance is 4, median distance is 5
*/
IndexVersion version = randomBoolean() ? IndexVersion.current() : IndexVersionUtils.randomCompatibleWriteVersion(random());
IndexVersion version = randomBoolean() ? IndexVersion.current() : IndexVersionUtils.randomCompatibleWriteVersion();
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
assertAcked(prepareCreate("index").setSettings(settings).setMapping(LOCATION_FIELD, "type=geo_point"));
XContentBuilder d1Builder = jsonBuilder();
Expand Down Expand Up @@ -225,7 +225,7 @@ public void testManyToManyGeoPointsWithDifferentFormats() throws ExecutionExcept
* |______________________
* 1 2 3 4 5 6
*/
IndexVersion version = randomBoolean() ? IndexVersion.current() : IndexVersionUtils.randomCompatibleWriteVersion(random());
IndexVersion version = randomBoolean() ? IndexVersion.current() : IndexVersionUtils.randomCompatibleWriteVersion();
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
assertAcked(prepareCreate("index").setSettings(settings).setMapping(LOCATION_FIELD, "type=geo_point"));
XContentBuilder d1Builder = jsonBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public TestException(StreamInput in) throws IOException {
}

private <T extends Exception> T serialize(T exception) throws IOException {
return serialize(exception, TransportVersionUtils.randomCompatibleVersion(random()));
return serialize(exception, TransportVersionUtils.randomCompatibleVersion());
}

private <T extends Exception> T serialize(T exception, TransportVersion version) throws IOException {
Expand All @@ -252,7 +252,7 @@ private <T extends Exception> T serialize(T exception, TransportVersion version)
}

private <T extends Exception> T serializeOptional(T exception) throws IOException {
return serializeOptional(exception, TransportVersionUtils.randomCompatibleVersion(random()));
return serializeOptional(exception, TransportVersionUtils.randomCompatibleVersion());
}

private <T extends Exception> T serializeOptional(T exception, TransportVersion version) throws IOException {
Expand Down Expand Up @@ -379,7 +379,7 @@ public void testActionTransportException() throws IOException {

public void testSearchContextMissingException() throws IOException {
ShardSearchContextId contextId = new ShardSearchContextId(UUIDs.randomBase64UUID(), randomLong());
TransportVersion version = TransportVersionUtils.randomCompatibleVersion(random());
TransportVersion version = TransportVersionUtils.randomCompatibleVersion();
SearchContextMissingException ex = serialize(new SearchContextMissingException(contextId), version);
assertThat(ex.contextId().getId(), equalTo(contextId.getId()));
assertThat(ex.contextId().getSessionId(), equalTo(contextId.getSessionId()));
Expand All @@ -388,7 +388,7 @@ public void testSearchContextMissingException() throws IOException {
public void testCircuitBreakingException() throws IOException {
CircuitBreakingException ex = serialize(
new CircuitBreakingException("Too large", 0, 100, CircuitBreaker.Durability.TRANSIENT),
TransportVersionUtils.randomCompatibleVersion(random())
TransportVersionUtils.randomCompatibleVersion()
);
assertEquals("Too large", ex.getMessage());
assertEquals(100, ex.getByteLimit());
Expand All @@ -397,7 +397,7 @@ public void testCircuitBreakingException() throws IOException {
}

public void testTooManyBucketsException() throws IOException {
TransportVersion version = TransportVersionUtils.randomCompatibleVersion(random());
TransportVersion version = TransportVersionUtils.randomCompatibleVersion();
MultiBucketConsumerService.TooManyBucketsException ex = serialize(
new MultiBucketConsumerService.TooManyBucketsException("Too many buckets", 100),
version
Expand Down Expand Up @@ -933,15 +933,15 @@ public void testElasticsearchRemoteException() throws IOException {
public void testShardLockObtainFailedException() throws IOException {
ShardId shardId = new ShardId("foo", "_na_", 1);
ShardLockObtainFailedException orig = new ShardLockObtainFailedException(shardId, "boom");
TransportVersion version = TransportVersionUtils.randomCompatibleVersion(random());
TransportVersion version = TransportVersionUtils.randomCompatibleVersion();
ShardLockObtainFailedException ex = serialize(orig, version);
assertEquals(orig.getMessage(), ex.getMessage());
assertEquals(orig.getShardId(), ex.getShardId());
}

public void testSnapshotInProgressException() throws IOException {
SnapshotInProgressException orig = new SnapshotInProgressException("boom");
TransportVersion version = TransportVersionUtils.randomCompatibleVersion(random());
TransportVersion version = TransportVersionUtils.randomCompatibleVersion();
SnapshotInProgressException ex = serialize(orig, version);
assertEquals(orig.getMessage(), ex.getMessage());
}
Expand Down
Loading