Remove Settings.settingsBuilder.
We have both `Settings.settingsBuilder` and `Settings.builder` that do exactly the same thing, so we should keep only one. I kept `Settings.builder` since it has my preference but also it is the one that we use in examples of the Java API.
This commit is contained in:
parent
df8a971966
commit
42526ac28e
|
@ -148,7 +148,7 @@ public class PutRepositoryRequest extends AcknowledgedRequest<PutRepositoryReque
|
|||
* @return this request
|
||||
*/
|
||||
public PutRepositoryRequest settings(String source) {
|
||||
this.settings = Settings.settingsBuilder().loadFromSource(source).build();
|
||||
this.settings = Settings.builder().loadFromSource(source).build();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ public class ClusterUpdateSettingsRequest extends AcknowledgedRequest<ClusterUpd
|
|||
* Sets the source containing the transient settings to be updated. They will not survive a full cluster restart
|
||||
*/
|
||||
public ClusterUpdateSettingsRequest transientSettings(String source) {
|
||||
this.transientSettings = Settings.settingsBuilder().loadFromSource(source).build();
|
||||
this.transientSettings = Settings.builder().loadFromSource(source).build();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ public class ClusterUpdateSettingsRequest extends AcknowledgedRequest<ClusterUpd
|
|||
* Sets the source containing the persistent settings to be updated. They will get applied cross restarts
|
||||
*/
|
||||
public ClusterUpdateSettingsRequest persistentSettings(String source) {
|
||||
this.persistentSettings = Settings.settingsBuilder().loadFromSource(source).build();
|
||||
this.persistentSettings = Settings.builder().loadFromSource(source).build();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ import static org.elasticsearch.cluster.ClusterState.builder;
|
|||
* due to the update.
|
||||
*/
|
||||
final class SettingsUpdater {
|
||||
final Settings.Builder transientUpdates = Settings.settingsBuilder();
|
||||
final Settings.Builder persistentUpdates = Settings.settingsBuilder();
|
||||
final Settings.Builder transientUpdates = Settings.builder();
|
||||
final Settings.Builder persistentUpdates = Settings.builder();
|
||||
private final ClusterSettings clusterSettings;
|
||||
|
||||
SettingsUpdater(ClusterSettings clusterSettings) {
|
||||
|
@ -50,11 +50,11 @@ final class SettingsUpdater {
|
|||
|
||||
synchronized ClusterState updateSettings(final ClusterState currentState, Settings transientToApply, Settings persistentToApply) {
|
||||
boolean changed = false;
|
||||
Settings.Builder transientSettings = Settings.settingsBuilder();
|
||||
Settings.Builder transientSettings = Settings.builder();
|
||||
transientSettings.put(currentState.metaData().transientSettings());
|
||||
changed |= clusterSettings.updateDynamicSettings(transientToApply, transientSettings, transientUpdates, "transient");
|
||||
|
||||
Settings.Builder persistentSettings = Settings.settingsBuilder();
|
||||
Settings.Builder persistentSettings = Settings.builder();
|
||||
persistentSettings.put(currentState.metaData().persistentSettings());
|
||||
changed |= clusterSettings.updateDynamicSettings(persistentToApply, persistentSettings, persistentUpdates, "persistent");
|
||||
|
||||
|
|
|
@ -299,7 +299,7 @@ public class CreateSnapshotRequest extends MasterNodeRequest<CreateSnapshotReque
|
|||
* @return this request
|
||||
*/
|
||||
public CreateSnapshotRequest settings(String source) {
|
||||
this.settings = Settings.settingsBuilder().loadFromSource(source).build();
|
||||
this.settings = Settings.builder().loadFromSource(source).build();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -324,7 +324,7 @@ public class RestoreSnapshotRequest extends MasterNodeRequest<RestoreSnapshotReq
|
|||
* @return this request
|
||||
*/
|
||||
public RestoreSnapshotRequest settings(String source) {
|
||||
this.settings = Settings.settingsBuilder().loadFromSource(source).build();
|
||||
this.settings = Settings.builder().loadFromSource(source).build();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -441,7 +441,7 @@ public class RestoreSnapshotRequest extends MasterNodeRequest<RestoreSnapshotReq
|
|||
* Sets settings that should be added/changed in all restored indices
|
||||
*/
|
||||
public RestoreSnapshotRequest indexSettings(String source) {
|
||||
this.indexSettings = Settings.settingsBuilder().loadFromSource(source).build();
|
||||
this.indexSettings = Settings.builder().loadFromSource(source).build();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ public class CreateIndexRequest extends AcknowledgedRequest<CreateIndexRequest>
|
|||
* The settings to create the index with (either json/yaml/properties format)
|
||||
*/
|
||||
public CreateIndexRequest settings(String source) {
|
||||
this.settings = Settings.settingsBuilder().loadFromSource(source).build();
|
||||
this.settings = Settings.builder().loadFromSource(source).build();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ public class UpdateSettingsRequest extends AcknowledgedRequest<UpdateSettingsReq
|
|||
* Sets the settings to be updated (either json/yaml/properties format)
|
||||
*/
|
||||
public UpdateSettingsRequest settings(String source) {
|
||||
this.settings = Settings.settingsBuilder().loadFromSource(source).build();
|
||||
this.settings = Settings.builder().loadFromSource(source).build();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ public class PutIndexTemplateRequest extends MasterNodeRequest<PutIndexTemplateR
|
|||
* The settings to create the index template with (either json/yaml/properties format).
|
||||
*/
|
||||
public PutIndexTemplateRequest settings(String source) {
|
||||
this.settings = Settings.settingsBuilder().loadFromSource(source).build();
|
||||
this.settings = Settings.builder().loadFromSource(source).build();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ public class TransportPutIndexTemplateAction extends TransportMasterNodeAction<P
|
|||
if (cause.length() == 0) {
|
||||
cause = "api";
|
||||
}
|
||||
final Settings.Builder templateSettingsBuilder = Settings.settingsBuilder();
|
||||
final Settings.Builder templateSettingsBuilder = Settings.builder();
|
||||
templateSettingsBuilder.put(request.settings()).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX);
|
||||
indexScopedSettings.validate(templateSettingsBuilder);
|
||||
indexTemplateService.putTemplate(new MetaDataIndexTemplateService.PutRequest(cause, request.name())
|
||||
|
|
|
@ -179,7 +179,7 @@ final class Bootstrap {
|
|||
// We do not need to reload system properties here as we have already applied them in building the settings and
|
||||
// reloading could cause multiple prompts to the user for values if a system property was specified with a prompt
|
||||
// placeholder
|
||||
Settings nodeSettings = Settings.settingsBuilder()
|
||||
Settings nodeSettings = Settings.builder()
|
||||
.put(settings)
|
||||
.put(InternalSettingsPreparer.IGNORE_SYSTEM_PROPERTIES_SETTING.getKey(), true)
|
||||
.build();
|
||||
|
|
|
@ -57,8 +57,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
|
||||
/**
|
||||
* The transport client allows to create a client that is not part of the cluster, but simply connects to one
|
||||
* or more nodes directly by adding their respective addresses using {@link #addTransportAddress(org.elasticsearch.common.transport.TransportAddress)}.
|
||||
|
@ -107,7 +105,7 @@ public class TransportClient extends AbstractClient {
|
|||
}
|
||||
|
||||
private PluginsService newPluginService(final Settings settings) {
|
||||
final Settings.Builder settingsBuilder = settingsBuilder()
|
||||
final Settings.Builder settingsBuilder = Settings.builder()
|
||||
.put(NettyTransport.PING_SCHEDULE.getKey(), "5s") // enable by default the transport schedule ping interval
|
||||
.put(InternalSettingsPreparer.prepareSettings(settings))
|
||||
.put(NetworkService.NETWORK_SERVER.getKey(), false)
|
||||
|
|
|
@ -72,7 +72,6 @@ import java.util.function.Function;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodeFilters.OpType.AND;
|
||||
import static org.elasticsearch.cluster.node.DiscoveryNodeFilters.OpType.OR;
|
||||
import static org.elasticsearch.common.settings.Settings.readSettingsFromStream;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.elasticsearch.common.settings.Settings.writeSettingsToStream;
|
||||
|
||||
/**
|
||||
|
@ -694,7 +693,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, FromXContentBuild
|
|||
}
|
||||
|
||||
public Builder numberOfShards(int numberOfShards) {
|
||||
settings = settingsBuilder().put(settings).put(SETTING_NUMBER_OF_SHARDS, numberOfShards).build();
|
||||
settings = Settings.builder().put(settings).put(SETTING_NUMBER_OF_SHARDS, numberOfShards).build();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -703,7 +702,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, FromXContentBuild
|
|||
}
|
||||
|
||||
public Builder numberOfReplicas(int numberOfReplicas) {
|
||||
settings = settingsBuilder().put(settings).put(SETTING_NUMBER_OF_REPLICAS, numberOfReplicas).build();
|
||||
settings = Settings.builder().put(settings).put(SETTING_NUMBER_OF_REPLICAS, numberOfReplicas).build();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -712,7 +711,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, FromXContentBuild
|
|||
}
|
||||
|
||||
public Builder creationDate(long creationDate) {
|
||||
settings = settingsBuilder().put(settings).put(SETTING_CREATION_DATE, creationDate).build();
|
||||
settings = Settings.builder().put(settings).put(SETTING_CREATION_DATE, creationDate).build();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -989,7 +988,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, FromXContentBuild
|
|||
currentFieldName = parser.currentName();
|
||||
} else if (token == XContentParser.Token.START_OBJECT) {
|
||||
if (KEY_SETTINGS.equals(currentFieldName)) {
|
||||
builder.settings(Settings.settingsBuilder().put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered())));
|
||||
builder.settings(Settings.builder().put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered())));
|
||||
} else if (KEY_MAPPINGS.equals(currentFieldName)) {
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
|
|
|
@ -376,7 +376,7 @@ public class IndexTemplateMetaData extends AbstractDiffable<IndexTemplateMetaDat
|
|||
currentFieldName = parser.currentName();
|
||||
} else if (token == XContentParser.Token.START_OBJECT) {
|
||||
if ("settings".equals(currentFieldName)) {
|
||||
Settings.Builder templateSettingsBuilder = Settings.settingsBuilder();
|
||||
Settings.Builder templateSettingsBuilder = Settings.builder();
|
||||
templateSettingsBuilder.put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered())).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX);
|
||||
builder.settings(templateSettingsBuilder.build());
|
||||
} else if ("mappings".equals(currentFieldName)) {
|
||||
|
|
|
@ -76,7 +76,6 @@ import java.util.TreeMap;
|
|||
|
||||
import static java.util.Collections.unmodifiableSet;
|
||||
import static org.elasticsearch.common.settings.Settings.readSettingsFromStream;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.elasticsearch.common.settings.Settings.writeSettingsToStream;
|
||||
import static org.elasticsearch.common.util.set.Sets.newHashSet;
|
||||
|
||||
|
@ -181,7 +180,7 @@ public class MetaData implements Iterable<IndexMetaData>, Diffable<MetaData>, Fr
|
|||
this.version = version;
|
||||
this.transientSettings = transientSettings;
|
||||
this.persistentSettings = persistentSettings;
|
||||
this.settings = Settings.settingsBuilder().put(persistentSettings).put(transientSettings).build();
|
||||
this.settings = Settings.builder().put(persistentSettings).put(transientSettings).build();
|
||||
this.indices = indices;
|
||||
this.customs = customs;
|
||||
this.templates = templates;
|
||||
|
@ -925,7 +924,7 @@ public class MetaData implements Iterable<IndexMetaData>, Diffable<MetaData>, Fr
|
|||
throw new IndexNotFoundException(index);
|
||||
}
|
||||
put(IndexMetaData.builder(indexMetaData)
|
||||
.settings(settingsBuilder().put(indexMetaData.getSettings()).put(settings)));
|
||||
.settings(Settings.builder().put(indexMetaData.getSettings()).put(settings)));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -1124,7 +1123,7 @@ public class MetaData implements Iterable<IndexMetaData>, Diffable<MetaData>, Fr
|
|||
currentFieldName = parser.currentName();
|
||||
} else if (token == XContentParser.Token.START_OBJECT) {
|
||||
if ("settings".equals(currentFieldName)) {
|
||||
builder.persistentSettings(Settings.settingsBuilder().put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered())).build());
|
||||
builder.persistentSettings(Settings.builder().put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered())).build());
|
||||
} else if ("indices".equals(currentFieldName)) {
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
builder.put(IndexMetaData.Builder.fromXContent(parser), false);
|
||||
|
|
|
@ -86,7 +86,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_INDEX_UUI
|
|||
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.common.settings.Settings.settingsBuilder;
|
||||
|
||||
/**
|
||||
* Service responsible for submitting create index requests
|
||||
|
@ -175,7 +174,7 @@ public class MetaDataCreateIndexService extends AbstractComponent {
|
|||
}
|
||||
|
||||
public void createIndex(final CreateIndexClusterStateUpdateRequest request, final ActionListener<ClusterStateUpdateResponse> listener) {
|
||||
Settings.Builder updatedSettingsBuilder = Settings.settingsBuilder();
|
||||
Settings.Builder updatedSettingsBuilder = Settings.builder();
|
||||
updatedSettingsBuilder.put(request.settings()).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX);
|
||||
indexScopedSettings.validate(updatedSettingsBuilder);
|
||||
request.settings(updatedSettingsBuilder.build());
|
||||
|
@ -265,7 +264,7 @@ public class MetaDataCreateIndexService extends AbstractComponent {
|
|||
}
|
||||
}
|
||||
|
||||
Settings.Builder indexSettingsBuilder = settingsBuilder();
|
||||
Settings.Builder indexSettingsBuilder = Settings.builder();
|
||||
// apply templates, here, in reverse order, since first ones are better matching
|
||||
for (int i = templates.size() - 1; i >= 0; i--) {
|
||||
indexSettingsBuilder.put(templates.get(i).settings());
|
||||
|
|
|
@ -106,7 +106,7 @@ public class MetaDataIndexTemplateService extends AbstractComponent {
|
|||
}
|
||||
|
||||
public void putTemplate(final PutRequest request, final PutListener listener) {
|
||||
Settings.Builder updatedSettingsBuilder = Settings.settingsBuilder();
|
||||
Settings.Builder updatedSettingsBuilder = Settings.builder();
|
||||
updatedSettingsBuilder.put(request.settings).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX);
|
||||
request.settings(updatedSettingsBuilder.build());
|
||||
|
||||
|
|
|
@ -52,8 +52,6 @@ import java.util.Locale;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
|
||||
/**
|
||||
* Service responsible for submitting update index settings requests
|
||||
*/
|
||||
|
@ -124,7 +122,7 @@ public class MetaDataUpdateSettingsService extends AbstractComponent implements
|
|||
if (nrReplicasChanged.size() > 0) {
|
||||
// update settings and kick of a reroute (implicit) for them to take effect
|
||||
for (final Integer fNumberOfReplicas : nrReplicasChanged.keySet()) {
|
||||
Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, fNumberOfReplicas).build();
|
||||
Settings settings = Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, fNumberOfReplicas).build();
|
||||
final List<Index> indices = nrReplicasChanged.get(fNumberOfReplicas);
|
||||
|
||||
UpdateSettingsClusterStateUpdateRequest updateRequest = new UpdateSettingsClusterStateUpdateRequest()
|
||||
|
@ -152,7 +150,7 @@ public class MetaDataUpdateSettingsService extends AbstractComponent implements
|
|||
}
|
||||
|
||||
public void updateSettings(final UpdateSettingsClusterStateUpdateRequest request, final ActionListener<ClusterStateUpdateResponse> listener) {
|
||||
final Settings normalizedSettings = Settings.settingsBuilder().put(request.settings()).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX).build();
|
||||
final Settings normalizedSettings = Settings.builder().put(request.settings()).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX).build();
|
||||
Settings.Builder settingsForClosedIndices = Settings.builder();
|
||||
Settings.Builder settingsForOpenIndices = Settings.builder();
|
||||
Settings.Builder skipppedSettings = Settings.builder();
|
||||
|
@ -316,7 +314,7 @@ public class MetaDataUpdateSettingsService extends AbstractComponent implements
|
|||
if (Version.CURRENT.equals(indexMetaData.getCreationVersion()) == false) {
|
||||
// No reason to pollute the settings, we didn't really upgrade anything
|
||||
metaDataBuilder.put(IndexMetaData.builder(indexMetaData)
|
||||
.settings(settingsBuilder().put(indexMetaData.getSettings())
|
||||
.settings(Settings.builder().put(indexMetaData.getSettings())
|
||||
.put(IndexMetaData.SETTING_VERSION_MINIMUM_COMPATIBLE, entry.getValue().v2())
|
||||
.put(IndexMetaData.SETTING_VERSION_UPGRADED, entry.getValue().v1())
|
||||
)
|
||||
|
|
|
@ -154,7 +154,7 @@ public class RepositoriesMetaData extends AbstractDiffable<Custom> implements Me
|
|||
if (parser.nextToken() != XContentParser.Token.START_OBJECT) {
|
||||
throw new ElasticsearchParseException("failed to parse repository [{}], incompatible params", name);
|
||||
}
|
||||
settings = Settings.settingsBuilder().put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered())).build();
|
||||
settings = Settings.builder().put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered())).build();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("failed to parse repository [{}], unknown field [{}]", name, currentFieldName);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ import java.util.Set;
|
|||
|
||||
import static java.util.Collections.unmodifiableMap;
|
||||
import static org.elasticsearch.common.Strings.cleanPath;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
|
||||
/**
|
||||
* Configures log4j with a special set of replacements.
|
||||
|
@ -106,7 +105,7 @@ public class LogConfigurator {
|
|||
// TODO: this is partly a copy of InternalSettingsPreparer...we should pass in Environment and not do all this...
|
||||
Environment environment = new Environment(settings);
|
||||
|
||||
Settings.Builder settingsBuilder = settingsBuilder();
|
||||
Settings.Builder settingsBuilder = Settings.builder();
|
||||
if (resolveConfig) {
|
||||
resolveConfig(environment, settingsBuilder);
|
||||
}
|
||||
|
|
|
@ -427,7 +427,7 @@ public abstract class AbstractScopedSettings extends AbstractComponent {
|
|||
private boolean updateSettings(Settings toApply, Settings.Builder target, Settings.Builder updates, String type, boolean onlyDynamic) {
|
||||
boolean changed = false;
|
||||
final Set<String> toRemove = new HashSet<>();
|
||||
Settings.Builder settingsBuilder = Settings.settingsBuilder();
|
||||
Settings.Builder settingsBuilder = Settings.builder();
|
||||
for (Map.Entry<String, String> entry : toApply.getAsMap().entrySet()) {
|
||||
if (entry.getValue() == null) {
|
||||
toRemove.add(entry.getKey());
|
||||
|
|
|
@ -735,14 +735,10 @@ public final class Settings implements ToXContent {
|
|||
}
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a builder to be used in order to build settings.
|
||||
*/
|
||||
public static Builder settingsBuilder() {
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
|
@ -771,7 +767,7 @@ public final class Settings implements ToXContent {
|
|||
|
||||
/**
|
||||
* A builder allowing to put different settings and then {@link #build()} an immutable
|
||||
* settings implementation. Use {@link Settings#settingsBuilder()} in order to
|
||||
* settings implementation. Use {@link Settings#builder()} in order to
|
||||
* construct it.
|
||||
*/
|
||||
public static class Builder {
|
||||
|
|
|
@ -97,7 +97,7 @@ public final class SettingsFilter extends AbstractComponent {
|
|||
}
|
||||
|
||||
private static Settings filterSettings(Iterable<String> patterns, Settings settings) {
|
||||
Settings.Builder builder = Settings.settingsBuilder().put(settings);
|
||||
Settings.Builder builder = Settings.builder().put(settings);
|
||||
List<String> simpleMatchPatternList = new ArrayList<>();
|
||||
for (String pattern : patterns) {
|
||||
if (Regex.isSimpleMatchPattern(pattern)) {
|
||||
|
|
|
@ -73,7 +73,7 @@ import java.util.Map;
|
|||
public final class AnalysisModule extends AbstractModule {
|
||||
|
||||
static {
|
||||
Settings build = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
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)
|
||||
.build();
|
||||
|
|
|
@ -213,12 +213,12 @@ public class HunspellService extends AbstractComponent {
|
|||
private static Settings loadDictionarySettings(Path dir, Settings defaults) {
|
||||
Path file = dir.resolve("settings.yml");
|
||||
if (Files.exists(file)) {
|
||||
return Settings.settingsBuilder().loadFromPath(file).put(defaults).build();
|
||||
return Settings.builder().loadFromPath(file).put(defaults).build();
|
||||
}
|
||||
|
||||
file = dir.resolve("settings.json");
|
||||
if (Files.exists(file)) {
|
||||
return Settings.settingsBuilder().loadFromPath(file).put(defaults).build();
|
||||
return Settings.builder().loadFromPath(file).put(defaults).build();
|
||||
}
|
||||
|
||||
return defaults;
|
||||
|
|
|
@ -121,8 +121,6 @@ import java.util.concurrent.CountDownLatch;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
|
||||
/**
|
||||
* A node represent a node within a cluster (<tt>cluster.name</tt>). The {@link #client()} can be used
|
||||
* in order to use a {@link Client} to perform actions/operations against the cluster.
|
||||
|
@ -162,7 +160,7 @@ public class Node implements Closeable {
|
|||
}
|
||||
|
||||
protected Node(Environment tmpEnv, Version version, Collection<Class<? extends Plugin>> classpathPlugins) {
|
||||
Settings tmpSettings = settingsBuilder().put(tmpEnv.settings())
|
||||
Settings tmpSettings = Settings.builder().put(tmpEnv.settings())
|
||||
.put(Client.CLIENT_TYPE_SETTING_S.getKey(), CLIENT_TYPE).build();
|
||||
tmpSettings = TribeService.processSettings(tmpSettings);
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import static org.elasticsearch.common.Strings.cleanPath;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -65,7 +64,7 @@ public class InternalSettingsPreparer {
|
|||
* Prepares the settings by gathering all elasticsearch system properties and setting defaults.
|
||||
*/
|
||||
public static Settings prepareSettings(Settings input) {
|
||||
Settings.Builder output = settingsBuilder();
|
||||
Settings.Builder output = Settings.builder();
|
||||
initializeSettings(output, input, true);
|
||||
finalizeSettings(output, null, null);
|
||||
return output.build();
|
||||
|
@ -82,7 +81,7 @@ public class InternalSettingsPreparer {
|
|||
*/
|
||||
public static Environment prepareEnvironment(Settings input, Terminal terminal) {
|
||||
// just create enough settings to build the environment, to get the config dir
|
||||
Settings.Builder output = settingsBuilder();
|
||||
Settings.Builder output = Settings.builder();
|
||||
initializeSettings(output, input, true);
|
||||
Environment environment = new Environment(output.build());
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ public class PluginsService extends AbstractComponent {
|
|||
|
||||
public Settings updatedSettings() {
|
||||
Map<String, String> foundSettings = new HashMap<>();
|
||||
final Settings.Builder builder = Settings.settingsBuilder();
|
||||
final Settings.Builder builder = Settings.builder();
|
||||
for (Tuple<PluginInfo, Plugin> plugin : plugins) {
|
||||
Settings settings = plugin.v2().additionalSettings();
|
||||
for (String setting : settings.getAsMap().keySet()) {
|
||||
|
|
|
@ -67,10 +67,10 @@ public class RestUpdateSettingsAction extends BaseRestHandler {
|
|||
updateSettingsRequest.masterNodeTimeout(request.paramAsTime("master_timeout", updateSettingsRequest.masterNodeTimeout()));
|
||||
updateSettingsRequest.indicesOptions(IndicesOptions.fromRequest(request, updateSettingsRequest.indicesOptions()));
|
||||
|
||||
Settings.Builder updateSettings = Settings.settingsBuilder();
|
||||
Settings.Builder updateSettings = Settings.builder();
|
||||
String bodySettingsStr = request.content().toUtf8();
|
||||
if (Strings.hasText(bodySettingsStr)) {
|
||||
Settings buildSettings = Settings.settingsBuilder().loadFromSource(bodySettingsStr).build();
|
||||
Settings buildSettings = Settings.builder().loadFromSource(bodySettingsStr).build();
|
||||
for (Map.Entry<String, String> entry : buildSettings.getAsMap().entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String value = entry.getValue();
|
||||
|
|
|
@ -255,7 +255,7 @@ public class RestoreService extends AbstractComponent implements ClusterStateLis
|
|||
createIndexService.validateIndexName(renamedIndexName, currentState);
|
||||
createIndexService.validateIndexSettings(renamedIndexName, snapshotIndexMetaData.getSettings());
|
||||
IndexMetaData.Builder indexMdBuilder = IndexMetaData.builder(snapshotIndexMetaData).state(IndexMetaData.State.OPEN).index(renamedIndexName);
|
||||
indexMdBuilder.settings(Settings.settingsBuilder().put(snapshotIndexMetaData.getSettings()).put(IndexMetaData.SETTING_INDEX_UUID, Strings.randomBase64UUID()));
|
||||
indexMdBuilder.settings(Settings.builder().put(snapshotIndexMetaData.getSettings()).put(IndexMetaData.SETTING_INDEX_UUID, Strings.randomBase64UUID()));
|
||||
if (!request.includeAliases() && !snapshotIndexMetaData.getAliases().isEmpty()) {
|
||||
// Remove all aliases - they shouldn't be restored
|
||||
indexMdBuilder.removeAllAliases();
|
||||
|
@ -291,7 +291,7 @@ public class RestoreService extends AbstractComponent implements ClusterStateLis
|
|||
aliases.add(alias.value);
|
||||
}
|
||||
}
|
||||
indexMdBuilder.settings(Settings.settingsBuilder().put(snapshotIndexMetaData.getSettings()).put(IndexMetaData.SETTING_INDEX_UUID, currentIndexMetaData.getIndexUUID()));
|
||||
indexMdBuilder.settings(Settings.builder().put(snapshotIndexMetaData.getSettings()).put(IndexMetaData.SETTING_INDEX_UUID, currentIndexMetaData.getIndexUUID()));
|
||||
IndexMetaData updatedIndexMetaData = indexMdBuilder.index(renamedIndexName).build();
|
||||
rtBuilder.addAsRestore(updatedIndexMetaData, restoreSource);
|
||||
blocks.updateBlocks(updatedIndexMetaData);
|
||||
|
@ -388,7 +388,7 @@ public class RestoreService extends AbstractComponent implements ClusterStateLis
|
|||
if (changeSettings.names().isEmpty() && ignoreSettings.length == 0) {
|
||||
return indexMetaData;
|
||||
}
|
||||
Settings normalizedChangeSettings = Settings.settingsBuilder().put(changeSettings).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX).build();
|
||||
Settings normalizedChangeSettings = Settings.builder().put(changeSettings).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX).build();
|
||||
IndexMetaData.Builder builder = IndexMetaData.builder(indexMetaData);
|
||||
Map<String, String> settingsMap = new HashMap<>(indexMetaData.getSettings().getAsMap());
|
||||
List<String> simpleMatchPatterns = new ArrayList<>();
|
||||
|
|
|
@ -65,7 +65,6 @@ import java.util.concurrent.TimeUnit;
|
|||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static java.util.Collections.unmodifiableMap;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.elasticsearch.common.unit.SizeValue.parseSizeValue;
|
||||
import static org.elasticsearch.common.unit.TimeValue.timeValueMinutes;
|
||||
|
||||
|
@ -181,7 +180,7 @@ public class ThreadPool extends AbstractComponent implements Closeable {
|
|||
}
|
||||
|
||||
public Settings build() {
|
||||
return settingsBuilder().put(settings).build();
|
||||
return Settings.builder().put(settings).build();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -126,7 +126,6 @@ import static org.elasticsearch.common.settings.Setting.boolSetting;
|
|||
import static org.elasticsearch.common.settings.Setting.byteSizeSetting;
|
||||
import static org.elasticsearch.common.settings.Setting.intSetting;
|
||||
import static org.elasticsearch.common.settings.Setting.timeSetting;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.elasticsearch.common.transport.NetworkExceptionHelper.isCloseConnectionException;
|
||||
import static org.elasticsearch.common.transport.NetworkExceptionHelper.isConnectException;
|
||||
import static org.elasticsearch.common.util.concurrent.ConcurrentCollections.newConcurrentMap;
|
||||
|
@ -337,7 +336,7 @@ public class NettyTransport extends AbstractLifecycleComponent<Transport> implem
|
|||
profileSettings.toDelimitedString(','));
|
||||
continue;
|
||||
} else if (TransportSettings.DEFAULT_PROFILE.equals(name)) {
|
||||
profileSettings = settingsBuilder()
|
||||
profileSettings = Settings.builder()
|
||||
.put(profileSettings)
|
||||
.put("port", profileSettings.get("port", TransportSettings.PORT.get(this.settings)))
|
||||
.build();
|
||||
|
@ -348,7 +347,7 @@ public class NettyTransport extends AbstractLifecycleComponent<Transport> implem
|
|||
}
|
||||
|
||||
// merge fallback settings with default settings with profile settings so we have complete settings with default values
|
||||
Settings mergedSettings = settingsBuilder()
|
||||
Settings mergedSettings = Settings.builder()
|
||||
.put(fallbackSettings)
|
||||
.put(defaultSettings)
|
||||
.put(profileSettings)
|
||||
|
@ -414,7 +413,7 @@ public class NettyTransport extends AbstractLifecycleComponent<Transport> implem
|
|||
}
|
||||
|
||||
private Settings createFallbackSettings() {
|
||||
Settings.Builder fallbackSettingsBuilder = settingsBuilder();
|
||||
Settings.Builder fallbackSettingsBuilder = Settings.builder();
|
||||
|
||||
List<String> fallbackBindHost = TransportSettings.BIND_HOST.get(settings);
|
||||
if (fallbackBindHost.isEmpty() == false) {
|
||||
|
|
|
@ -52,7 +52,7 @@ public final class ClusterAllocationExplainIT extends ESIntegTestCase {
|
|||
});
|
||||
|
||||
logger.info("--> creating 'test' index");
|
||||
prepareCreate("test").setSettings(Settings.settingsBuilder()
|
||||
prepareCreate("test").setSettings(Settings.builder()
|
||||
.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "1m")
|
||||
.put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 5)
|
||||
.put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1)).get();
|
||||
|
|
|
@ -45,7 +45,7 @@ public class RepositoryBlocksIT extends ESIntegTestCase {
|
|||
assertBlocked(client().admin().cluster().preparePutRepository("test-repo-blocks")
|
||||
.setType("fs")
|
||||
.setVerify(false)
|
||||
.setSettings(Settings.settingsBuilder().put("location", randomRepoPath())), MetaData.CLUSTER_READ_ONLY_BLOCK);
|
||||
.setSettings(Settings.builder().put("location", randomRepoPath())), MetaData.CLUSTER_READ_ONLY_BLOCK);
|
||||
} finally {
|
||||
setClusterReadOnly(false);
|
||||
}
|
||||
|
@ -54,14 +54,14 @@ public class RepositoryBlocksIT extends ESIntegTestCase {
|
|||
assertAcked(client().admin().cluster().preparePutRepository("test-repo-blocks")
|
||||
.setType("fs")
|
||||
.setVerify(false)
|
||||
.setSettings(Settings.settingsBuilder().put("location", randomRepoPath())));
|
||||
.setSettings(Settings.builder().put("location", randomRepoPath())));
|
||||
}
|
||||
|
||||
public void testVerifyRepositoryWithBlocks() {
|
||||
assertAcked(client().admin().cluster().preparePutRepository("test-repo-blocks")
|
||||
.setType("fs")
|
||||
.setVerify(false)
|
||||
.setSettings(Settings.settingsBuilder().put("location", randomRepoPath())));
|
||||
.setSettings(Settings.builder().put("location", randomRepoPath())));
|
||||
|
||||
// This test checks that the Get Repository operation is never blocked, even if the cluster is read only.
|
||||
try {
|
||||
|
@ -77,7 +77,7 @@ public class RepositoryBlocksIT extends ESIntegTestCase {
|
|||
assertAcked(client().admin().cluster().preparePutRepository("test-repo-blocks")
|
||||
.setType("fs")
|
||||
.setVerify(false)
|
||||
.setSettings(Settings.settingsBuilder().put("location", randomRepoPath())));
|
||||
.setSettings(Settings.builder().put("location", randomRepoPath())));
|
||||
|
||||
logger.info("--> deleting a repository is blocked when the cluster is read only");
|
||||
try {
|
||||
|
@ -95,7 +95,7 @@ public class RepositoryBlocksIT extends ESIntegTestCase {
|
|||
assertAcked(client().admin().cluster().preparePutRepository("test-repo-blocks")
|
||||
.setType("fs")
|
||||
.setVerify(false)
|
||||
.setSettings(Settings.settingsBuilder().put("location", randomRepoPath())));
|
||||
.setSettings(Settings.builder().put("location", randomRepoPath())));
|
||||
|
||||
// This test checks that the Get Repository operation is never blocked, even if the cluster is read only.
|
||||
try {
|
||||
|
|
|
@ -69,7 +69,7 @@ public class SnapshotBlocksIT extends ESIntegTestCase {
|
|||
logger.info("--> register a repository");
|
||||
assertAcked(client().admin().cluster().preparePutRepository(REPOSITORY_NAME)
|
||||
.setType("fs")
|
||||
.setSettings(Settings.settingsBuilder().put("location", randomRepoPath())));
|
||||
.setSettings(Settings.builder().put("location", randomRepoPath())));
|
||||
|
||||
logger.info("--> verify the repository");
|
||||
VerifyRepositoryResponse verifyResponse = client().admin().cluster().prepareVerifyRepository(REPOSITORY_NAME).get();
|
||||
|
|
|
@ -38,7 +38,6 @@ import java.io.IOException;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
@ -159,7 +158,7 @@ public class ClusterStatsIT extends ESIntegTestCase {
|
|||
public void testValuesSmokeScreen() throws IOException {
|
||||
internalCluster().ensureAtMostNumDataNodes(5);
|
||||
internalCluster().ensureAtLeastNumDataNodes(1);
|
||||
assertAcked(prepareCreate("test1").setSettings(settingsBuilder().put(Store.INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), 0).build()));
|
||||
assertAcked(prepareCreate("test1").setSettings(Settings.builder().put(Store.INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), 0).build()));
|
||||
index("test1", "type", "1", "f", "f");
|
||||
/*
|
||||
* Ensure at least one shard is allocated otherwise the FS stats might
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction;
|
|||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.IndexSettings;
|
||||
import org.elasticsearch.index.analysis.AnalysisRegistry;
|
||||
import org.elasticsearch.index.analysis.AnalysisService;
|
||||
|
@ -36,8 +35,6 @@ import org.elasticsearch.test.IndexSettingsModule;
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
|
||||
public class TransportAnalyzeActionTests extends ESTestCase {
|
||||
|
||||
private AnalysisService analysisService;
|
||||
|
@ -49,7 +46,7 @@ public class TransportAnalyzeActionTests extends ESTestCase {
|
|||
super.setUp();
|
||||
Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()).build();
|
||||
|
||||
Settings indexSettings = settingsBuilder()
|
||||
Settings indexSettings = Settings.builder()
|
||||
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.put("index.analysis.filter.wordDelimiter.type", "word_delimiter")
|
||||
.put("index.analysis.filter.wordDelimiter.split_on_numerics", false)
|
||||
|
|
|
@ -48,7 +48,7 @@ public class MetaDataIndexTemplateServiceTests extends ESTestCase {
|
|||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, "0");
|
||||
request.settings(Settings.settingsBuilder().put(map).build());
|
||||
request.settings(Settings.builder().put(map).build());
|
||||
|
||||
List<Throwable> throwables = putTemplate(request);
|
||||
assertEquals(throwables.size(), 1);
|
||||
|
@ -62,7 +62,7 @@ public class MetaDataIndexTemplateServiceTests extends ESTestCase {
|
|||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, "0");
|
||||
request.settings(Settings.settingsBuilder().put(map).build());
|
||||
request.settings(Settings.builder().put(map).build());
|
||||
|
||||
List<Throwable> throwables = putTemplate(request);
|
||||
assertEquals(throwables.size(), 1);
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.elasticsearch.test.ESIntegTestCase.Scope;
|
|||
public class BulkProcessorClusterSettingsIT extends ESIntegTestCase {
|
||||
public void testBulkProcessorAutoCreateRestrictions() throws Exception {
|
||||
// See issue #8125
|
||||
Settings settings = Settings.settingsBuilder().put("action.auto_create_index", false).build();
|
||||
Settings settings = Settings.builder().put("action.auto_create_index", false).build();
|
||||
|
||||
internalCluster().startNode(settings);
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ public abstract class AbstractTermVectorsTestCase extends ESIntegTestCase {
|
|||
field.addToMappings(mappingBuilder);
|
||||
}
|
||||
mappingBuilder.endObject().endObject().endObject();
|
||||
Settings.Builder settings = Settings.settingsBuilder()
|
||||
Settings.Builder settings = Settings.builder()
|
||||
.put(indexSettings())
|
||||
.put("index.analysis.analyzer.tv_test.tokenizer", "standard")
|
||||
.putArray("index.analysis.analyzer.tv_test.filter", "type_as_payload", "lowercase");
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.elasticsearch.common.lucene.uid.Versions;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.json.JsonXContent;
|
||||
import org.elasticsearch.index.engine.VersionConflictEngineException;
|
||||
import org.elasticsearch.index.mapper.FieldMapper;
|
||||
import org.hamcrest.Matcher;
|
||||
|
@ -52,7 +51,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertThrows;
|
||||
|
@ -198,7 +196,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
.endObject().endObject();
|
||||
assertAcked(prepareCreate("test").addMapping("type1", mapping)
|
||||
.addAlias(new Alias("alias"))
|
||||
.setSettings(settingsBuilder()
|
||||
.setSettings(Settings.builder()
|
||||
.put(indexSettings())
|
||||
.put("index.analysis.analyzer.tv_test.tokenizer", "whitespace")
|
||||
.putArray("index.analysis.analyzer.tv_test.filter", "type_as_payload", "lowercase")));
|
||||
|
@ -285,7 +283,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
.endObject()
|
||||
.endObject().endObject();
|
||||
assertAcked(prepareCreate("test").addMapping("type1", mapping)
|
||||
.setSettings(settingsBuilder()
|
||||
.setSettings(Settings.builder()
|
||||
.put("index.analysis.analyzer.tv_test.tokenizer", "whitespace")
|
||||
.putArray("index.analysis.analyzer.tv_test.filter", "type_as_payload", "lowercase")));
|
||||
ensureYellow();
|
||||
|
@ -431,7 +429,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
.startObject("field").field("type", "text").field("term_vector", "with_positions_offsets_payloads")
|
||||
.field("analyzer", "payload_test").endObject().endObject().endObject().endObject();
|
||||
assertAcked(prepareCreate("test").addMapping("type1", mapping).setSettings(
|
||||
settingsBuilder()
|
||||
Settings.builder()
|
||||
.put(indexSettings())
|
||||
.put("index.analysis.analyzer.payload_test.tokenizer", "whitespace")
|
||||
.putArray("index.analysis.analyzer.payload_test.filter", "my_delimited_payload_filter")
|
||||
|
@ -597,7 +595,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
|
||||
assertAcked(prepareCreate("test")
|
||||
.addMapping("type1", mapping)
|
||||
.setSettings(settingsBuilder()
|
||||
.setSettings(Settings.builder()
|
||||
.put(indexSettings())
|
||||
.put("index.analysis.analyzer.tv_test.tokenizer", "whitespace")
|
||||
.putArray("index.analysis.analyzer.tv_test.filter", "type_as_payload", "lowercase")));
|
||||
|
@ -785,7 +783,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
|
||||
public void testArtificialVsExisting() throws ExecutionException, InterruptedException, IOException {
|
||||
// setup indices
|
||||
Settings.Builder settings = settingsBuilder()
|
||||
Settings.Builder settings = Settings.builder()
|
||||
.put(indexSettings())
|
||||
.put("index.analysis.analyzer", "standard");
|
||||
assertAcked(prepareCreate("test")
|
||||
|
@ -843,7 +841,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
|
||||
public void testArtificialNoDoc() throws IOException {
|
||||
// setup indices
|
||||
Settings.Builder settings = settingsBuilder()
|
||||
Settings.Builder settings = Settings.builder()
|
||||
.put(indexSettings())
|
||||
.put("index.analysis.analyzer", "standard");
|
||||
assertAcked(prepareCreate("test")
|
||||
|
@ -891,7 +889,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
mapping.endObject().endObject().endObject();
|
||||
|
||||
// setup indices with mapping
|
||||
Settings.Builder settings = settingsBuilder()
|
||||
Settings.Builder settings = Settings.builder()
|
||||
.put(indexSettings())
|
||||
.put("index.analysis.analyzer", "standard");
|
||||
assertAcked(prepareCreate("test")
|
||||
|
@ -982,7 +980,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
|
||||
public void testTermVectorsWithVersion() {
|
||||
assertAcked(prepareCreate("test").addAlias(new Alias("alias"))
|
||||
.setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1)));
|
||||
.setSettings(Settings.builder().put("index.refresh_interval", -1)));
|
||||
ensureGreen();
|
||||
|
||||
TermVectorsResponse response = client().prepareTermVectors("test", "type1", "1").get();
|
||||
|
@ -1085,7 +1083,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
|
||||
public void testFilterLength() throws ExecutionException, InterruptedException, IOException {
|
||||
logger.info("Setting up the index ...");
|
||||
Settings.Builder settings = settingsBuilder()
|
||||
Settings.Builder settings = Settings.builder()
|
||||
.put(indexSettings())
|
||||
.put("index.analysis.analyzer", "keyword");
|
||||
assertAcked(prepareCreate("test")
|
||||
|
@ -1123,7 +1121,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
|
||||
public void testFilterTermFreq() throws ExecutionException, InterruptedException, IOException {
|
||||
logger.info("Setting up the index ...");
|
||||
Settings.Builder settings = settingsBuilder()
|
||||
Settings.Builder settings = Settings.builder()
|
||||
.put(indexSettings())
|
||||
.put("index.analysis.analyzer", "keyword");
|
||||
assertAcked(prepareCreate("test")
|
||||
|
@ -1163,7 +1161,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
|
||||
public void testFilterDocFreq() throws ExecutionException, InterruptedException, IOException {
|
||||
logger.info("Setting up the index ...");
|
||||
Settings.Builder settings = settingsBuilder()
|
||||
Settings.Builder settings = Settings.builder()
|
||||
.put(indexSettings())
|
||||
.put("index.analysis.analyzer", "keyword")
|
||||
.put("index.number_of_shards", 1); // no dfs
|
||||
|
|
|
@ -85,7 +85,7 @@ public class MultiTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
|
||||
public void testMultiTermVectorsWithVersion() throws Exception {
|
||||
assertAcked(prepareCreate("test").addAlias(new Alias("alias"))
|
||||
.setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1)));
|
||||
.setSettings(Settings.builder().put("index.refresh_interval", -1)));
|
||||
ensureGreen();
|
||||
|
||||
MultiTermVectorsResponse response = client().prepareMultiTermVectors().add(indexOrAlias(), "type1", "1").get();
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.elasticsearch.cluster.metadata.AliasMetaData;
|
|||
import org.elasticsearch.cluster.metadata.AliasOrIndex;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||
import org.elasticsearch.common.StopWatch;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
|
@ -64,7 +65,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_BLOCKS_ME
|
|||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_BLOCKS_READ;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_BLOCKS_WRITE;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_READ_ONLY;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.hasChildQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.hasParentQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
|
@ -447,7 +447,7 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
|||
|
||||
public void testWaitForAliasCreationSingleShard() throws Exception {
|
||||
logger.info("--> creating index [test]");
|
||||
assertAcked(admin().indices().create(createIndexRequest("test").settings(settingsBuilder().put("index.number_of_replicas", 0).put("index.number_of_shards", 1))).get());
|
||||
assertAcked(admin().indices().create(createIndexRequest("test").settings(Settings.builder().put("index.number_of_replicas", 0).put("index.number_of_shards", 1))).get());
|
||||
|
||||
ensureGreen();
|
||||
|
||||
|
|
|
@ -27,11 +27,11 @@ import org.elasticsearch.action.index.IndexRequestBuilder;
|
|||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.cluster.block.ClusterBlockException;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
|
||||
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST)
|
||||
|
@ -83,11 +83,11 @@ public class SimpleBlocksIT extends ESIntegTestCase {
|
|||
canCreateIndex("test1");
|
||||
canIndexDocument("test1");
|
||||
client().admin().indices().prepareUpdateSettings("test1")
|
||||
.setSettings(settingsBuilder().put(IndexMetaData.SETTING_BLOCKS_WRITE, true))
|
||||
.setSettings(Settings.builder().put(IndexMetaData.SETTING_BLOCKS_WRITE, true))
|
||||
.execute().actionGet();
|
||||
canNotIndexDocument("test1");
|
||||
client().admin().indices().prepareUpdateSettings("test1")
|
||||
.setSettings(settingsBuilder().put(IndexMetaData.SETTING_BLOCKS_WRITE, false))
|
||||
.setSettings(Settings.builder().put(IndexMetaData.SETTING_BLOCKS_WRITE, false))
|
||||
.execute().actionGet();
|
||||
canIndexDocument("test1");
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ public class ClusterStateBackwardsCompatIT extends ESBackcompatTestCase {
|
|||
}
|
||||
|
||||
private TransportClient newTransportClient() {
|
||||
Settings settings = Settings.settingsBuilder().put("client.transport.ignore_cluster_name", true)
|
||||
Settings settings = Settings.builder().put("client.transport.ignore_cluster_name", true)
|
||||
.put("node.name", "transport_client_" + getTestName()).build();
|
||||
return TransportClient.builder().settings(settings).build();
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class NodesStatsBasicBackwardsCompatIT extends ESBackcompatTestCase {
|
|||
|
||||
NodesInfoResponse nodesInfo = client().admin().cluster().prepareNodesInfo().execute().actionGet();
|
||||
|
||||
Settings settings = Settings.settingsBuilder()
|
||||
Settings settings = Settings.builder()
|
||||
.put("client.transport.ignore_cluster_name", true)
|
||||
.put("node.name", "transport_client_" + getTestName()).build();
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class NodesStatsBasicBackwardsCompatIT extends ESBackcompatTestCase {
|
|||
|
||||
NodesInfoResponse nodesInfo = client().admin().cluster().prepareNodesInfo().execute().actionGet();
|
||||
|
||||
Settings settings = Settings.settingsBuilder()
|
||||
Settings settings = Settings.builder()
|
||||
.put("node.name", "transport_client_" + getTestName())
|
||||
.put("client.transport.ignore_cluster_name", true).build();
|
||||
|
||||
|
|
|
@ -52,7 +52,6 @@ import java.util.Locale;
|
|||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
@ -66,7 +65,7 @@ public class RestoreBackwardsCompatIT extends AbstractSnapshotIntegTestCase {
|
|||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
if (randomBoolean()) {
|
||||
// Configure using path.repo
|
||||
return settingsBuilder()
|
||||
return Settings.builder()
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
.put(Environment.PATH_REPO_SETTING.getKey(), getBwcIndicesPath())
|
||||
.build();
|
||||
|
@ -74,7 +73,7 @@ public class RestoreBackwardsCompatIT extends AbstractSnapshotIntegTestCase {
|
|||
// Configure using url white list
|
||||
try {
|
||||
URI repoJarPatternUri = new URI("jar:" + getBwcIndicesPath().toUri().toString() + "*.zip!/repo/");
|
||||
return settingsBuilder()
|
||||
return Settings.builder()
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
.putArray(URLRepository.ALLOWED_URLS_SETTING.getKey(), repoJarPatternUri.toString())
|
||||
.build();
|
||||
|
@ -159,7 +158,7 @@ public class RestoreBackwardsCompatIT extends AbstractSnapshotIntegTestCase {
|
|||
URI repoJarUri = new URI("jar:" + repoFileUri.toString() + "!/repo/");
|
||||
logger.info("--> creating repository [{}] for version [{}]", repo, version);
|
||||
assertAcked(client().admin().cluster().preparePutRepository(repo)
|
||||
.setType("url").setSettings(settingsBuilder()
|
||||
.setType("url").setSettings(Settings.builder()
|
||||
.put("url", repoJarUri.toString())));
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public class UnicastBackwardsCompatibilityIT extends ESBackcompatTestCase {
|
|||
|
||||
@Override
|
||||
protected Settings externalNodeSettings(int nodeOrdinal) {
|
||||
return Settings.settingsBuilder()
|
||||
return Settings.builder()
|
||||
.put(super.externalNodeSettings(nodeOrdinal))
|
||||
.put(TransportSettings.PORT.getKey(), 9390 + nodeOrdinal)
|
||||
.put("discovery.zen.ping.unicast.hosts", "localhost:9380,localhost:9381,localhost:9390,localhost:9391")
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.test.ESIntegTestCase;
|
|||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
import org.elasticsearch.test.ESIntegTestCase.Scope;
|
||||
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
/**
|
||||
|
@ -34,7 +33,7 @@ import static org.hamcrest.Matchers.is;
|
|||
public class NodeClientIT extends ESIntegTestCase {
|
||||
@Override
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put(Client.CLIENT_TYPE_SETTING_S.getKey(), "anything").build();
|
||||
return Settings.builder().put(super.nodeSettings(nodeOrdinal)).put(Client.CLIENT_TYPE_SETTING_S.getKey(), "anything").build();
|
||||
}
|
||||
|
||||
public void testThatClientTypeSettingCannotBeChanged() {
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.elasticsearch.transport.TransportService;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
@ -92,7 +91,7 @@ public class TransportClientIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testThatTransportClientSettingCannotBeChanged() {
|
||||
Settings baseSettings = settingsBuilder()
|
||||
Settings baseSettings = Settings.builder()
|
||||
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir())
|
||||
.build();
|
||||
try (TransportClient client = TransportClient.builder().settings(baseSettings).build()) {
|
||||
|
|
|
@ -38,7 +38,6 @@ import org.elasticsearch.transport.TransportService;
|
|||
import java.io.IOException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
|
||||
|
@ -52,7 +51,7 @@ public class TransportClientRetryIT extends ESIntegTestCase {
|
|||
addresses[i++] = instance.boundAddress().publishAddress();
|
||||
}
|
||||
|
||||
Settings.Builder builder = settingsBuilder().put("client.transport.nodes_sampler_interval", "1s")
|
||||
Settings.Builder builder = Settings.builder().put("client.transport.nodes_sampler_interval", "1s")
|
||||
.put("node.name", "transport_client_retry_test")
|
||||
.put(Node.NODE_MODE_SETTING.getKey(), internalCluster().getNodeMode())
|
||||
.put(ClusterName.CLUSTER_NAME_SETTING.getKey(), internalCluster().getClusterName())
|
||||
|
|
|
@ -62,7 +62,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
|
||||
import static java.util.Collections.emptySet;
|
||||
import static java.util.Collections.unmodifiableSet;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.elasticsearch.common.util.set.Sets.newHashSet;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
|
@ -139,7 +138,7 @@ public class ClusterInfoServiceIT extends ESIntegTestCase {
|
|||
|
||||
public void testClusterInfoServiceCollectsInformation() throws Exception {
|
||||
internalCluster().startNodesAsync(2).get();
|
||||
assertAcked(prepareCreate("test").setSettings(settingsBuilder()
|
||||
assertAcked(prepareCreate("test").setSettings(Settings.builder()
|
||||
.put(Store.INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), 0)
|
||||
.put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE).build()));
|
||||
ensureGreen("test");
|
||||
|
|
|
@ -51,7 +51,6 @@ import java.util.concurrent.TimeUnit;
|
|||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoTimeout;
|
||||
|
@ -75,7 +74,7 @@ public class MinimumMasterNodesIT extends ESIntegTestCase {
|
|||
|
||||
public void testSimpleMinimumMasterNodes() throws Exception {
|
||||
|
||||
Settings settings = settingsBuilder()
|
||||
Settings settings = Settings.builder()
|
||||
.put("discovery.type", "zen")
|
||||
.put("discovery.zen.minimum_master_nodes", 2)
|
||||
.put(ZenDiscovery.PING_TIMEOUT_SETTING.getKey(), "200ms")
|
||||
|
@ -187,7 +186,7 @@ public class MinimumMasterNodesIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testMultipleNodesShutdownNonMasterNodes() throws Exception {
|
||||
Settings settings = settingsBuilder()
|
||||
Settings settings = Settings.builder()
|
||||
.put("discovery.type", "zen")
|
||||
.put("discovery.zen.minimum_master_nodes", 3)
|
||||
.put(ZenDiscovery.PING_TIMEOUT_SETTING.getKey(), "1s")
|
||||
|
@ -263,7 +262,7 @@ public class MinimumMasterNodesIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testDynamicUpdateMinimumMasterNodes() throws Exception {
|
||||
Settings settings = settingsBuilder()
|
||||
Settings settings = Settings.builder()
|
||||
.put("discovery.type", "zen")
|
||||
.put(ZenDiscovery.PING_TIMEOUT_SETTING.getKey(), "400ms")
|
||||
.put("discovery.initial_state_timeout", "500ms")
|
||||
|
@ -291,7 +290,7 @@ public class MinimumMasterNodesIT extends ESIntegTestCase {
|
|||
assertNoMasterBlockOnAllNodes();
|
||||
|
||||
logger.info("--> bringing another node up");
|
||||
internalCluster().startNode(settingsBuilder().put(settings).put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), 2).build());
|
||||
internalCluster().startNode(Settings.builder().put(settings).put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), 2).build());
|
||||
clusterHealthResponse = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForNodes("2").get();
|
||||
assertThat(clusterHealthResponse.isTimedOut(), equalTo(false));
|
||||
}
|
||||
|
@ -321,7 +320,7 @@ public class MinimumMasterNodesIT extends ESIntegTestCase {
|
|||
|
||||
public void testCanNotBringClusterDown() throws ExecutionException, InterruptedException {
|
||||
int nodeCount = scaledRandomIntBetween(1, 5);
|
||||
Settings.Builder settings = settingsBuilder()
|
||||
Settings.Builder settings = Settings.builder()
|
||||
.put("discovery.type", "zen")
|
||||
.put(ZenDiscovery.PING_TIMEOUT_SETTING.getKey(), "200ms")
|
||||
.put("discovery.initial_state_timeout", "500ms");
|
||||
|
@ -341,7 +340,7 @@ public class MinimumMasterNodesIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> updating [{}] to [{}]", ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), updateCount);
|
||||
assertAcked(client().admin().cluster().prepareUpdateSettings()
|
||||
.setPersistentSettings(settingsBuilder().put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), updateCount)));
|
||||
.setPersistentSettings(Settings.builder().put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), updateCount)));
|
||||
|
||||
logger.info("--> verifying no node left and master is up");
|
||||
assertFalse(client().admin().cluster().prepareHealth().setWaitForNodes(Integer.toString(nodeCount)).get().isTimedOut());
|
||||
|
@ -350,7 +349,7 @@ public class MinimumMasterNodesIT extends ESIntegTestCase {
|
|||
logger.info("--> trying to updating [{}] to [{}]", ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), updateCount);
|
||||
try {
|
||||
client().admin().cluster().prepareUpdateSettings()
|
||||
.setPersistentSettings(settingsBuilder().put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), updateCount));
|
||||
.setPersistentSettings(Settings.builder().put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), updateCount));
|
||||
} catch (IllegalArgumentException ex) {
|
||||
assertEquals(ex.getMessage(), "cannot set discovery.zen.minimum_master_nodes to more than the current master nodes count [" +updateCount+ "]");
|
||||
}
|
||||
|
@ -360,7 +359,7 @@ public class MinimumMasterNodesIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testCanNotPublishWithoutMinMastNodes() throws Exception {
|
||||
Settings settings = settingsBuilder()
|
||||
Settings settings = Settings.builder()
|
||||
.put("discovery.type", "zen")
|
||||
.put(FaultDetection.PING_TIMEOUT_SETTING.getKey(), "1h") // disable it
|
||||
.put(ZenDiscovery.PING_TIMEOUT_SETTING.getKey(), "200ms")
|
||||
|
|
|
@ -43,7 +43,6 @@ import org.elasticsearch.test.ESIntegTestCase.Scope;
|
|||
import java.util.HashMap;
|
||||
|
||||
import static org.elasticsearch.action.percolate.PercolateSourceBuilder.docBuilder;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertExists;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertThrows;
|
||||
|
@ -61,7 +60,7 @@ public class NoMasterNodeIT extends ESIntegTestCase {
|
|||
boolean autoCreateIndex = randomBoolean();
|
||||
logger.info("auto_create_index set to {}", autoCreateIndex);
|
||||
|
||||
Settings settings = settingsBuilder()
|
||||
Settings settings = Settings.builder()
|
||||
.put("discovery.type", "zen")
|
||||
.put("action.auto_create_index", autoCreateIndex)
|
||||
.put("discovery.zen.minimum_master_nodes", 2)
|
||||
|
@ -213,7 +212,7 @@ public class NoMasterNodeIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testNoMasterActionsWriteMasterBlock() throws Exception {
|
||||
Settings settings = settingsBuilder()
|
||||
Settings settings = Settings.builder()
|
||||
.put("discovery.type", "zen")
|
||||
.put("action.auto_create_index", false)
|
||||
.put("discovery.zen.minimum_master_nodes", 2)
|
||||
|
|
|
@ -23,13 +23,13 @@ import org.elasticsearch.action.UnavailableShardsException;
|
|||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
import org.elasticsearch.test.ESIntegTestCase.Scope;
|
||||
|
||||
import static org.elasticsearch.client.Requests.createIndexRequest;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
|
@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
@ClusterScope(scope= Scope.TEST, numDataNodes =0)
|
||||
public class SimpleDataNodesIT extends ESIntegTestCase {
|
||||
public void testDataNodes() throws Exception {
|
||||
internalCluster().startNode(settingsBuilder().put(Node.NODE_DATA_SETTING.getKey(), false).build());
|
||||
internalCluster().startNode(Settings.builder().put(Node.NODE_DATA_SETTING.getKey(), false).build());
|
||||
client().admin().indices().create(createIndexRequest("test")).actionGet();
|
||||
try {
|
||||
client().index(Requests.indexRequest("test").type("type1").id("1").source(source("1", "test")).timeout(timeValueSeconds(1))).actionGet();
|
||||
|
@ -48,7 +48,7 @@ public class SimpleDataNodesIT extends ESIntegTestCase {
|
|||
// all is well
|
||||
}
|
||||
|
||||
internalCluster().startNode(settingsBuilder().put(Node.NODE_DATA_SETTING.getKey(), false).build());
|
||||
internalCluster().startNode(Settings.builder().put(Node.NODE_DATA_SETTING.getKey(), false).build());
|
||||
assertThat(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForNodes("2").setLocal(true).execute().actionGet().isTimedOut(), equalTo(false));
|
||||
|
||||
// still no shard should be allocated
|
||||
|
@ -60,7 +60,7 @@ public class SimpleDataNodesIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
// now, start a node data, and see that it gets with shards
|
||||
internalCluster().startNode(settingsBuilder().put(Node.NODE_DATA_SETTING.getKey(), true).build());
|
||||
internalCluster().startNode(Settings.builder().put(Node.NODE_DATA_SETTING.getKey(), true).build());
|
||||
assertThat(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForNodes("3").setLocal(true).execute().actionGet().isTimedOut(), equalTo(false));
|
||||
|
||||
IndexResponse indexResponse = client().index(Requests.indexRequest("test").type("type1").id("1").source(source("1", "test"))).actionGet();
|
||||
|
|
|
@ -21,14 +21,13 @@ package org.elasticsearch.cluster;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
import org.elasticsearch.test.ESIntegTestCase.Scope;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
|
@ -36,14 +35,11 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
@ClusterScope(scope= Scope.TEST, numDataNodes =0)
|
||||
public class UpdateSettingsValidationIT extends ESIntegTestCase {
|
||||
public void testUpdateSettingsValidation() throws Exception {
|
||||
List<String> nodes = internalCluster().startNodesAsync(
|
||||
settingsBuilder().put(Node.NODE_DATA_SETTING.getKey(), false).build(),
|
||||
settingsBuilder().put(Node.NODE_MASTER_SETTING.getKey(), false).build(),
|
||||
settingsBuilder().put(Node.NODE_MASTER_SETTING.getKey(), false).build()
|
||||
internalCluster().startNodesAsync(
|
||||
Settings.builder().put(Node.NODE_DATA_SETTING.getKey(), false).build(),
|
||||
Settings.builder().put(Node.NODE_MASTER_SETTING.getKey(), false).build(),
|
||||
Settings.builder().put(Node.NODE_MASTER_SETTING.getKey(), false).build()
|
||||
).get();
|
||||
String master = nodes.get(0);
|
||||
String node_1 = nodes.get(1);
|
||||
String node_2 = nodes.get(2);
|
||||
|
||||
createIndex("test");
|
||||
NumShards test = getNumShards("test");
|
||||
|
@ -52,13 +48,13 @@ public class UpdateSettingsValidationIT extends ESIntegTestCase {
|
|||
assertThat(healthResponse.isTimedOut(), equalTo(false));
|
||||
assertThat(healthResponse.getIndices().get("test").getActiveShards(), equalTo(test.totalNumShards));
|
||||
|
||||
client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put("index.number_of_replicas", 0)).execute().actionGet();
|
||||
client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put("index.number_of_replicas", 0)).execute().actionGet();
|
||||
healthResponse = client().admin().cluster().prepareHealth("test").setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet();
|
||||
assertThat(healthResponse.isTimedOut(), equalTo(false));
|
||||
assertThat(healthResponse.getIndices().get("test").getActiveShards(), equalTo(test.numPrimaries));
|
||||
|
||||
try {
|
||||
client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put("index.refresh_interval", "")).execute().actionGet();
|
||||
client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put("index.refresh_interval", "")).execute().actionGet();
|
||||
fail();
|
||||
} catch (IllegalArgumentException ex) {
|
||||
logger.info("Error message: [{}]", ex.getMessage());
|
||||
|
|
|
@ -36,7 +36,6 @@ import org.elasticsearch.discovery.DiscoverySettings;
|
|||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.elasticsearch.test.ESIntegTestCase.Scope.TEST;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
@ -91,7 +90,7 @@ public class AckClusterUpdateSettingsIT extends ESIntegTestCase {
|
|||
assertNotNull(excludedNodeId);
|
||||
|
||||
ClusterUpdateSettingsResponse clusterUpdateSettingsResponse = client().admin().cluster().prepareUpdateSettings()
|
||||
.setTransientSettings(settingsBuilder().put("cluster.routing.allocation.exclude._id", excludedNodeId)).get();
|
||||
.setTransientSettings(Settings.builder().put("cluster.routing.allocation.exclude._id", excludedNodeId)).get();
|
||||
assertAcked(clusterUpdateSettingsResponse);
|
||||
assertThat(clusterUpdateSettingsResponse.getTransientSettings().get("cluster.routing.allocation.exclude._id"), equalTo(excludedNodeId));
|
||||
|
||||
|
@ -115,7 +114,7 @@ public class AckClusterUpdateSettingsIT extends ESIntegTestCase {
|
|||
|
||||
public void testClusterUpdateSettingsNoAcknowledgement() {
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder()
|
||||
.setSettings(Settings.builder()
|
||||
.put("number_of_shards", between(cluster().numDataNodes(), DEFAULT_MAX_NUM_SHARDS))
|
||||
.put("number_of_replicas", 0)).get();
|
||||
ensureGreen();
|
||||
|
@ -134,7 +133,7 @@ public class AckClusterUpdateSettingsIT extends ESIntegTestCase {
|
|||
assertNotNull(excludedNodeId);
|
||||
|
||||
ClusterUpdateSettingsResponse clusterUpdateSettingsResponse = client().admin().cluster().prepareUpdateSettings().setTimeout("0s")
|
||||
.setTransientSettings(settingsBuilder().put("cluster.routing.allocation.exclude._id", excludedNodeId)).get();
|
||||
.setTransientSettings(Settings.builder().put("cluster.routing.allocation.exclude._id", excludedNodeId)).get();
|
||||
assertThat(clusterUpdateSettingsResponse.isAcknowledged(), equalTo(false));
|
||||
assertThat(clusterUpdateSettingsResponse.getTransientSettings().get("cluster.routing.allocation.exclude._id"), equalTo(excludedNodeId));
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ 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.common.settings.Settings.settingsBuilder;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.hamcrest.Matchers.anyOf;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
@ -121,7 +120,7 @@ public class AckIT extends ESIntegTestCase {
|
|||
|
||||
public void testClusterRerouteNoAcknowledgement() throws InterruptedException {
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder()
|
||||
.setSettings(Settings.builder()
|
||||
.put(SETTING_NUMBER_OF_SHARDS, between(cluster().numDataNodes(), DEFAULT_MAX_NUM_SHARDS))
|
||||
.put(SETTING_NUMBER_OF_REPLICAS, 0)).get();
|
||||
ensureGreen();
|
||||
|
@ -134,7 +133,7 @@ public class AckIT extends ESIntegTestCase {
|
|||
|
||||
public void testClusterRerouteAcknowledgementDryRun() throws InterruptedException {
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder()
|
||||
.setSettings(Settings.builder()
|
||||
.put(SETTING_NUMBER_OF_SHARDS, between(cluster().numDataNodes(), DEFAULT_MAX_NUM_SHARDS))
|
||||
.put(SETTING_NUMBER_OF_REPLICAS, 0)).get();
|
||||
ensureGreen();
|
||||
|
@ -169,7 +168,7 @@ public class AckIT extends ESIntegTestCase {
|
|||
|
||||
public void testClusterRerouteNoAcknowledgementDryRun() throws InterruptedException {
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder()
|
||||
.setSettings(Settings.builder()
|
||||
.put(SETTING_NUMBER_OF_SHARDS, between(cluster().numDataNodes(), DEFAULT_MAX_NUM_SHARDS))
|
||||
.put(SETTING_NUMBER_OF_REPLICAS, 0)).get();
|
||||
ensureGreen();
|
||||
|
|
|
@ -55,7 +55,6 @@ import java.util.function.Function;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
|
@ -73,7 +72,7 @@ public class ShardFailedClusterStateTaskExecutorTests extends ESAllocationTestCa
|
|||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
allocationService = createAllocationService(settingsBuilder()
|
||||
allocationService = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 8)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.build());
|
||||
|
|
|
@ -38,7 +38,6 @@ import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.anyOf;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
|
@ -55,13 +54,13 @@ public class AwarenessAllocationIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testSimpleAwareness() throws Exception {
|
||||
Settings commonSettings = Settings.settingsBuilder()
|
||||
Settings commonSettings = Settings.builder()
|
||||
.put("cluster.routing.allocation.awareness.attributes", "rack_id")
|
||||
.build();
|
||||
|
||||
|
||||
logger.info("--> starting 2 nodes on the same rack");
|
||||
internalCluster().startNodesAsync(2, Settings.settingsBuilder().put(commonSettings).put("node.attr.rack_id", "rack_1").build()).get();
|
||||
internalCluster().startNodesAsync(2, Settings.builder().put(commonSettings).put("node.attr.rack_id", "rack_1").build()).get();
|
||||
|
||||
createIndex("test1");
|
||||
createIndex("test2");
|
||||
|
@ -74,7 +73,7 @@ public class AwarenessAllocationIT extends ESIntegTestCase {
|
|||
ensureGreen();
|
||||
|
||||
logger.info("--> starting 1 node on a different rack");
|
||||
final String node3 = internalCluster().startNode(Settings.settingsBuilder().put(commonSettings).put("node.attr.rack_id", "rack_2").build());
|
||||
final String node3 = internalCluster().startNode(Settings.builder().put(commonSettings).put("node.attr.rack_id", "rack_2").build());
|
||||
|
||||
// On slow machines the initial relocation might be delayed
|
||||
assertThat(awaitBusy(
|
||||
|
@ -104,7 +103,7 @@ public class AwarenessAllocationIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testAwarenessZones() throws Exception {
|
||||
Settings commonSettings = Settings.settingsBuilder()
|
||||
Settings commonSettings = Settings.builder()
|
||||
.put(AwarenessAllocationDecider.CLUSTER_ROUTING_ALLOCATION_AWARENESS_FORCE_GROUP_SETTING.getKey() + "zone.values", "a,b")
|
||||
.put(AwarenessAllocationDecider.CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING.getKey(), "zone")
|
||||
.put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), 3)
|
||||
|
@ -113,10 +112,10 @@ public class AwarenessAllocationIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> starting 4 nodes on different zones");
|
||||
List<String> nodes = internalCluster().startNodesAsync(
|
||||
Settings.settingsBuilder().put(commonSettings).put("node.attr.zone", "a").build(),
|
||||
Settings.settingsBuilder().put(commonSettings).put("node.attr.zone", "b").build(),
|
||||
Settings.settingsBuilder().put(commonSettings).put("node.attr.zone", "b").build(),
|
||||
Settings.settingsBuilder().put(commonSettings).put("node.attr.zone", "a").build()
|
||||
Settings.builder().put(commonSettings).put("node.attr.zone", "a").build(),
|
||||
Settings.builder().put(commonSettings).put("node.attr.zone", "b").build(),
|
||||
Settings.builder().put(commonSettings).put("node.attr.zone", "b").build(),
|
||||
Settings.builder().put(commonSettings).put("node.attr.zone", "a").build()
|
||||
).get();
|
||||
String A_0 = nodes.get(0);
|
||||
String B_0 = nodes.get(1);
|
||||
|
@ -128,7 +127,7 @@ public class AwarenessAllocationIT extends ESIntegTestCase {
|
|||
assertThat(health.isTimedOut(), equalTo(false));
|
||||
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder().put("index.number_of_shards", 5)
|
||||
.setSettings(Settings.builder().put("index.number_of_shards", 5)
|
||||
.put("index.number_of_replicas", 1)).execute().actionGet();
|
||||
|
||||
logger.info("--> waiting for shards to be allocated");
|
||||
|
@ -152,20 +151,20 @@ public class AwarenessAllocationIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testAwarenessZonesIncrementalNodes() throws Exception {
|
||||
Settings commonSettings = Settings.settingsBuilder()
|
||||
Settings commonSettings = Settings.builder()
|
||||
.put("cluster.routing.allocation.awareness.force.zone.values", "a,b")
|
||||
.put("cluster.routing.allocation.awareness.attributes", "zone")
|
||||
.build();
|
||||
|
||||
logger.info("--> starting 2 nodes on zones 'a' & 'b'");
|
||||
List<String> nodes = internalCluster().startNodesAsync(
|
||||
Settings.settingsBuilder().put(commonSettings).put("node.attr.zone", "a").build(),
|
||||
Settings.settingsBuilder().put(commonSettings).put("node.attr.zone", "b").build()
|
||||
Settings.builder().put(commonSettings).put("node.attr.zone", "a").build(),
|
||||
Settings.builder().put(commonSettings).put("node.attr.zone", "b").build()
|
||||
).get();
|
||||
String A_0 = nodes.get(0);
|
||||
String B_0 = nodes.get(1);
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder().put("index.number_of_shards", 5)
|
||||
.setSettings(Settings.builder().put("index.number_of_shards", 5)
|
||||
.put("index.number_of_replicas", 1)).execute().actionGet();
|
||||
ClusterHealthResponse health = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().setWaitForNodes("2").setWaitForRelocatingShards(0).execute().actionGet();
|
||||
assertThat(health.isTimedOut(), equalTo(false));
|
||||
|
@ -183,7 +182,7 @@ public class AwarenessAllocationIT extends ESIntegTestCase {
|
|||
assertThat(counts.get(B_0), equalTo(5));
|
||||
logger.info("--> starting another node in zone 'b'");
|
||||
|
||||
String B_1 = internalCluster().startNode(Settings.settingsBuilder().put(commonSettings).put("node.attr.zone", "b").build());
|
||||
String B_1 = internalCluster().startNode(Settings.builder().put(commonSettings).put("node.attr.zone", "b").build());
|
||||
health = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().setWaitForNodes("3").execute().actionGet();
|
||||
assertThat(health.isTimedOut(), equalTo(false));
|
||||
client().admin().cluster().prepareReroute().get();
|
||||
|
@ -228,7 +227,7 @@ public class AwarenessAllocationIT extends ESIntegTestCase {
|
|||
assertThat(counts.get(B_0), equalTo(3));
|
||||
assertThat(counts.get(B_1), equalTo(2));
|
||||
assertThat(counts.containsKey(noZoneNode), equalTo(false));
|
||||
client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.settingsBuilder().put("cluster.routing.allocation.awareness.attributes", "").build()).get();
|
||||
client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder().put("cluster.routing.allocation.awareness.attributes", "").build()).get();
|
||||
|
||||
health = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().setWaitForNodes("4").setWaitForActiveShards(10).setWaitForRelocatingShards(0).execute().actionGet();
|
||||
|
||||
|
|
|
@ -58,7 +58,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_BLOCKS_RE
|
|||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_BLOCKS_WRITE;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_READ_ONLY;
|
||||
import static org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertBlocked;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
@ -71,7 +70,7 @@ public class ClusterRerouteIT extends ESIntegTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(ClusterRerouteIT.class);
|
||||
|
||||
public void testRerouteWithCommands_disableAllocationSettings() throws Exception {
|
||||
Settings commonSettings = settingsBuilder()
|
||||
Settings commonSettings = Settings.builder()
|
||||
.put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), "none")
|
||||
.put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), "none")
|
||||
.build();
|
||||
|
@ -79,7 +78,7 @@ public class ClusterRerouteIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testRerouteWithCommands_enableAllocationSettings() throws Exception {
|
||||
Settings commonSettings = settingsBuilder()
|
||||
Settings commonSettings = Settings.builder()
|
||||
.put(CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), Allocation.NONE.name())
|
||||
.build();
|
||||
rerouteWithCommands(commonSettings);
|
||||
|
@ -92,7 +91,7 @@ public class ClusterRerouteIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> create an index with 1 shard, 1 replica, nothing should allocate");
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder().put("index.number_of_shards", 1))
|
||||
.setSettings(Settings.builder().put("index.number_of_shards", 1))
|
||||
.execute().actionGet();
|
||||
|
||||
ClusterState state = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
|
@ -147,7 +146,7 @@ public class ClusterRerouteIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testRerouteWithAllocateLocalGateway_disableAllocationSettings() throws Exception {
|
||||
Settings commonSettings = settingsBuilder()
|
||||
Settings commonSettings = Settings.builder()
|
||||
.put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), "none")
|
||||
.put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), "none")
|
||||
.build();
|
||||
|
@ -155,14 +154,14 @@ public class ClusterRerouteIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testRerouteWithAllocateLocalGateway_enableAllocationSettings() throws Exception {
|
||||
Settings commonSettings = settingsBuilder()
|
||||
Settings commonSettings = Settings.builder()
|
||||
.put(CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), Allocation.NONE.name())
|
||||
.build();
|
||||
rerouteWithAllocateLocalGateway(commonSettings);
|
||||
}
|
||||
|
||||
public void testDelayWithALargeAmountOfShards() throws Exception {
|
||||
Settings commonSettings = settingsBuilder()
|
||||
Settings commonSettings = Settings.builder()
|
||||
.put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_INCOMING_RECOVERIES_SETTING.getKey(), 1)
|
||||
.put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING.getKey(), 1)
|
||||
.build();
|
||||
|
@ -179,7 +178,7 @@ public class ClusterRerouteIT extends ESIntegTestCase {
|
|||
logger.info("--> create indices");
|
||||
for (int i = 0; i < 25; i++) {
|
||||
client().admin().indices().prepareCreate("test" + i)
|
||||
.setSettings(settingsBuilder()
|
||||
.setSettings(Settings.builder()
|
||||
.put("index.number_of_shards", 5).put("index.number_of_replicas", 1)
|
||||
.put("index.unassigned.node_left.delayed_timeout", randomIntBetween(250, 1000) + "ms"))
|
||||
.execute().actionGet();
|
||||
|
@ -204,7 +203,7 @@ public class ClusterRerouteIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> create an index with 1 shard, 1 replica, nothing should allocate");
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder().put("index.number_of_shards", 1))
|
||||
.setSettings(Settings.builder().put("index.number_of_shards", 1))
|
||||
.execute().actionGet();
|
||||
|
||||
ClusterState state = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
|
@ -264,7 +263,7 @@ public class ClusterRerouteIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testRerouteExplain() {
|
||||
Settings commonSettings = settingsBuilder().build();
|
||||
Settings commonSettings = Settings.builder().build();
|
||||
|
||||
logger.info("--> starting a node");
|
||||
String node_1 = internalCluster().startNode(commonSettings);
|
||||
|
@ -275,13 +274,13 @@ public class ClusterRerouteIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> create an index with 1 shard");
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0))
|
||||
.setSettings(Settings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0))
|
||||
.execute().actionGet();
|
||||
|
||||
ensureGreen("test");
|
||||
|
||||
logger.info("--> disable allocation");
|
||||
Settings newSettings = settingsBuilder()
|
||||
Settings newSettings = Settings.builder()
|
||||
.put(CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), Allocation.NONE.name())
|
||||
.build();
|
||||
client().admin().cluster().prepareUpdateSettings().setTransientSettings(newSettings).execute().actionGet();
|
||||
|
@ -309,7 +308,7 @@ public class ClusterRerouteIT extends ESIntegTestCase {
|
|||
List<String> nodesIds = internalCluster().startNodesAsync(2).get();
|
||||
|
||||
logger.info("--> create an index with 1 shard and 0 replicas");
|
||||
assertAcked(prepareCreate("test-blocks").setSettings(settingsBuilder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0)));
|
||||
assertAcked(prepareCreate("test-blocks").setSettings(Settings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0)));
|
||||
ensureGreen("test-blocks");
|
||||
|
||||
logger.info("--> check that the index has 1 shard");
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.elasticsearch.cluster.routing.ShardRouting;
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
|
@ -33,7 +34,6 @@ import org.elasticsearch.test.ESIntegTestCase.Scope;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
@ClusterScope(scope= Scope.TEST, numDataNodes =0)
|
||||
|
@ -50,7 +50,7 @@ public class FilteringAllocationIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> creating an index with no replicas");
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder().put("index.number_of_replicas", 0))
|
||||
.setSettings(Settings.builder().put("index.number_of_replicas", 0))
|
||||
.execute().actionGet();
|
||||
ensureGreen();
|
||||
logger.info("--> index some data");
|
||||
|
@ -62,7 +62,7 @@ public class FilteringAllocationIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> decommission the second node");
|
||||
client().admin().cluster().prepareUpdateSettings()
|
||||
.setTransientSettings(settingsBuilder().put("cluster.routing.allocation.exclude._name", node_1))
|
||||
.setTransientSettings(Settings.builder().put("cluster.routing.allocation.exclude._name", node_1))
|
||||
.execute().actionGet();
|
||||
waitForRelocation();
|
||||
|
||||
|
@ -89,7 +89,7 @@ public class FilteringAllocationIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> creating an index with no replicas");
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder().put("index.number_of_replicas", 0))
|
||||
.setSettings(Settings.builder().put("index.number_of_replicas", 0))
|
||||
.execute().actionGet();
|
||||
|
||||
ensureGreen();
|
||||
|
@ -113,13 +113,13 @@ public class FilteringAllocationIT extends ESIntegTestCase {
|
|||
|
||||
if (numShardsOnNode1 > ThrottlingAllocationDecider.DEFAULT_CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES) {
|
||||
client().admin().cluster().prepareUpdateSettings()
|
||||
.setTransientSettings(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", numShardsOnNode1)).execute().actionGet();
|
||||
.setTransientSettings(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", numShardsOnNode1)).execute().actionGet();
|
||||
// make sure we can recover all the nodes at once otherwise we might run into a state where one of the shards has not yet started relocating
|
||||
// but we already fired up the request to wait for 0 relocating shards.
|
||||
}
|
||||
logger.info("--> remove index from the first node");
|
||||
client().admin().indices().prepareUpdateSettings("test")
|
||||
.setSettings(settingsBuilder().put("index.routing.allocation.exclude._name", node_0))
|
||||
.setSettings(Settings.builder().put("index.routing.allocation.exclude._name", node_0))
|
||||
.execute().actionGet();
|
||||
client().admin().cluster().prepareReroute().get();
|
||||
ensureGreen();
|
||||
|
@ -135,7 +135,7 @@ public class FilteringAllocationIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> disable allocation filtering ");
|
||||
client().admin().indices().prepareUpdateSettings("test")
|
||||
.setSettings(settingsBuilder().put("index.routing.allocation.exclude._name", ""))
|
||||
.setSettings(Settings.builder().put("index.routing.allocation.exclude._name", ""))
|
||||
.execute().actionGet();
|
||||
client().admin().cluster().prepareReroute().get();
|
||||
ensureGreen();
|
||||
|
|
|
@ -20,10 +20,10 @@ package org.elasticsearch.cluster.allocation;
|
|||
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.routing.RoutingNode;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class SimpleAllocationIT extends ESIntegTestCase {
|
|||
assertThat(node.size(), equalTo(2));
|
||||
}
|
||||
}
|
||||
client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put(SETTING_NUMBER_OF_REPLICAS, 0)).execute().actionGet();
|
||||
client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(SETTING_NUMBER_OF_REPLICAS, 0)).execute().actionGet();
|
||||
ensureGreen();
|
||||
state = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class SimpleAllocationIT extends ESIntegTestCase {
|
|||
assertAcked(prepareCreate("test2", 3));
|
||||
ensureGreen();
|
||||
|
||||
client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put(SETTING_NUMBER_OF_REPLICAS, 1)).execute().actionGet();
|
||||
client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(SETTING_NUMBER_OF_REPLICAS, 1)).execute().actionGet();
|
||||
ensureGreen();
|
||||
state = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ public class MetaDataIndexUpgradeServiceTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public static IndexMetaData newIndexMeta(String name, Settings indexSettings) {
|
||||
Settings build = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
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(IndexMetaData.SETTING_CREATION_DATE, 1)
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.elasticsearch.cluster.metadata;
|
||||
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
|
@ -27,7 +28,6 @@ import org.elasticsearch.test.ESTestCase;
|
|||
import java.io.IOException;
|
||||
|
||||
import static org.elasticsearch.cluster.metadata.AliasMetaData.newAliasMetaDataBuilder;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
@ -118,7 +118,7 @@ public class ToAndFromJsonMetaDataTests extends ESTestCase {
|
|||
.put(IndexTemplateMetaData.builder("foo")
|
||||
.template("bar")
|
||||
.order(1)
|
||||
.settings(settingsBuilder()
|
||||
.settings(Settings.builder()
|
||||
.put("setting1", "value1")
|
||||
.put("setting2", "value2"))
|
||||
.putAlias(newAliasMetaDataBuilder("alias-bar1"))
|
||||
|
@ -139,7 +139,7 @@ public class ToAndFromJsonMetaDataTests extends ESTestCase {
|
|||
.put(IndexTemplateMetaData.builder("foo")
|
||||
.template("bar")
|
||||
.order(1)
|
||||
.settings(settingsBuilder()
|
||||
.settings(Settings.builder()
|
||||
.put("setting1", "value1")
|
||||
.put("setting2", "value2"))
|
||||
.putAlias(newAliasMetaDataBuilder("alias-bar1"))
|
||||
|
|
|
@ -59,7 +59,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testNameMatch() {
|
||||
Settings settings = Settings.settingsBuilder()
|
||||
Settings settings = Settings.builder()
|
||||
.put("xxx.name", "name1")
|
||||
.build();
|
||||
DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(OR, "xxx.", settings);
|
||||
|
@ -72,7 +72,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testIdMatch() {
|
||||
Settings settings = Settings.settingsBuilder()
|
||||
Settings settings = Settings.builder()
|
||||
.put("xxx._id", "id1")
|
||||
.build();
|
||||
DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(OR, "xxx.", settings);
|
||||
|
@ -85,7 +85,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testIdOrNameMatch() {
|
||||
Settings settings = shuffleSettings(Settings.settingsBuilder()
|
||||
Settings settings = shuffleSettings(Settings.builder()
|
||||
.put("xxx._id", "id1,blah")
|
||||
.put("xxx.name", "blah,name2")
|
||||
.build());
|
||||
|
@ -102,7 +102,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testTagAndGroupMatch() {
|
||||
Settings settings = shuffleSettings(Settings.settingsBuilder()
|
||||
Settings settings = shuffleSettings(Settings.builder()
|
||||
.put("xxx.tag", "A")
|
||||
.put("xxx.group", "B")
|
||||
.build());
|
||||
|
@ -136,7 +136,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testStarMatch() {
|
||||
Settings settings = Settings.settingsBuilder()
|
||||
Settings settings = Settings.builder()
|
||||
.put("xxx.name", "*")
|
||||
.build();
|
||||
DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(OR, "xxx.", settings);
|
||||
|
@ -146,7 +146,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testIpBindFilteringMatchingAnd() {
|
||||
Settings settings = shuffleSettings(Settings.settingsBuilder()
|
||||
Settings settings = shuffleSettings(Settings.builder()
|
||||
.put("xxx.tag", "A")
|
||||
.put("xxx." + randomFrom("_ip", "_host_ip", "_publish_ip"), "192.1.1.54")
|
||||
.build());
|
||||
|
@ -157,7 +157,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testIpBindFilteringNotMatching() {
|
||||
Settings settings = shuffleSettings(Settings.settingsBuilder()
|
||||
Settings settings = shuffleSettings(Settings.builder()
|
||||
.put("xxx.tag", "B")
|
||||
.put("xxx." + randomFrom("_ip", "_host_ip", "_publish_ip"), "192.1.1.54")
|
||||
.build());
|
||||
|
@ -168,7 +168,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testIpBindFilteringNotMatchingAnd() {
|
||||
Settings settings = shuffleSettings(Settings.settingsBuilder()
|
||||
Settings settings = shuffleSettings(Settings.builder()
|
||||
.put("xxx.tag", "A")
|
||||
.put("xxx." + randomFrom("_ip", "_host_ip", "_publish_ip"), "8.8.8.8")
|
||||
.build());
|
||||
|
@ -179,7 +179,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testIpBindFilteringMatchingOr() {
|
||||
Settings settings = shuffleSettings(Settings.settingsBuilder()
|
||||
Settings settings = shuffleSettings(Settings.builder()
|
||||
.put("xxx." + randomFrom("_ip", "_host_ip", "_publish_ip"), "192.1.1.54")
|
||||
.put("xxx.tag", "A")
|
||||
.build());
|
||||
|
@ -190,7 +190,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testIpBindFilteringNotMatchingOr() {
|
||||
Settings settings = shuffleSettings(Settings.settingsBuilder()
|
||||
Settings settings = shuffleSettings(Settings.builder()
|
||||
.put("xxx.tag", "A")
|
||||
.put("xxx." + randomFrom("_ip", "_host_ip", "_publish_ip"), "8.8.8.8")
|
||||
.build());
|
||||
|
@ -201,7 +201,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testIpPublishFilteringMatchingAnd() {
|
||||
Settings settings = shuffleSettings(Settings.settingsBuilder()
|
||||
Settings settings = shuffleSettings(Settings.builder()
|
||||
.put("xxx.tag", "A")
|
||||
.put("xxx._publish_ip", "192.1.1.54")
|
||||
.build());
|
||||
|
@ -212,7 +212,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testIpPublishFilteringNotMatchingAnd() {
|
||||
Settings settings = shuffleSettings(Settings.settingsBuilder()
|
||||
Settings settings = shuffleSettings(Settings.builder()
|
||||
.put("xxx.tag", "A")
|
||||
.put("xxx._publish_ip", "8.8.8.8")
|
||||
.build());
|
||||
|
@ -223,7 +223,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testIpPublishFilteringMatchingOr() {
|
||||
Settings settings = shuffleSettings(Settings.settingsBuilder()
|
||||
Settings settings = shuffleSettings(Settings.builder()
|
||||
.put("xxx._publish_ip", "192.1.1.54")
|
||||
.put("xxx.tag", "A")
|
||||
.build());
|
||||
|
@ -234,7 +234,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testIpPublishFilteringNotMatchingOr() {
|
||||
Settings settings = shuffleSettings(Settings.settingsBuilder()
|
||||
Settings settings = shuffleSettings(Settings.builder()
|
||||
.put("xxx.tag", "A")
|
||||
.put("xxx._publish_ip", "8.8.8.8")
|
||||
.build());
|
||||
|
@ -245,7 +245,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
private Settings shuffleSettings(Settings source) {
|
||||
Settings.Builder settings = Settings.settingsBuilder();
|
||||
Settings.Builder settings = Settings.builder();
|
||||
List<String> keys = new ArrayList<>(source.getAsMap().keySet());
|
||||
Collections.shuffle(keys, random());
|
||||
for (String o : keys) {
|
||||
|
|
|
@ -40,7 +40,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
|
@ -60,7 +59,7 @@ public class PrimaryTermsTests extends ESAllocationTestCase {
|
|||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
this.allocationService = createAllocationService(settingsBuilder()
|
||||
this.allocationService = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", Integer.MAX_VALUE) // don't limit recoveries
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", Integer.MAX_VALUE)
|
||||
.build());
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.elasticsearch.test.ESAllocationTestCase;
|
|||
import org.junit.Before;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
@ -49,7 +48,7 @@ public class RoutingTableTests extends ESAllocationTestCase {
|
|||
private int shardsPerIndex;
|
||||
private int totalNumberOfShards;
|
||||
private final static Settings DEFAULT_SETTINGS = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build();
|
||||
private final AllocationService ALLOCATION_SERVICE = createAllocationService(settingsBuilder()
|
||||
private final AllocationService ALLOCATION_SERVICE = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", Integer.MAX_VALUE) // don't limit recoveries
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", Integer.MAX_VALUE)
|
||||
.build());
|
||||
|
|
|
@ -43,13 +43,12 @@ import java.util.Collections;
|
|||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
|
||||
public class AddIncrementallyTests extends ESAllocationTestCase {
|
||||
private final ESLogger logger = Loggers.getLogger(AddIncrementallyTests.class);
|
||||
|
||||
public void testAddNodesAndIndices() {
|
||||
Settings.Builder settings = settingsBuilder();
|
||||
Settings.Builder settings = Settings.builder();
|
||||
settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString());
|
||||
AllocationService service = createAllocationService(settings.build());
|
||||
|
||||
|
@ -92,7 +91,7 @@ public class AddIncrementallyTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testMinimalRelocations() {
|
||||
Settings.Builder settings = settingsBuilder();
|
||||
Settings.Builder settings = Settings.builder();
|
||||
settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString())
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 2);
|
||||
AllocationService service = createAllocationService(settings.build());
|
||||
|
@ -160,7 +159,7 @@ public class AddIncrementallyTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testMinimalRelocationsNoLimit() {
|
||||
Settings.Builder settings = settingsBuilder();
|
||||
Settings.Builder settings = Settings.builder();
|
||||
settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString())
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 100)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 100);
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.elasticsearch.common.io.stream.BytesStreamOutput;
|
|||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
|
@ -51,7 +52,6 @@ import static java.util.Collections.singleton;
|
|||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class AllocationCommandsTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(AllocationCommandsTests.class);
|
||||
|
||||
public void testMoveShardCommand() {
|
||||
AllocationService allocation = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
AllocationService allocation = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
|
||||
logger.info("creating an index with 1 shard, no replica");
|
||||
MetaData metaData = MetaData.builder()
|
||||
|
@ -112,7 +112,7 @@ public class AllocationCommandsTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testAllocateCommand() {
|
||||
AllocationService allocation = createAllocationService(settingsBuilder()
|
||||
AllocationService allocation = createAllocationService(Settings.builder()
|
||||
.put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), "none")
|
||||
.put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), "none")
|
||||
.build());
|
||||
|
@ -238,7 +238,7 @@ public class AllocationCommandsTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testCancelCommand() {
|
||||
AllocationService allocation = createAllocationService(settingsBuilder()
|
||||
AllocationService allocation = createAllocationService(Settings.builder()
|
||||
.put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), "none")
|
||||
.put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), "none")
|
||||
.build());
|
||||
|
|
|
@ -25,10 +25,10 @@ import org.elasticsearch.cluster.metadata.MetaData;
|
|||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.cluster.routing.RoutingTable;
|
||||
import org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
|
||||
public class AllocationPriorityTests extends ESAllocationTestCase {
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class AllocationPriorityTests extends ESAllocationTestCase {
|
|||
* See https://github.com/elastic/elasticsearch/issues/13249 for details
|
||||
*/
|
||||
public void testPrioritizedIndicesAllocatedFirst() {
|
||||
AllocationService allocation = createAllocationService(settingsBuilder().
|
||||
AllocationService allocation = createAllocationService(Settings.builder().
|
||||
put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES_SETTING.getKey(), 1)
|
||||
.put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING.getKey(), 10)
|
||||
.put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES_SETTING.getKey(), 1)
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationComman
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.index.shard.ShardId;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static java.util.Collections.singletonMap;
|
||||
|
@ -41,7 +41,6 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
|||
import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.sameInstance;
|
||||
|
@ -53,7 +52,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(AwarenessAllocationTests.class);
|
||||
|
||||
public void testMoveShardOnceNewNodeWithAttributeAdded1() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.awareness.attributes", "rack_id")
|
||||
|
@ -121,7 +120,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testMoveShardOnceNewNodeWithAttributeAdded2() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.awareness.attributes", "rack_id")
|
||||
|
@ -190,7 +189,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testMoveShardOnceNewNodeWithAttributeAdded3() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
|
@ -282,7 +281,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testMoveShardOnceNewNodeWithAttributeAdded4() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
|
@ -377,7 +376,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testMoveShardOnceNewNodeWithAttributeAdded5() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.awareness.attributes", "rack_id")
|
||||
|
@ -455,7 +454,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testMoveShardOnceNewNodeWithAttributeAdded6() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.awareness.attributes", "rack_id")
|
||||
|
@ -535,7 +534,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testFullAwareness1() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.awareness.force.rack_id.values", "1,2")
|
||||
|
@ -602,7 +601,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testFullAwareness2() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.awareness.force.rack_id.values", "1,2")
|
||||
|
@ -670,7 +669,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testFullAwareness3() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
|
@ -754,7 +753,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testUnbalancedZones() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.awareness.force.zone.values", "a,b")
|
||||
.put("cluster.routing.allocation.awareness.attributes", "zone")
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
|
@ -818,7 +817,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testUnassignedShardsWithUnbalancedZones() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.awareness.attributes", "zone")
|
||||
|
|
|
@ -49,7 +49,6 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
|
||||
public class BalanceConfigurationTests extends ESAllocationTestCase {
|
||||
|
||||
|
@ -66,7 +65,7 @@ public class BalanceConfigurationTests extends ESAllocationTestCase {
|
|||
final float replicaBalance = 0.0f;
|
||||
final float balanceTreshold = 1.0f;
|
||||
|
||||
Settings.Builder settings = settingsBuilder();
|
||||
Settings.Builder settings = Settings.builder();
|
||||
settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString());
|
||||
settings.put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), indexBalance);
|
||||
settings.put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), replicaBalance);
|
||||
|
@ -91,7 +90,7 @@ public class BalanceConfigurationTests extends ESAllocationTestCase {
|
|||
final float replicaBalance = 1.0f;
|
||||
final float balanceTreshold = 1.0f;
|
||||
|
||||
Settings.Builder settings = settingsBuilder();
|
||||
Settings.Builder settings = Settings.builder();
|
||||
settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString());
|
||||
settings.put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), indexBalance);
|
||||
settings.put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), replicaBalance);
|
||||
|
@ -280,17 +279,17 @@ public class BalanceConfigurationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testPersistedSettings() {
|
||||
Settings.Builder settings = settingsBuilder();
|
||||
Settings.Builder settings = Settings.builder();
|
||||
settings.put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 0.2);
|
||||
settings.put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 0.3);
|
||||
settings.put(BalancedShardsAllocator.THRESHOLD_SETTING.getKey(), 2.0);
|
||||
ClusterSettings service = new ClusterSettings(settingsBuilder().build(), ClusterSettings.BUILT_IN_CLUSTER_SETTINGS);
|
||||
ClusterSettings service = new ClusterSettings(Settings.builder().build(), ClusterSettings.BUILT_IN_CLUSTER_SETTINGS);
|
||||
BalancedShardsAllocator allocator = new BalancedShardsAllocator(settings.build(), service);
|
||||
assertThat(allocator.getIndexBalance(), Matchers.equalTo(0.2f));
|
||||
assertThat(allocator.getShardBalance(), Matchers.equalTo(0.3f));
|
||||
assertThat(allocator.getThreshold(), Matchers.equalTo(2.0f));
|
||||
|
||||
settings = settingsBuilder();
|
||||
settings = Settings.builder();
|
||||
settings.put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 0.2);
|
||||
settings.put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 0.3);
|
||||
settings.put(BalancedShardsAllocator.THRESHOLD_SETTING.getKey(), 2.0);
|
||||
|
@ -300,7 +299,7 @@ public class BalanceConfigurationTests extends ESAllocationTestCase {
|
|||
assertThat(allocator.getShardBalance(), Matchers.equalTo(0.3f));
|
||||
assertThat(allocator.getThreshold(), Matchers.equalTo(2.0f));
|
||||
|
||||
settings = settingsBuilder();
|
||||
settings = Settings.builder();
|
||||
settings.put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 0.5);
|
||||
settings.put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 0.1);
|
||||
settings.put(BalancedShardsAllocator.THRESHOLD_SETTING.getKey(), 3.0);
|
||||
|
@ -311,7 +310,7 @@ public class BalanceConfigurationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testNoRebalanceOnPrimaryOverload() {
|
||||
Settings.Builder settings = settingsBuilder();
|
||||
Settings.Builder settings = Settings.builder();
|
||||
AllocationService strategy = new AllocationService(settings.build(), randomAllocationDeciders(settings.build(),
|
||||
new ClusterSettings(Settings.Builder.EMPTY_SETTINGS, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS), random()),
|
||||
NoopGatewayAllocator.INSTANCE, new ShardsAllocator() {
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.elasticsearch.cluster.metadata.MetaData;
|
|||
import org.elasticsearch.cluster.routing.IndexShardRoutingTable;
|
||||
import org.elasticsearch.cluster.routing.RoutingTable;
|
||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -35,7 +36,6 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
|
||||
/**
|
||||
* see issue #9023
|
||||
|
@ -54,7 +54,7 @@ public class BalanceUnbalancedClusterTests extends CatAllocationTestCase {
|
|||
@Override
|
||||
protected ClusterState allocateNew(ClusterState state) {
|
||||
String index = "tweets-2014-12-29:00";
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.build());
|
||||
MetaData metaData = MetaData.builder(state.metaData())
|
||||
.put(IndexMetaData.builder(index).settings(settings(Version.CURRENT)).numberOfShards(5).numberOfReplicas(1))
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.elasticsearch.cluster.routing.RoutingTable;
|
|||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.cluster.routing.ShardRoutingState;
|
||||
import org.elasticsearch.cluster.routing.TestShardRouting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
|
@ -47,7 +48,6 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
|
||||
/**
|
||||
* A base testcase that allows to run tests based on the output of the CAT API
|
||||
|
@ -134,7 +134,7 @@ public abstract class CatAllocationTestCase extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
private ClusterState rebalance(ClusterState clusterState) {
|
||||
RoutingTable routingTable;AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
RoutingTable routingTable;AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.build());
|
||||
RoutingAllocation.Result reroute = strategy.reroute(clusterState, "reroute");
|
||||
routingTable = reroute.routingTable();
|
||||
|
|
|
@ -40,7 +40,6 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
|||
import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.anyOf;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
|
@ -48,7 +47,7 @@ public class ClusterRebalanceRoutingTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(ClusterRebalanceRoutingTests.class);
|
||||
|
||||
public void testAlways() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
|
||||
AllocationService strategy = createAllocationService(Settings.builder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
|
||||
ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString()).build());
|
||||
|
||||
MetaData metaData = MetaData.builder()
|
||||
|
@ -134,7 +133,7 @@ public class ClusterRebalanceRoutingTests extends ESAllocationTestCase {
|
|||
|
||||
|
||||
public void testClusterPrimariesActive1() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
|
||||
AllocationService strategy = createAllocationService(Settings.builder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
|
||||
ClusterRebalanceAllocationDecider.ClusterRebalanceType.INDICES_PRIMARIES_ACTIVE.toString()).build());
|
||||
|
||||
MetaData metaData = MetaData.builder()
|
||||
|
@ -238,7 +237,7 @@ public class ClusterRebalanceRoutingTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testClusterPrimariesActive2() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
|
||||
AllocationService strategy = createAllocationService(Settings.builder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
|
||||
ClusterRebalanceAllocationDecider.ClusterRebalanceType.INDICES_PRIMARIES_ACTIVE.toString()).build());
|
||||
|
||||
MetaData metaData = MetaData.builder()
|
||||
|
@ -322,7 +321,7 @@ public class ClusterRebalanceRoutingTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testClusterAllActive1() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
|
||||
AllocationService strategy = createAllocationService(Settings.builder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
|
||||
ClusterRebalanceAllocationDecider.ClusterRebalanceType.INDICES_ALL_ACTIVE.toString()).build());
|
||||
|
||||
MetaData metaData = MetaData.builder()
|
||||
|
@ -445,7 +444,7 @@ public class ClusterRebalanceRoutingTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testClusterAllActive2() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
|
||||
AllocationService strategy = createAllocationService(Settings.builder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
|
||||
ClusterRebalanceAllocationDecider.ClusterRebalanceType.INDICES_ALL_ACTIVE.toString()).build());
|
||||
|
||||
MetaData metaData = MetaData.builder()
|
||||
|
@ -529,7 +528,7 @@ public class ClusterRebalanceRoutingTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testClusterAllActive3() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
|
||||
AllocationService strategy = createAllocationService(Settings.builder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
|
||||
ClusterRebalanceAllocationDecider.ClusterRebalanceType.INDICES_ALL_ACTIVE.toString()).build());
|
||||
|
||||
MetaData metaData = MetaData.builder()
|
||||
|
@ -739,7 +738,7 @@ public class ClusterRebalanceRoutingTests extends ESAllocationTestCase {
|
|||
|
||||
public void testRebalanceWhileShardFetching() {
|
||||
final AtomicBoolean hasFetches = new AtomicBoolean(true);
|
||||
AllocationService strategy = createAllocationService(settingsBuilder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
|
||||
AllocationService strategy = createAllocationService(Settings.builder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
|
||||
ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString()).build(), new NoopGatewayAllocator() {
|
||||
@Override
|
||||
public boolean allocateUnassigned(RoutingAllocation allocation) {
|
||||
|
|
|
@ -28,13 +28,13 @@ import org.elasticsearch.cluster.routing.RoutingNodes;
|
|||
import org.elasticsearch.cluster.routing.RoutingTable;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class ConcurrentRebalanceRoutingTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(ConcurrentRebalanceRoutingTests.class);
|
||||
|
||||
public void testClusterConcurrentRebalance() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", 3)
|
||||
.build());
|
||||
|
|
|
@ -30,12 +30,12 @@ import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationComman
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
|
@ -44,7 +44,7 @@ public class DeadNodesAllocationTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(DeadNodesAllocationTests.class);
|
||||
|
||||
public void testSimpleDeadNodeOnStartedPrimaryShard() {
|
||||
AllocationService allocation = createAllocationService(settingsBuilder()
|
||||
AllocationService allocation = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.build());
|
||||
|
@ -95,7 +95,7 @@ public class DeadNodesAllocationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testDeadNodeWhileRelocatingOnToNode() {
|
||||
AllocationService allocation = createAllocationService(settingsBuilder()
|
||||
AllocationService allocation = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.build());
|
||||
|
@ -169,7 +169,7 @@ public class DeadNodesAllocationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testDeadNodeWhileRelocatingOnFromNode() {
|
||||
AllocationService allocation = createAllocationService(settingsBuilder()
|
||||
AllocationService allocation = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.build());
|
||||
|
|
|
@ -29,11 +29,11 @@ import org.elasticsearch.cluster.routing.RoutingNodes;
|
|||
import org.elasticsearch.cluster.routing.RoutingTable;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
|
@ -43,7 +43,7 @@ public class ElectReplicaAsPrimaryDuringRelocationTests extends ESAllocationTest
|
|||
private final ESLogger logger = Loggers.getLogger(ElectReplicaAsPrimaryDuringRelocationTests.class);
|
||||
|
||||
public void testElectReplicaAsPrimaryDuringRelocation() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
AllocationService strategy = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
|
||||
logger.info("Building initial routing table");
|
||||
|
||||
|
|
|
@ -30,18 +30,18 @@ import org.elasticsearch.cluster.routing.RoutingTable;
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public class FailedNodeRoutingTests extends ESAllocationTestCase {
|
||||
private final ESLogger logger = Loggers.getLogger(FailedNodeRoutingTests.class);
|
||||
|
||||
public void testSimpleFailedNodeTest() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
|
||||
AllocationService strategy = createAllocationService(Settings.builder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
|
||||
ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString()).build());
|
||||
|
||||
MetaData metaData = MetaData.builder()
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationComman
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -41,7 +42,6 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
|||
import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.anyOf;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.lessThan;
|
||||
|
@ -55,7 +55,7 @@ public class FailedShardsRoutingTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(FailedShardsRoutingTests.class);
|
||||
|
||||
public void testFailedShardPrimaryRelocatingToAndFrom() {
|
||||
AllocationService allocation = createAllocationService(settingsBuilder()
|
||||
AllocationService allocation = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.build());
|
||||
|
@ -143,7 +143,7 @@ public class FailedShardsRoutingTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testFailPrimaryStartedCheckReplicaElected() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.build());
|
||||
|
@ -224,7 +224,7 @@ public class FailedShardsRoutingTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testFirstAllocationFailureSingleNode() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.build());
|
||||
|
@ -280,7 +280,7 @@ public class FailedShardsRoutingTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testSingleShardMultipleAllocationFailures() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.build());
|
||||
|
@ -336,7 +336,7 @@ public class FailedShardsRoutingTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testFirstAllocationFailureTwoNodes() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.build());
|
||||
|
@ -396,7 +396,7 @@ public class FailedShardsRoutingTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testRebalanceFailure() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.build());
|
||||
|
@ -491,7 +491,7 @@ public class FailedShardsRoutingTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testFailAllReplicasInitializingOnPrimaryFail() {
|
||||
AllocationService allocation = createAllocationService(settingsBuilder()
|
||||
AllocationService allocation = createAllocationService(Settings.builder()
|
||||
.build());
|
||||
|
||||
MetaData metaData = MetaData.builder()
|
||||
|
@ -537,7 +537,7 @@ public class FailedShardsRoutingTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testFailAllReplicasInitializingOnPrimaryFailWhileHavingAReplicaToElect() {
|
||||
AllocationService allocation = createAllocationService(settingsBuilder()
|
||||
AllocationService allocation = createAllocationService(Settings.builder()
|
||||
.build());
|
||||
|
||||
MetaData metaData = MetaData.builder()
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.elasticsearch.cluster.routing.ShardRouting;
|
|||
import org.elasticsearch.cluster.routing.ShardRoutingState;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
import org.hamcrest.Matchers;
|
||||
|
||||
|
@ -38,7 +39,6 @@ import java.util.List;
|
|||
import static java.util.Collections.singletonMap;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
|
@ -47,7 +47,7 @@ public class FilterRoutingTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(FilterRoutingTests.class);
|
||||
|
||||
public void testClusterFilters() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.include.tag1", "value1,value2")
|
||||
.put("cluster.routing.allocation.exclude.tag1", "value3,value4")
|
||||
.build());
|
||||
|
@ -92,7 +92,7 @@ public class FilterRoutingTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testIndexFilters() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.build());
|
||||
|
||||
logger.info("Building initial routing table");
|
||||
|
@ -166,7 +166,7 @@ public class FilterRoutingTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testRebalanceAfterShardsCannotRemainOnNode() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder().build());
|
||||
AllocationService strategy = createAllocationService(Settings.builder().build());
|
||||
|
||||
logger.info("Building initial routing table");
|
||||
MetaData metaData = MetaData.builder()
|
||||
|
@ -198,7 +198,7 @@ public class FilterRoutingTests extends ESAllocationTestCase {
|
|||
assertThat(clusterState.getRoutingNodes().shardsWithState(STARTED).size(), equalTo(4));
|
||||
|
||||
logger.info("--> disable allocation for node1 and reroute");
|
||||
strategy = createAllocationService(settingsBuilder()
|
||||
strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", "1")
|
||||
.put("cluster.routing.allocation.exclude.tag1", "value1")
|
||||
.build());
|
||||
|
|
|
@ -29,12 +29,12 @@ import org.elasticsearch.cluster.routing.RoutingTable;
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class IndexBalanceTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(IndexBalanceTests.class);
|
||||
|
||||
public void testBalanceAllNodesStarted() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
|
@ -175,7 +175,7 @@ public class IndexBalanceTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testBalanceIncrementallyStartNodes() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
|
@ -337,7 +337,7 @@ public class IndexBalanceTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testBalanceAllNodesStartedAddIndex() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
|
|
|
@ -60,7 +60,6 @@ import static java.util.Collections.shuffle;
|
|||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.elasticsearch.test.VersionUtils.randomVersion;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
@ -74,7 +73,7 @@ public class NodeVersionAllocationDeciderTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(NodeVersionAllocationDeciderTests.class);
|
||||
|
||||
public void testDoNotAllocateFromPrimary() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
|
||||
|
@ -188,7 +187,7 @@ public class NodeVersionAllocationDeciderTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testRandom() {
|
||||
AllocationService service = createAllocationService(settingsBuilder()
|
||||
AllocationService service = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
|
||||
|
@ -237,7 +236,7 @@ public class NodeVersionAllocationDeciderTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testRollingRestart() {
|
||||
AllocationService service = createAllocationService(settingsBuilder()
|
||||
AllocationService service = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.elasticsearch.cluster.metadata.MetaData;
|
|||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.cluster.routing.RoutingTable;
|
||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static java.util.Collections.singletonMap;
|
||||
|
@ -32,7 +33,6 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
|||
import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
|
@ -45,7 +45,7 @@ public class PreferLocalPrimariesToRelocatingPrimariesTests extends ESAllocation
|
|||
int totalNumberOfShards = numberOfShards * 2;
|
||||
|
||||
logger.info("create an allocation with [{}] initial primary recoveries and [{}] concurrent recoveries", primaryRecoveries, concurrentRecoveries);
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", concurrentRecoveries)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", primaryRecoveries)
|
||||
.build());
|
||||
|
|
|
@ -28,10 +28,10 @@ import org.elasticsearch.cluster.routing.RoutingTable;
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
|
@ -41,7 +41,7 @@ public class PreferPrimaryAllocationTests extends ESAllocationTestCase {
|
|||
|
||||
public void testPreferPrimaryAllocationOverReplicas() {
|
||||
logger.info("create an allocation with 1 initial recoveries");
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 1)
|
||||
.put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING.getKey(), 10)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 1)
|
||||
|
|
|
@ -28,11 +28,11 @@ import org.elasticsearch.cluster.routing.RoutingNodes;
|
|||
import org.elasticsearch.cluster.routing.RoutingTable;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class PrimaryElectionRoutingTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(PrimaryElectionRoutingTests.class);
|
||||
|
||||
public void testBackupElectionToPrimaryWhenPrimaryCanBeAllocatedToAnotherNode() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
AllocationService strategy = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
|
||||
logger.info("Building initial routing table");
|
||||
|
||||
|
@ -96,7 +96,7 @@ public class PrimaryElectionRoutingTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testRemovingInitializingReplicasIfPrimariesFails() {
|
||||
AllocationService allocation = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
AllocationService allocation = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
|
||||
logger.info("Building initial routing table");
|
||||
|
||||
|
|
|
@ -28,11 +28,11 @@ import org.elasticsearch.cluster.routing.RoutingNodes;
|
|||
import org.elasticsearch.cluster.routing.RoutingTable;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ public class PrimaryNotRelocatedWhileBeingRecoveredTests extends ESAllocationTes
|
|||
private final ESLogger logger = Loggers.getLogger(PrimaryNotRelocatedWhileBeingRecoveredTests.class);
|
||||
|
||||
public void testPrimaryNotRelocatedWhileBeingRecoveredFrom() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put("cluster.routing.allocation.concurrent_source_recoveries", 10)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 10)
|
||||
|
|
|
@ -46,7 +46,6 @@ import java.util.HashSet;
|
|||
import java.util.Random;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public class RandomAllocationDeciderTests extends ESAllocationTestCase {
|
||||
|
@ -57,7 +56,7 @@ public class RandomAllocationDeciderTests extends ESAllocationTestCase {
|
|||
* balance.*/
|
||||
public void testRandomDecisions() {
|
||||
RandomAllocationDecider randomAllocationDecider = new RandomAllocationDecider(random());
|
||||
AllocationService strategy = new AllocationService(settingsBuilder().build(), new AllocationDeciders(Settings.EMPTY,
|
||||
AllocationService strategy = new AllocationService(Settings.builder().build(), new AllocationDeciders(Settings.EMPTY,
|
||||
new HashSet<>(Arrays.asList(new SameShardAllocationDecider(Settings.EMPTY), new ReplicaAfterPrimaryActiveAllocationDecider(Settings.EMPTY),
|
||||
randomAllocationDecider))), NoopGatewayAllocator.INSTANCE, new BalancedShardsAllocator(Settings.EMPTY), EmptyClusterInfoService.INSTANCE);
|
||||
int indices = scaledRandomIntBetween(1, 20);
|
||||
|
|
|
@ -33,13 +33,13 @@ import org.elasticsearch.cluster.routing.ShardRouting;
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class RebalanceAfterActiveTests extends ESAllocationTestCase {
|
|||
sizes[i] = randomIntBetween(0, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
|
||||
|
|
|
@ -28,12 +28,12 @@ import org.elasticsearch.cluster.routing.RoutingNodes;
|
|||
import org.elasticsearch.cluster.routing.RoutingTable;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
@ -45,7 +45,7 @@ public class ReplicaAllocatedAfterPrimaryTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(ReplicaAllocatedAfterPrimaryTests.class);
|
||||
|
||||
public void testBackupIsAllocatedAfterPrimary() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
AllocationService strategy = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
|
||||
logger.info("Building initial routing table");
|
||||
|
||||
|
|
|
@ -31,11 +31,11 @@ import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllo
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
|
@ -45,7 +45,7 @@ public class RoutingNodesIntegrityTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(IndexBalanceTests.class);
|
||||
|
||||
public void testBalanceAllNodesStarted() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
|
@ -117,7 +117,7 @@ public class RoutingNodesIntegrityTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testBalanceIncrementallyStartNodes() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
|
@ -209,7 +209,7 @@ public class RoutingNodesIntegrityTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testBalanceAllNodesStartedAddIndex() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 1)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 3)
|
||||
.put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING.getKey(), 10)
|
||||
|
|
|
@ -31,13 +31,13 @@ import org.elasticsearch.cluster.routing.ShardRoutingState;
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.SameShardAllocationDecider;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.DummyTransportAddress;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingNodesUtils.numberOfShardsOfType;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
|
@ -46,7 +46,7 @@ public class SameShardRoutingTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(SameShardRoutingTests.class);
|
||||
|
||||
public void testSameHost() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put(SameShardAllocationDecider.SAME_HOST_SETTING, true).build());
|
||||
|
||||
MetaData metaData = MetaData.builder()
|
||||
|
|
|
@ -29,19 +29,19 @@ import org.elasticsearch.cluster.routing.RoutingTable;
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public class ShardVersioningTests extends ESAllocationTestCase {
|
||||
private final ESLogger logger = Loggers.getLogger(ShardVersioningTests.class);
|
||||
|
||||
public void testSimple() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
|
||||
AllocationService strategy = createAllocationService(Settings.builder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
|
||||
ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString()).build());
|
||||
|
||||
MetaData metaData = MetaData.builder()
|
||||
|
|
|
@ -31,13 +31,13 @@ import org.elasticsearch.cluster.routing.ShardRoutingState;
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.ShardsLimitAllocationDecider;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingNodesUtils.numberOfShardsOfType;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
|
@ -46,7 +46,7 @@ public class ShardsLimitAllocationTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(ShardsLimitAllocationTests.class);
|
||||
|
||||
public void testIndexLevelShardsLimitAllocate() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
AllocationService strategy = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
|
||||
logger.info("Building initial routing table");
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class ShardsLimitAllocationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testClusterLevelShardsLimitAllocate() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ShardsLimitAllocationDecider.CLUSTER_TOTAL_SHARDS_PER_NODE_SETTING.getKey(), 1)
|
||||
.build());
|
||||
|
@ -124,7 +124,7 @@ public class ShardsLimitAllocationTests extends ESAllocationTestCase {
|
|||
assertThat(clusterState.getRoutingNodes().unassigned().size(), equalTo(2));
|
||||
|
||||
// Bump the cluster total shards to 2
|
||||
strategy = createAllocationService(settingsBuilder()
|
||||
strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ShardsLimitAllocationDecider.CLUSTER_TOTAL_SHARDS_PER_NODE_SETTING.getKey(), 2)
|
||||
.build());
|
||||
|
@ -146,7 +146,7 @@ public class ShardsLimitAllocationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testIndexLevelShardsLimitRemain() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 10)
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.elasticsearch.cluster.routing.ShardRouting;
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -44,7 +45,6 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING;
|
|||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingNodesUtils.numberOfShardsOfType;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.anyOf;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.hasItem;
|
||||
|
@ -59,7 +59,7 @@ public class SingleShardNoReplicasRoutingTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(SingleShardNoReplicasRoutingTests.class);
|
||||
|
||||
public void testSingleIndexStartedShard() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
AllocationService strategy = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
|
||||
logger.info("Building initial routing table");
|
||||
|
||||
|
@ -160,7 +160,7 @@ public class SingleShardNoReplicasRoutingTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testSingleIndexShardFailed() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
AllocationService strategy = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
|
||||
logger.info("Building initial routing table");
|
||||
|
||||
|
@ -209,7 +209,7 @@ public class SingleShardNoReplicasRoutingTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testMultiIndexEvenDistribution() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
|
||||
|
@ -321,7 +321,7 @@ public class SingleShardNoReplicasRoutingTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testMultiIndexUnevenNodes() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
|
||||
|
|
|
@ -28,12 +28,12 @@ import org.elasticsearch.cluster.routing.RoutingNodes;
|
|||
import org.elasticsearch.cluster.routing.RoutingTable;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class SingleShardOneReplicaRoutingTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(SingleShardOneReplicaRoutingTests.class);
|
||||
|
||||
public void testSingleIndexFirstStartPrimaryThenBackups() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
AllocationService strategy = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
|
||||
logger.info("Building initial routing table");
|
||||
|
||||
|
|
|
@ -29,13 +29,13 @@ import org.elasticsearch.cluster.routing.RoutingTable;
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.lessThan;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
@ -47,7 +47,7 @@ public class TenShardsOneReplicaRoutingTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(TenShardsOneReplicaRoutingTests.class);
|
||||
|
||||
public void testSingleIndexFirstStartPrimaryThenBackups() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
|
|
|
@ -37,7 +37,6 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
|||
import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
|
@ -47,7 +46,7 @@ public class ThrottlingAllocationTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(ThrottlingAllocationTests.class);
|
||||
|
||||
public void testPrimaryRecoveryThrottling() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 3)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 3)
|
||||
.build());
|
||||
|
@ -107,7 +106,7 @@ public class ThrottlingAllocationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testReplicaAndPrimaryRecoveryThrottling() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder()
|
||||
AllocationService strategy = createAllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 3)
|
||||
.put("cluster.routing.allocation.concurrent_source_recoveries", 3)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 3)
|
||||
|
@ -177,7 +176,7 @@ public class ThrottlingAllocationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testThrottleIncomingAndOutgoing() {
|
||||
Settings settings = settingsBuilder()
|
||||
Settings settings = Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 5)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 5)
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", 5)
|
||||
|
@ -244,7 +243,7 @@ public class ThrottlingAllocationTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testOutgoingThrottlesAllocaiton() {
|
||||
Settings settings = settingsBuilder()
|
||||
Settings settings = Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 1)
|
||||
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 1)
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", 1)
|
||||
|
|
|
@ -28,12 +28,12 @@ import org.elasticsearch.cluster.routing.RoutingNodes;
|
|||
import org.elasticsearch.cluster.routing.RoutingTable;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESAllocationTestCase;
|
||||
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.anyOf;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
|
@ -46,7 +46,7 @@ public class UpdateNumberOfReplicasTests extends ESAllocationTestCase {
|
|||
private final ESLogger logger = Loggers.getLogger(UpdateNumberOfReplicasTests.class);
|
||||
|
||||
public void testUpdateNumberOfReplicas() {
|
||||
AllocationService strategy = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
AllocationService strategy = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());
|
||||
|
||||
logger.info("Building initial routing table");
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
|||
import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
@ -69,7 +68,7 @@ import static org.hamcrest.Matchers.nullValue;
|
|||
public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
||||
|
||||
public void testDiskThreshold() {
|
||||
Settings diskSettings = settingsBuilder()
|
||||
Settings diskSettings = Settings.builder()
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true)
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), 0.7)
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), 0.8).build();
|
||||
|
@ -104,7 +103,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
// noop
|
||||
}
|
||||
};
|
||||
AllocationService strategy = new AllocationService(settingsBuilder()
|
||||
AllocationService strategy = new AllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
|
||||
|
@ -183,7 +182,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
// Set the low threshold to 60 instead of 70
|
||||
// Set the high threshold to 70 instead of 80
|
||||
// node2 now should not have new shards allocated to it, but shards can remain
|
||||
diskSettings = settingsBuilder()
|
||||
diskSettings = Settings.builder()
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true)
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "60%")
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), 0.7).build();
|
||||
|
@ -193,7 +192,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
new SameShardAllocationDecider(Settings.EMPTY),
|
||||
new DiskThresholdDecider(diskSettings))));
|
||||
|
||||
strategy = new AllocationService(settingsBuilder()
|
||||
strategy = new AllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
|
||||
|
@ -214,7 +213,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
// Set the low threshold to 50 instead of 60
|
||||
// Set the high threshold to 60 instead of 70
|
||||
// node2 now should not have new shards allocated to it, and shards cannot remain
|
||||
diskSettings = settingsBuilder()
|
||||
diskSettings = Settings.builder()
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true)
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), 0.5)
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), 0.6).build();
|
||||
|
@ -224,7 +223,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
new SameShardAllocationDecider(Settings.EMPTY),
|
||||
new DiskThresholdDecider(diskSettings))));
|
||||
|
||||
strategy = new AllocationService(settingsBuilder()
|
||||
strategy = new AllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
|
||||
|
@ -268,7 +267,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testDiskThresholdWithAbsoluteSizes() {
|
||||
Settings diskSettings = settingsBuilder()
|
||||
Settings diskSettings = Settings.builder()
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true)
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "30b")
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), "9b").build();
|
||||
|
@ -305,7 +304,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
}
|
||||
};
|
||||
|
||||
AllocationService strategy = new AllocationService(settingsBuilder()
|
||||
AllocationService strategy = new AllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
|
||||
|
@ -363,7 +362,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
// noop
|
||||
}
|
||||
};
|
||||
strategy = new AllocationService(settingsBuilder()
|
||||
strategy = new AllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
|
||||
|
@ -422,7 +421,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
// Set the low threshold to 60 instead of 70
|
||||
// Set the high threshold to 70 instead of 80
|
||||
// node2 now should not have new shards allocated to it, but shards can remain
|
||||
diskSettings = settingsBuilder()
|
||||
diskSettings = Settings.builder()
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true)
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "40b")
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), "30b").build();
|
||||
|
@ -432,7 +431,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
new SameShardAllocationDecider(Settings.EMPTY),
|
||||
new DiskThresholdDecider(diskSettings))));
|
||||
|
||||
strategy = new AllocationService(settingsBuilder()
|
||||
strategy = new AllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
|
||||
|
@ -453,7 +452,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
// Set the low threshold to 50 instead of 60
|
||||
// Set the high threshold to 60 instead of 70
|
||||
// node2 now should not have new shards allocated to it, and shards cannot remain
|
||||
diskSettings = settingsBuilder()
|
||||
diskSettings = Settings.builder()
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true)
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "50b")
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), "40b").build();
|
||||
|
@ -463,7 +462,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
new SameShardAllocationDecider(Settings.EMPTY),
|
||||
new DiskThresholdDecider(diskSettings))));
|
||||
|
||||
strategy = new AllocationService(settingsBuilder()
|
||||
strategy = new AllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
|
||||
|
@ -541,7 +540,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testDiskThresholdWithShardSizes() {
|
||||
Settings diskSettings = settingsBuilder()
|
||||
Settings diskSettings = Settings.builder()
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true)
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), 0.7)
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), "71%").build();
|
||||
|
@ -574,7 +573,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
}
|
||||
};
|
||||
|
||||
AllocationService strategy = new AllocationService(settingsBuilder()
|
||||
AllocationService strategy = new AllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
|
||||
|
@ -610,7 +609,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testUnknownDiskUsage() {
|
||||
Settings diskSettings = settingsBuilder()
|
||||
Settings diskSettings = Settings.builder()
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true)
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), 0.7)
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), 0.85).build();
|
||||
|
@ -644,7 +643,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
}
|
||||
};
|
||||
|
||||
AllocationService strategy = new AllocationService(settingsBuilder()
|
||||
AllocationService strategy = new AllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
|
||||
|
@ -711,7 +710,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testShardRelocationsTakenIntoAccount() {
|
||||
Settings diskSettings = settingsBuilder()
|
||||
Settings diskSettings = Settings.builder()
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true)
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS_SETTING.getKey(), true)
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), 0.7)
|
||||
|
@ -749,7 +748,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
}
|
||||
};
|
||||
|
||||
AllocationService strategy = new AllocationService(settingsBuilder()
|
||||
AllocationService strategy = new AllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
|
||||
|
@ -820,7 +819,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testCanRemainWithShardRelocatingAway() {
|
||||
Settings diskSettings = settingsBuilder()
|
||||
Settings diskSettings = Settings.builder()
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true)
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS_SETTING.getKey(), true)
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "60%")
|
||||
|
@ -917,7 +916,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
AllocationDeciders deciders = new AllocationDeciders(Settings.EMPTY, new HashSet<>(Arrays.asList(
|
||||
new SameShardAllocationDecider(Settings.EMPTY), diskThresholdDecider
|
||||
)));
|
||||
AllocationService strategy = new AllocationService(settingsBuilder()
|
||||
AllocationService strategy = new AllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
|
||||
|
@ -935,7 +934,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
}
|
||||
|
||||
public void testForSingleDataNode() {
|
||||
Settings diskSettings = settingsBuilder()
|
||||
Settings diskSettings = Settings.builder()
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true)
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS_SETTING.getKey(), true)
|
||||
.put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "60%")
|
||||
|
@ -1014,7 +1013,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
|||
new SameShardAllocationDecider(Settings.EMPTY), diskThresholdDecider
|
||||
)));
|
||||
|
||||
AllocationService strategy = new AllocationService(settingsBuilder()
|
||||
AllocationService strategy = new AllocationService(Settings.builder()
|
||||
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
|
||||
.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always")
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue