mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 15:17:30 -04:00
Dry up more of index setting creation in tests (#95602)
Quick follow-up to #95569 of spots that I could automatically identify and refactor, saving another 1.5k LoC in tests.
This commit is contained in:
parent
e752135f44
commit
4e69fa102f
140 changed files with 406 additions and 1890 deletions
|
@ -369,13 +369,7 @@ public class DatabaseNodeServiceTests extends ESTestCase {
|
|||
: GeoIpDownloader.DATABASES_INDEX;
|
||||
Index index = new Index(indexName, UUID.randomUUID().toString());
|
||||
IndexMetadata.Builder idxMeta = IndexMetadata.builder(index.getName())
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put("index.version.created", Version.CURRENT)
|
||||
.put("index.uuid", index.getUUID())
|
||||
.put("index.number_of_shards", 1)
|
||||
.put("index.number_of_replicas", 0)
|
||||
);
|
||||
.settings(indexSettings(Version.CURRENT, 1, 0).put("index.uuid", index.getUUID()));
|
||||
if (aliasGeoipDatabase) {
|
||||
idxMeta.putAlias(AliasMetadata.builder(GeoIpDownloader.DATABASES_INDEX));
|
||||
}
|
||||
|
|
|
@ -195,12 +195,7 @@ public abstract class AbstractFeatureMigrationIntegTest extends ESIntegTestCase
|
|||
}
|
||||
|
||||
static Settings createSettings(Version creationVersion, int flagSettingValue) {
|
||||
return Settings.builder()
|
||||
.put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1)
|
||||
.put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 0)
|
||||
.put(FlAG_SETTING_KEY, flagSettingValue)
|
||||
.put("index.version.created", creationVersion)
|
||||
.build();
|
||||
return indexSettings(creationVersion, 1, 0).put(FlAG_SETTING_KEY, flagSettingValue).build();
|
||||
}
|
||||
|
||||
static String createMapping(boolean descriptorManaged, boolean descriptorInternal) {
|
||||
|
|
|
@ -179,13 +179,7 @@ public class ReindexSourceTargetValidationTests extends ESTestCase {
|
|||
}
|
||||
|
||||
private static IndexMetadata index(String name, @Nullable Boolean writeIndex, String... aliases) {
|
||||
IndexMetadata.Builder builder = IndexMetadata.builder(name)
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put("index.version.created", Version.CURRENT.id)
|
||||
.put("index.number_of_shards", 1)
|
||||
.put("index.number_of_replicas", 1)
|
||||
);
|
||||
IndexMetadata.Builder builder = IndexMetadata.builder(name).settings(indexSettings(Version.CURRENT, 1, 1));
|
||||
for (String alias : aliases) {
|
||||
builder.putAlias(AliasMetadata.builder(alias).writeIndex(writeIndex).build());
|
||||
}
|
||||
|
|
|
@ -171,11 +171,7 @@ public class RetryTests extends ESIntegTestCase {
|
|||
.put("node.attr.color", "blue")
|
||||
.build();
|
||||
final String node = internalCluster().startDataOnlyNode(nodeSettings);
|
||||
final Settings indexSettings = Settings.builder()
|
||||
.put("index.number_of_shards", 1)
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.routing.allocation.include.color", "blue")
|
||||
.build();
|
||||
final Settings indexSettings = indexSettings(1, 0).put("index.routing.allocation.include.color", "blue").build();
|
||||
|
||||
// Create the source index on the node with small thread pools so we can block them.
|
||||
client().admin().indices().prepareCreate("source").setSettings(indexSettings).execute().actionGet();
|
||||
|
|
|
@ -174,7 +174,7 @@ public class CCSDuelIT extends ESRestTestCase {
|
|||
assertTrue(response.isAcknowledged());
|
||||
|
||||
int numShards = randomIntBetween(1, 5);
|
||||
Settings settings = Settings.builder().put("index.number_of_shards", numShards).put("index.number_of_replicas", 0).build();
|
||||
Settings settings = indexSettings(numShards, 0).build();
|
||||
String mapping = """
|
||||
{
|
||||
"properties": {
|
||||
|
|
|
@ -1213,12 +1213,7 @@ public final class ClusterAllocationExplainIT extends ESIntegTestCase {
|
|||
client().admin()
|
||||
.indices()
|
||||
.prepareCreate("idx")
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_shards", numPrimaries)
|
||||
.put("index.number_of_replicas", numReplicas)
|
||||
.put(settings)
|
||||
)
|
||||
.setSettings(indexSettings(numPrimaries, numReplicas).put(settings))
|
||||
.setWaitForActiveShards(activeShardCount)
|
||||
.get()
|
||||
);
|
||||
|
|
|
@ -105,13 +105,7 @@ public class ShrinkIndexIT extends ESIntegTestCase {
|
|||
client().admin()
|
||||
.indices()
|
||||
.prepareResizeIndex("source", "first_shrink")
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.number_of_shards", shardSplits[1])
|
||||
.putNull("index.blocks.write")
|
||||
.build()
|
||||
)
|
||||
.setSettings(indexSettings(shardSplits[1], 0).putNull("index.blocks.write").build())
|
||||
.get()
|
||||
);
|
||||
ensureGreen();
|
||||
|
@ -139,12 +133,7 @@ public class ShrinkIndexIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareResizeIndex("first_shrink", "second_shrink")
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.number_of_shards", shardSplits[2])
|
||||
.putNull("index.blocks.write")
|
||||
.putNull("index.routing.allocation.require._name")
|
||||
.build()
|
||||
indexSettings(shardSplits[2], 0).putNull("index.blocks.write").putNull("index.routing.allocation.require._name").build()
|
||||
)
|
||||
.get()
|
||||
);
|
||||
|
@ -230,10 +219,7 @@ public class ShrinkIndexIT extends ESIntegTestCase {
|
|||
final long beforeShrinkPrimaryTerm = IntStream.range(0, numberOfShards).mapToLong(indexMetadata::primaryTerm).max().getAsLong();
|
||||
|
||||
// now merge source into target
|
||||
final Settings shrinkSettings = Settings.builder()
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.number_of_shards", numberOfTargetShards)
|
||||
.build();
|
||||
final Settings shrinkSettings = indexSettings(numberOfTargetShards, 0).build();
|
||||
assertAcked(client().admin().indices().prepareResizeIndex("source", "target").setSettings(shrinkSettings).get());
|
||||
|
||||
ensureGreen(TimeValue.timeValueSeconds(120));
|
||||
|
@ -476,13 +462,7 @@ public class ShrinkIndexIT extends ESIntegTestCase {
|
|||
() -> client().admin()
|
||||
.indices()
|
||||
.prepareResizeIndex("source", "target")
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.number_of_shards", "2")
|
||||
.put("index.sort.field", "foo")
|
||||
.build()
|
||||
)
|
||||
.setSettings(indexSettings(2, 0).put("index.sort.field", "foo").build())
|
||||
.get()
|
||||
);
|
||||
assertThat(exc.getMessage(), containsString("can't override index sort when resizing an index"));
|
||||
|
@ -492,13 +472,7 @@ public class ShrinkIndexIT extends ESIntegTestCase {
|
|||
client().admin()
|
||||
.indices()
|
||||
.prepareResizeIndex("source", "target")
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.number_of_shards", "2")
|
||||
.putNull("index.blocks.write")
|
||||
.build()
|
||||
)
|
||||
.setSettings(indexSettings(2, 0).putNull("index.blocks.write").build())
|
||||
.get()
|
||||
);
|
||||
ensureGreen();
|
||||
|
@ -620,11 +594,9 @@ public class ShrinkIndexIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareResizeIndex("original", "shrunk")
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.putNull(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getConcreteSettingForNamespace("_name").getKey())
|
||||
.build()
|
||||
indexSettings(1, 1).putNull(
|
||||
IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getConcreteSettingForNamespace("_name").getKey()
|
||||
).build()
|
||||
)
|
||||
.setResizeType(ResizeType.SHRINK)
|
||||
.get()
|
||||
|
@ -644,11 +616,9 @@ public class ShrinkIndexIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareResizeIndex("shrunk", "splitagain")
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, shardCount)
|
||||
.putNull(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getConcreteSettingForNamespace("_name").getKey())
|
||||
.build()
|
||||
indexSettings(shardCount, 0).putNull(
|
||||
IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getConcreteSettingForNamespace("_name").getKey()
|
||||
).build()
|
||||
)
|
||||
.setResizeType(ResizeType.SPLIT)
|
||||
);
|
||||
|
|
|
@ -178,10 +178,7 @@ public class SplitIndexIT extends ESIntegTestCase {
|
|||
ensureYellow();
|
||||
updateIndexSettings(Settings.builder().put("index.blocks.write", true), "source");
|
||||
ensureGreen();
|
||||
Settings.Builder firstSplitSettingsBuilder = Settings.builder()
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.number_of_shards", firstSplitShards)
|
||||
.putNull("index.blocks.write");
|
||||
Settings.Builder firstSplitSettingsBuilder = indexSettings(firstSplitShards, 0).putNull("index.blocks.write");
|
||||
if (sourceShards == 1 && useRoutingPartition == false && randomBoolean()) { // try to set it if we have a source index with 1 shard
|
||||
firstSplitSettingsBuilder.put("index.number_of_routing_shards", secondSplitShards);
|
||||
}
|
||||
|
@ -220,13 +217,7 @@ public class SplitIndexIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareResizeIndex("first_split", "second_split")
|
||||
.setResizeType(ResizeType.SPLIT)
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.number_of_shards", secondSplitShards)
|
||||
.putNull("index.blocks.write")
|
||||
.build()
|
||||
)
|
||||
.setSettings(indexSettings(secondSplitShards, 0).putNull("index.blocks.write").build())
|
||||
.get()
|
||||
);
|
||||
ensureGreen();
|
||||
|
@ -339,11 +330,7 @@ public class SplitIndexIT extends ESIntegTestCase {
|
|||
final long beforeSplitPrimaryTerm = IntStream.range(0, numberOfShards).mapToLong(indexMetadata::primaryTerm).max().getAsLong();
|
||||
|
||||
// now split source into target
|
||||
final Settings splitSettings = Settings.builder()
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.number_of_shards", numberOfTargetShards)
|
||||
.putNull("index.blocks.write")
|
||||
.build();
|
||||
final Settings splitSettings = indexSettings(numberOfTargetShards, 0).putNull("index.blocks.write").build();
|
||||
assertAcked(
|
||||
client().admin()
|
||||
.indices()
|
||||
|
@ -398,13 +385,7 @@ public class SplitIndexIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareResizeIndex("source", "target")
|
||||
.setResizeType(ResizeType.SPLIT)
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_replicas", createWithReplicas ? 1 : 0)
|
||||
.put("index.number_of_shards", 2)
|
||||
.putNull("index.blocks.write")
|
||||
.build()
|
||||
)
|
||||
.setSettings(indexSettings(2, createWithReplicas ? 1 : 0).putNull("index.blocks.write").build())
|
||||
.get()
|
||||
);
|
||||
ensureGreen();
|
||||
|
@ -508,13 +489,7 @@ public class SplitIndexIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareResizeIndex("source", "target")
|
||||
.setResizeType(ResizeType.SPLIT)
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.number_of_shards", 4)
|
||||
.put("index.sort.field", "foo")
|
||||
.build()
|
||||
)
|
||||
.setSettings(indexSettings(4, 0).put("index.sort.field", "foo").build())
|
||||
.get()
|
||||
);
|
||||
assertThat(exc.getMessage(), containsString("can't override index sort when resizing an index"));
|
||||
|
@ -525,13 +500,7 @@ public class SplitIndexIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareResizeIndex("source", "target")
|
||||
.setResizeType(ResizeType.SPLIT)
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.number_of_shards", 4)
|
||||
.putNull("index.blocks.write")
|
||||
.build()
|
||||
)
|
||||
.setSettings(indexSettings(4, 0).putNull("index.blocks.write").build())
|
||||
.get()
|
||||
);
|
||||
ensureGreen();
|
||||
|
|
|
@ -13,7 +13,6 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
|||
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
|
||||
import org.elasticsearch.cluster.health.ClusterHealthStatus;
|
||||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.core.Strings;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
@ -30,11 +29,7 @@ import static org.hamcrest.Matchers.startsWith;
|
|||
*/
|
||||
public class WaitActiveShardCountIT extends ESIntegTestCase {
|
||||
public void testReplicationWaitsForActiveShardCount() throws Exception {
|
||||
CreateIndexResponse createIndexResponse = prepareCreate(
|
||||
"test",
|
||||
1,
|
||||
Settings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 2)
|
||||
).get();
|
||||
CreateIndexResponse createIndexResponse = prepareCreate("test", 1, indexSettings(1, 2)).get();
|
||||
|
||||
assertAcked(createIndexResponse);
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.cluster.metadata.IndexAbstraction;
|
|||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
import org.elasticsearch.cluster.metadata.Metadata;
|
||||
import org.elasticsearch.common.StopWatch;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.core.TimeValue;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
|
@ -704,15 +703,7 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
|||
|
||||
public void testWaitForAliasCreationSingleShard() throws Exception {
|
||||
logger.info("--> creating index [test]");
|
||||
assertAcked(
|
||||
admin().indices()
|
||||
.create(
|
||||
new CreateIndexRequest("test").settings(
|
||||
Settings.builder().put("index.number_of_replicas", 0).put("index.number_of_shards", 1)
|
||||
)
|
||||
)
|
||||
.get()
|
||||
);
|
||||
assertAcked(admin().indices().create(new CreateIndexRequest("test").settings(indexSettings(1, 0))).get());
|
||||
|
||||
ensureGreen();
|
||||
|
||||
|
|
|
@ -125,14 +125,7 @@ public class PrevalidateNodeRemovalIT extends ESIntegTestCase {
|
|||
String node1 = internalCluster().startDataOnlyNode();
|
||||
String node2 = internalCluster().startDataOnlyNode();
|
||||
String indexName = "test-idx";
|
||||
createIndex(
|
||||
indexName,
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put("index.routing.allocation.require._name", node1)
|
||||
.build()
|
||||
);
|
||||
createIndex(indexName, indexSettings(1, 0).put("index.routing.allocation.require._name", node1).build());
|
||||
ensureGreen(indexName);
|
||||
// Prevent node1 from removing its local index shard copies upon removal, by blocking
|
||||
// its ACTION_SHARD_EXISTS requests since after a relocation, the source first waits
|
||||
|
@ -181,14 +174,7 @@ public class PrevalidateNodeRemovalIT extends ESIntegTestCase {
|
|||
String node1 = internalCluster().startDataOnlyNode();
|
||||
String node2 = internalCluster().startDataOnlyNode();
|
||||
String indexName = "test-index";
|
||||
createIndex(
|
||||
indexName,
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put("index.routing.allocation.require._name", node1)
|
||||
.build()
|
||||
);
|
||||
createIndex(indexName, indexSettings(1, 0).put("index.routing.allocation.require._name", node1).build());
|
||||
ensureGreen(indexName);
|
||||
// make it red!
|
||||
internalCluster().stopNode(node1);
|
||||
|
|
|
@ -231,10 +231,7 @@ public class ClusterRerouteIT extends ESIntegTestCase {
|
|||
final String indexName = "test" + i;
|
||||
createIndex(
|
||||
indexName,
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 5)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), randomIntBetween(250, 1000) + "ms")
|
||||
indexSettings(5, 1).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), randomIntBetween(250, 1000) + "ms")
|
||||
.build()
|
||||
);
|
||||
if (randomBoolean()) {
|
||||
|
|
|
@ -73,9 +73,7 @@ public class RareClusterStateIT extends ESIntegTestCase {
|
|||
public void testAssignmentWithJustAddedNodes() {
|
||||
internalCluster().startNode(Settings.builder().put(TransportSettings.CONNECT_TIMEOUT.getKey(), "1s"));
|
||||
final String index = "index";
|
||||
prepareCreate(index).setSettings(
|
||||
Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
).get();
|
||||
prepareCreate(index).setSettings(indexSettings(1, 0)).get();
|
||||
ensureGreen(index);
|
||||
|
||||
// close to have some unassigned started shards shards..
|
||||
|
@ -243,14 +241,7 @@ public class RareClusterStateIT extends ESIntegTestCase {
|
|||
assertNotNull(otherNode);
|
||||
|
||||
// Don't allocate the shard on the master node
|
||||
assertAcked(
|
||||
prepareCreate("index").setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put("index.routing.allocation.exclude._name", master)
|
||||
).get()
|
||||
);
|
||||
assertAcked(prepareCreate("index").setSettings(indexSettings(1, 0).put("index.routing.allocation.exclude._name", master)).get());
|
||||
ensureGreen();
|
||||
|
||||
// Check routing tables
|
||||
|
@ -333,12 +324,7 @@ public class RareClusterStateIT extends ESIntegTestCase {
|
|||
|
||||
// Force allocation of the primary on the master node by first only allocating on the master
|
||||
// and then allowing all nodes so that the replica gets allocated on the other node
|
||||
prepareCreate("index").setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put("index.routing.allocation.include._name", master)
|
||||
).get();
|
||||
prepareCreate("index").setSettings(indexSettings(1, 1).put("index.routing.allocation.include._name", master)).get();
|
||||
updateIndexSettings(Settings.builder().put("index.routing.allocation.include._name", ""), "index");
|
||||
ensureGreen();
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ package org.elasticsearch.cluster.routing;
|
|||
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.core.TimeValue;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
@ -29,12 +28,8 @@ public class DelayedAllocationIT extends ESIntegTestCase {
|
|||
*/
|
||||
public void testNoDelayedTimeout() throws Exception {
|
||||
internalCluster().startNodes(3);
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), 0)
|
||||
).get();
|
||||
prepareCreate("test").setSettings(indexSettings(1, 1).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), 0))
|
||||
.get();
|
||||
ensureGreen("test");
|
||||
indexRandomData();
|
||||
internalCluster().stopNode(findNodeWithShard());
|
||||
|
@ -51,10 +46,7 @@ public class DelayedAllocationIT extends ESIntegTestCase {
|
|||
public void testDelayedAllocationNodeLeavesAndComesBack() throws Exception {
|
||||
internalCluster().startNodes(3);
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), TimeValue.timeValueHours(1))
|
||||
indexSettings(1, 1).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), TimeValue.timeValueHours(1))
|
||||
).get();
|
||||
ensureGreen("test");
|
||||
indexRandomData();
|
||||
|
@ -79,10 +71,7 @@ public class DelayedAllocationIT extends ESIntegTestCase {
|
|||
public void testDelayedAllocationTimesOut() throws Exception {
|
||||
internalCluster().startNodes(3);
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), TimeValue.timeValueMillis(100))
|
||||
indexSettings(1, 1).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), TimeValue.timeValueMillis(100))
|
||||
).get();
|
||||
ensureGreen("test");
|
||||
indexRandomData();
|
||||
|
@ -110,10 +99,7 @@ public class DelayedAllocationIT extends ESIntegTestCase {
|
|||
public void testDelayedAllocationChangeWithSettingTo100ms() throws Exception {
|
||||
internalCluster().startNodes(3);
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), TimeValue.timeValueHours(1))
|
||||
indexSettings(1, 1).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), TimeValue.timeValueHours(1))
|
||||
).get();
|
||||
ensureGreen("test");
|
||||
indexRandomData();
|
||||
|
@ -142,10 +128,7 @@ public class DelayedAllocationIT extends ESIntegTestCase {
|
|||
public void testDelayedAllocationChangeWithSettingTo0() throws Exception {
|
||||
internalCluster().startNodes(3);
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), TimeValue.timeValueHours(1))
|
||||
indexSettings(1, 1).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), TimeValue.timeValueHours(1))
|
||||
).get();
|
||||
ensureGreen("test");
|
||||
indexRandomData();
|
||||
|
|
|
@ -55,8 +55,6 @@ import java.util.concurrent.TimeUnit;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
|
@ -92,12 +90,7 @@ public class PrimaryAllocationIT extends ESIntegTestCase {
|
|||
client().admin()
|
||||
.indices()
|
||||
.prepareCreate("test")
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_shards", 1)
|
||||
.put("index.number_of_replicas", 1)
|
||||
.put("index.global_checkpoint_sync.interval", "1s")
|
||||
)
|
||||
.setSettings(indexSettings(1, 1).put("index.global_checkpoint_sync.interval", "1s"))
|
||||
.get()
|
||||
);
|
||||
ensureGreen();
|
||||
|
@ -422,12 +415,7 @@ public class PrimaryAllocationIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareCreate("test")
|
||||
.setWaitForActiveShards(ActiveShardCount.NONE)
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put("index.routing.allocation.exclude._name", node)
|
||||
.put("index.number_of_shards", 1)
|
||||
.put("index.number_of_replicas", 0)
|
||||
)
|
||||
.setSettings(indexSettings(1, 0).put("index.routing.allocation.exclude._name", node))
|
||||
.get();
|
||||
|
||||
assertThat(
|
||||
|
@ -446,12 +434,7 @@ public class PrimaryAllocationIT extends ESIntegTestCase {
|
|||
client().admin()
|
||||
.indices()
|
||||
.prepareCreate("test")
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_shards", 1)
|
||||
.put("index.number_of_replicas", 1)
|
||||
.put("index.unassigned.node_left.delayed_timeout", "0ms")
|
||||
)
|
||||
.setSettings(indexSettings(1, 1).put("index.unassigned.node_left.delayed_timeout", "0ms"))
|
||||
.get()
|
||||
);
|
||||
String replicaNode = internalCluster().startDataOnlyNode(Settings.EMPTY);
|
||||
|
@ -486,12 +469,7 @@ public class PrimaryAllocationIT extends ESIntegTestCase {
|
|||
client().admin()
|
||||
.indices()
|
||||
.prepareCreate("test")
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_shards", 1)
|
||||
.put("index.number_of_replicas", 1)
|
||||
.put("index.unassigned.node_left.delayed_timeout", "0ms")
|
||||
)
|
||||
.setSettings(indexSettings(1, 1).put("index.unassigned.node_left.delayed_timeout", "0ms"))
|
||||
.get()
|
||||
);
|
||||
String replicaNode = internalCluster().startDataOnlyNode(Settings.EMPTY);
|
||||
|
@ -580,12 +558,7 @@ public class PrimaryAllocationIT extends ESIntegTestCase {
|
|||
String master = internalCluster().startMasterOnlyNode(Settings.EMPTY);
|
||||
final int numberOfReplicas = between(2, 3);
|
||||
final String oldPrimary = internalCluster().startDataOnlyNode();
|
||||
assertAcked(
|
||||
prepareCreate(
|
||||
"test",
|
||||
Settings.builder().put(indexSettings()).put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, numberOfReplicas)
|
||||
)
|
||||
);
|
||||
assertAcked(prepareCreate("test", indexSettings(1, numberOfReplicas)));
|
||||
final ShardId shardId = new ShardId(clusterService().state().metadata().index("test").getIndex(), 0);
|
||||
final Set<String> replicaNodes = new HashSet<>(internalCluster().startDataOnlyNodes(numberOfReplicas));
|
||||
ensureGreen();
|
||||
|
|
|
@ -70,10 +70,7 @@ public class RemoveReplicaPriorityIT extends ESIntegTestCase {
|
|||
|
||||
createIndex(
|
||||
INDEX_NAME,
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 3)
|
||||
.put(IndexMetadata.INDEX_ROUTING_INCLUDE_GROUP_PREFIX + "._id", dataNodeIdFilter)
|
||||
indexSettings(1, 3).put(IndexMetadata.INDEX_ROUTING_INCLUDE_GROUP_PREFIX + "._id", dataNodeIdFilter)
|
||||
.put(IndexMetadata.INDEX_ROUTING_EXCLUDE_GROUP_PREFIX + "._id", excludedDataNodeId)
|
||||
.build()
|
||||
);
|
||||
|
|
|
@ -235,10 +235,7 @@ public class ShardRoutingRoleIT extends ESIntegTestCase {
|
|||
|
||||
Settings getIndexSettings() {
|
||||
logger.info("--> numShards={}, numReplicas={}", numShards, numReplicas);
|
||||
return Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numShards)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, numReplicas)
|
||||
.build();
|
||||
return indexSettings(numShards, numReplicas).build();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,10 +50,7 @@ public class DiskThresholdMonitorIT extends DiskUsageIntegTestCase {
|
|||
final String indexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
|
||||
createIndex(
|
||||
indexName,
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), "0ms")
|
||||
indexSettings(1, 0).put(INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), "0ms")
|
||||
.put(INDEX_ROUTING_REQUIRE_GROUP_SETTING.getConcreteSettingForNamespace("_name").getKey(), dataNodeName)
|
||||
.build()
|
||||
);
|
||||
|
@ -110,10 +107,7 @@ public class DiskThresholdMonitorIT extends DiskUsageIntegTestCase {
|
|||
final String indexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
|
||||
createIndex(
|
||||
indexName,
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), "0ms")
|
||||
indexSettings(1, 0).put(INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), "0ms")
|
||||
.put(INDEX_ROUTING_REQUIRE_GROUP_SETTING.getConcreteSettingForNamespace("_name").getKey(), dataNodeName)
|
||||
.build()
|
||||
);
|
||||
|
|
|
@ -10,7 +10,6 @@ package org.elasticsearch.cluster.routing.allocation;
|
|||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.health.ClusterHealthStatus;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.IndexService;
|
||||
import org.elasticsearch.index.shard.IndexShard;
|
||||
import org.elasticsearch.indices.IndicesService;
|
||||
|
@ -22,9 +21,7 @@ public class ShardStateIT extends ESIntegTestCase {
|
|||
|
||||
public void testPrimaryFailureIncreasesTerm() throws Exception {
|
||||
internalCluster().ensureAtLeastNumDataNodes(2);
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 2).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
).get();
|
||||
prepareCreate("test").setSettings(indexSettings(2, 1)).get();
|
||||
ensureGreen();
|
||||
assertPrimaryTerms(1, 1);
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.elasticsearch.cluster.ClusterInfoService;
|
|||
import org.elasticsearch.cluster.ClusterInfoServiceUtils;
|
||||
import org.elasticsearch.cluster.DiskUsageIntegTestCase;
|
||||
import org.elasticsearch.cluster.InternalClusterInfoService;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
import org.elasticsearch.cluster.routing.IndexRoutingTable;
|
||||
import org.elasticsearch.cluster.routing.IndexShardRoutingTable;
|
||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
|
@ -84,14 +83,7 @@ public class DiskThresholdDeciderIT extends DiskUsageIntegTestCase {
|
|||
final String dataNode0Id = internalCluster().getInstance(NodeEnvironment.class, dataNodeName).nodeId();
|
||||
|
||||
final String indexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
|
||||
createIndex(
|
||||
indexName,
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 6)
|
||||
.put(INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), "0ms")
|
||||
.build()
|
||||
);
|
||||
createIndex(indexName, indexSettings(6, 0).put(INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), "0ms").build());
|
||||
var smallestShard = createReasonableSizedShards(indexName);
|
||||
|
||||
// reduce disk size of node 0 so that no shards fit below the high watermark, forcing all shards onto the other data node
|
||||
|
@ -127,14 +119,7 @@ public class DiskThresholdDeciderIT extends DiskUsageIntegTestCase {
|
|||
final String dataNode0Id = internalCluster().getInstance(NodeEnvironment.class, dataNodeName).nodeId();
|
||||
|
||||
final String indexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
|
||||
createIndex(
|
||||
indexName,
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 6)
|
||||
.put(INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), "0ms")
|
||||
.build()
|
||||
);
|
||||
createIndex(indexName, indexSettings(6, 0).put(INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), "0ms").build());
|
||||
var smallestShard = createReasonableSizedShards(indexName);
|
||||
|
||||
final CreateSnapshotResponse createSnapshotResponse = client().admin()
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
package org.elasticsearch.cluster.routing.allocation.decider;
|
||||
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
import org.elasticsearch.cluster.routing.ShardRoutingState;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
@ -38,16 +37,8 @@ public class UpdateShardAllocationSettingsIT extends ESIntegTestCase {
|
|||
// we test with 2 shards since otherwise it's pretty fragile if there are difference in the num or shards such that
|
||||
// all shards are relocated to the second node which is not what we want here. It's solely a test for the settings to take effect
|
||||
final int numShards = 2;
|
||||
assertAcked(
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numShards)
|
||||
)
|
||||
);
|
||||
assertAcked(
|
||||
prepareCreate("test_1").setSettings(
|
||||
Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numShards)
|
||||
)
|
||||
);
|
||||
assertAcked(prepareCreate("test").setSettings(indexSettings(numShards, 0)));
|
||||
assertAcked(prepareCreate("test_1").setSettings(indexSettings(numShards, 0)));
|
||||
ensureGreen();
|
||||
assertAllShardsOnNodes("test", firstNode);
|
||||
assertAllShardsOnNodes("test_1", firstNode);
|
||||
|
|
|
@ -42,12 +42,7 @@ public class ClusterSearchShardsIT extends ESIntegTestCase {
|
|||
client().admin()
|
||||
.indices()
|
||||
.prepareCreate("test")
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_shards", "1")
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.routing.allocation.include.tag", "A")
|
||||
)
|
||||
.setSettings(indexSettings(1, 0).put("index.routing.allocation.include.tag", "A"))
|
||||
.execute()
|
||||
.actionGet();
|
||||
ensureGreen();
|
||||
|
@ -73,12 +68,7 @@ public class ClusterSearchShardsIT extends ESIntegTestCase {
|
|||
client().admin()
|
||||
.indices()
|
||||
.prepareCreate("test")
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_shards", "4")
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.routing.allocation.include.tag", "A")
|
||||
)
|
||||
.setSettings(indexSettings(4, 0).put("index.routing.allocation.include.tag", "A"))
|
||||
.execute()
|
||||
.actionGet();
|
||||
ensureGreen();
|
||||
|
|
|
@ -126,11 +126,7 @@ public class ClusterShardLimitIT extends ESIntegTestCase {
|
|||
.preparePutTemplate("should-fail")
|
||||
.setPatterns(Collections.singletonList("should-fail"))
|
||||
.setOrder(1)
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(SETTING_NUMBER_OF_SHARDS, counts.getFailingIndexShards())
|
||||
.put(SETTING_NUMBER_OF_REPLICAS, counts.getFailingIndexReplicas())
|
||||
)
|
||||
.setSettings(indexSettings(counts.getFailingIndexShards(), counts.getFailingIndexReplicas()))
|
||||
.get()
|
||||
);
|
||||
|
||||
|
@ -152,10 +148,7 @@ public class ClusterShardLimitIT extends ESIntegTestCase {
|
|||
int shardsPerNode = firstShardCount - 1;
|
||||
setShardsPerNode(shardsPerNode);
|
||||
|
||||
prepareCreate(
|
||||
"growing-should-fail",
|
||||
Settings.builder().put(indexSettings()).put(SETTING_NUMBER_OF_SHARDS, firstShardCount).put(SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
).get();
|
||||
prepareCreate("growing-should-fail", indexSettings(firstShardCount, 0)).get();
|
||||
|
||||
try {
|
||||
client().admin()
|
||||
|
|
|
@ -279,11 +279,7 @@ public class ClusterDisruptionIT extends AbstractDisruptionTestCase {
|
|||
public void testRejoinDocumentExistsInAllShardCopies() throws Exception {
|
||||
List<String> nodes = startCluster(3);
|
||||
|
||||
assertAcked(
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 2)
|
||||
).get()
|
||||
);
|
||||
assertAcked(prepareCreate("test").setSettings(indexSettings(1, 2)).get());
|
||||
ensureGreen("test");
|
||||
|
||||
nodes = new ArrayList<>(nodes);
|
||||
|
@ -329,11 +325,7 @@ public class ClusterDisruptionIT extends AbstractDisruptionTestCase {
|
|||
String masterNode = internalCluster().getMasterName();
|
||||
List<String> nonMasterNodes = nodes.stream().filter(node -> node.equals(masterNode) == false).toList();
|
||||
String nonMasterNode = randomFrom(nonMasterNodes);
|
||||
assertAcked(
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 3).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 2)
|
||||
)
|
||||
);
|
||||
assertAcked(prepareCreate("test").setSettings(indexSettings(3, 2)));
|
||||
ensureGreen();
|
||||
String nonMasterNodeId = internalCluster().clusterService(nonMasterNode).localNode().getId();
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ import org.elasticsearch.action.bulk.BulkRequestBuilder;
|
|||
import org.elasticsearch.action.bulk.BulkResponse;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.coordination.NoMasterBlockService;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.core.Strings;
|
||||
import org.elasticsearch.core.TimeValue;
|
||||
|
@ -87,13 +86,7 @@ public class MasterDisruptionIT extends AbstractDisruptionTestCase {
|
|||
public void testIsolateMasterAndVerifyClusterStateConsensus() throws Exception {
|
||||
final List<String> nodes = startCluster(3);
|
||||
|
||||
assertAcked(
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1 + randomInt(2))
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, randomInt(2))
|
||||
)
|
||||
);
|
||||
assertAcked(prepareCreate("test").setSettings(indexSettings(1 + randomInt(2), randomInt(2))));
|
||||
|
||||
ensureGreen();
|
||||
String isolatedNode = internalCluster().getMasterName();
|
||||
|
@ -164,11 +157,7 @@ public class MasterDisruptionIT extends AbstractDisruptionTestCase {
|
|||
internalCluster().startNodes(3, Settings.builder().putNull(NoMasterBlockService.NO_MASTER_BLOCK_SETTING.getKey()).build());
|
||||
|
||||
// Makes sure that the get request can be executed on each node locally:
|
||||
assertAcked(
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 2)
|
||||
)
|
||||
);
|
||||
assertAcked(prepareCreate("test").setSettings(indexSettings(1, 2)));
|
||||
|
||||
// Everything is stable now, it is now time to simulate evil...
|
||||
// but first make sure we have no initializing shards and all is green
|
||||
|
|
|
@ -18,8 +18,6 @@ import org.elasticsearch.action.index.IndexResponse;
|
|||
import org.elasticsearch.action.support.replication.ReplicationResponse;
|
||||
import org.elasticsearch.action.update.UpdateResponse;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.xcontent.XContentType;
|
||||
|
||||
|
@ -96,11 +94,9 @@ public class ShardInfoIT extends ESIntegTestCase {
|
|||
logger.info("Number of copies: {}", numCopies);
|
||||
|
||||
assertAcked(
|
||||
prepareCreate("idx").setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numberOfPrimaryShards)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, numCopies - 1)
|
||||
).setMapping("_routing", "required=" + routingRequired).get()
|
||||
prepareCreate("idx").setSettings(indexSettings(numberOfPrimaryShards, numCopies - 1))
|
||||
.setMapping("_routing", "required=" + routingRequired)
|
||||
.get()
|
||||
);
|
||||
for (int i = 0; i < numberOfPrimaryShards; i++) {
|
||||
ensureActiveShardCopies(i, numNodes);
|
||||
|
|
|
@ -58,7 +58,6 @@ import java.util.Set;
|
|||
import java.util.stream.IntStream;
|
||||
|
||||
import static org.elasticsearch.cluster.coordination.ClusterBootstrapService.INITIAL_MASTER_NODES_SETTING;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.gateway.GatewayService.RECOVER_AFTER_DATA_NODES_SETTING;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
|
@ -194,11 +193,7 @@ public class RecoveryFromGatewayIT extends ESIntegTestCase {
|
|||
);
|
||||
// note: default replica settings are tied to #data nodes-1 which is 0 here. We can do with 1 in this test.
|
||||
int numberOfShards = numberOfShards();
|
||||
assertAcked(
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder().put(SETTING_NUMBER_OF_SHARDS, numberOfShards()).put(SETTING_NUMBER_OF_REPLICAS, randomIntBetween(0, 1))
|
||||
).setMapping(mapping)
|
||||
);
|
||||
assertAcked(prepareCreate("test").setSettings(indexSettings(numberOfShards(), randomIntBetween(0, 1))).setMapping(mapping));
|
||||
|
||||
int value1Docs;
|
||||
int value2Docs;
|
||||
|
@ -698,14 +693,7 @@ public class RecoveryFromGatewayIT extends ESIntegTestCase {
|
|||
3,
|
||||
Settings.builder().put(ElectionSchedulerFactory.ELECTION_INITIAL_TIMEOUT_SETTING.getKey(), "2ms").build()
|
||||
);
|
||||
createIndex(
|
||||
"test",
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "100ms")
|
||||
.build()
|
||||
);
|
||||
createIndex("test", indexSettings(1, 0).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "100ms").build());
|
||||
ensureGreen("test");
|
||||
internalCluster().fullRestart();
|
||||
ensureGreen("test");
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
package org.elasticsearch.gateway;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.stats.ShardStats;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.cluster.routing.RoutingNodesHelper;
|
||||
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
||||
|
@ -80,10 +79,7 @@ public class ReplicaShardAllocatorIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareCreate(indexName)
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(IndexSettings.FILE_BASED_RECOVERY_THRESHOLD_SETTING.getKey(), 1.0f)
|
||||
indexSettings(1, 1).put(IndexSettings.FILE_BASED_RECOVERY_THRESHOLD_SETTING.getKey(), 1.0f)
|
||||
.put(IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
.put(IndexService.GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "1ms")
|
||||
|
@ -154,10 +150,7 @@ public class ReplicaShardAllocatorIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareCreate(indexName)
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(IndexSettings.FILE_BASED_RECOVERY_THRESHOLD_SETTING.getKey(), 0.1f)
|
||||
indexSettings(1, 1).put(IndexSettings.FILE_BASED_RECOVERY_THRESHOLD_SETTING.getKey(), 0.1f)
|
||||
.put(IndexService.GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
.put(IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "1ms")
|
||||
|
@ -248,10 +241,10 @@ public class ReplicaShardAllocatorIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareCreate(indexName)
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey(), randomIntBetween(10, 100) + "kb")
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, numOfReplicas)
|
||||
indexSettings(1, numOfReplicas).put(
|
||||
IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey(),
|
||||
randomIntBetween(10, 100) + "kb"
|
||||
)
|
||||
.put(IndexSettings.FILE_BASED_RECOVERY_THRESHOLD_SETTING.getKey(), 0.5)
|
||||
.put(IndexService.GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
.put(IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
|
@ -295,10 +288,10 @@ public class ReplicaShardAllocatorIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareCreate(indexName)
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey(), randomIntBetween(10, 100) + "kb")
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
indexSettings(1, 1).put(
|
||||
IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey(),
|
||||
randomIntBetween(10, 100) + "kb"
|
||||
)
|
||||
.put(IndexSettings.FILE_BASED_RECOVERY_THRESHOLD_SETTING.getKey(), 3.0)
|
||||
.put(IndexService.GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "0ms")
|
||||
|
@ -361,10 +354,7 @@ public class ReplicaShardAllocatorIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareCreate(indexName)
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexService.GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
indexSettings(1, 0).put(IndexService.GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
.put(IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
)
|
||||
);
|
||||
|
@ -417,10 +407,7 @@ public class ReplicaShardAllocatorIT extends ESIntegTestCase {
|
|||
internalCluster().ensureAtLeastNumDataNodes(1);
|
||||
createIndex(
|
||||
indexName,
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexService.GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
indexSettings(1, 0).put(IndexService.GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
.put(IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
.build()
|
||||
);
|
||||
|
|
|
@ -10,7 +10,6 @@ package org.elasticsearch.gateway;
|
|||
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.elasticsearch.action.admin.indices.stats.ShardStats;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
||||
import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider;
|
||||
import org.elasticsearch.common.UUIDs;
|
||||
|
@ -159,10 +158,9 @@ public class ReplicaShardAllocatorSyncIdIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareCreate(indexName)
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(IndexSettings.INDEX_SOFT_DELETES_RETENTION_LEASE_PERIOD_SETTING.getKey(), "1ms") // expire PRRLs quickly
|
||||
indexSettings(1, 1)
|
||||
// expire PRRLs quickly
|
||||
.put(IndexSettings.INDEX_SOFT_DELETES_RETENTION_LEASE_PERIOD_SETTING.getKey(), "1ms")
|
||||
.put(IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
.put(IndexService.GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "1ms")
|
||||
|
@ -228,10 +226,10 @@ public class ReplicaShardAllocatorSyncIdIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareCreate(indexName)
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, numOfReplicas)
|
||||
.put(IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey(), randomIntBetween(10, 100) + "kb")
|
||||
indexSettings(1, numOfReplicas).put(
|
||||
IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey(),
|
||||
randomIntBetween(10, 100) + "kb"
|
||||
)
|
||||
.put(IndexSettings.INDEX_SOFT_DELETES_RETENTION_LEASE_PERIOD_SETTING.getKey(), "1ms") // expire PRRLs quickly
|
||||
.put(IndexService.GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
.put(IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
|
|
|
@ -23,8 +23,6 @@ import org.junit.Before;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.cluster.node.DiscoveryNodeRole.DATA_FROZEN_NODE_ROLE;
|
||||
import static org.elasticsearch.indices.ShardLimitValidator.SETTING_CLUSTER_MAX_SHARDS_PER_NODE;
|
||||
import static org.hamcrest.Matchers.empty;
|
||||
|
@ -86,7 +84,7 @@ public class ShardsCapacityHealthIndicatorServiceIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
private void createIndex(int shards, int replicas) {
|
||||
createIndex(INDEX_NAME, Settings.builder().put(SETTING_NUMBER_OF_SHARDS, shards).put(SETTING_NUMBER_OF_REPLICAS, replicas).build());
|
||||
createIndex(INDEX_NAME, indexSettings(shards, replicas).build());
|
||||
}
|
||||
|
||||
private HealthIndicatorResult fetchShardsCapacityIndicatorResult(InternalTestCluster internalCluster) throws Exception {
|
||||
|
|
|
@ -15,7 +15,6 @@ import org.elasticsearch.action.bulk.BulkResponse;
|
|||
import org.elasticsearch.action.bulk.TransportShardBulkAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.common.UUIDs;
|
||||
|
@ -72,12 +71,7 @@ public class IndexingPressureIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testWriteIndexingPressureMetricsAreIncremented() throws Exception {
|
||||
assertAcked(
|
||||
prepareCreate(
|
||||
INDEX_NAME,
|
||||
Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
)
|
||||
);
|
||||
assertAcked(prepareCreate(INDEX_NAME, indexSettings(1, 1)));
|
||||
ensureGreen(INDEX_NAME);
|
||||
|
||||
Tuple<String, String> primaryReplicaNodeNames = getPrimaryReplicaNodeNames();
|
||||
|
@ -256,12 +250,7 @@ public class IndexingPressureIT extends ESIntegTestCase {
|
|||
Settings.builder().put(IndexingPressure.MAX_INDEXING_BYTES.getKey(), (long) (bulkShardRequestSize * 1.5) + "B").build()
|
||||
);
|
||||
|
||||
assertAcked(
|
||||
prepareCreate(
|
||||
INDEX_NAME,
|
||||
Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
)
|
||||
);
|
||||
assertAcked(prepareCreate(INDEX_NAME, indexSettings(1, 1)));
|
||||
ensureGreen(INDEX_NAME);
|
||||
|
||||
Tuple<String, String> primaryReplicaNodeNames = getPrimaryReplicaNodeNames();
|
||||
|
@ -324,12 +313,7 @@ public class IndexingPressureIT extends ESIntegTestCase {
|
|||
Settings.builder().put(IndexingPressure.MAX_INDEXING_BYTES.getKey(), (long) (bulkShardRequestSize * 1.5) + "B").build()
|
||||
);
|
||||
|
||||
assertAcked(
|
||||
prepareCreate(
|
||||
INDEX_NAME,
|
||||
Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
)
|
||||
);
|
||||
assertAcked(prepareCreate(INDEX_NAME, indexSettings(1, 1)));
|
||||
ensureGreen(INDEX_NAME);
|
||||
|
||||
Tuple<String, String> primaryReplicaNodeNames = getPrimaryReplicaNodeNames();
|
||||
|
@ -373,12 +357,7 @@ public class IndexingPressureIT extends ESIntegTestCase {
|
|||
|
||||
public void testWritesWillSucceedIfBelowThreshold() throws Exception {
|
||||
restartNodesWithSettings(Settings.builder().put(IndexingPressure.MAX_INDEXING_BYTES.getKey(), "1MB").build());
|
||||
assertAcked(
|
||||
prepareCreate(
|
||||
INDEX_NAME,
|
||||
Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
)
|
||||
);
|
||||
assertAcked(prepareCreate(INDEX_NAME, indexSettings(1, 1)));
|
||||
ensureGreen(INDEX_NAME);
|
||||
|
||||
Tuple<String, String> primaryReplicaNodeNames = getPrimaryReplicaNodeNames();
|
||||
|
|
|
@ -11,8 +11,6 @@ import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
|||
import org.elasticsearch.action.bulk.BulkRequestBuilder;
|
||||
import org.elasticsearch.action.bulk.BulkResponse;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
import org.elasticsearch.test.ESIntegTestCase.Scope;
|
||||
|
@ -30,14 +28,7 @@ public class InternalEngineMergeIT extends ESIntegTestCase {
|
|||
public void testMergesHappening() throws Exception {
|
||||
final int numOfShards = randomIntBetween(1, 5);
|
||||
// some settings to keep num segments low
|
||||
assertAcked(
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numOfShards)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.build()
|
||||
)
|
||||
);
|
||||
assertAcked(prepareCreate("test").setSettings(indexSettings(numOfShards, 0).build()));
|
||||
long id = 0;
|
||||
final int rounds = scaledRandomIntBetween(50, 300);
|
||||
logger.info("Starting rounds [{}] ", rounds);
|
||||
|
|
|
@ -95,8 +95,6 @@ import static java.util.Collections.emptyMap;
|
|||
import static java.util.Collections.emptySet;
|
||||
import static org.elasticsearch.action.support.WriteRequest.RefreshPolicy.IMMEDIATE;
|
||||
import static org.elasticsearch.action.support.WriteRequest.RefreshPolicy.NONE;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.cluster.routing.TestShardRouting.newShardRouting;
|
||||
import static org.elasticsearch.index.shard.IndexShardTestCase.getTranslog;
|
||||
import static org.elasticsearch.index.shard.IndexShardTestCase.recoverFromStore;
|
||||
|
@ -239,12 +237,7 @@ public class IndexShardIT extends ESSingleNodeTestCase {
|
|||
}
|
||||
|
||||
public void testExpectedShardSizeIsPresent() throws InterruptedException {
|
||||
assertAcked(
|
||||
client().admin()
|
||||
.indices()
|
||||
.prepareCreate("test")
|
||||
.setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0))
|
||||
);
|
||||
assertAcked(client().admin().indices().prepareCreate("test").setSettings(indexSettings(1, 0)));
|
||||
for (int i = 0; i < 50; i++) {
|
||||
client().prepareIndex("test").setSource("{}", XContentType.JSON).get();
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.elasticsearch.action.search.SearchRequestBuilder;
|
|||
import org.elasticsearch.cli.MockTerminal;
|
||||
import org.elasticsearch.cli.ProcessInfo;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.cluster.routing.GroupShardsIterator;
|
||||
|
@ -107,10 +106,7 @@ public class RemoveCorruptedShardDataCommandIT extends ESIntegTestCase {
|
|||
final String indexName = "index42";
|
||||
assertAcked(
|
||||
prepareCreate(indexName).setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(MergePolicyConfig.INDEX_MERGE_ENABLED, false)
|
||||
indexSettings(1, 0).put(MergePolicyConfig.INDEX_MERGE_ENABLED, false)
|
||||
.put(IndexSettings.INDEX_REFRESH_INTERVAL_SETTING.getKey(), "-1")
|
||||
.put(MockEngineSupport.DISABLE_FLUSH_ON_CLOSE.getKey(), true)
|
||||
.put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), "checksum")
|
||||
|
@ -277,10 +273,7 @@ public class RemoveCorruptedShardDataCommandIT extends ESIntegTestCase {
|
|||
final String indexName = "test";
|
||||
assertAcked(
|
||||
prepareCreate(indexName).setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(IndexSettings.INDEX_REFRESH_INTERVAL_SETTING.getKey(), "-1")
|
||||
indexSettings(1, 1).put(IndexSettings.INDEX_REFRESH_INTERVAL_SETTING.getKey(), "-1")
|
||||
.put(MockEngineSupport.DISABLE_FLUSH_ON_CLOSE.getKey(), true) // never flush - always recover from translog
|
||||
.put("index.routing.allocation.exclude._name", node2)
|
||||
)
|
||||
|
@ -476,10 +469,7 @@ public class RemoveCorruptedShardDataCommandIT extends ESIntegTestCase {
|
|||
final String indexName = "test";
|
||||
assertAcked(
|
||||
prepareCreate(indexName).setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(IndexSettings.INDEX_REFRESH_INTERVAL_SETTING.getKey(), "-1")
|
||||
indexSettings(1, 1).put(IndexSettings.INDEX_REFRESH_INTERVAL_SETTING.getKey(), "-1")
|
||||
.put(MockEngineSupport.DISABLE_FLUSH_ON_CLOSE.getKey(), true) // never flush - always recover from translog
|
||||
.put("index.routing.allocation.exclude._name", node2)
|
||||
)
|
||||
|
@ -582,13 +572,7 @@ public class RemoveCorruptedShardDataCommandIT extends ESIntegTestCase {
|
|||
final List<String> nodeNames = internalCluster().startNodes(numOfNodes, Settings.EMPTY);
|
||||
|
||||
final String indexName = "test" + randomInt(100);
|
||||
assertAcked(
|
||||
prepareCreate(indexName).setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, numOfNodes - 1)
|
||||
)
|
||||
);
|
||||
assertAcked(prepareCreate(indexName).setSettings(indexSettings(1, numOfNodes - 1)));
|
||||
flush(indexName);
|
||||
|
||||
ensureGreen(indexName);
|
||||
|
|
|
@ -147,10 +147,7 @@ public class CorruptedFileIT extends ESIntegTestCase {
|
|||
|
||||
assertAcked(
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, "1")
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, "1")
|
||||
.put(MergePolicyConfig.INDEX_MERGE_ENABLED, false)
|
||||
indexSettings(1, 1).put(MergePolicyConfig.INDEX_MERGE_ENABLED, false)
|
||||
// no checkindex - we corrupt shards on purpose
|
||||
.put(MockFSIndexStore.INDEX_CHECK_INDEX_ON_CLOSE_SETTING.getKey(), false)
|
||||
// no translog based flush - it might change the .liv / segments.N files
|
||||
|
@ -347,10 +344,7 @@ public class CorruptedFileIT extends ESIntegTestCase {
|
|||
var unluckyNode = dataNodes.get(1);
|
||||
assertAcked(
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, "0")
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put("index.routing.allocation.include._name", primariesNode.getName())
|
||||
indexSettings(1, 0).put("index.routing.allocation.include._name", primariesNode.getName())
|
||||
.put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE)
|
||||
.put("index.allocation.max_retries", Integer.MAX_VALUE) // keep on retrying
|
||||
)
|
||||
|
@ -404,9 +398,7 @@ public class CorruptedFileIT extends ESIntegTestCase {
|
|||
|
||||
assertAcked(
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, "0")
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, between(1, 4)) // don't go crazy here it must recovery fast
|
||||
indexSettings(between(1, 4), 0) // don't go crazy here it must recovery fast
|
||||
// This does corrupt files on the replica, so we can't check:
|
||||
.put(MockFSIndexStore.INDEX_CHECK_INDEX_ON_CLOSE_SETTING.getKey(), false)
|
||||
.put("index.routing.allocation.include._name", primariesNode.getName())
|
||||
|
|
|
@ -51,10 +51,7 @@ public class CorruptedTranslogIT extends ESIntegTestCase {
|
|||
|
||||
assertAcked(
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_shards", 1)
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.refresh_interval", "-1")
|
||||
indexSettings(1, 0).put("index.refresh_interval", "-1")
|
||||
.put(MockEngineSupport.DISABLE_FLUSH_ON_CLOSE.getKey(), true) // never flush - always recover from translog
|
||||
.put(IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey(), new ByteSizeValue(1, ByteSizeUnit.PB))
|
||||
)
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.elasticsearch.cluster.ClusterState;
|
|||
import org.elasticsearch.cluster.routing.GroupShardsIterator;
|
||||
import org.elasticsearch.cluster.routing.ShardIterator;
|
||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.search.stats.SearchStats;
|
||||
import org.elasticsearch.search.suggest.SuggestBuilder;
|
||||
import org.elasticsearch.search.suggest.phrase.PhraseSuggestionBuilder;
|
||||
|
@ -27,8 +26,6 @@ import org.elasticsearch.test.ESIntegTestCase;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
@ -52,16 +49,8 @@ public class SuggestStatsIT extends ESIntegTestCase {
|
|||
final int shardsIdx2 = Math.max(numNodes - shardsIdx1, randomIntBetween(1, 10));
|
||||
final int totalShards = shardsIdx1 + shardsIdx2;
|
||||
assertThat(numNodes, lessThanOrEqualTo(totalShards));
|
||||
assertAcked(
|
||||
prepareCreate("test1").setSettings(
|
||||
Settings.builder().put(SETTING_NUMBER_OF_SHARDS, shardsIdx1).put(SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
).setMapping("f", "type=text")
|
||||
);
|
||||
assertAcked(
|
||||
prepareCreate("test2").setSettings(
|
||||
Settings.builder().put(SETTING_NUMBER_OF_SHARDS, shardsIdx2).put(SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
).setMapping("f", "type=text")
|
||||
);
|
||||
assertAcked(prepareCreate("test1").setSettings(indexSettings(shardsIdx1, 0)).setMapping("f", "type=text"));
|
||||
assertAcked(prepareCreate("test2").setSettings(indexSettings(shardsIdx2, 0)).setMapping("f", "type=text"));
|
||||
assertThat(shardsIdx1 + shardsIdx2, equalTo(numAssignedShards("test1", "test2")));
|
||||
assertThat(numAssignedShards("test1", "test2"), greaterThanOrEqualTo(2));
|
||||
ensureGreen();
|
||||
|
|
|
@ -13,7 +13,6 @@ import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse;
|
|||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.search.SearchType;
|
||||
import org.elasticsearch.client.internal.Client;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.time.DateFormatter;
|
||||
import org.elasticsearch.index.cache.request.RequestCacheStats;
|
||||
|
@ -112,11 +111,8 @@ public class IndicesRequestCacheIT extends ESIntegTestCase {
|
|||
.prepareCreate("index")
|
||||
.setMapping("s", "type=date")
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(IndicesRequestCache.INDEX_CACHE_REQUEST_ENABLED_SETTING.getKey(), true)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 5)
|
||||
indexSettings(5, 0).put(IndicesRequestCache.INDEX_CACHE_REQUEST_ENABLED_SETTING.getKey(), true)
|
||||
.put("index.number_of_routing_shards", 5)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
)
|
||||
.get()
|
||||
);
|
||||
|
@ -182,12 +178,7 @@ public class IndicesRequestCacheIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareCreate("index")
|
||||
.setMapping("s", "type=date")
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(IndicesRequestCache.INDEX_CACHE_REQUEST_ENABLED_SETTING.getKey(), true)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
)
|
||||
.setSettings(indexSettings(1, 0).put(IndicesRequestCache.INDEX_CACHE_REQUEST_ENABLED_SETTING.getKey(), true))
|
||||
.get()
|
||||
);
|
||||
indexRandom(
|
||||
|
@ -248,12 +239,7 @@ public class IndicesRequestCacheIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareCreate("index")
|
||||
.setMapping("d", "type=date")
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(IndicesRequestCache.INDEX_CACHE_REQUEST_ENABLED_SETTING.getKey(), true)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
)
|
||||
.setSettings(indexSettings(1, 0).put(IndicesRequestCache.INDEX_CACHE_REQUEST_ENABLED_SETTING.getKey(), true))
|
||||
.get()
|
||||
);
|
||||
indexRandom(
|
||||
|
@ -313,11 +299,7 @@ public class IndicesRequestCacheIT extends ESIntegTestCase {
|
|||
|
||||
public void testQueryRewriteDatesWithNow() throws Exception {
|
||||
Client client = client();
|
||||
Settings settings = Settings.builder()
|
||||
.put(IndicesRequestCache.INDEX_CACHE_REQUEST_ENABLED_SETTING.getKey(), true)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.build();
|
||||
Settings settings = indexSettings(1, 0).put(IndicesRequestCache.INDEX_CACHE_REQUEST_ENABLED_SETTING.getKey(), true).build();
|
||||
assertAcked(client.admin().indices().prepareCreate("index-1").setMapping("d", "type=date").setSettings(settings).get());
|
||||
assertAcked(client.admin().indices().prepareCreate("index-2").setMapping("d", "type=date").setSettings(settings).get());
|
||||
assertAcked(client.admin().indices().prepareCreate("index-3").setMapping("d", "type=date").setSettings(settings).get());
|
||||
|
@ -393,11 +375,8 @@ public class IndicesRequestCacheIT extends ESIntegTestCase {
|
|||
|
||||
public void testCanCache() throws Exception {
|
||||
Client client = client();
|
||||
Settings settings = Settings.builder()
|
||||
.put(IndicesRequestCache.INDEX_CACHE_REQUEST_ENABLED_SETTING.getKey(), true)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 2)
|
||||
Settings settings = indexSettings(2, 0).put(IndicesRequestCache.INDEX_CACHE_REQUEST_ENABLED_SETTING.getKey(), true)
|
||||
.put("index.number_of_routing_shards", 2)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.build();
|
||||
assertAcked(client.admin().indices().prepareCreate("index").setMapping("s", "type=date").setSettings(settings).get());
|
||||
indexRandom(
|
||||
|
@ -493,11 +472,7 @@ public class IndicesRequestCacheIT extends ESIntegTestCase {
|
|||
|
||||
public void testCacheWithFilteredAlias() {
|
||||
Client client = client();
|
||||
Settings settings = Settings.builder()
|
||||
.put(IndicesRequestCache.INDEX_CACHE_REQUEST_ENABLED_SETTING.getKey(), true)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.build();
|
||||
Settings settings = indexSettings(1, 0).put(IndicesRequestCache.INDEX_CACHE_REQUEST_ENABLED_SETTING.getKey(), true).build();
|
||||
assertAcked(
|
||||
client.admin()
|
||||
.indices()
|
||||
|
@ -552,12 +527,7 @@ public class IndicesRequestCacheIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareCreate("index")
|
||||
.setMapping("k", "type=keyword")
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(IndicesRequestCache.INDEX_CACHE_REQUEST_ENABLED_SETTING.getKey(), true)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
)
|
||||
.setSettings(indexSettings(1, 0).put(IndicesRequestCache.INDEX_CACHE_REQUEST_ENABLED_SETTING.getKey(), true))
|
||||
.get()
|
||||
);
|
||||
indexRandom(true, client.prepareIndex("index").setSource("k", "hello"));
|
||||
|
|
|
@ -11,7 +11,6 @@ import org.elasticsearch.action.ActionListener;
|
|||
import org.elasticsearch.action.admin.indices.flush.FlushRequest;
|
||||
import org.elasticsearch.action.admin.indices.flush.FlushResponse;
|
||||
import org.elasticsearch.action.admin.indices.stats.ShardStats;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
import org.elasticsearch.common.ValidationException;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.IndexService;
|
||||
|
@ -122,10 +121,7 @@ public class FlushIT extends ESIntegTestCase {
|
|||
.indices()
|
||||
.prepareCreate(indexName)
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(IndexSettings.INDEX_TRANSLOG_SYNC_INTERVAL_SETTING.getKey(), randomTimeValue(200, 500, "ms"))
|
||||
indexSettings(1, 1).put(IndexSettings.INDEX_TRANSLOG_SYNC_INTERVAL_SETTING.getKey(), randomTimeValue(200, 500, "ms"))
|
||||
.put(IndexService.GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTING.getKey(), randomTimeValue(50, 200, "ms"))
|
||||
.put("index.routing.allocation.include._name", String.join(",", dataNodes))
|
||||
.build()
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.elasticsearch.action.search.SearchRequestBuilder;
|
|||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.client.internal.Client;
|
||||
import org.elasticsearch.client.internal.Requests;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider;
|
||||
import org.elasticsearch.common.breaker.CircuitBreaker;
|
||||
import org.elasticsearch.common.breaker.CircuitBreakingException;
|
||||
|
@ -365,10 +364,7 @@ public class CircuitBreakerServiceIT extends ESIntegTestCase {
|
|||
|
||||
assertAcked(
|
||||
prepareCreate("index").setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put("index.routing.allocation.include._name", targetNode.getNode().getName())
|
||||
indexSettings(1, 0).put("index.routing.allocation.include._name", targetNode.getNode().getName())
|
||||
.put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE)
|
||||
)
|
||||
);
|
||||
|
|
|
@ -347,10 +347,7 @@ public class IndexRecoveryIT extends AbstractIndexRecoveryIntegTestCase {
|
|||
logger.info("--> create index on node: {}", nodeA);
|
||||
createIndex(
|
||||
INDEX_NAME,
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
indexSettings(1, 1).put(IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
.put(IndexService.GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTING.getKey(), "100ms")
|
||||
.build()
|
||||
);
|
||||
|
@ -801,12 +798,7 @@ public class IndexRecoveryIT extends AbstractIndexRecoveryIntegTestCase {
|
|||
client().admin()
|
||||
.indices()
|
||||
.prepareCreate(indexName)
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 2)
|
||||
.put(IndexSettings.FILE_BASED_RECOVERY_THRESHOLD_SETTING.getKey(), 1.0)
|
||||
)
|
||||
.setSettings(indexSettings(1, 2).put(IndexSettings.FILE_BASED_RECOVERY_THRESHOLD_SETTING.getKey(), 1.0))
|
||||
.get();
|
||||
ensureGreen(indexName);
|
||||
|
||||
|
@ -920,12 +912,7 @@ public class IndexRecoveryIT extends AbstractIndexRecoveryIntegTestCase {
|
|||
client().admin()
|
||||
.indices()
|
||||
.prepareCreate(indexName)
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put("index.routing.allocation.include._name", nodeWithPrimary)
|
||||
)
|
||||
.setSettings(indexSettings(1, 0).put("index.routing.allocation.include._name", nodeWithPrimary))
|
||||
);
|
||||
MockTransportService transport = (MockTransportService) internalCluster().getInstance(TransportService.class, nodeWithPrimary);
|
||||
CountDownLatch phase1ReadyBlocked = new CountDownLatch(1);
|
||||
|
@ -1079,10 +1066,7 @@ public class IndexRecoveryIT extends AbstractIndexRecoveryIntegTestCase {
|
|||
String indexName = "test-index";
|
||||
createIndex(
|
||||
indexName,
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true)
|
||||
indexSettings(1, 1).put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true)
|
||||
.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "12h")
|
||||
.build()
|
||||
);
|
||||
|
@ -1150,10 +1134,7 @@ public class IndexRecoveryIT extends AbstractIndexRecoveryIntegTestCase {
|
|||
String indexName = "test-index";
|
||||
createIndex(
|
||||
indexName,
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true)
|
||||
indexSettings(1, 1).put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true)
|
||||
.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "12h")
|
||||
.build()
|
||||
);
|
||||
|
@ -1233,10 +1214,7 @@ public class IndexRecoveryIT extends AbstractIndexRecoveryIntegTestCase {
|
|||
internalCluster().ensureAtLeastNumDataNodes(2);
|
||||
|
||||
String indexName = "test-index";
|
||||
final Settings.Builder settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true)
|
||||
final Settings.Builder settings = indexSettings(1, 1).put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true)
|
||||
.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "12h")
|
||||
.put(IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), "100ms");
|
||||
|
||||
|
@ -1378,14 +1356,7 @@ public class IndexRecoveryIT extends AbstractIndexRecoveryIntegTestCase {
|
|||
internalCluster().ensureAtLeastNumDataNodes(2);
|
||||
|
||||
String indexName = "test-index";
|
||||
createIndex(
|
||||
indexName,
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true)
|
||||
.build()
|
||||
);
|
||||
createIndex(indexName, indexSettings(1, 0).put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true).build());
|
||||
indexRandom(
|
||||
randomBoolean(),
|
||||
randomBoolean(),
|
||||
|
@ -1462,11 +1433,7 @@ public class IndexRecoveryIT extends AbstractIndexRecoveryIntegTestCase {
|
|||
final String indexName = "test-index";
|
||||
createIndex(
|
||||
indexName,
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, randomIntBetween(1, 6))
|
||||
.put(IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), "200ms")
|
||||
.build()
|
||||
indexSettings(randomIntBetween(1, 6), 1).put(IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), "200ms").build()
|
||||
);
|
||||
indexRandom(
|
||||
randomBoolean(),
|
||||
|
|
|
@ -55,12 +55,7 @@ public class TaskRecoveryIT extends ESIntegTestCase {
|
|||
client().admin()
|
||||
.indices()
|
||||
.prepareCreate(indexName)
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put("index.routing.allocation.include._name", nodeWithPrimary)
|
||||
)
|
||||
.setSettings(indexSettings(1, 0).put("index.routing.allocation.include._name", nodeWithPrimary))
|
||||
);
|
||||
try {
|
||||
String nodeWithReplica = internalCluster().startDataOnlyNode();
|
||||
|
|
|
@ -405,14 +405,7 @@ public class CloseIndexIT extends ESIntegTestCase {
|
|||
final String indexName = "noop-peer-recovery-test";
|
||||
int numberOfReplicas = between(1, 2);
|
||||
internalCluster().ensureAtLeastNumDataNodes(numberOfReplicas + between(1, 2));
|
||||
createIndex(
|
||||
indexName,
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, numberOfReplicas)
|
||||
.put("index.routing.rebalance.enable", "none")
|
||||
.build()
|
||||
);
|
||||
createIndex(indexName, indexSettings(1, numberOfReplicas).put("index.routing.rebalance.enable", "none").build());
|
||||
int iterations = between(1, 3);
|
||||
for (int iter = 0; iter < iterations; iter++) {
|
||||
indexRandom(
|
||||
|
@ -451,14 +444,7 @@ public class CloseIndexIT extends ESIntegTestCase {
|
|||
2,
|
||||
clusterService().state().nodes().getDataNodes().values().stream().map(DiscoveryNode::getName).collect(Collectors.toSet())
|
||||
);
|
||||
createIndex(
|
||||
indexName,
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put("index.routing.allocation.include._name", String.join(",", dataNodes))
|
||||
.build()
|
||||
);
|
||||
createIndex(indexName, indexSettings(1, 1).put("index.routing.allocation.include._name", String.join(",", dataNodes)).build());
|
||||
indexRandom(
|
||||
randomBoolean(),
|
||||
randomBoolean(),
|
||||
|
@ -501,14 +487,7 @@ public class CloseIndexIT extends ESIntegTestCase {
|
|||
final String indexName = "closed-index";
|
||||
final List<String> dataNodes = internalCluster().startDataOnlyNodes(2);
|
||||
// allocate shard to first data node
|
||||
createIndex(
|
||||
indexName,
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put("index.routing.allocation.include._name", dataNodes.get(0))
|
||||
.build()
|
||||
);
|
||||
createIndex(indexName, indexSettings(1, 0).put("index.routing.allocation.include._name", dataNodes.get(0)).build());
|
||||
indexRandom(
|
||||
randomBoolean(),
|
||||
randomBoolean(),
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequestBuilder
|
|||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
import org.elasticsearch.cluster.routing.RecoverySource;
|
||||
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
||||
import org.elasticsearch.common.Priority;
|
||||
|
@ -182,10 +181,7 @@ public class FullRollingRestartIT extends ESIntegTestCase {
|
|||
* We have a fix for this to wait until we have allocated unallocated shards now so this shouldn't happen.
|
||||
*/
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, "6")
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, "0")
|
||||
.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), TimeValue.timeValueMinutes(1))
|
||||
indexSettings(6, 0).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), TimeValue.timeValueMinutes(1))
|
||||
).get();
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.elasticsearch.cluster.routing.ShardRouting;
|
|||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.CollectionUtils;
|
||||
import org.elasticsearch.core.TimeValue;
|
||||
import org.elasticsearch.index.IndexService;
|
||||
|
@ -41,8 +40,6 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
|
||||
|
@ -73,10 +70,7 @@ public class RecoveryWhileUnderLoadIT extends ESIntegTestCase {
|
|||
prepareCreate(
|
||||
"test",
|
||||
1,
|
||||
Settings.builder()
|
||||
.put(SETTING_NUMBER_OF_SHARDS, numberOfShards)
|
||||
.put(SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.ASYNC)
|
||||
indexSettings(numberOfShards, 1).put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.ASYNC)
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -137,10 +131,7 @@ public class RecoveryWhileUnderLoadIT extends ESIntegTestCase {
|
|||
prepareCreate(
|
||||
"test",
|
||||
1,
|
||||
Settings.builder()
|
||||
.put(SETTING_NUMBER_OF_SHARDS, numberOfShards)
|
||||
.put(SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.ASYNC)
|
||||
indexSettings(numberOfShards, 1).put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.ASYNC)
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -198,10 +189,7 @@ public class RecoveryWhileUnderLoadIT extends ESIntegTestCase {
|
|||
prepareCreate(
|
||||
"test",
|
||||
2,
|
||||
Settings.builder()
|
||||
.put(SETTING_NUMBER_OF_SHARDS, numberOfShards)
|
||||
.put(SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.ASYNC)
|
||||
indexSettings(numberOfShards, 1).put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.ASYNC)
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -314,11 +302,10 @@ public class RecoveryWhileUnderLoadIT extends ESIntegTestCase {
|
|||
prepareCreate(
|
||||
"test",
|
||||
3,
|
||||
Settings.builder()
|
||||
.put(SETTING_NUMBER_OF_SHARDS, numShards)
|
||||
.put(SETTING_NUMBER_OF_REPLICAS, numReplicas)
|
||||
.put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.ASYNC)
|
||||
.put(IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), randomFrom("100ms", "1s", "5s", "30s", "60s"))
|
||||
indexSettings(numShards, numReplicas).put(
|
||||
IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(),
|
||||
Translog.Durability.ASYNC
|
||||
).put(IndexService.RETENTION_LEASE_SYNC_INTERVAL_SETTING.getKey(), randomFrom("100ms", "1s", "5s", "30s", "60s"))
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -401,10 +401,7 @@ public class RelocationIT extends ESIntegTestCase {
|
|||
|
||||
final String p_node = internalCluster().startNode();
|
||||
|
||||
prepareCreate(
|
||||
indexName,
|
||||
Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
).get();
|
||||
prepareCreate(indexName, indexSettings(1, 0)).get();
|
||||
|
||||
internalCluster().startNode();
|
||||
internalCluster().startNode();
|
||||
|
|
|
@ -79,10 +79,7 @@ public class TruncatedRecoveryIT extends ESIntegTestCase {
|
|||
assertAcked(
|
||||
prepareCreate("test").setMapping("field1", "type=text", "the_id", "type=text")
|
||||
.setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numberOfShards())
|
||||
.put("index.routing.allocation.include._name", primariesNode.getNode().getName())
|
||||
indexSettings(numberOfShards(), 0).put("index.routing.allocation.include._name", primariesNode.getNode().getName())
|
||||
)
|
||||
); // only allocate on the lucky node
|
||||
|
||||
|
|
|
@ -52,8 +52,6 @@ import java.util.Map;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.filter;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.significantTerms;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.significantText;
|
||||
|
@ -438,8 +436,7 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase {
|
|||
|
||||
private void indexEqualTestData() throws ExecutionException, InterruptedException {
|
||||
assertAcked(
|
||||
prepareCreate("test").setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0))
|
||||
.setMapping("text", "type=text,fielddata=true", "class", "type=keyword")
|
||||
prepareCreate("test").setSettings(indexSettings(1, 0)).setMapping("text", "type=text,fielddata=true", "class", "type=keyword")
|
||||
);
|
||||
createIndex("idx_unmapped");
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ package org.elasticsearch.search.aggregations.bucket;
|
|||
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter;
|
||||
|
@ -22,8 +21,6 @@ import org.elasticsearch.xcontent.XContentType;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.filter;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.significantTerms;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||
|
@ -46,10 +43,7 @@ public class TermsShardMinDocCountIT extends ESIntegTestCase {
|
|||
} else {
|
||||
textMappings = "type=text,fielddata=true";
|
||||
}
|
||||
assertAcked(
|
||||
prepareCreate(index).setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0))
|
||||
.setMapping("text", textMappings)
|
||||
);
|
||||
assertAcked(prepareCreate(index).setSettings(indexSettings(1, 0)).setMapping("text", textMappings));
|
||||
List<IndexRequestBuilder> indexBuilders = new ArrayList<>();
|
||||
|
||||
addTermsDocs("1", 1, 0, indexBuilders);// high score but low doc freq
|
||||
|
@ -115,10 +109,7 @@ public class TermsShardMinDocCountIT extends ESIntegTestCase {
|
|||
if (termtype.equals("text")) {
|
||||
termMappings += ",fielddata=true";
|
||||
}
|
||||
assertAcked(
|
||||
prepareCreate(index).setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0))
|
||||
.setMapping("text", termMappings)
|
||||
);
|
||||
assertAcked(prepareCreate(index).setSettings(indexSettings(1, 0)).setMapping("text", termMappings));
|
||||
List<IndexRequestBuilder> indexBuilders = new ArrayList<>();
|
||||
|
||||
addTermsDocs("1", 1, indexBuilders);// low doc freq but high score
|
||||
|
|
|
@ -444,18 +444,12 @@ public class FieldCapabilitiesIT extends ESIntegTestCase {
|
|||
private void populateTimeRangeIndices() throws Exception {
|
||||
internalCluster().ensureAtLeastNumDataNodes(2);
|
||||
assertAcked(
|
||||
prepareCreate("log-index-1").setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, between(1, 5))
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
).setMapping("timestamp", "type=date", "field1", "type=keyword")
|
||||
prepareCreate("log-index-1").setSettings(indexSettings(between(1, 5), 1))
|
||||
.setMapping("timestamp", "type=date", "field1", "type=keyword")
|
||||
);
|
||||
assertAcked(
|
||||
prepareCreate("log-index-2").setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, between(1, 5))
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
).setMapping("timestamp", "type=date", "field1", "type=long")
|
||||
prepareCreate("log-index-2").setSettings(indexSettings(between(1, 5), 1))
|
||||
.setMapping("timestamp", "type=date", "field1", "type=long")
|
||||
);
|
||||
List<IndexRequestBuilder> reqs = new ArrayList<>();
|
||||
reqs.add(client().prepareIndex("log-index-1").setSource("timestamp", "2015-07-08"));
|
||||
|
@ -510,10 +504,7 @@ public class FieldCapabilitiesIT extends ESIntegTestCase {
|
|||
public void testNoActiveCopy() throws Exception {
|
||||
assertAcked(
|
||||
prepareCreate("log-index-inactive").setSettings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, between(1, 5))
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put("index.routing.allocation.require._id", "unknown")
|
||||
indexSettings(between(1, 5), 1).put("index.routing.allocation.require._id", "unknown")
|
||||
).setWaitForActiveShards(ActiveShardCount.NONE).setMapping("timestamp", "type=date", "field1", "type=keyword")
|
||||
);
|
||||
{
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.elasticsearch.xcontent.XContentFactory;
|
|||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.common.lucene.search.function.CombineFunction.REPLACE;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.boolQuery;
|
||||
|
@ -773,10 +772,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
|||
|
||||
// #11277
|
||||
public void testFromSize() throws Exception {
|
||||
Builder settings = Settings.builder();
|
||||
settings.put(SETTING_NUMBER_OF_SHARDS, 1);
|
||||
settings.put(SETTING_NUMBER_OF_REPLICAS, 0);
|
||||
assertAcked(prepareCreate("test").setSettings(settings));
|
||||
assertAcked(prepareCreate("test").setSettings(indexSettings(1, 0)));
|
||||
for (int i = 0; i < 5; i++) {
|
||||
client().prepareIndex("test").setId("" + i).setSource("text", "hello world").get();
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.moreLikeThisQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||
|
@ -319,7 +318,7 @@ public class MoreLikeThisIT extends ESIntegTestCase {
|
|||
|
||||
// Issue #3039
|
||||
public void testMoreLikeThisIssueRoutingNotSerialized() throws Exception {
|
||||
assertAcked(prepareCreate("foo", 2, Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 2).put(SETTING_NUMBER_OF_REPLICAS, 0)));
|
||||
assertAcked(prepareCreate("foo", 2, indexSettings(2, 0)));
|
||||
ensureGreen();
|
||||
|
||||
client().prepareIndex("foo")
|
||||
|
|
|
@ -22,8 +22,6 @@ import java.util.HashSet;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
|
@ -43,11 +41,7 @@ public class SearchReplicaSelectionIT extends ESIntegTestCase {
|
|||
// We grab a client directly to avoid using a randomizing client that might set a search preference.
|
||||
Client client = internalCluster().coordOnlyNodeClient();
|
||||
|
||||
client.admin()
|
||||
.indices()
|
||||
.prepareCreate("test")
|
||||
.setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 2))
|
||||
.get();
|
||||
client.admin().indices().prepareCreate("test").setSettings(indexSettings(1, 2)).get();
|
||||
ensureGreen();
|
||||
|
||||
client.prepareIndex("test").setSource("field", "value").get();
|
||||
|
|
|
@ -503,9 +503,7 @@ public class SearchScrollIT extends ESIntegTestCase {
|
|||
|
||||
public void testStringSortMissingAscTerminates() throws Exception {
|
||||
assertAcked(
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
).setMapping("no_field", "type=keyword", "some_field", "type=keyword")
|
||||
prepareCreate("test").setSettings(indexSettings(1, 0)).setMapping("no_field", "type=keyword", "some_field", "type=keyword")
|
||||
);
|
||||
client().prepareIndex("test").setId("1").setSource("some_field", "test").get();
|
||||
refresh();
|
||||
|
@ -685,22 +683,8 @@ public class SearchScrollIT extends ESIntegTestCase {
|
|||
|
||||
public void testRestartDataNodesDuringScrollSearch() throws Exception {
|
||||
final String dataNode = internalCluster().startDataOnlyNode();
|
||||
createIndex(
|
||||
"demo",
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put("index.routing.allocation.include._name", dataNode)
|
||||
.build()
|
||||
);
|
||||
createIndex(
|
||||
"prod",
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put("index.routing.allocation.include._name", dataNode)
|
||||
.build()
|
||||
);
|
||||
createIndex("demo", indexSettings(1, 0).put("index.routing.allocation.include._name", dataNode).build());
|
||||
createIndex("prod", indexSettings(1, 0).put("index.routing.allocation.include._name", dataNode).build());
|
||||
int numDocs = randomIntBetween(10, 100);
|
||||
for (int i = 0; i < numDocs; i++) {
|
||||
index("demo", "demo-" + i, Map.of());
|
||||
|
|
|
@ -39,8 +39,6 @@ import java.util.List;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static org.elasticsearch.action.support.WriteRequest.RefreshPolicy.IMMEDIATE;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.boolQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.queryStringQuery;
|
||||
|
@ -310,7 +308,7 @@ public class SimpleSearchIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testSimpleTerminateAfterCount() throws Exception {
|
||||
prepareCreate("test").setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0)).get();
|
||||
prepareCreate("test").setSettings(indexSettings(1, 0)).get();
|
||||
ensureGreen();
|
||||
int max = randomIntBetween(3, 29);
|
||||
List<IndexRequestBuilder> docbuilders = new ArrayList<>(max);
|
||||
|
@ -344,9 +342,7 @@ public class SimpleSearchIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testSimpleIndexSortEarlyTerminate() throws Exception {
|
||||
prepareCreate("test").setSettings(
|
||||
Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0).put("index.sort.field", "rank")
|
||||
).setMapping("rank", "type=integer").get();
|
||||
prepareCreate("test").setSettings(indexSettings(1, 0).put("index.sort.field", "rank")).setMapping("rank", "type=integer").get();
|
||||
ensureGreen();
|
||||
int max = randomIntBetween(3, 29);
|
||||
List<IndexRequestBuilder> docbuilders = new ArrayList<>(max);
|
||||
|
|
|
@ -27,8 +27,6 @@ import java.util.Locale;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
|
@ -51,12 +49,7 @@ public class FieldUsageStatsIT extends ESIntegTestCase {
|
|||
public void testFieldUsageStats() throws ExecutionException, InterruptedException {
|
||||
internalCluster().ensureAtLeastNumDataNodes(2);
|
||||
int numShards = randomIntBetween(1, 2);
|
||||
assertAcked(
|
||||
client().admin()
|
||||
.indices()
|
||||
.prepareCreate("test")
|
||||
.setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, numShards).put(SETTING_NUMBER_OF_REPLICAS, 1))
|
||||
);
|
||||
assertAcked(client().admin().indices().prepareCreate("test").setSettings(indexSettings(numShards, 1)));
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd", Locale.ROOT);
|
||||
LocalDate date = LocalDate.of(2015, 9, 1);
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.elasticsearch.cluster.ClusterState;
|
|||
import org.elasticsearch.cluster.routing.GroupShardsIterator;
|
||||
import org.elasticsearch.cluster.routing.ShardIterator;
|
||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.core.TimeValue;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.index.search.stats.SearchStats.Stats;
|
||||
|
@ -36,8 +35,6 @@ import java.util.Set;
|
|||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
|
||||
|
@ -83,11 +80,7 @@ public class SearchStatsIT extends ESIntegTestCase {
|
|||
final int shardsIdx1 = randomIntBetween(1, 10); // we make sure each node gets at least a single shard...
|
||||
final int shardsIdx2 = Math.max(numNodes - shardsIdx1, randomIntBetween(1, 10));
|
||||
assertThat(numNodes, lessThanOrEqualTo(shardsIdx1 + shardsIdx2));
|
||||
assertAcked(
|
||||
prepareCreate("test1").setSettings(
|
||||
Settings.builder().put(SETTING_NUMBER_OF_SHARDS, shardsIdx1).put(SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
)
|
||||
);
|
||||
assertAcked(prepareCreate("test1").setSettings(indexSettings(shardsIdx1, 0)));
|
||||
int docsTest1 = scaledRandomIntBetween(3 * shardsIdx1, 5 * shardsIdx1);
|
||||
for (int i = 0; i < docsTest1; i++) {
|
||||
client().prepareIndex("test1").setId(Integer.toString(i)).setSource("field", "value").get();
|
||||
|
@ -95,11 +88,7 @@ public class SearchStatsIT extends ESIntegTestCase {
|
|||
refresh();
|
||||
}
|
||||
}
|
||||
assertAcked(
|
||||
prepareCreate("test2").setSettings(
|
||||
Settings.builder().put(SETTING_NUMBER_OF_SHARDS, shardsIdx2).put(SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
)
|
||||
);
|
||||
assertAcked(prepareCreate("test2").setSettings(indexSettings(shardsIdx2, 0)));
|
||||
int docsTest2 = scaledRandomIntBetween(3 * shardsIdx2, 5 * shardsIdx2);
|
||||
for (int i = 0; i < docsTest2; i++) {
|
||||
client().prepareIndex("test2").setId(Integer.toString(i)).setSource("field", "value").get();
|
||||
|
|
|
@ -55,8 +55,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import static org.elasticsearch.action.support.WriteRequest.RefreshPolicy.IMMEDIATE;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.common.util.CollectionUtils.iterableAsArrayList;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
|
||||
|
@ -1315,10 +1313,7 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase {
|
|||
|
||||
// see #3555
|
||||
public void testPrunedSegments() throws IOException {
|
||||
createIndexAndMappingAndSettings(
|
||||
Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0).build(),
|
||||
completionMappingBuilder
|
||||
);
|
||||
createIndexAndMappingAndSettings(indexSettings(1, 0).build(), completionMappingBuilder);
|
||||
|
||||
client().prepareIndex(INDEX)
|
||||
.setId("1")
|
||||
|
|
|
@ -47,7 +47,6 @@ import java.util.Map.Entry;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchQuery;
|
||||
import static org.elasticsearch.search.suggest.SuggestBuilders.phraseSuggestion;
|
||||
|
@ -181,10 +180,7 @@ public class SuggestSearchIT extends ESIntegTestCase {
|
|||
// see #3037
|
||||
public void testSuggestModes() throws IOException {
|
||||
CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(
|
||||
Settings.builder()
|
||||
.put(SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put("index.analysis.analyzer.biword.tokenizer", "standard")
|
||||
indexSettings(1, 0).put("index.analysis.analyzer.biword.tokenizer", "standard")
|
||||
.putList("index.analysis.analyzer.biword.filter", "shingler", "lowercase")
|
||||
.put("index.analysis.filter.shingler.type", "shingle")
|
||||
.put("index.analysis.filter.shingler.min_shingle_size", 2)
|
||||
|
@ -241,7 +237,7 @@ public class SuggestSearchIT extends ESIntegTestCase {
|
|||
|
||||
// see #2729
|
||||
public void testSizeOneShard() throws Exception {
|
||||
prepareCreate("test").setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0)).get();
|
||||
prepareCreate("test").setSettings(indexSettings(1, 0)).get();
|
||||
ensureGreen();
|
||||
|
||||
for (int i = 0; i < 15; i++) {
|
||||
|
|
|
@ -55,14 +55,7 @@ public class BlobStoreIncrementalityIT extends AbstractSnapshotIntegTestCase {
|
|||
internalCluster().startMasterOnlyNode();
|
||||
final String primaryNode = internalCluster().startDataOnlyNode();
|
||||
final String indexName = "test-index";
|
||||
createIndex(
|
||||
indexName,
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), 0)
|
||||
.build()
|
||||
);
|
||||
createIndex(indexName, indexSettings(1, 1).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), 0).build());
|
||||
ensureYellow(indexName);
|
||||
final String newPrimary = internalCluster().startDataOnlyNode();
|
||||
final Collection<String> toDelete = new ArrayList<>();
|
||||
|
|
|
@ -297,14 +297,7 @@ public class RestoreSnapshotIT extends AbstractSnapshotIntegTestCase {
|
|||
logger.info("--> delete the index and recreate it with foo field");
|
||||
cluster().wipeIndices("test-idx");
|
||||
assertAcked(
|
||||
prepareCreate(
|
||||
"test-idx",
|
||||
2,
|
||||
Settings.builder()
|
||||
.put(SETTING_NUMBER_OF_SHARDS, numShards.numPrimaries)
|
||||
.put(SETTING_NUMBER_OF_REPLICAS, between(0, 1))
|
||||
.put("refresh_interval", 5, TimeUnit.SECONDS)
|
||||
)
|
||||
prepareCreate("test-idx", 2, indexSettings(numShards.numPrimaries, between(0, 1)).put("refresh_interval", 5, TimeUnit.SECONDS))
|
||||
);
|
||||
assertAcked(client().admin().indices().preparePutMapping("test-idx").setSource("foo", "type=text"));
|
||||
ensureGreen();
|
||||
|
|
|
@ -1080,13 +1080,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas
|
|||
);
|
||||
|
||||
// Create index on 2 nodes and make sure each node has a primary by setting no replicas
|
||||
assertAcked(
|
||||
prepareCreate(
|
||||
"test-idx",
|
||||
2,
|
||||
Settings.builder().put("number_of_replicas", 0).put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, randomIntBetween(2, 10))
|
||||
)
|
||||
);
|
||||
assertAcked(prepareCreate("test-idx", 2, indexSettingsNoReplicas(randomIntBetween(2, 10))));
|
||||
indexRandomDocs("test-idx", 100);
|
||||
|
||||
// Pick one node and block it
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.elasticsearch.cluster.routing.allocation.RoutingExplanations;
|
|||
import org.elasticsearch.cluster.routing.allocation.command.AllocateReplicaAllocationCommand;
|
||||
import org.elasticsearch.cluster.routing.allocation.decider.Decision;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.TransportAddress;
|
||||
import org.elasticsearch.common.xcontent.ChunkedToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentHelper;
|
||||
|
@ -310,11 +309,8 @@ public class ClusterRerouteResponseTests extends ESTestCase {
|
|||
.put(
|
||||
IndexMetadata.builder("index")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), true)
|
||||
indexSettings(1, 0).put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), true)
|
||||
.put(IndexSettings.MAX_SCRIPT_FIELDS_SETTING.getKey(), 10)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.build()
|
||||
)
|
||||
|
|
|
@ -226,11 +226,7 @@ public class AnalysisStatsTests extends AbstractWireSerializingTestCase<Analysis
|
|||
public void testAccountsRegularIndices() {
|
||||
String mapping = """
|
||||
{"properties":{"bar":{"type":"text","analyzer":"german"}}}""";
|
||||
Settings settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.build();
|
||||
Settings settings = indexSettings(Version.CURRENT, 4, 1).build();
|
||||
Metadata metadata = new Metadata.Builder().put(new IndexMetadata.Builder("foo").settings(settings).putMapping(mapping)).build();
|
||||
{
|
||||
AnalysisStats analysisStats = AnalysisStats.of(metadata, () -> {});
|
||||
|
@ -269,11 +265,7 @@ public class AnalysisStatsTests extends AbstractWireSerializingTestCase<Analysis
|
|||
public void testIgnoreSystemIndices() {
|
||||
String mapping = """
|
||||
{"properties":{"bar":{"type":"text","analyzer":"german"}}}""";
|
||||
Settings settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.build();
|
||||
Settings settings = indexSettings(Version.CURRENT, 4, 1).build();
|
||||
IndexMetadata.Builder indexMetadata = new IndexMetadata.Builder("foo").settings(settings).putMapping(mapping).system(true);
|
||||
Metadata metadata = new Metadata.Builder().put(indexMetadata).build();
|
||||
AnalysisStats analysisStats = AnalysisStats.of(metadata, () -> {});
|
||||
|
@ -281,12 +273,7 @@ public class AnalysisStatsTests extends AbstractWireSerializingTestCase<Analysis
|
|||
}
|
||||
|
||||
public void testChecksForCancellation() {
|
||||
Settings settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.build();
|
||||
IndexMetadata.Builder indexMetadata = new IndexMetadata.Builder("foo").settings(settings);
|
||||
IndexMetadata.Builder indexMetadata = new IndexMetadata.Builder("foo").settings(indexSettings(Version.CURRENT, 4, 1));
|
||||
Metadata metadata = new Metadata.Builder().put(indexMetadata).build();
|
||||
expectThrows(
|
||||
TaskCancelledException.class,
|
||||
|
|
|
@ -32,11 +32,7 @@ import java.util.List;
|
|||
|
||||
public class MappingStatsTests extends AbstractWireSerializingTestCase<MappingStats> {
|
||||
|
||||
private static final Settings SINGLE_SHARD_NO_REPLICAS = Settings.builder()
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.number_of_shards", 1)
|
||||
.put("index.version.created", Version.CURRENT)
|
||||
.build();
|
||||
private static final Settings SINGLE_SHARD_NO_REPLICAS = indexSettings(Version.CURRENT, 1, 0).build();
|
||||
|
||||
public static final String MAPPING_TEMPLATE = """
|
||||
{
|
||||
|
@ -469,12 +465,8 @@ public class MappingStatsTests extends AbstractWireSerializingTestCase<MappingSt
|
|||
public void testAccountsRegularIndices() {
|
||||
String mapping = """
|
||||
{"properties":{"bar":{"type":"long"}}}""";
|
||||
Settings settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.build();
|
||||
IndexMetadata.Builder indexMetadata = new IndexMetadata.Builder("foo").settings(settings).putMapping(mapping);
|
||||
IndexMetadata.Builder indexMetadata = new IndexMetadata.Builder("foo").settings(indexSettings(Version.CURRENT, 4, 1))
|
||||
.putMapping(mapping);
|
||||
Metadata metadata = new Metadata.Builder().put(indexMetadata).build();
|
||||
MappingStats mappingStats = MappingStats.of(metadata, () -> {});
|
||||
FieldStats expectedStats = new FieldStats("long");
|
||||
|
@ -486,11 +478,7 @@ public class MappingStatsTests extends AbstractWireSerializingTestCase<MappingSt
|
|||
public void testIgnoreSystemIndices() {
|
||||
String mapping = """
|
||||
{"properties":{"bar":{"type":"long"}}}""";
|
||||
Settings settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.build();
|
||||
Settings settings = indexSettings(Version.CURRENT, 4, 1).build();
|
||||
IndexMetadata.Builder indexMetadata = new IndexMetadata.Builder("foo").settings(settings).putMapping(mapping).system(true);
|
||||
Metadata metadata = new Metadata.Builder().put(indexMetadata).build();
|
||||
MappingStats mappingStats = MappingStats.of(metadata, () -> {});
|
||||
|
@ -498,11 +486,7 @@ public class MappingStatsTests extends AbstractWireSerializingTestCase<MappingSt
|
|||
}
|
||||
|
||||
public void testChecksForCancellation() {
|
||||
Settings settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.build();
|
||||
Settings settings = indexSettings(Version.CURRENT, 4, 1).build();
|
||||
IndexMetadata.Builder indexMetadata = new IndexMetadata.Builder("foo").settings(settings).putMapping("{}");
|
||||
Metadata metadata = new Metadata.Builder().put(indexMetadata).build();
|
||||
expectThrows(
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.elasticsearch.cluster.routing.RecoverySource;
|
|||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.shard.IndexShard;
|
||||
import org.elasticsearch.index.shard.ShardId;
|
||||
import org.elasticsearch.index.shard.ShardPath;
|
||||
|
@ -137,13 +136,7 @@ public class VersionStatsTests extends AbstractWireSerializingTestCase<VersionSt
|
|||
}
|
||||
|
||||
private static IndexMetadata indexMeta(String name, Version version, int primaryShards) {
|
||||
Settings settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, version)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, primaryShards)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, randomIntBetween(0, 3))
|
||||
.build();
|
||||
IndexMetadata.Builder indexMetadata = new IndexMetadata.Builder(name).settings(settings);
|
||||
return indexMetadata.build();
|
||||
return new IndexMetadata.Builder(name).settings(indexSettings(version, primaryShards, randomIntBetween(0, 3))).build();
|
||||
}
|
||||
|
||||
public static VersionStats randomInstance() {
|
||||
|
|
|
@ -178,11 +178,7 @@ public class MetadataRolloverServiceTests extends ESTestCase {
|
|||
String index2 = randomAlphaOfLength(10);
|
||||
String aliasWithNoWriteIndex = randomAlphaOfLength(10);
|
||||
Boolean firstIsWriteIndex = randomFrom(false, null);
|
||||
final Settings settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID())
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
final Settings settings = indexSettings(Version.CURRENT, 1, 0).put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID())
|
||||
.build();
|
||||
Metadata.Builder metadataBuilder = Metadata.builder()
|
||||
.put(
|
||||
|
@ -289,11 +285,7 @@ public class MetadataRolloverServiceTests extends ESTestCase {
|
|||
final RolloverRequest rolloverRequest = new RolloverRequest(alias, randomAlphaOfLength(10));
|
||||
final ActiveShardCount activeShardCount = randomBoolean() ? ActiveShardCount.ALL : ActiveShardCount.ONE;
|
||||
rolloverRequest.getCreateIndexRequest().waitForActiveShards(activeShardCount);
|
||||
final Settings settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID())
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
final Settings settings = indexSettings(Version.CURRENT, 1, 0).put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID())
|
||||
.build();
|
||||
rolloverRequest.getCreateIndexRequest().settings(settings);
|
||||
final CreateIndexClusterStateUpdateRequest createIndexRequest = MetadataRolloverService.prepareCreateIndexRequest(
|
||||
|
@ -312,11 +304,7 @@ public class MetadataRolloverServiceTests extends ESTestCase {
|
|||
final RolloverRequest rolloverRequest = new RolloverRequest(dataStream.getName(), randomAlphaOfLength(10));
|
||||
final ActiveShardCount activeShardCount = randomBoolean() ? ActiveShardCount.ALL : ActiveShardCount.ONE;
|
||||
rolloverRequest.getCreateIndexRequest().waitForActiveShards(activeShardCount);
|
||||
final Settings settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID())
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
final Settings settings = indexSettings(Version.CURRENT, 1, 0).put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID())
|
||||
.build();
|
||||
rolloverRequest.getCreateIndexRequest().settings(settings);
|
||||
final CreateIndexClusterStateUpdateRequest createIndexRequest = MetadataRolloverService.prepareDataStreamCreateIndexRequest(
|
||||
|
@ -748,15 +736,9 @@ public class MetadataRolloverServiceTests extends ESTestCase {
|
|||
}
|
||||
|
||||
private static IndexMetadata createMetadata(String indexName) {
|
||||
final Settings settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID())
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.build();
|
||||
return IndexMetadata.builder(indexName)
|
||||
.creationDate(System.currentTimeMillis() - TimeValue.timeValueHours(3).getMillis())
|
||||
.settings(settings)
|
||||
.settings(indexSettings(Version.CURRENT, 1, 0).put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID()))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -216,12 +216,10 @@ public class TransportRolloverActionTests extends ESTestCase {
|
|||
minPrimaryShardDocsCondition
|
||||
);
|
||||
|
||||
final Settings settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID())
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, randomIntBetween(1, 1000))
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, randomInt(10))
|
||||
.build();
|
||||
final Settings settings = indexSettings(Version.CURRENT, randomIntBetween(1, 1000), 10).put(
|
||||
IndexMetadata.SETTING_INDEX_UUID,
|
||||
UUIDs.randomBase64UUID()
|
||||
).build();
|
||||
|
||||
final IndexMetadata metadata = IndexMetadata.builder(randomAlphaOfLength(10))
|
||||
.creationDate(System.currentTimeMillis() - TimeValue.timeValueHours(randomIntBetween(5, 10)).getMillis())
|
||||
|
@ -285,12 +283,10 @@ public class TransportRolloverActionTests extends ESTestCase {
|
|||
minPrimaryShardDocsCondition
|
||||
);
|
||||
|
||||
final Settings settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID())
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, randomIntBetween(1, 1000))
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, randomInt(10))
|
||||
.build();
|
||||
final Settings settings = indexSettings(Version.CURRENT, randomIntBetween(1, 1000), 10).put(
|
||||
IndexMetadata.SETTING_INDEX_UUID,
|
||||
UUIDs.randomBase64UUID()
|
||||
).build();
|
||||
|
||||
final IndexMetadata metadata = IndexMetadata.builder(randomAlphaOfLength(10))
|
||||
.creationDate(System.currentTimeMillis() - TimeValue.timeValueHours(randomIntBetween(5, 10)).getMillis())
|
||||
|
@ -447,11 +443,7 @@ public class TransportRolloverActionTests extends ESTestCase {
|
|||
}
|
||||
|
||||
private static IndexMetadata createMetadata(String indexName) {
|
||||
final Settings settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID())
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
final Settings settings = indexSettings(Version.CURRENT, 1, 0).put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID())
|
||||
.build();
|
||||
return IndexMetadata.builder(indexName)
|
||||
.creationDate(System.currentTimeMillis() - TimeValue.timeValueHours(3).getMillis())
|
||||
|
|
|
@ -42,19 +42,7 @@ public class TransportUpdateSettingsActionTests extends ESTestCase {
|
|||
private static final ClusterState CLUSTER_STATE = ClusterState.builder(new ClusterName("test"))
|
||||
.metadata(
|
||||
Metadata.builder()
|
||||
.put(
|
||||
IndexMetadata.builder(".my-system")
|
||||
.system(true)
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.build()
|
||||
)
|
||||
.build(),
|
||||
true
|
||||
)
|
||||
.put(IndexMetadata.builder(".my-system").system(true).settings(indexSettings(Version.CURRENT, 1, 0)).build(), true)
|
||||
.build()
|
||||
)
|
||||
.build();
|
||||
|
|
|
@ -10,7 +10,6 @@ package org.elasticsearch.action.admin.indices.shrink;
|
|||
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
import org.elasticsearch.index.shard.DocsStats;
|
||||
import org.elasticsearch.index.store.StoreStats;
|
||||
|
@ -21,12 +20,9 @@ import static org.elasticsearch.action.admin.indices.shrink.ResizeNumberOfShards
|
|||
public class ResizeNumberOfShardsCalculatorTests extends ESTestCase {
|
||||
|
||||
public void testShrink() {
|
||||
Settings settings = Settings.builder()
|
||||
.put("index.number_of_shards", randomIntBetween(1, 5))
|
||||
.put("index.number_of_replicas", randomIntBetween(0, 5))
|
||||
.put("index.version.created", Version.CURRENT)
|
||||
IndexMetadata indexMetadata = IndexMetadata.builder("index")
|
||||
.settings(indexSettings(Version.CURRENT, randomIntBetween(1, 5), randomIntBetween(0, 5)))
|
||||
.build();
|
||||
IndexMetadata indexMetadata = IndexMetadata.builder("index").settings(settings).build();
|
||||
|
||||
ResizeNumberOfShardsCalculator.ShrinkShardsCalculator shrinkShardsCalculator =
|
||||
new ResizeNumberOfShardsCalculator.ShrinkShardsCalculator(
|
||||
|
@ -52,12 +48,9 @@ public class ResizeNumberOfShardsCalculatorTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testCloneInputs() {
|
||||
Settings settings = Settings.builder()
|
||||
.put("index.number_of_shards", randomIntBetween(1, 5))
|
||||
.put("index.number_of_replicas", randomIntBetween(0, 5))
|
||||
.put("index.version.created", Version.CURRENT)
|
||||
IndexMetadata indexMetadata = IndexMetadata.builder("index")
|
||||
.settings(indexSettings(Version.CURRENT, randomIntBetween(1, 5), randomIntBetween(0, 5)))
|
||||
.build();
|
||||
IndexMetadata indexMetadata = IndexMetadata.builder("index").settings(settings).build();
|
||||
|
||||
ResizeNumberOfShardsCalculator.CloneShardsCalculator cloneShardsCalculator =
|
||||
new ResizeNumberOfShardsCalculator.CloneShardsCalculator();
|
||||
|
@ -73,12 +66,9 @@ public class ResizeNumberOfShardsCalculatorTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testSplitInputs() {
|
||||
Settings settings = Settings.builder()
|
||||
.put("index.number_of_shards", randomIntBetween(2, 5))
|
||||
.put("index.number_of_replicas", randomIntBetween(0, 5))
|
||||
.put("index.version.created", Version.CURRENT)
|
||||
IndexMetadata indexMetadata = IndexMetadata.builder("index")
|
||||
.settings(indexSettings(Version.CURRENT, randomIntBetween(2, 5), randomIntBetween(0, 5)))
|
||||
.build();
|
||||
IndexMetadata indexMetadata = IndexMetadata.builder("index").settings(settings).build();
|
||||
|
||||
ResizeNumberOfShardsCalculator.SplitShardsCalculator splitShardsCalculator =
|
||||
new ResizeNumberOfShardsCalculator.SplitShardsCalculator();
|
||||
|
|
|
@ -80,11 +80,7 @@ public class TransportShardBulkActionTests extends IndexShardTestCase {
|
|||
private static final ActionListener<Void> ASSERTING_DONE_LISTENER = ActionTestUtils.assertNoFailureListener(r -> {});
|
||||
|
||||
private final ShardId shardId = new ShardId("index", "_na_", 0);
|
||||
private final Settings idxSettings = Settings.builder()
|
||||
.put("index.number_of_shards", 1)
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.version.created", Version.CURRENT.id)
|
||||
.build();
|
||||
private final Settings idxSettings = indexSettings(Version.CURRENT, 1, 0).build();
|
||||
|
||||
private IndexMetadata indexMetadata() throws IOException {
|
||||
return IndexMetadata.builder("index").putMapping("""
|
||||
|
|
|
@ -111,11 +111,10 @@ public class RequestDispatcherTests extends ESAllocationTestCase {
|
|||
}
|
||||
Metadata.Builder metadata = Metadata.builder();
|
||||
for (String index : allIndices) {
|
||||
final Settings.Builder settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, between(1, 10))
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, between(0, 2))
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT.minimumIndexCompatibilityVersion());
|
||||
metadata.put(IndexMetadata.builder(index).settings(settings));
|
||||
metadata.put(
|
||||
IndexMetadata.builder(index)
|
||||
.settings(indexSettings(Version.CURRENT.minimumIndexCompatibilityVersion(), between(1, 10), between(0, 2)))
|
||||
);
|
||||
}
|
||||
clusterState = newClusterState(metadata.build(), discoNodes.build());
|
||||
}
|
||||
|
@ -182,11 +181,10 @@ public class RequestDispatcherTests extends ESAllocationTestCase {
|
|||
}
|
||||
Metadata.Builder metadata = Metadata.builder();
|
||||
for (String index : allIndices) {
|
||||
final Settings.Builder settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, between(1, 10))
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, between(1, 3))
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT.minimumIndexCompatibilityVersion());
|
||||
metadata.put(IndexMetadata.builder(index).settings(settings));
|
||||
metadata.put(
|
||||
IndexMetadata.builder(index)
|
||||
.settings(indexSettings(Version.CURRENT.minimumIndexCompatibilityVersion(), between(1, 10), between(1, 3)))
|
||||
);
|
||||
}
|
||||
clusterState = newClusterState(metadata.build(), discoNodes.build());
|
||||
}
|
||||
|
@ -304,11 +302,10 @@ public class RequestDispatcherTests extends ESAllocationTestCase {
|
|||
}
|
||||
Metadata.Builder metadata = Metadata.builder();
|
||||
for (String index : allIndices) {
|
||||
final Settings.Builder settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, between(1, 10))
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, between(0, 3))
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT.minimumIndexCompatibilityVersion());
|
||||
metadata.put(IndexMetadata.builder(index).settings(settings));
|
||||
metadata.put(
|
||||
IndexMetadata.builder(index)
|
||||
.settings(indexSettings(Version.CURRENT.minimumIndexCompatibilityVersion(), between(1, 10), between(0, 3)))
|
||||
);
|
||||
}
|
||||
clusterState = newClusterState(metadata.build(), discoNodes.build());
|
||||
}
|
||||
|
@ -428,11 +425,10 @@ public class RequestDispatcherTests extends ESAllocationTestCase {
|
|||
}
|
||||
Metadata.Builder metadata = Metadata.builder();
|
||||
for (String index : allIndices) {
|
||||
final Settings.Builder settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, between(2, 10))
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, between(0, 2))
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT.minimumIndexCompatibilityVersion());
|
||||
metadata.put(IndexMetadata.builder(index).settings(settings));
|
||||
metadata.put(
|
||||
IndexMetadata.builder(index)
|
||||
.settings(indexSettings(Version.CURRENT.minimumIndexCompatibilityVersion(), between(2, 10), between(0, 2)))
|
||||
);
|
||||
}
|
||||
clusterState = newClusterState(metadata.build(), discoNodes.build());
|
||||
}
|
||||
|
@ -456,7 +452,6 @@ public class RequestDispatcherTests extends ESAllocationTestCase {
|
|||
);
|
||||
final RequestTracker requestTracker = new RequestTracker(dispatcher, clusterState.routingTable(), withFilter);
|
||||
transportService.requestTracker.set(requestTracker);
|
||||
final AtomicInteger failedTimes = new AtomicInteger();
|
||||
final Set<ShardId> allUnmatchedShardIds = new HashSet<>();
|
||||
for (String index : indices) {
|
||||
final Set<ShardId> shardIds = new HashSet<>();
|
||||
|
@ -519,7 +514,6 @@ public class RequestDispatcherTests extends ESAllocationTestCase {
|
|||
public void testStopAfterAllShardsUnmatched() throws Exception {
|
||||
final List<String> allIndices = IntStream.rangeClosed(1, 5).mapToObj(n -> "index_" + n).toList();
|
||||
final ClusterState clusterState;
|
||||
final boolean newVersionOnly = randomBoolean();
|
||||
{
|
||||
DiscoveryNodes.Builder discoNodes = DiscoveryNodes.builder();
|
||||
int numNodes = randomIntBetween(1, 10);
|
||||
|
@ -528,11 +522,10 @@ public class RequestDispatcherTests extends ESAllocationTestCase {
|
|||
}
|
||||
Metadata.Builder metadata = Metadata.builder();
|
||||
for (String index : allIndices) {
|
||||
final Settings.Builder settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, between(1, 10))
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, between(0, 2))
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT.minimumIndexCompatibilityVersion());
|
||||
metadata.put(IndexMetadata.builder(index).settings(settings));
|
||||
metadata.put(
|
||||
IndexMetadata.builder(index)
|
||||
.settings(indexSettings(Version.CURRENT.minimumIndexCompatibilityVersion(), between(1, 10), between(0, 2)))
|
||||
);
|
||||
}
|
||||
clusterState = newClusterState(metadata.build(), discoNodes.build());
|
||||
}
|
||||
|
@ -556,7 +549,6 @@ public class RequestDispatcherTests extends ESAllocationTestCase {
|
|||
);
|
||||
final RequestTracker requestTracker = new RequestTracker(dispatcher, clusterState.routingTable(), withFilter);
|
||||
transportService.requestTracker.set(requestTracker);
|
||||
final AtomicInteger failedTimes = new AtomicInteger();
|
||||
final List<String> unmatchedIndices = randomSubsetOf(between(1, indices.size()), indices);
|
||||
transportService.setTransportInterceptor(new TransportInterceptor.AsyncSender() {
|
||||
@Override
|
||||
|
|
|
@ -98,11 +98,7 @@ public class TransportMultiGetActionTests extends ESTestCase {
|
|||
.metadata(
|
||||
new Metadata.Builder().put(
|
||||
new IndexMetadata.Builder(index1.getName()).settings(
|
||||
Settings.builder()
|
||||
.put("index.version.created", Version.CURRENT)
|
||||
.put("index.number_of_shards", 1)
|
||||
.put("index.number_of_replicas", 1)
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, index1.getUUID())
|
||||
indexSettings(Version.CURRENT, 1, 1).put(IndexMetadata.SETTING_INDEX_UUID, index1.getUUID())
|
||||
)
|
||||
.putMapping(
|
||||
XContentHelper.convertToJson(
|
||||
|
@ -123,11 +119,7 @@ public class TransportMultiGetActionTests extends ESTestCase {
|
|||
)
|
||||
.put(
|
||||
new IndexMetadata.Builder(index2.getName()).settings(
|
||||
Settings.builder()
|
||||
.put("index.version.created", Version.CURRENT)
|
||||
.put("index.number_of_shards", 1)
|
||||
.put("index.number_of_replicas", 1)
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, index1.getUUID())
|
||||
indexSettings(Version.CURRENT, 1, 1).put(IndexMetadata.SETTING_INDEX_UUID, index1.getUUID())
|
||||
)
|
||||
.putMapping(
|
||||
XContentHelper.convertToJson(
|
||||
|
|
|
@ -66,9 +66,6 @@ import static java.util.Collections.emptyMap;
|
|||
import static java.util.Collections.emptySet;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_CREATION_DATE;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_INDEX_UUID;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_VERSION_CREATED;
|
||||
import static org.elasticsearch.cluster.routing.TestShardRouting.newShardRouting;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.setState;
|
||||
|
@ -129,11 +126,7 @@ public class TransportReplicationAllPermitsAcquisitionTests extends IndexShardTe
|
|||
RecoverySource.EmptyStoreRecoverySource.INSTANCE
|
||||
);
|
||||
|
||||
Settings indexSettings = Settings.builder()
|
||||
.put(SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(SETTING_INDEX_UUID, shardId.getIndex().getUUID())
|
||||
.put(SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
Settings indexSettings = indexSettings(Version.CURRENT, 1, 1).put(SETTING_INDEX_UUID, shardId.getIndex().getUUID())
|
||||
.put(SETTING_CREATION_DATE, System.currentTimeMillis())
|
||||
.build();
|
||||
|
||||
|
|
|
@ -99,11 +99,7 @@ public class TransportMultiTermVectorsActionTests extends ESTestCase {
|
|||
.metadata(
|
||||
new Metadata.Builder().put(
|
||||
new IndexMetadata.Builder(index1.getName()).settings(
|
||||
Settings.builder()
|
||||
.put("index.version.created", Version.CURRENT)
|
||||
.put("index.number_of_shards", 1)
|
||||
.put("index.number_of_replicas", 1)
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, index1.getUUID())
|
||||
indexSettings(Version.CURRENT, 1, 1).put(IndexMetadata.SETTING_INDEX_UUID, index1.getUUID())
|
||||
)
|
||||
.putMapping(
|
||||
XContentHelper.convertToJson(
|
||||
|
@ -124,11 +120,7 @@ public class TransportMultiTermVectorsActionTests extends ESTestCase {
|
|||
)
|
||||
.put(
|
||||
new IndexMetadata.Builder(index2.getName()).settings(
|
||||
Settings.builder()
|
||||
.put("index.version.created", Version.CURRENT)
|
||||
.put("index.number_of_shards", 1)
|
||||
.put("index.number_of_replicas", 1)
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, index1.getUUID())
|
||||
indexSettings(Version.CURRENT, 1, 1).put(IndexMetadata.SETTING_INDEX_UUID, index1.getUUID())
|
||||
)
|
||||
.putMapping(
|
||||
XContentHelper.convertToJson(
|
||||
|
|
|
@ -112,11 +112,8 @@ public class ComponentTemplateTests extends SimpleDiffableSerializationTestCase<
|
|||
}
|
||||
|
||||
private static Settings randomSettings() {
|
||||
return Settings.builder()
|
||||
.put(IndexMetadata.SETTING_BLOCKS_READ, randomBoolean())
|
||||
return indexSettings(randomIntBetween(1, 10), randomIntBetween(0, 5)).put(IndexMetadata.SETTING_BLOCKS_READ, randomBoolean())
|
||||
.put(IndexMetadata.SETTING_BLOCKS_WRITE, randomBoolean())
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, randomIntBetween(1, 10))
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, randomIntBetween(0, 5))
|
||||
.put(IndexMetadata.SETTING_BLOCKS_WRITE, randomBoolean())
|
||||
.put(IndexMetadata.SETTING_PRIORITY, randomIntBetween(0, 100000))
|
||||
.build();
|
||||
|
|
|
@ -127,11 +127,8 @@ public class ComposableIndexTemplateTests extends SimpleDiffableSerializationTes
|
|||
}
|
||||
|
||||
private static Settings randomSettings() {
|
||||
return Settings.builder()
|
||||
.put(IndexMetadata.SETTING_BLOCKS_READ, randomBoolean())
|
||||
return indexSettings(randomIntBetween(1, 10), randomIntBetween(0, 5)).put(IndexMetadata.SETTING_BLOCKS_READ, randomBoolean())
|
||||
.put(IndexMetadata.SETTING_BLOCKS_WRITE, randomBoolean())
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, randomIntBetween(1, 10))
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, randomIntBetween(0, 5))
|
||||
.put(IndexMetadata.SETTING_BLOCKS_WRITE, randomBoolean())
|
||||
.put(IndexMetadata.SETTING_PRIORITY, randomIntBetween(0, 100000))
|
||||
.build();
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.elasticsearch.cluster.routing.ShardRouting;
|
|||
import org.elasticsearch.cluster.routing.ShardRoutingHelper;
|
||||
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
||||
import org.elasticsearch.common.UUIDs;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.core.TimeValue;
|
||||
import org.elasticsearch.index.shard.DocsStats;
|
||||
import org.elasticsearch.index.shard.IndexingStats;
|
||||
|
@ -38,15 +37,7 @@ import static org.mockito.Mockito.when;
|
|||
public class IndexMetadataStatsTests extends ESTestCase {
|
||||
public void testFromStatsCreation() {
|
||||
final String indexName = "idx";
|
||||
final IndexMetadata indexMetadata = IndexMetadata.builder(indexName)
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 3)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.build()
|
||||
)
|
||||
.build();
|
||||
final IndexMetadata indexMetadata = IndexMetadata.builder(indexName).settings(indexSettings(Version.CURRENT, 3, 1)).build();
|
||||
|
||||
final IndicesStatsResponse response = mock(IndicesStatsResponse.class);
|
||||
final IndexStats indexStats = mock(IndexStats.class);
|
||||
|
|
|
@ -79,13 +79,7 @@ public class IndexMetadataTests extends ESTestCase {
|
|||
Double indexWriteLoadForecast = randomBoolean() ? randomDoubleBetween(0.0, 128, true) : null;
|
||||
Long shardSizeInBytesForecast = randomBoolean() ? randomLongBetween(1024, 10240) : null;
|
||||
IndexMetadata metadata = IndexMetadata.builder("foo")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put("index.version.created", 1)
|
||||
.put("index.number_of_shards", numShard)
|
||||
.put("index.number_of_replicas", numberOfReplicas)
|
||||
.build()
|
||||
)
|
||||
.settings(indexSettings(numShard, numberOfReplicas).put("index.version.created", 1))
|
||||
.creationDate(randomLong())
|
||||
.primaryTerm(0, 2)
|
||||
.setRoutingNumShards(32)
|
||||
|
@ -176,13 +170,7 @@ public class IndexMetadataTests extends ESTestCase {
|
|||
public void testSelectShrinkShards() {
|
||||
int numberOfReplicas = randomIntBetween(0, 10);
|
||||
IndexMetadata metadata = IndexMetadata.builder("foo")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put("index.version.created", 1)
|
||||
.put("index.number_of_shards", 32)
|
||||
.put("index.number_of_replicas", numberOfReplicas)
|
||||
.build()
|
||||
)
|
||||
.settings(indexSettings(32, numberOfReplicas).put("index.version.created", 1))
|
||||
.creationDate(randomLong())
|
||||
.build();
|
||||
Set<ShardId> shardIds = IndexMetadata.selectShrinkShards(0, metadata, 8);
|
||||
|
@ -226,25 +214,13 @@ public class IndexMetadataTests extends ESTestCase {
|
|||
int numTargetShards = randomFrom(4, 6, 8, 12);
|
||||
|
||||
IndexMetadata split = IndexMetadata.builder("foo")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put("index.version.created", 1)
|
||||
.put("index.number_of_shards", 2)
|
||||
.put("index.number_of_replicas", 0)
|
||||
.build()
|
||||
)
|
||||
.settings(indexSettings(2, 0).put("index.version.created", 1))
|
||||
.creationDate(randomLong())
|
||||
.setRoutingNumShards(numTargetShards * 2)
|
||||
.build();
|
||||
|
||||
IndexMetadata shrink = IndexMetadata.builder("foo")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put("index.version.created", 1)
|
||||
.put("index.number_of_shards", 32)
|
||||
.put("index.number_of_replicas", 0)
|
||||
.build()
|
||||
)
|
||||
.settings(indexSettings(32, 0).put("index.version.created", 1))
|
||||
.creationDate(randomLong())
|
||||
.build();
|
||||
int shard = randomIntBetween(0, numTargetShards - 1);
|
||||
|
@ -265,13 +241,7 @@ public class IndexMetadataTests extends ESTestCase {
|
|||
|
||||
public void testSelectSplitShard() {
|
||||
IndexMetadata metadata = IndexMetadata.builder("foo")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put("index.version.created", 1)
|
||||
.put("index.number_of_shards", 2)
|
||||
.put("index.number_of_replicas", 0)
|
||||
.build()
|
||||
)
|
||||
.settings(indexSettings(2, 0).put("index.version.created", 1))
|
||||
.creationDate(randomLong())
|
||||
.setRoutingNumShards(4)
|
||||
.build();
|
||||
|
@ -301,12 +271,7 @@ public class IndexMetadataTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testIndexFormat() {
|
||||
Settings defaultSettings = Settings.builder()
|
||||
.put("index.version.created", 1)
|
||||
.put("index.number_of_shards", 1)
|
||||
.put("index.number_of_replicas", 1)
|
||||
.build();
|
||||
|
||||
Settings defaultSettings = indexSettings(1, 1).put("index.version.created", 1).build();
|
||||
// matching version
|
||||
{
|
||||
IndexMetadata metadata = IndexMetadata.builder("foo")
|
||||
|
@ -446,10 +411,7 @@ public class IndexMetadataTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testIsHidden() {
|
||||
Settings.Builder settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, randomIntBetween(1, 8))
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT);
|
||||
Settings.Builder settings = indexSettings(Version.CURRENT, randomIntBetween(1, 8), 0);
|
||||
IndexMetadata indexMetadata = IndexMetadata.builder("test").settings(settings).build();
|
||||
assertFalse(indexMetadata.isHidden());
|
||||
|
||||
|
@ -480,11 +442,7 @@ public class IndexMetadataTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testLifeCyclePolicyName() {
|
||||
Settings.Builder settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, randomIntBetween(1, 8))
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT);
|
||||
|
||||
Settings.Builder settings = indexSettings(Version.CURRENT, randomIntBetween(1, 8), 0);
|
||||
IndexMetadata idxMeta1 = IndexMetadata.builder("test").settings(settings).build();
|
||||
|
||||
// null means no policy
|
||||
|
@ -535,12 +493,7 @@ public class IndexMetadataTests extends ESTestCase {
|
|||
}
|
||||
|
||||
private static Settings indexSettingsWithDataTier(String dataTier) {
|
||||
return Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(DataTier.TIER_PREFERENCE, dataTier)
|
||||
.build();
|
||||
return indexSettings(Version.CURRENT, 1, 0).put(DataTier.TIER_PREFERENCE, dataTier).build();
|
||||
}
|
||||
|
||||
private IndexMetadataStats randomIndexStats(int numberOfShards) {
|
||||
|
|
|
@ -152,14 +152,10 @@ public class IndexMetadataVerifierTests extends ESTestCase {
|
|||
}
|
||||
|
||||
private static IndexMetadata.Builder newIndexMetaBuilder(String name, Settings indexSettings) {
|
||||
final Settings settings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, randomIndexCompatibleVersion(random()))
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, between(0, 5))
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, between(1, 5))
|
||||
.put(IndexMetadata.SETTING_CREATION_DATE, randomNonNegativeLong())
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID(random()))
|
||||
.put(indexSettings)
|
||||
.build();
|
||||
final Settings settings = indexSettings(randomIndexCompatibleVersion(random()), between(1, 5), between(0, 5)).put(
|
||||
IndexMetadata.SETTING_CREATION_DATE,
|
||||
randomNonNegativeLong()
|
||||
).put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID(random())).put(indexSettings).build();
|
||||
final IndexMetadata.Builder indexMetadataBuilder = IndexMetadata.builder(name).settings(settings);
|
||||
if (randomBoolean()) {
|
||||
indexMetadataBuilder.state(IndexMetadata.State.CLOSE);
|
||||
|
|
|
@ -125,9 +125,7 @@ public class MetadataIndexTemplateServiceTests extends ESSingleNodeTestCase {
|
|||
PutRequest request = new PutRequest("test", "test_replicas");
|
||||
request.patterns(singletonList("test_shards_wait*"));
|
||||
|
||||
Settings.Builder settingsBuilder = builder().put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, "1")
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, "1")
|
||||
.put(IndexMetadata.SETTING_WAIT_FOR_ACTIVE_SHARDS.getKey(), "2");
|
||||
Settings.Builder settingsBuilder = indexSettings(1, 1).put(IndexMetadata.SETTING_WAIT_FOR_ACTIVE_SHARDS.getKey(), "2");
|
||||
|
||||
request.settings(settingsBuilder.build());
|
||||
|
||||
|
@ -140,9 +138,7 @@ public class MetadataIndexTemplateServiceTests extends ESSingleNodeTestCase {
|
|||
PutRequest request = new PutRequest("test", "test_specified_replicas");
|
||||
request.patterns(singletonList("test_shards_wait*"));
|
||||
|
||||
Settings.Builder settingsBuilder = builder().put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, "1")
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, "1")
|
||||
.put(IndexMetadata.SETTING_WAIT_FOR_ACTIVE_SHARDS.getKey(), "3");
|
||||
Settings.Builder settingsBuilder = indexSettings(1, 1).put(IndexMetadata.SETTING_WAIT_FOR_ACTIVE_SHARDS.getKey(), "3");
|
||||
|
||||
request.settings(settingsBuilder.build());
|
||||
|
||||
|
@ -1908,16 +1904,8 @@ public class MetadataIndexTemplateServiceTests extends ESSingleNodeTestCase {
|
|||
)
|
||||
.put(
|
||||
IndexMetadata.builder(".ds-unreferenced-000001")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, "uuid2")
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.build()
|
||||
)
|
||||
.settings(indexSettings(Version.CURRENT, 1, 0).put(IndexMetadata.SETTING_INDEX_UUID, "uuid2"))
|
||||
)
|
||||
.build()
|
||||
)
|
||||
.build();
|
||||
|
||||
|
@ -1945,16 +1933,8 @@ public class MetadataIndexTemplateServiceTests extends ESSingleNodeTestCase {
|
|||
)
|
||||
.put(
|
||||
IndexMetadata.builder(".ds-logs-mysql-default-000001")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, "uuid")
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.build()
|
||||
)
|
||||
.settings(indexSettings(Version.CURRENT, 1, 0).put(IndexMetadata.SETTING_INDEX_UUID, "uuid"))
|
||||
)
|
||||
.build()
|
||||
)
|
||||
.build();
|
||||
|
||||
|
@ -2068,16 +2048,8 @@ public class MetadataIndexTemplateServiceTests extends ESSingleNodeTestCase {
|
|||
)
|
||||
.put(
|
||||
IndexMetadata.builder(".ds-unreferenced-000001")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, "uuid2")
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.build()
|
||||
)
|
||||
.settings(indexSettings(Version.CURRENT, 1, 0).put(IndexMetadata.SETTING_INDEX_UUID, "uuid2"))
|
||||
)
|
||||
.build()
|
||||
)
|
||||
.build();
|
||||
|
||||
|
@ -2105,16 +2077,8 @@ public class MetadataIndexTemplateServiceTests extends ESSingleNodeTestCase {
|
|||
)
|
||||
.put(
|
||||
IndexMetadata.builder(".ds-logs-mysql-default-000001")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, "uuid")
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.build()
|
||||
)
|
||||
.settings(indexSettings(Version.CURRENT, 1, 0).put(IndexMetadata.SETTING_INDEX_UUID, "uuid"))
|
||||
)
|
||||
.build()
|
||||
)
|
||||
.build();
|
||||
|
||||
|
|
|
@ -620,26 +620,8 @@ public class MetadataTests extends ESTestCase {
|
|||
|
||||
public void testFindMappings() throws IOException {
|
||||
Metadata metadata = Metadata.builder()
|
||||
.put(
|
||||
IndexMetadata.builder("index1")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
)
|
||||
.putMapping(FIND_MAPPINGS_TEST_ITEM)
|
||||
)
|
||||
.put(
|
||||
IndexMetadata.builder("index2")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
)
|
||||
.putMapping(FIND_MAPPINGS_TEST_ITEM)
|
||||
)
|
||||
.put(IndexMetadata.builder("index1").settings(indexSettings(Version.CURRENT, 1, 0)).putMapping(FIND_MAPPINGS_TEST_ITEM))
|
||||
.put(IndexMetadata.builder("index2").settings(indexSettings(Version.CURRENT, 1, 0)).putMapping(FIND_MAPPINGS_TEST_ITEM))
|
||||
.build();
|
||||
|
||||
{
|
||||
|
@ -684,16 +666,7 @@ public class MetadataTests extends ESTestCase {
|
|||
);
|
||||
|
||||
Metadata metadata = Metadata.builder()
|
||||
.put(
|
||||
IndexMetadata.builder("index1")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
)
|
||||
.putMapping(originalMappingMetadata)
|
||||
)
|
||||
.put(IndexMetadata.builder("index1").settings(indexSettings(Version.CURRENT, 1, 0)).putMapping(originalMappingMetadata))
|
||||
.build();
|
||||
|
||||
{
|
||||
|
@ -729,36 +702,9 @@ public class MetadataTests extends ESTestCase {
|
|||
}
|
||||
|
||||
Metadata metadata = Metadata.builder()
|
||||
.put(
|
||||
IndexMetadata.builder("index1")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
)
|
||||
.putMapping(mapping)
|
||||
)
|
||||
.put(
|
||||
IndexMetadata.builder("index2")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
)
|
||||
.putMapping(mapping)
|
||||
)
|
||||
.put(
|
||||
IndexMetadata.builder("index3")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
)
|
||||
.putMapping(mapping)
|
||||
)
|
||||
.put(IndexMetadata.builder("index1").settings(indexSettings(Version.CURRENT, 1, 0)).putMapping(mapping))
|
||||
.put(IndexMetadata.builder("index2").settings(indexSettings(Version.CURRENT, 1, 0)).putMapping(mapping))
|
||||
.put(IndexMetadata.builder("index3").settings(indexSettings(Version.CURRENT, 1, 0)).putMapping(mapping))
|
||||
.build();
|
||||
|
||||
{
|
||||
|
@ -1269,14 +1215,7 @@ public class MetadataTests extends ESTestCase {
|
|||
|
||||
b = Metadata.builder();
|
||||
b.put(
|
||||
IndexMetadata.builder("index1")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
)
|
||||
.putAlias(new AliasMetadata.Builder("my-alias"))
|
||||
IndexMetadata.builder("index1").settings(indexSettings(Version.CURRENT, 1, 0)).putAlias(new AliasMetadata.Builder("my-alias"))
|
||||
);
|
||||
|
||||
addDataStream("d1", b);
|
||||
|
@ -1304,14 +1243,7 @@ public class MetadataTests extends ESTestCase {
|
|||
|
||||
b = Metadata.builder();
|
||||
b.put(
|
||||
IndexMetadata.builder("index1")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
)
|
||||
.putAlias(new AliasMetadata.Builder("my-alias"))
|
||||
IndexMetadata.builder("index1").settings(indexSettings(Version.CURRENT, 1, 0)).putAlias(new AliasMetadata.Builder("my-alias"))
|
||||
);
|
||||
b.dataStreams(Map.of("d1", createDataStream("d1")), Map.of("my-alias", new DataStreamAlias("my-alias", List.of("d1"), null, null)));
|
||||
e = expectThrows(IllegalStateException.class, b::build);
|
||||
|
|
|
@ -236,9 +236,6 @@ public class SystemIndexMetadataUpgradeServiceTests extends ESTestCase {
|
|||
}
|
||||
|
||||
private static Settings.Builder getSettingsBuilder() {
|
||||
return Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1);
|
||||
return indexSettings(Version.CURRENT, 1, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,8 +44,6 @@ import java.util.Locale;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.cluster.routing.RoutingNodesHelper.shardsWithState;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
|
@ -138,10 +136,8 @@ public class FailedNodeRoutingTests extends ESAllocationTestCase {
|
|||
logger.info("--> creating some indices");
|
||||
for (int i = 0; i < randomIntBetween(2, 5); i++) {
|
||||
String name = "index_" + randomAlphaOfLength(8).toLowerCase(Locale.ROOT);
|
||||
Settings.Builder settingsBuilder = Settings.builder()
|
||||
.put(SETTING_NUMBER_OF_SHARDS, randomIntBetween(1, 4))
|
||||
.put(SETTING_NUMBER_OF_REPLICAS, randomIntBetween(2, 4));
|
||||
CreateIndexRequest request = new CreateIndexRequest(name, settingsBuilder.build()).waitForActiveShards(ActiveShardCount.NONE);
|
||||
CreateIndexRequest request = new CreateIndexRequest(name, indexSettings(randomIntBetween(1, 4), randomIntBetween(2, 4)).build())
|
||||
.waitForActiveShards(ActiveShardCount.NONE);
|
||||
state = cluster.createIndex(state, request);
|
||||
assertTrue(state.metadata().hasIndex(name));
|
||||
}
|
||||
|
|
|
@ -496,14 +496,7 @@ public class IndexBalanceTests extends ESAllocationTestCase {
|
|||
IntFunction<String> assignmentFunction
|
||||
) {
|
||||
final var inSyncIds = randomList(numberOfShards, numberOfShards, () -> UUIDs.randomBase64UUID(random()));
|
||||
final var indexMetadataBuilder = IndexMetadata.builder(indexName)
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_shards", numberOfShards)
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.version.created", Version.CURRENT)
|
||||
.build()
|
||||
);
|
||||
final var indexMetadataBuilder = IndexMetadata.builder(indexName).settings(indexSettings(Version.CURRENT, numberOfShards, 0));
|
||||
for (int shardId = 0; shardId < numberOfShards; shardId++) {
|
||||
indexMetadataBuilder.putInSyncAllocationIds(shardId, Set.of(inSyncIds.get(shardId)));
|
||||
}
|
||||
|
|
|
@ -312,23 +312,13 @@ public class ResizeAllocationDeciderTests extends ESAllocationTestCase {
|
|||
|
||||
public void testGetForcedInitialShardAllocationToNodes() {
|
||||
var source = IndexMetadata.builder("source")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, "uuid-1")
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
)
|
||||
.settings(indexSettings(Version.CURRENT, 1, 0).put(IndexMetadata.SETTING_INDEX_UUID, "uuid-1"))
|
||||
.build();
|
||||
var target = IndexMetadata.builder("target")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.INDEX_RESIZE_SOURCE_NAME.getKey(), "source")
|
||||
indexSettings(Version.CURRENT, 1, 0).put(IndexMetadata.INDEX_RESIZE_SOURCE_NAME.getKey(), "source")
|
||||
.put(IndexMetadata.INDEX_RESIZE_SOURCE_UUID.getKey(), "uuid-1")
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, "uuid-2")
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
)
|
||||
.build();
|
||||
var clusterState = ClusterState.builder(new ClusterName("test-cluster"))
|
||||
|
|
|
@ -119,11 +119,10 @@ public class ClusterAllocationSimulationTests extends ESAllocationTestCase {
|
|||
metadataBuilder.put(
|
||||
IndexMetadata.builder(indexName)
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, shardCount)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, replicaCount)
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_PREFIX + ".fake_tier", tier)
|
||||
indexSettings(Version.CURRENT, shardCount, replicaCount).put(
|
||||
IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_PREFIX + ".fake_tier",
|
||||
tier
|
||||
)
|
||||
)
|
||||
.indexWriteLoadForecast(indexWriteLoad)
|
||||
.shardSizeInBytesForecast(shardSize)
|
||||
|
|
|
@ -329,12 +329,7 @@ public class ClusterInfoSimulatorTests extends ESTestCase {
|
|||
|
||||
private static void addIndex(Metadata.Builder metadataBuilder, RoutingTable.Builder routingTableBuilder, ShardRouting shardRouting) {
|
||||
var name = shardRouting.getIndexName();
|
||||
var settings = Settings.builder()
|
||||
.put("index.number_of_shards", 1)
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.version.created", Version.CURRENT)
|
||||
.build();
|
||||
metadataBuilder.put(IndexMetadata.builder(name).settings(settings));
|
||||
metadataBuilder.put(IndexMetadata.builder(name).settings(indexSettings(Version.CURRENT, 1, 0)));
|
||||
routingTableBuilder.add(IndexRoutingTable.builder(metadataBuilder.get(name).getIndex()).addShard(shardRouting));
|
||||
}
|
||||
|
||||
|
|
|
@ -602,14 +602,7 @@ public class DesiredBalanceComputerTests extends ESTestCase {
|
|||
var inSyncIds = randomList(shards * (replicas + 1), shards * (replicas + 1), () -> UUIDs.randomBase64UUID(random()));
|
||||
var shardSize = randomLongBetween(10_000_000L, 10_000_000_000L);
|
||||
|
||||
var indexMetadataBuilder = IndexMetadata.builder(indexName)
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_shards", shards)
|
||||
.put("index.number_of_replicas", replicas)
|
||||
.put("index.version.created", Version.CURRENT)
|
||||
.build()
|
||||
);
|
||||
var indexMetadataBuilder = IndexMetadata.builder(indexName).settings(indexSettings(Version.CURRENT, shards, replicas));
|
||||
if (randomBoolean()) {
|
||||
indexMetadataBuilder.shardSizeInBytesForecast(smallShardSizeDeviation(shardSize));
|
||||
}
|
||||
|
@ -749,14 +742,7 @@ public class DesiredBalanceComputerTests extends ESTestCase {
|
|||
|
||||
metadataBuilder.put(
|
||||
IndexMetadata.builder(indexName)
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_shards", 1)
|
||||
.put("index.number_of_replicas", 1)
|
||||
.put("index.version.created", Version.CURRENT)
|
||||
.put("index.routing.allocation.exclude._name", "node-2")
|
||||
.build()
|
||||
)
|
||||
.settings(indexSettings(Version.CURRENT, 1, 1).put("index.routing.allocation.exclude._name", "node-2"))
|
||||
);
|
||||
|
||||
var indexId = metadataBuilder.get(indexName).getIndex();
|
||||
|
@ -789,14 +775,7 @@ public class DesiredBalanceComputerTests extends ESTestCase {
|
|||
|
||||
metadataBuilder.put(
|
||||
IndexMetadata.builder(indexName)
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put("index.number_of_shards", 1)
|
||||
.put("index.number_of_replicas", 0)
|
||||
.put("index.version.created", Version.CURRENT)
|
||||
.put("index.routing.allocation.exclude._name", "node-2")
|
||||
.build()
|
||||
)
|
||||
.settings(indexSettings(Version.CURRENT, 1, 0).put("index.routing.allocation.exclude._name", "node-2"))
|
||||
);
|
||||
|
||||
var indexId = metadataBuilder.get(indexName).getIndex();
|
||||
|
|
|
@ -297,12 +297,8 @@ public class FilterAllocationDeciderTests extends ESAllocationTestCase {
|
|||
public void testGetForcedInitialShardAllocationToNodes() {
|
||||
var index = IndexMetadata.builder("index")
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put("index.routing.allocation.initial_recovery._id", "node-1")
|
||||
indexSettings(Version.CURRENT, 1, 0).put("index.routing.allocation.initial_recovery._id", "node-1")
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, "uuid")
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
)
|
||||
.build();
|
||||
var clusterState = ClusterState.builder(new ClusterName("test-cluster"))
|
||||
|
|
|
@ -75,14 +75,7 @@ public class NodeReplacementAllocationDeciderTests extends ESAllocationTestCase
|
|||
private final String idxName = "test-idx";
|
||||
private final String idxUuid = "test-idx-uuid";
|
||||
private final IndexMetadata indexMetadata = IndexMetadata.builder(idxName)
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, idxUuid)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.build()
|
||||
)
|
||||
.settings(indexSettings(Version.CURRENT, 1, 0).put(IndexMetadata.SETTING_INDEX_UUID, idxUuid))
|
||||
.build();
|
||||
|
||||
public void testNoReplacements() {
|
||||
|
|
|
@ -69,14 +69,7 @@ public class NodeShutdownAllocationDeciderTests extends ESAllocationTestCase {
|
|||
private final String idxName = "test-idx";
|
||||
private final String idxUuid = "test-idx-uuid";
|
||||
private final IndexMetadata indexMetadata = IndexMetadata.builder(idxName)
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, idxUuid)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.build()
|
||||
)
|
||||
.settings(indexSettings(Version.CURRENT, 1, 0).put(IndexMetadata.SETTING_INDEX_UUID, idxUuid))
|
||||
.build();
|
||||
|
||||
private static final List<SingleNodeShutdownMetadata.Type> REMOVE_SHUTDOWN_TYPES = List.of(
|
||||
|
|
|
@ -1066,14 +1066,7 @@ public class ScopedSettingsTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public static IndexMetadata newIndexMeta(String name, Settings indexSettings) {
|
||||
Settings build = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(indexSettings)
|
||||
.build();
|
||||
IndexMetadata metadata = IndexMetadata.builder(name).settings(build).build();
|
||||
return metadata;
|
||||
return IndexMetadata.builder(name).settings(indexSettings(Version.CURRENT, 1, 0).put(indexSettings)).build();
|
||||
}
|
||||
|
||||
public void testKeyPattern() {
|
||||
|
|
|
@ -107,14 +107,7 @@ public class ClusterStateUpdatersTests extends ESTestCase {
|
|||
|
||||
private IndexMetadata createIndexMetadata(final String name, final Settings settings) {
|
||||
return IndexMetadata.builder(name)
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID())
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(settings)
|
||||
)
|
||||
.settings(indexSettings(Version.CURRENT, 1, 0).put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID()).put(settings))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -33,11 +33,7 @@ import static org.mockito.Mockito.when;
|
|||
|
||||
public class DanglingIndicesStateTests extends ESTestCase {
|
||||
|
||||
private static final Settings indexSettings = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.build();
|
||||
private static final Settings indexSettings = indexSettings(Version.CURRENT, 1, 0).build();
|
||||
|
||||
public void testDanglingIndicesAreDiscovered() throws Exception {
|
||||
try (NodeEnvironment env = newNodeEnvironment()) {
|
||||
|
|
|
@ -171,16 +171,9 @@ public class GatewayMetaStatePersistedStateTests extends ESTestCase {
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
private IndexMetadata createIndexMetadata(String indexName, int numberOfShards, long version) {
|
||||
private static IndexMetadata createIndexMetadata(String indexName, int numberOfShards, long version) {
|
||||
return IndexMetadata.builder(indexName)
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, indexName)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numberOfShards)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.build()
|
||||
)
|
||||
.settings(indexSettings(Version.CURRENT, numberOfShards, 0).put(IndexMetadata.SETTING_INDEX_UUID, indexName).build())
|
||||
.version(version)
|
||||
.build();
|
||||
}
|
||||
|
|
|
@ -45,14 +45,7 @@ public class MetaStateServiceTests extends ESTestCase {
|
|||
|
||||
private static IndexMetadata indexMetadata(String name) {
|
||||
return IndexMetadata.builder(name)
|
||||
.settings(
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID())
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.build()
|
||||
)
|
||||
.settings(indexSettings(Version.CURRENT, 1, 0).put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID()))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -279,12 +279,8 @@ public class PriorityComparatorTests extends ESTestCase {
|
|||
}
|
||||
|
||||
private static Settings buildSettings(int creationDate, int priority) {
|
||||
return Settings.builder()
|
||||
.put(IndexMetadata.SETTING_CREATION_DATE, creationDate)
|
||||
return indexSettings(Version.CURRENT, 1, 0).put(IndexMetadata.SETTING_CREATION_DATE, creationDate)
|
||||
.put(IndexMetadata.SETTING_PRIORITY, priority)
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -220,11 +220,7 @@ public class IndexSettingsTests extends ESTestCase {
|
|||
public void testNodeSettingsAreContained() {
|
||||
final int numShards = randomIntBetween(1, 10);
|
||||
final int numReplicas = randomIntBetween(0, 10);
|
||||
Settings theSettings = Settings.builder()
|
||||
.put("index.foo.bar", 0)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, numReplicas)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numShards)
|
||||
.build();
|
||||
Settings theSettings = indexSettings(numShards, numReplicas).put("index.foo.bar", 0).build();
|
||||
|
||||
Settings nodeSettings = Settings.builder().put("index.foo.bar", 43).build();
|
||||
final AtomicInteger indexValue = new AtomicInteger(0);
|
||||
|
@ -236,44 +232,18 @@ public class IndexSettingsTests extends ESTestCase {
|
|||
assertEquals(0, indexValue.get());
|
||||
|
||||
assertTrue(
|
||||
settings.updateIndexMetadata(
|
||||
newIndexMeta(
|
||||
"index",
|
||||
Settings.builder()
|
||||
.put("index.foo.bar", 42)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, numReplicas + 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numShards)
|
||||
.build()
|
||||
)
|
||||
)
|
||||
settings.updateIndexMetadata(newIndexMeta("index", indexSettings(numShards, numReplicas + 1).put("index.foo.bar", 42).build()))
|
||||
);
|
||||
|
||||
assertEquals(42, indexValue.get());
|
||||
assertSame(nodeSettings, settings.getNodeSettings());
|
||||
|
||||
assertTrue(
|
||||
settings.updateIndexMetadata(
|
||||
newIndexMeta(
|
||||
"index",
|
||||
Settings.builder()
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, numReplicas + 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numShards)
|
||||
.build()
|
||||
)
|
||||
)
|
||||
);
|
||||
assertTrue(settings.updateIndexMetadata(newIndexMeta("index", indexSettings(numShards, numReplicas + 1).build())));
|
||||
assertEquals(43, indexValue.get());
|
||||
|
||||
}
|
||||
|
||||
public static IndexMetadata newIndexMeta(String name, Settings indexSettings) {
|
||||
Settings build = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(indexSettings)
|
||||
.build();
|
||||
return IndexMetadata.builder(name).settings(build).build();
|
||||
return IndexMetadata.builder(name).settings(indexSettings(Version.CURRENT, 1, 1).put(indexSettings)).build();
|
||||
}
|
||||
|
||||
public void testUpdateDurability() {
|
||||
|
|
|
@ -469,13 +469,6 @@ public class IndexingSlowLogTests extends ESTestCase {
|
|||
}
|
||||
|
||||
private IndexMetadata newIndexMeta(String name, Settings indexSettings) {
|
||||
Settings build = Settings.builder()
|
||||
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(indexSettings)
|
||||
.build();
|
||||
IndexMetadata metadata = IndexMetadata.builder(name).settings(build).build();
|
||||
return metadata;
|
||||
return IndexMetadata.builder(name).settings(indexSettings(Version.CURRENT, 1, 1).put(indexSettings)).build();
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue