Core: Less settings to AbstractComponent (#35140)
Stop passing `Settings` to `AbstractComponent`'s ctor. This allows us to stop passing around `Settings` in a *ton* of places. While this change touches many files, it touches them all in fairly small, mechanical ways, doing a few things per file: 1. Drop the `super(settings);` line on everything that extends `AbstractComponent`. 2. Drop the `settings` argument to the ctor if it is no longer used. 3. If the file doesn't use `logger` then drop `extends AbstractComponent` from it. 4. Clean up all compilation failure caused by the `settings` removal and drop any now unused `settings` isntances and method arguments. I've intentionally *not* removed the `settings` argument from a few files: 1. TransportAction 2. AbstractLifecycleComponent 3. BaseRestHandler These files don't *need* `settings` either, but this change is large enough as is. Relates to #34488
This commit is contained in:
parent
b5e5e93c46
commit
e28509fbfe
|
@ -46,10 +46,6 @@ public final class Allocators {
|
|||
private static class NoopGatewayAllocator extends GatewayAllocator {
|
||||
public static final NoopGatewayAllocator INSTANCE = new NoopGatewayAllocator();
|
||||
|
||||
protected NoopGatewayAllocator() {
|
||||
super(Settings.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyStartedShards(RoutingAllocation allocation, List<ShardRouting> startedShards) {
|
||||
// noop
|
||||
|
@ -79,7 +75,7 @@ public final class Allocators {
|
|||
|
||||
public static AllocationService createAllocationService(Settings settings, ClusterSettings clusterSettings) throws
|
||||
InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
|
||||
return new AllocationService(settings,
|
||||
return new AllocationService(
|
||||
defaultAllocationDeciders(settings, clusterSettings),
|
||||
NoopGatewayAllocator.INSTANCE, new BalancedShardsAllocator(settings), EmptyClusterInfoService.INSTANCE);
|
||||
}
|
||||
|
@ -88,7 +84,7 @@ public final class Allocators {
|
|||
IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException {
|
||||
Collection<AllocationDecider> deciders =
|
||||
ClusterModule.createAllocationDeciders(settings, clusterSettings, Collections.emptyList());
|
||||
return new AllocationDeciders(settings, deciders);
|
||||
return new AllocationDeciders(deciders);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,6 @@ public class ExpressionPlugin extends Plugin implements ScriptPlugin {
|
|||
|
||||
@Override
|
||||
public ScriptEngine getScriptEngine(Settings settings, Collection<ScriptContext<?>> contexts) {
|
||||
return new ExpressionScriptEngine(settings);
|
||||
return new ExpressionScriptEngine();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,6 @@ import org.apache.lucene.queries.function.valuesource.DoubleConstValueSource;
|
|||
import org.apache.lucene.search.SortField;
|
||||
import org.elasticsearch.SpecialPermission;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.fielddata.IndexFieldData;
|
||||
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
|
||||
import org.elasticsearch.index.mapper.DateFieldMapper;
|
||||
|
@ -63,14 +61,10 @@ import java.util.Map;
|
|||
*
|
||||
* Only contexts returning numeric types or {@link Object} are supported.
|
||||
*/
|
||||
public class ExpressionScriptEngine extends AbstractComponent implements ScriptEngine {
|
||||
public class ExpressionScriptEngine implements ScriptEngine {
|
||||
|
||||
public static final String NAME = "expression";
|
||||
|
||||
public ExpressionScriptEngine(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return NAME;
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.script.expression;
|
||||
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.fielddata.AtomicNumericFieldData;
|
||||
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
|
||||
import org.elasticsearch.index.fielddata.SortedNumericDoubleValues;
|
||||
|
@ -64,7 +63,7 @@ public class ExpressionFieldScriptTests extends ESTestCase {
|
|||
when(fieldData.getFieldName()).thenReturn("field");
|
||||
when(fieldData.load(anyObject())).thenReturn(atomicFieldData);
|
||||
|
||||
service = new ExpressionScriptEngine(Settings.EMPTY);
|
||||
service = new ExpressionScriptEngine();
|
||||
lookup = new SearchLookup(mapperService, ignored -> fieldData, null);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.elasticsearch.script.expression;
|
|||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.Collections;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.fielddata.AtomicNumericFieldData;
|
||||
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
|
||||
import org.elasticsearch.index.fielddata.SortedNumericDoubleValues;
|
||||
|
@ -63,7 +62,7 @@ public class ExpressionNumberSortScriptTests extends ESTestCase {
|
|||
when(fieldData.getFieldName()).thenReturn("field");
|
||||
when(fieldData.load(anyObject())).thenReturn(atomicFieldData);
|
||||
|
||||
service = new ExpressionScriptEngine(Settings.EMPTY);
|
||||
service = new ExpressionScriptEngine();
|
||||
lookup = new SearchLookup(mapperService, ignored -> fieldData, null);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.elasticsearch.script.expression;
|
|||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.Collections;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.fielddata.AtomicNumericFieldData;
|
||||
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
|
||||
import org.elasticsearch.index.fielddata.SortedNumericDoubleValues;
|
||||
|
@ -63,7 +62,7 @@ public class ExpressionTermsSetQueryTests extends ESTestCase {
|
|||
when(fieldData.getFieldName()).thenReturn("field");
|
||||
when(fieldData.load(anyObject())).thenReturn(atomicFieldData);
|
||||
|
||||
service = new ExpressionScriptEngine(Settings.EMPTY);
|
||||
service = new ExpressionScriptEngine();
|
||||
lookup = new SearchLookup(mapperService, ignored -> fieldData, null);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.elasticsearch.painless;
|
||||
|
||||
import org.elasticsearch.SpecialPermission;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.painless.Compiler.Loader;
|
||||
import org.elasticsearch.painless.lookup.PainlessLookupBuilder;
|
||||
|
@ -54,7 +53,7 @@ import static org.elasticsearch.painless.node.SSource.MainMethodReserved;
|
|||
/**
|
||||
* Implementation of a ScriptEngine for the Painless language.
|
||||
*/
|
||||
public final class PainlessScriptEngine extends AbstractComponent implements ScriptEngine {
|
||||
public final class PainlessScriptEngine implements ScriptEngine {
|
||||
|
||||
/**
|
||||
* Standard name of the Painless language.
|
||||
|
@ -90,8 +89,6 @@ public final class PainlessScriptEngine extends AbstractComponent implements Scr
|
|||
* @param settings The settings to initialize the engine with.
|
||||
*/
|
||||
public PainlessScriptEngine(Settings settings, Map<ScriptContext<?>, List<Whitelist>> contexts) {
|
||||
super(settings);
|
||||
|
||||
defaultCompilerSettings.setRegexesEnabled(CompilerSettings.REGEX_ENABLED.get(settings));
|
||||
|
||||
Map<ScriptContext<?>, Compiler> contextsToCompilers = new HashMap<>();
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.apache.lucene.search.Query;
|
|||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.common.document.DocumentField;
|
||||
import org.elasticsearch.common.lucene.search.function.FunctionScoreQuery;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.text.Text;
|
||||
import org.elasticsearch.index.query.ParsedQuery;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
|
@ -56,8 +55,8 @@ import java.util.Map;
|
|||
final class PercolatorHighlightSubFetchPhase implements FetchSubPhase {
|
||||
private final HighlightPhase highlightPhase;
|
||||
|
||||
PercolatorHighlightSubFetchPhase(Settings settings, Map<String, Highlighter> highlighters) {
|
||||
this.highlightPhase = new HighlightPhase(settings, highlighters);
|
||||
PercolatorHighlightSubFetchPhase(Map<String, Highlighter> highlighters) {
|
||||
this.highlightPhase = new HighlightPhase(highlighters);
|
||||
}
|
||||
|
||||
boolean hitsExecutionNeeded(SearchContext context) { // for testing
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.elasticsearch.percolator;
|
||||
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.mapper.Mapper;
|
||||
import org.elasticsearch.plugins.MapperPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
|
@ -35,13 +34,6 @@ import static java.util.Collections.singletonList;
|
|||
import static java.util.Collections.singletonMap;
|
||||
|
||||
public class PercolatorPlugin extends Plugin implements MapperPlugin, SearchPlugin {
|
||||
|
||||
private final Settings settings;
|
||||
|
||||
public PercolatorPlugin(Settings settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QuerySpec<?>> getQueries() {
|
||||
return singletonList(new QuerySpec<>(PercolateQueryBuilder.NAME, PercolateQueryBuilder::new, PercolateQueryBuilder::fromXContent));
|
||||
|
@ -51,7 +43,7 @@ public class PercolatorPlugin extends Plugin implements MapperPlugin, SearchPlug
|
|||
public List<FetchSubPhase> getFetchSubPhases(FetchPhaseConstructionContext context) {
|
||||
return Arrays.asList(
|
||||
new PercolatorMatchedSlotSubFetchPhase(),
|
||||
new PercolatorHighlightSubFetchPhase(settings, context.getHighlighters())
|
||||
new PercolatorHighlightSubFetchPhase(context.getHighlighters())
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.apache.lucene.search.MatchAllDocsQuery;
|
|||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.lucene.search.function.FunctionScoreQuery;
|
||||
import org.elasticsearch.common.lucene.search.function.RandomScoreFunction;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.search.fetch.subphase.highlight.SearchContextHighlight;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
|
@ -47,8 +46,7 @@ public class PercolatorHighlightSubFetchPhaseTests extends ESTestCase {
|
|||
public void testHitsExecutionNeeded() {
|
||||
PercolateQuery percolateQuery = new PercolateQuery("_name", ctx -> null, Collections.singletonList(new BytesArray("{}")),
|
||||
new MatchAllDocsQuery(), Mockito.mock(IndexSearcher.class), null, new MatchAllDocsQuery());
|
||||
PercolatorHighlightSubFetchPhase subFetchPhase = new PercolatorHighlightSubFetchPhase(Settings.EMPTY,
|
||||
emptyMap());
|
||||
PercolatorHighlightSubFetchPhase subFetchPhase = new PercolatorHighlightSubFetchPhase(emptyMap());
|
||||
SearchContext searchContext = Mockito.mock(SearchContext.class);
|
||||
Mockito.when(searchContext.highlight()).thenReturn(new SearchContextHighlight(Collections.emptyList()));
|
||||
Mockito.when(searchContext.query()).thenReturn(new MatchAllDocsQuery());
|
||||
|
|
|
@ -53,7 +53,7 @@ public class ReindexSourceTargetValidationTests extends ESTestCase {
|
|||
.put(index("baz"), true)
|
||||
.put(index("source", "source_multi"), true)
|
||||
.put(index("source2", "source_multi"), true)).build();
|
||||
private static final IndexNameExpressionResolver INDEX_NAME_EXPRESSION_RESOLVER = new IndexNameExpressionResolver(Settings.EMPTY);
|
||||
private static final IndexNameExpressionResolver INDEX_NAME_EXPRESSION_RESOLVER = new IndexNameExpressionResolver();
|
||||
private static final AutoCreateIndex AUTO_CREATE_INDEX = new AutoCreateIndex(Settings.EMPTY,
|
||||
new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS), INDEX_NAME_EXPRESSION_RESOLVER);
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.common.blobstore.BlobContainer;
|
|||
import org.elasticsearch.common.blobstore.BlobPath;
|
||||
import org.elasticsearch.common.blobstore.BlobStore;
|
||||
import org.elasticsearch.common.blobstore.BlobStoreException;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeUnit;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
|
@ -34,7 +33,7 @@ import java.net.URL;
|
|||
/**
|
||||
* Read-only URL-based blob store
|
||||
*/
|
||||
public class URLBlobStore extends AbstractComponent implements BlobStore {
|
||||
public class URLBlobStore implements BlobStore {
|
||||
|
||||
private final URL path;
|
||||
|
||||
|
@ -53,7 +52,6 @@ public class URLBlobStore extends AbstractComponent implements BlobStore {
|
|||
* @param path base URL
|
||||
*/
|
||||
public URLBlobStore(Settings settings, URL path) {
|
||||
super(settings);
|
||||
this.path = path;
|
||||
this.bufferSizeInBytes = (int) settings.getAsBytesSize("repositories.uri.buffer_size",
|
||||
new ByteSizeValue(100, ByteSizeUnit.KB)).getBytes();
|
||||
|
|
|
@ -108,7 +108,6 @@ public class AzureUnicastHostsProvider extends AbstractComponent implements Unic
|
|||
|
||||
public AzureUnicastHostsProvider(Settings settings, AzureComputeService azureComputeService,
|
||||
TransportService transportService, NetworkService networkService) {
|
||||
super(settings);
|
||||
this.settings = settings;
|
||||
this.azureComputeService = azureComputeService;
|
||||
this.transportService = transportService;
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.elasticsearch.ElasticsearchException;
|
|||
import org.elasticsearch.common.Randomness;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.LazyInitializable;
|
||||
|
||||
import java.util.Random;
|
||||
|
@ -46,10 +45,6 @@ class AwsEc2ServiceImpl extends AbstractComponent implements AwsEc2Service {
|
|||
private final AtomicReference<LazyInitializable<AmazonEc2Reference, ElasticsearchException>> lazyClientReference =
|
||||
new AtomicReference<>();
|
||||
|
||||
AwsEc2ServiceImpl(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
private AmazonEC2 buildClient(Ec2ClientSettings clientSettings) {
|
||||
final AWSCredentialsProvider credentials = buildCredentials(logger, clientSettings);
|
||||
final ClientConfiguration configuration = buildConfiguration(logger, clientSettings);
|
||||
|
|
|
@ -69,7 +69,6 @@ class AwsEc2UnicastHostsProvider extends AbstractComponent implements UnicastHos
|
|||
private final TransportAddressesCache dynamicHosts;
|
||||
|
||||
AwsEc2UnicastHostsProvider(Settings settings, TransportService transportService, AwsEc2Service awsEc2Service) {
|
||||
super(settings);
|
||||
this.transportService = transportService;
|
||||
this.awsEc2Service = awsEc2Service;
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ public class Ec2DiscoveryPlugin extends Plugin implements DiscoveryPlugin, Reloa
|
|||
protected final AwsEc2Service ec2Service;
|
||||
|
||||
public Ec2DiscoveryPlugin(Settings settings) {
|
||||
this(settings, new AwsEc2ServiceImpl(settings));
|
||||
this(settings, new AwsEc2ServiceImpl());
|
||||
}
|
||||
|
||||
protected Ec2DiscoveryPlugin(Settings settings, AwsEc2ServiceImpl ec2Service) {
|
||||
|
@ -91,7 +91,7 @@ public class Ec2DiscoveryPlugin extends Plugin implements DiscoveryPlugin, Reloa
|
|||
@Override
|
||||
public NetworkService.CustomNameResolver getCustomNameResolver(Settings settings) {
|
||||
logger.debug("Register _ec2_, _ec2:xxx_ network names");
|
||||
return new Ec2NameResolver(settings);
|
||||
return new Ec2NameResolver();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.core.internal.io.IOUtils;
|
|||
import org.elasticsearch.common.SuppressForbidden;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.network.NetworkService.CustomNameResolver;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
|
@ -79,13 +78,6 @@ class Ec2NameResolver extends AbstractComponent implements CustomNameResolver {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a {@link CustomNameResolver}.
|
||||
*/
|
||||
Ec2NameResolver(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type the ec2 hostname type to discover.
|
||||
* @return the appropriate host resolved from ec2 meta-data, or null if it cannot be obtained.
|
||||
|
|
|
@ -24,8 +24,6 @@ import com.amazonaws.auth.AWSCredentialsProvider;
|
|||
import com.amazonaws.services.ec2.AmazonEC2;
|
||||
import com.amazonaws.services.ec2.model.Tag;
|
||||
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AwsEc2ServiceMock extends AwsEc2ServiceImpl {
|
||||
|
@ -33,8 +31,7 @@ public class AwsEc2ServiceMock extends AwsEc2ServiceImpl {
|
|||
private final int nodes;
|
||||
private final List<List<Tag>> tagsList;
|
||||
|
||||
public AwsEc2ServiceMock(Settings settings, int nodes, List<List<Tag>> tagsList) {
|
||||
super(settings);
|
||||
public AwsEc2ServiceMock(int nodes, List<List<Tag>> tagsList) {
|
||||
this.nodes = nodes;
|
||||
this.tagsList = tagsList;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class Ec2DiscoveryPluginMock extends Ec2DiscoveryPlugin {
|
|||
}
|
||||
|
||||
public Ec2DiscoveryPluginMock(Settings settings, int nodes, List<List<Tag>> tagsList) {
|
||||
super(settings, new AwsEc2ServiceMock(settings, nodes, tagsList));
|
||||
super(settings, new AwsEc2ServiceMock(nodes, tagsList));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -298,7 +298,7 @@ public class Ec2DiscoveryTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testGetNodeListEmptyCache() throws Exception {
|
||||
AwsEc2Service awsEc2Service = new AwsEc2ServiceMock(Settings.EMPTY, 1, null);
|
||||
AwsEc2Service awsEc2Service = new AwsEc2ServiceMock(1, null);
|
||||
DummyEc2HostProvider provider = new DummyEc2HostProvider(Settings.EMPTY, transportService, awsEc2Service) {
|
||||
@Override
|
||||
protected List<TransportAddress> fetchDynamicNodes() {
|
||||
|
|
|
@ -32,6 +32,9 @@ import static org.hamcrest.Matchers.containsString;
|
|||
|
||||
/**
|
||||
* Test for EC2 network.host settings.
|
||||
* <p>
|
||||
* Warning: This test doesn't assert that the exceptions are thrown.
|
||||
* They aren't.
|
||||
*/
|
||||
public class Ec2NetworkTests extends ESTestCase {
|
||||
/**
|
||||
|
@ -42,10 +45,11 @@ public class Ec2NetworkTests extends ESTestCase {
|
|||
.put("network.host", "_ec2_")
|
||||
.build();
|
||||
|
||||
NetworkService networkService = new NetworkService(Collections.singletonList(new Ec2NameResolver(nodeSettings)));
|
||||
NetworkService networkService = new NetworkService(Collections.singletonList(new Ec2NameResolver()));
|
||||
// TODO we need to replace that with a mock. For now we check the URL we are supposed to reach.
|
||||
try {
|
||||
networkService.resolveBindHostAddresses(null);
|
||||
// note: this can succeed and the test can pass
|
||||
} catch (IOException e) {
|
||||
assertThat(e.getMessage(), containsString("local-ipv4"));
|
||||
}
|
||||
|
@ -59,10 +63,11 @@ public class Ec2NetworkTests extends ESTestCase {
|
|||
.put("network.host", "_ec2:publicIp_")
|
||||
.build();
|
||||
|
||||
NetworkService networkService = new NetworkService(Collections.singletonList(new Ec2NameResolver(nodeSettings)));
|
||||
NetworkService networkService = new NetworkService(Collections.singletonList(new Ec2NameResolver()));
|
||||
// TODO we need to replace that with a mock. For now we check the URL we are supposed to reach.
|
||||
try {
|
||||
networkService.resolveBindHostAddresses(null);
|
||||
// note: this can succeed and the test can pass
|
||||
} catch (IOException e) {
|
||||
assertThat(e.getMessage(), containsString("public-ipv4"));
|
||||
}
|
||||
|
@ -76,10 +81,11 @@ public class Ec2NetworkTests extends ESTestCase {
|
|||
.put("network.host", "_ec2:privateIp_")
|
||||
.build();
|
||||
|
||||
NetworkService networkService = new NetworkService(Collections.singletonList(new Ec2NameResolver(nodeSettings)));
|
||||
NetworkService networkService = new NetworkService(Collections.singletonList(new Ec2NameResolver()));
|
||||
// TODO we need to replace that with a mock. For now we check the URL we are supposed to reach.
|
||||
try {
|
||||
networkService.resolveBindHostAddresses(null);
|
||||
// note: this can succeed and the test can pass
|
||||
} catch (IOException e) {
|
||||
assertThat(e.getMessage(), containsString("local-ipv4"));
|
||||
}
|
||||
|
@ -93,10 +99,11 @@ public class Ec2NetworkTests extends ESTestCase {
|
|||
.put("network.host", "_ec2:privateIpv4_")
|
||||
.build();
|
||||
|
||||
NetworkService networkService = new NetworkService(Collections.singletonList(new Ec2NameResolver(nodeSettings)));
|
||||
NetworkService networkService = new NetworkService(Collections.singletonList(new Ec2NameResolver()));
|
||||
// TODO we need to replace that with a mock. For now we check the URL we are supposed to reach.
|
||||
try {
|
||||
networkService.resolveBindHostAddresses(null);
|
||||
// note: this can succeed and the test can pass
|
||||
} catch (IOException e) {
|
||||
assertThat(e.getMessage(), containsString("local-ipv4"));
|
||||
}
|
||||
|
@ -110,10 +117,11 @@ public class Ec2NetworkTests extends ESTestCase {
|
|||
.put("network.host", "_ec2:privateDns_")
|
||||
.build();
|
||||
|
||||
NetworkService networkService = new NetworkService(Collections.singletonList(new Ec2NameResolver(nodeSettings)));
|
||||
NetworkService networkService = new NetworkService(Collections.singletonList(new Ec2NameResolver()));
|
||||
// TODO we need to replace that with a mock. For now we check the URL we are supposed to reach.
|
||||
try {
|
||||
networkService.resolveBindHostAddresses(null);
|
||||
// note: this can succeed and the test can pass
|
||||
} catch (IOException e) {
|
||||
assertThat(e.getMessage(), containsString("local-hostname"));
|
||||
}
|
||||
|
@ -127,10 +135,11 @@ public class Ec2NetworkTests extends ESTestCase {
|
|||
.put("network.host", "_ec2:publicIpv4_")
|
||||
.build();
|
||||
|
||||
NetworkService networkService = new NetworkService(Collections.singletonList(new Ec2NameResolver(nodeSettings)));
|
||||
NetworkService networkService = new NetworkService(Collections.singletonList(new Ec2NameResolver()));
|
||||
// TODO we need to replace that with a mock. For now we check the URL we are supposed to reach.
|
||||
try {
|
||||
networkService.resolveBindHostAddresses(null);
|
||||
// note: this can succeed and the test can pass
|
||||
} catch (IOException e) {
|
||||
assertThat(e.getMessage(), containsString("public-ipv4"));
|
||||
}
|
||||
|
@ -144,10 +153,11 @@ public class Ec2NetworkTests extends ESTestCase {
|
|||
.put("network.host", "_ec2:publicDns_")
|
||||
.build();
|
||||
|
||||
NetworkService networkService = new NetworkService(Collections.singletonList(new Ec2NameResolver(nodeSettings)));
|
||||
NetworkService networkService = new NetworkService(Collections.singletonList(new Ec2NameResolver()));
|
||||
// TODO we need to replace that with a mock. For now we check the URL we are supposed to reach.
|
||||
try {
|
||||
networkService.resolveBindHostAddresses(null);
|
||||
// note: this can succeed and the test can pass
|
||||
} catch (IOException e) {
|
||||
assertThat(e.getMessage(), containsString("public-hostname"));
|
||||
}
|
||||
|
@ -158,11 +168,7 @@ public class Ec2NetworkTests extends ESTestCase {
|
|||
* network.host: _local_
|
||||
*/
|
||||
public void testNetworkHostCoreLocal() throws IOException {
|
||||
Settings nodeSettings = Settings.builder()
|
||||
.put("network.host", "_local_")
|
||||
.build();
|
||||
|
||||
NetworkService networkService = new NetworkService(Collections.singletonList(new Ec2NameResolver(nodeSettings)));
|
||||
NetworkService networkService = new NetworkService(Collections.singletonList(new Ec2NameResolver()));
|
||||
InetAddress[] addresses = networkService.resolveBindHostAddresses(null);
|
||||
assertThat(addresses, arrayContaining(networkService.resolveBindHostAddresses(new String[] { "_local_" })));
|
||||
}
|
||||
|
|
|
@ -108,7 +108,6 @@ public class GceInstancesServiceImpl extends AbstractComponent implements GceIns
|
|||
private final boolean validateCerts;
|
||||
|
||||
public GceInstancesServiceImpl(Settings settings) {
|
||||
super(settings);
|
||||
this.settings = settings;
|
||||
this.validateCerts = GCE_VALIDATE_CERTIFICATES.get(settings);
|
||||
this.project = resolveProject();
|
||||
|
|
|
@ -22,9 +22,7 @@ package org.elasticsearch.cloud.gce.network;
|
|||
import org.elasticsearch.cloud.gce.GceMetadataService;
|
||||
import org.elasticsearch.cloud.gce.util.Access;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.network.NetworkService.CustomNameResolver;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
|
@ -39,7 +37,7 @@ import java.net.InetAddress;
|
|||
* <li>_gce:hostname_</li>
|
||||
* </ul>
|
||||
*/
|
||||
public class GceNameResolver extends AbstractComponent implements CustomNameResolver {
|
||||
public class GceNameResolver implements CustomNameResolver {
|
||||
|
||||
private final GceMetadataService gceMetadataService;
|
||||
|
||||
|
@ -73,8 +71,7 @@ public class GceNameResolver extends AbstractComponent implements CustomNameReso
|
|||
/**
|
||||
* Construct a {@link CustomNameResolver}.
|
||||
*/
|
||||
public GceNameResolver(Settings settings, GceMetadataService gceMetadataService) {
|
||||
super(settings);
|
||||
public GceNameResolver(GceMetadataService gceMetadataService) {
|
||||
this.gceMetadataService = gceMetadataService;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,6 @@ public class GceUnicastHostsProvider extends AbstractComponent implements Unicas
|
|||
public GceUnicastHostsProvider(Settings settings, GceInstancesService gceInstancesService,
|
||||
TransportService transportService,
|
||||
NetworkService networkService) {
|
||||
super(settings);
|
||||
this.settings = settings;
|
||||
this.gceInstancesService = gceInstancesService;
|
||||
this.transportService = transportService;
|
||||
|
|
|
@ -95,7 +95,7 @@ public class GceDiscoveryPlugin extends Plugin implements DiscoveryPlugin, Close
|
|||
@Override
|
||||
public NetworkService.CustomNameResolver getCustomNameResolver(Settings settings) {
|
||||
logger.debug("Register _gce_, _gce:xxx network names");
|
||||
return new GceNameResolver(settings, new GceMetadataService(settings));
|
||||
return new GceNameResolver(new GceMetadataService(settings));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -107,7 +107,7 @@ public class GceNetworkTests extends ESTestCase {
|
|||
.build();
|
||||
|
||||
GceMetadataServiceMock mock = new GceMetadataServiceMock(nodeSettings);
|
||||
NetworkService networkService = new NetworkService(Collections.singletonList(new GceNameResolver(nodeSettings, mock)));
|
||||
NetworkService networkService = new NetworkService(Collections.singletonList(new GceNameResolver(mock)));
|
||||
try {
|
||||
InetAddress[] addresses = networkService.resolveBindHostAddresses(
|
||||
NetworkService.GLOBAL_NETWORK_BINDHOST_SETTING.get(nodeSettings).toArray(Strings.EMPTY_ARRAY));
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.common.blobstore.BlobMetaData;
|
|||
import org.elasticsearch.common.blobstore.BlobPath;
|
||||
import org.elasticsearch.common.blobstore.BlobStore;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URISyntaxException;
|
||||
|
@ -47,9 +46,8 @@ public class AzureBlobStore extends AbstractComponent implements BlobStore {
|
|||
private final String container;
|
||||
private final LocationMode locationMode;
|
||||
|
||||
public AzureBlobStore(RepositoryMetaData metadata, Settings settings, AzureStorageService service)
|
||||
public AzureBlobStore(RepositoryMetaData metadata, AzureStorageService service)
|
||||
throws URISyntaxException, StorageException {
|
||||
super(settings);
|
||||
this.container = Repository.CONTAINER_SETTING.get(metadata.settings());
|
||||
this.clientName = Repository.CLIENT_NAME.get(metadata.settings());
|
||||
this.service = service;
|
||||
|
|
|
@ -125,7 +125,7 @@ public class AzureRepository extends BlobStoreRepository {
|
|||
*/
|
||||
@Override
|
||||
protected AzureBlobStore createBlobStore() throws URISyntaxException, StorageException {
|
||||
final AzureBlobStore blobStore = new AzureBlobStore(metadata, environment.settings(), storageService);
|
||||
final AzureBlobStore blobStore = new AzureBlobStore(metadata, storageService);
|
||||
|
||||
logger.debug((org.apache.logging.log4j.util.Supplier<?>) () -> new ParameterizedMessage(
|
||||
"using container [{}], chunk_size [{}], compress [{}], base_path [{}]",
|
||||
|
|
|
@ -70,7 +70,6 @@ public class AzureStorageService extends AbstractComponent {
|
|||
volatile Map<String, AzureStorageSettings> storageSettings = emptyMap();
|
||||
|
||||
public AzureStorageService(Settings settings) {
|
||||
super(settings);
|
||||
// eagerly load client settings so that secure settings are read
|
||||
final Map<String, AzureStorageSettings> clientsSettings = AzureStorageSettings.load(settings);
|
||||
refreshAndClearCache(clientsSettings);
|
||||
|
|
|
@ -34,7 +34,7 @@ public class AzureBlobStoreContainerTests extends ESBlobStoreContainerTestCase {
|
|||
try {
|
||||
RepositoryMetaData repositoryMetaData = new RepositoryMetaData("azure", "ittest", Settings.EMPTY);
|
||||
AzureStorageServiceMock client = new AzureStorageServiceMock();
|
||||
return new AzureBlobStore(repositoryMetaData, Settings.EMPTY, client);
|
||||
return new AzureBlobStore(repositoryMetaData, client);
|
||||
} catch (URISyntaxException | StorageException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class AzureBlobStoreTests extends ESBlobStoreTestCase {
|
|||
try {
|
||||
RepositoryMetaData repositoryMetaData = new RepositoryMetaData("azure", "ittest", Settings.EMPTY);
|
||||
AzureStorageServiceMock client = new AzureStorageServiceMock();
|
||||
return new AzureBlobStore(repositoryMetaData, Settings.EMPTY, client);
|
||||
return new AzureBlobStore(repositoryMetaData, client);
|
||||
} catch (URISyntaxException | StorageException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.elasticsearch.common.blobstore.BlobStoreException;
|
|||
import org.elasticsearch.common.blobstore.support.PlainBlobMetaData;
|
||||
import org.elasticsearch.common.collect.MapBuilder;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.core.internal.io.Streams;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -69,8 +68,7 @@ class GoogleCloudStorageBlobStore extends AbstractComponent implements BlobStore
|
|||
private final String clientName;
|
||||
private final GoogleCloudStorageService storageService;
|
||||
|
||||
GoogleCloudStorageBlobStore(Settings settings, String bucketName, String clientName, GoogleCloudStorageService storageService) {
|
||||
super(settings);
|
||||
GoogleCloudStorageBlobStore(String bucketName, String clientName, GoogleCloudStorageService storageService) {
|
||||
this.bucketName = bucketName;
|
||||
this.clientName = clientName;
|
||||
this.storageService = storageService;
|
||||
|
|
|
@ -38,14 +38,14 @@ public class GoogleCloudStoragePlugin extends Plugin implements RepositoryPlugin
|
|||
final GoogleCloudStorageService storageService;
|
||||
|
||||
public GoogleCloudStoragePlugin(final Settings settings) {
|
||||
this.storageService = createStorageService(settings);
|
||||
this.storageService = createStorageService();
|
||||
// eagerly load client settings so that secure settings are readable (not closed)
|
||||
reload(settings);
|
||||
}
|
||||
|
||||
// overridable for tests
|
||||
protected GoogleCloudStorageService createStorageService(Settings settings) {
|
||||
return new GoogleCloudStorageService(settings);
|
||||
protected GoogleCloudStorageService createStorageService() {
|
||||
return new GoogleCloudStorageService();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -91,7 +91,7 @@ class GoogleCloudStorageRepository extends BlobStoreRepository {
|
|||
|
||||
@Override
|
||||
protected GoogleCloudStorageBlobStore createBlobStore() {
|
||||
return new GoogleCloudStorageBlobStore(settings, bucket, clientName, storageService);
|
||||
return new GoogleCloudStorageBlobStore(bucket, clientName, storageService);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.apache.logging.log4j.message.ParameterizedMessage;
|
|||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.collect.MapBuilder;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.LazyInitializable;
|
||||
|
||||
|
@ -54,10 +53,6 @@ public class GoogleCloudStorageService extends AbstractComponent {
|
|||
*/
|
||||
private final AtomicReference<Map<String, LazyInitializable<Storage, IOException>>> clientsCache = new AtomicReference<>(emptyMap());
|
||||
|
||||
public GoogleCloudStorageService(final Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refreshes the client settings and clears the client cache. Subsequent calls to
|
||||
* {@code GoogleCloudStorageService#client} will return new clients constructed
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.elasticsearch.repositories.gcs;
|
||||
|
||||
import org.elasticsearch.common.blobstore.BlobStore;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.repositories.ESBlobStoreContainerTestCase;
|
||||
|
||||
import java.util.Locale;
|
||||
|
@ -42,6 +41,6 @@ public class GoogleCloudStorageBlobStoreContainerTests extends ESBlobStoreContai
|
|||
} catch (final Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return new GoogleCloudStorageBlobStore(Settings.EMPTY, bucketName, clientName, storageService);
|
||||
return new GoogleCloudStorageBlobStore(bucketName, clientName, storageService);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,17 +79,12 @@ public class GoogleCloudStorageBlobStoreRepositoryTests extends ESBlobStoreRepos
|
|||
}
|
||||
|
||||
@Override
|
||||
protected GoogleCloudStorageService createStorageService(Settings settings) {
|
||||
return new MockGoogleCloudStorageService(settings);
|
||||
protected GoogleCloudStorageService createStorageService() {
|
||||
return new MockGoogleCloudStorageService();
|
||||
}
|
||||
}
|
||||
|
||||
public static class MockGoogleCloudStorageService extends GoogleCloudStorageService {
|
||||
|
||||
MockGoogleCloudStorageService(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Storage client(String clientName) {
|
||||
return new MockStorage(BUCKET, blobs);
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.elasticsearch.repositories.gcs;
|
||||
|
||||
import org.elasticsearch.common.blobstore.BlobStore;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.repositories.ESBlobStoreTestCase;
|
||||
|
||||
import java.util.Locale;
|
||||
|
@ -42,6 +41,6 @@ public class GoogleCloudStorageBlobStoreTests extends ESBlobStoreTestCase {
|
|||
} catch (final Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return new GoogleCloudStorageBlobStore(Settings.EMPTY, bucketName, clientName, storageService);
|
||||
return new GoogleCloudStorageBlobStore(bucketName, clientName, storageService);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class GoogleCloudStorageServiceTests extends ESTestCase {
|
|||
.put(GoogleCloudStorageClientSettings.ENDPOINT_SETTING.getConcreteSettingForNamespace(clientName).getKey(), endpoint)
|
||||
.put(GoogleCloudStorageClientSettings.PROJECT_ID_SETTING.getConcreteSettingForNamespace(clientName).getKey(), projectIdName)
|
||||
.build();
|
||||
final GoogleCloudStorageService service = new GoogleCloudStorageService(settings);
|
||||
final GoogleCloudStorageService service = new GoogleCloudStorageService();
|
||||
service.refreshAndClearCache(GoogleCloudStorageClientSettings.load(settings));
|
||||
final IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> service.client("another_client"));
|
||||
assertThat(e.getMessage(), Matchers.startsWith("Unknown client name"));
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.elasticsearch.common.blobstore.BlobPath;
|
|||
import org.elasticsearch.common.blobstore.BlobStore;
|
||||
import org.elasticsearch.common.blobstore.BlobStoreException;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -55,9 +54,8 @@ class S3BlobStore extends AbstractComponent implements BlobStore {
|
|||
|
||||
private final StorageClass storageClass;
|
||||
|
||||
S3BlobStore(Settings settings, S3Service service, String clientName, String bucket, boolean serverSideEncryption,
|
||||
S3BlobStore(S3Service service, String clientName, String bucket, boolean serverSideEncryption,
|
||||
ByteSizeValue bufferSize, String cannedACL, String storageClass) {
|
||||
super(settings);
|
||||
this.service = service;
|
||||
this.clientName = clientName;
|
||||
this.bucket = bucket;
|
||||
|
|
|
@ -245,7 +245,7 @@ class S3Repository extends BlobStoreRepository {
|
|||
protected S3BlobStore createBlobStore() {
|
||||
if (reference != null) {
|
||||
assert S3ClientSettings.checkDeprecatedCredentials(metadata.settings()) : metadata.name();
|
||||
return new S3BlobStore(settings, service, clientName, bucket, serverSideEncryption, bufferSize, cannedACL, storageClass) {
|
||||
return new S3BlobStore(service, clientName, bucket, serverSideEncryption, bufferSize, cannedACL, storageClass) {
|
||||
@Override
|
||||
public AmazonS3Reference clientReference() {
|
||||
if (reference.tryIncRef()) {
|
||||
|
@ -256,7 +256,7 @@ class S3Repository extends BlobStoreRepository {
|
|||
}
|
||||
};
|
||||
} else {
|
||||
return new S3BlobStore(settings, service, clientName, bucket, serverSideEncryption, bufferSize, cannedACL, storageClass);
|
||||
return new S3BlobStore(service, clientName, bucket, serverSideEncryption, bufferSize, cannedACL, storageClass);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public class S3RepositoryPlugin extends Plugin implements RepositoryPlugin, Relo
|
|||
protected final S3Service service;
|
||||
|
||||
public S3RepositoryPlugin(final Settings settings) {
|
||||
this(settings, new S3Service(settings));
|
||||
this(settings, new S3Service());
|
||||
}
|
||||
|
||||
S3RepositoryPlugin(final Settings settings, final S3Service service) {
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.apache.logging.log4j.Logger;
|
|||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.collect.MapBuilder;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
|
@ -47,10 +46,6 @@ class S3Service extends AbstractComponent implements Closeable {
|
|||
private volatile Map<String, AmazonS3Reference> clientsCache = emptyMap();
|
||||
private volatile Map<String, S3ClientSettings> clientsSettings = emptyMap();
|
||||
|
||||
S3Service(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refreshes the settings for the AmazonS3 clients and clears the cache of
|
||||
* existing clients. New clients will be build using these new settings. Old
|
||||
|
|
|
@ -68,11 +68,6 @@ public class RepositoryCredentialsTests extends ESTestCase {
|
|||
}
|
||||
|
||||
static final class ProxyS3Service extends S3Service {
|
||||
|
||||
ProxyS3Service(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
AmazonS3 buildClient(final S3ClientSettings clientSettings) {
|
||||
final AmazonS3 client = super.buildClient(clientSettings);
|
||||
|
@ -82,7 +77,7 @@ public class RepositoryCredentialsTests extends ESTestCase {
|
|||
}
|
||||
|
||||
ProxyS3RepositoryPlugin(Settings settings) {
|
||||
super(settings, new ProxyS3Service(settings));
|
||||
super(settings, new ProxyS3Service());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -118,7 +118,7 @@ public class S3BlobStoreRepositoryTests extends ESBlobStoreRepositoryIntegTestCa
|
|||
@Override
|
||||
public Map<String, Repository.Factory> getRepositories(final Environment env, final NamedXContentRegistry registry) {
|
||||
return Collections.singletonMap(S3Repository.TYPE,
|
||||
(metadata) -> new S3Repository(metadata, env.settings(), registry, new S3Service(env.settings()) {
|
||||
(metadata) -> new S3Repository(metadata, env.settings(), registry, new S3Service() {
|
||||
@Override
|
||||
AmazonS3 buildClient(S3ClientSettings clientSettings) {
|
||||
return new MockAmazonS3(blobs, bucket, serverSideEncryption, cannedACL, storageClass);
|
||||
|
|
|
@ -24,7 +24,6 @@ import com.amazonaws.services.s3.model.CannedAccessControlList;
|
|||
import com.amazonaws.services.s3.model.StorageClass;
|
||||
import org.elasticsearch.common.blobstore.BlobStore;
|
||||
import org.elasticsearch.common.blobstore.BlobStoreException;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeUnit;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
import org.elasticsearch.repositories.ESBlobStoreTestCase;
|
||||
|
@ -117,13 +116,13 @@ public class S3BlobStoreTests extends ESBlobStoreTestCase {
|
|||
|
||||
final String theClientName = randomAlphaOfLength(4);
|
||||
final AmazonS3 client = new MockAmazonS3(new ConcurrentHashMap<>(), bucket, serverSideEncryption, cannedACL, storageClass);
|
||||
final S3Service service = new S3Service(Settings.EMPTY) {
|
||||
final S3Service service = new S3Service() {
|
||||
@Override
|
||||
public synchronized AmazonS3Reference client(String clientName) {
|
||||
assert theClientName.equals(clientName);
|
||||
return new AmazonS3Reference(client);
|
||||
}
|
||||
};
|
||||
return new S3BlobStore(Settings.EMPTY, service, theClientName, bucket, serverSideEncryption, bufferSize, cannedACL, storageClass);
|
||||
return new S3BlobStore(service, theClientName, bucket, serverSideEncryption, bufferSize, cannedACL, storageClass);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,10 +57,6 @@ public class S3RepositoryTests extends ESTestCase {
|
|||
}
|
||||
|
||||
private static class DummyS3Service extends S3Service {
|
||||
DummyS3Service() {
|
||||
super(Settings.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AmazonS3Reference client(String clientName) {
|
||||
return new AmazonS3Reference(new DummyS3Client());
|
||||
|
|
|
@ -298,7 +298,7 @@ public class ContextAndHeaderTransportIT extends HttpSmokeTestCase {
|
|||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||
NamedXContentRegistry xContentRegistry, Environment environment,
|
||||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry) {
|
||||
loggingFilter.set(new LoggingFilter(clusterService.getSettings(), threadPool));
|
||||
loggingFilter.set(new LoggingFilter(threadPool));
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
@ -313,8 +313,7 @@ public class ContextAndHeaderTransportIT extends HttpSmokeTestCase {
|
|||
|
||||
private final ThreadPool threadPool;
|
||||
|
||||
public LoggingFilter(Settings settings, ThreadPool pool) {
|
||||
super(settings);
|
||||
public LoggingFilter(ThreadPool pool) {
|
||||
this.threadPool = pool;
|
||||
}
|
||||
|
||||
|
|
|
@ -384,7 +384,7 @@ public class ActionModule extends AbstractModule {
|
|||
if (transportClient) {
|
||||
restController = null;
|
||||
} else {
|
||||
restController = new RestController(settings, headers, restWrapper, nodeClient, circuitBreakerService, usageService);
|
||||
restController = new RestController(headers, restWrapper, nodeClient, circuitBreakerService, usageService);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.elasticsearch.action;
|
||||
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.transport.TransportRequestOptions;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
@ -28,14 +27,13 @@ import org.elasticsearch.transport.TransportService;
|
|||
/**
|
||||
* A generic proxy that will execute the given action against a specific node.
|
||||
*/
|
||||
public class TransportActionNodeProxy<Request extends ActionRequest, Response extends ActionResponse> extends AbstractComponent {
|
||||
public class TransportActionNodeProxy<Request extends ActionRequest, Response extends ActionResponse> {
|
||||
|
||||
private final TransportService transportService;
|
||||
private final Action<Response> action;
|
||||
private final TransportRequestOptions transportOptions;
|
||||
|
||||
public TransportActionNodeProxy(Settings settings, Action<Response> action, TransportService transportService) {
|
||||
super(settings);
|
||||
this.action = action;
|
||||
this.transportService = transportService;
|
||||
this.transportOptions = action.transportOptions(settings);
|
||||
|
|
|
@ -82,7 +82,7 @@ public class TransportRolloverAction extends TransportMasterNodeAction<RolloverR
|
|||
this.createIndexService = createIndexService;
|
||||
this.indexAliasesService = indexAliasesService;
|
||||
this.client = client;
|
||||
this.activeShardsObserver = new ActiveShardsObserver(settings, clusterService, threadPool);
|
||||
this.activeShardsObserver = new ActiveShardsObserver(clusterService, threadPool);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -35,9 +35,7 @@ import org.apache.lucene.search.TotalHits;
|
|||
import org.apache.lucene.search.TotalHits.Relation;
|
||||
import org.apache.lucene.search.grouping.CollapseTopFieldDocs;
|
||||
import org.elasticsearch.common.collect.HppcMaps;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.lucene.search.TopDocsAndMaxScore;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.SearchHits;
|
||||
|
@ -71,7 +69,7 @@ import java.util.function.IntFunction;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
public final class SearchPhaseController extends AbstractComponent {
|
||||
public final class SearchPhaseController {
|
||||
|
||||
private static final ScoreDoc[] EMPTY_DOCS = new ScoreDoc[0];
|
||||
|
||||
|
@ -79,11 +77,9 @@ public final class SearchPhaseController extends AbstractComponent {
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param settings Node settings
|
||||
* @param reduceContextFunction A function that builds a context for the reduce of an {@link InternalAggregation}
|
||||
*/
|
||||
public SearchPhaseController(Settings settings, Function<Boolean, ReduceContext> reduceContextFunction) {
|
||||
super(settings);
|
||||
public SearchPhaseController(Function<Boolean, ReduceContext> reduceContextFunction) {
|
||||
this.reduceContextFunction = reduceContextFunction;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,11 +26,9 @@ import org.elasticsearch.action.OriginalIndices;
|
|||
import org.elasticsearch.action.support.HandledTransportAction.ChannelActionListener;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
|
||||
import org.elasticsearch.search.SearchPhaseResult;
|
||||
import org.elasticsearch.search.SearchService;
|
||||
|
@ -66,7 +64,7 @@ import java.util.function.BiFunction;
|
|||
* An encapsulation of {@link org.elasticsearch.search.SearchService} operations exposed through
|
||||
* transport.
|
||||
*/
|
||||
public class SearchTransportService extends AbstractComponent {
|
||||
public class SearchTransportService {
|
||||
|
||||
public static final String FREE_CONTEXT_SCROLL_ACTION_NAME = "indices:data/read/search[free_context/scroll]";
|
||||
public static final String FREE_CONTEXT_ACTION_NAME = "indices:data/read/search[free_context]";
|
||||
|
@ -84,9 +82,8 @@ public class SearchTransportService extends AbstractComponent {
|
|||
private final BiFunction<Transport.Connection, SearchActionListener, ActionListener> responseWrapper;
|
||||
private final Map<String, Long> clientConnections = ConcurrentCollections.newConcurrentMapWithAggressiveConcurrency();
|
||||
|
||||
public SearchTransportService(Settings settings, TransportService transportService,
|
||||
public SearchTransportService(TransportService transportService,
|
||||
BiFunction<Transport.Connection, SearchActionListener, ActionListener> responseWrapper) {
|
||||
super(settings);
|
||||
this.transportService = transportService;
|
||||
this.responseWrapper = responseWrapper;
|
||||
}
|
||||
|
|
|
@ -22,8 +22,6 @@ package org.elasticsearch.action.support;
|
|||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.ActionRequest;
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
|
||||
/**
|
||||
|
@ -47,12 +45,7 @@ public interface ActionFilter {
|
|||
* filter chain. This base class should serve any action filter implementations that doesn't require
|
||||
* to apply async filtering logic.
|
||||
*/
|
||||
abstract class Simple extends AbstractComponent implements ActionFilter {
|
||||
|
||||
protected Simple(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
abstract class Simple implements ActionFilter {
|
||||
@Override
|
||||
public final <Request extends ActionRequest, Response extends ActionResponse> void apply(Task task, String action, Request request,
|
||||
ActionListener<Response> listener, ActionFilterChain<Request, Response> chain) {
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.cluster.ClusterState;
|
|||
import org.elasticsearch.cluster.ClusterStateObserver;
|
||||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.node.NodeClosedException;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
|
@ -42,8 +41,7 @@ public class ActiveShardsObserver extends AbstractComponent {
|
|||
private final ClusterService clusterService;
|
||||
private final ThreadPool threadPool;
|
||||
|
||||
public ActiveShardsObserver(final Settings settings, final ClusterService clusterService, final ThreadPool threadPool) {
|
||||
super(settings);
|
||||
public ActiveShardsObserver(final ClusterService clusterService, final ThreadPool threadPool) {
|
||||
this.clusterService = clusterService;
|
||||
this.threadPool = threadPool;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.action.support;
|
||||
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.Property;
|
||||
|
@ -28,7 +27,7 @@ import org.elasticsearch.common.settings.Settings;
|
|||
/**
|
||||
* Helper for dealing with destructive operations and wildcard usage.
|
||||
*/
|
||||
public final class DestructiveOperations extends AbstractComponent {
|
||||
public final class DestructiveOperations {
|
||||
|
||||
/**
|
||||
* Setting which controls whether wildcard usage (*, prefix*, _all) is allowed.
|
||||
|
@ -38,7 +37,6 @@ public final class DestructiveOperations extends AbstractComponent {
|
|||
private volatile boolean destructiveRequiresName;
|
||||
|
||||
public DestructiveOperations(Settings settings, ClusterSettings clusterSettings) {
|
||||
super(settings);
|
||||
destructiveRequiresName = REQUIRES_NAME_SETTING.get(settings);
|
||||
clusterSettings.addSettingsUpdateConsumer(REQUIRES_NAME_SETTING, this::setDestructiveRequiresName);
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public abstract class TransportAction<Request extends ActionRequest, Response ex
|
|||
protected final TaskManager taskManager;
|
||||
|
||||
protected TransportAction(Settings settings, String actionName, ActionFilters actionFilters, TaskManager taskManager) {
|
||||
super(settings);
|
||||
// TODO drop settings from ctor
|
||||
this.actionName = actionName;
|
||||
this.filters = actionFilters.filters();
|
||||
this.taskManager = taskManager;
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.elasticsearch.common.collect.Tuple;
|
|||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.io.stream.BytesStreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Streamable;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentHelper;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
|
@ -60,8 +59,7 @@ public class UpdateHelper extends AbstractComponent {
|
|||
|
||||
private final ScriptService scriptService;
|
||||
|
||||
public UpdateHelper(Settings settings, ScriptService scriptService) {
|
||||
super(settings);
|
||||
public UpdateHelper(ScriptService scriptService) {
|
||||
this.scriptService = scriptService;
|
||||
}
|
||||
|
||||
|
|
|
@ -350,7 +350,6 @@ public abstract class AbstractClient extends AbstractComponent implements Client
|
|||
private final ThreadedActionListener.Wrapper threadedWrapper;
|
||||
|
||||
public AbstractClient(Settings settings, ThreadPool threadPool) {
|
||||
super(settings);
|
||||
this.settings = settings;
|
||||
this.threadPool = threadPool;
|
||||
this.admin = new Admin(this);
|
||||
|
|
|
@ -124,7 +124,6 @@ final class TransportClientNodesService extends AbstractComponent implements Clo
|
|||
|
||||
TransportClientNodesService(Settings settings, TransportService transportService,
|
||||
ThreadPool threadPool, TransportClient.HostFailureListener hostFailureListener) {
|
||||
super(settings);
|
||||
this.clusterName = ClusterName.CLUSTER_NAME_SETTING.get(settings);
|
||||
this.transportService = transportService;
|
||||
this.threadPool = threadPool;
|
||||
|
|
|
@ -108,11 +108,11 @@ public class ClusterModule extends AbstractModule {
|
|||
public ClusterModule(Settings settings, ClusterService clusterService, List<ClusterPlugin> clusterPlugins,
|
||||
ClusterInfoService clusterInfoService) {
|
||||
this.deciderList = createAllocationDeciders(settings, clusterService.getClusterSettings(), clusterPlugins);
|
||||
this.allocationDeciders = new AllocationDeciders(settings, deciderList);
|
||||
this.allocationDeciders = new AllocationDeciders(deciderList);
|
||||
this.shardsAllocator = createShardsAllocator(settings, clusterService.getClusterSettings(), clusterPlugins);
|
||||
this.clusterService = clusterService;
|
||||
this.indexNameExpressionResolver = new IndexNameExpressionResolver(settings);
|
||||
this.allocationService = new AllocationService(settings, allocationDeciders, shardsAllocator, clusterInfoService);
|
||||
this.indexNameExpressionResolver = new IndexNameExpressionResolver();
|
||||
this.allocationService = new AllocationService(allocationDeciders, shardsAllocator, clusterInfoService);
|
||||
}
|
||||
|
||||
public static List<Entry> getNamedWriteables() {
|
||||
|
@ -205,16 +205,16 @@ public class ClusterModule extends AbstractModule {
|
|||
List<ClusterPlugin> clusterPlugins) {
|
||||
// collect deciders by class so that we can detect duplicates
|
||||
Map<Class, AllocationDecider> deciders = new LinkedHashMap<>();
|
||||
addAllocationDecider(deciders, new MaxRetryAllocationDecider(settings));
|
||||
addAllocationDecider(deciders, new ResizeAllocationDecider(settings));
|
||||
addAllocationDecider(deciders, new ReplicaAfterPrimaryActiveAllocationDecider(settings));
|
||||
addAllocationDecider(deciders, new RebalanceOnlyWhenActiveAllocationDecider(settings));
|
||||
addAllocationDecider(deciders, new MaxRetryAllocationDecider());
|
||||
addAllocationDecider(deciders, new ResizeAllocationDecider());
|
||||
addAllocationDecider(deciders, new ReplicaAfterPrimaryActiveAllocationDecider());
|
||||
addAllocationDecider(deciders, new RebalanceOnlyWhenActiveAllocationDecider());
|
||||
addAllocationDecider(deciders, new ClusterRebalanceAllocationDecider(settings, clusterSettings));
|
||||
addAllocationDecider(deciders, new ConcurrentRebalanceAllocationDecider(settings, clusterSettings));
|
||||
addAllocationDecider(deciders, new EnableAllocationDecider(settings, clusterSettings));
|
||||
addAllocationDecider(deciders, new NodeVersionAllocationDecider(settings));
|
||||
addAllocationDecider(deciders, new SnapshotInProgressAllocationDecider(settings));
|
||||
addAllocationDecider(deciders, new RestoreInProgressAllocationDecider(settings));
|
||||
addAllocationDecider(deciders, new NodeVersionAllocationDecider());
|
||||
addAllocationDecider(deciders, new SnapshotInProgressAllocationDecider());
|
||||
addAllocationDecider(deciders, new RestoreInProgressAllocationDecider());
|
||||
addAllocationDecider(deciders, new FilterAllocationDecider(settings, clusterSettings));
|
||||
addAllocationDecider(deciders, new SameShardAllocationDecider(settings, clusterSettings));
|
||||
addAllocationDecider(deciders, new DiskThresholdDecider(settings, clusterSettings));
|
||||
|
|
|
@ -19,19 +19,12 @@
|
|||
|
||||
package org.elasticsearch.cluster;
|
||||
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
/**
|
||||
* ClusterInfoService that provides empty maps for disk usage and shard sizes
|
||||
*/
|
||||
public class EmptyClusterInfoService extends AbstractComponent implements ClusterInfoService {
|
||||
public class EmptyClusterInfoService implements ClusterInfoService {
|
||||
public static final EmptyClusterInfoService INSTANCE = new EmptyClusterInfoService();
|
||||
|
||||
private EmptyClusterInfoService() {
|
||||
super(Settings.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClusterInfo getClusterInfo() {
|
||||
return ClusterInfo.EMPTY;
|
||||
|
|
|
@ -88,7 +88,6 @@ public class InternalClusterInfoService extends AbstractComponent
|
|||
|
||||
public InternalClusterInfoService(Settings settings, ClusterService clusterService, ThreadPool threadPool, NodeClient client,
|
||||
Consumer<ClusterInfo> listener) {
|
||||
super(settings);
|
||||
this.leastAvailableSpaceUsages = ImmutableOpenMap.of();
|
||||
this.mostAvailableSpaceUsages = ImmutableOpenMap.of();
|
||||
this.shardRoutingToDataPath = ImmutableOpenMap.of();
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.ElasticsearchTimeoutException;
|
|||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.IndicesAdminClient;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
|
@ -39,7 +38,7 @@ import org.elasticsearch.index.mapper.Mapping;
|
|||
* Called by shards in the cluster when their mapping was dynamically updated and it needs to be updated
|
||||
* in the cluster state meta data (and broadcast to all members).
|
||||
*/
|
||||
public class MappingUpdatedAction extends AbstractComponent {
|
||||
public class MappingUpdatedAction {
|
||||
|
||||
public static final Setting<TimeValue> INDICES_MAPPING_DYNAMIC_TIMEOUT_SETTING =
|
||||
Setting.positiveTimeSetting("indices.mapping.dynamic_timeout", TimeValue.timeValueSeconds(30),
|
||||
|
@ -50,7 +49,6 @@ public class MappingUpdatedAction extends AbstractComponent {
|
|||
|
||||
@Inject
|
||||
public MappingUpdatedAction(Settings settings, ClusterSettings clusterSettings) {
|
||||
super(settings);
|
||||
this.dynamicMappingUpdateTimeout = INDICES_MAPPING_DYNAMIC_TIMEOUT_SETTING.get(settings);
|
||||
clusterSettings.addSettingsUpdateConsumer(INDICES_MAPPING_DYNAMIC_TIMEOUT_SETTING, this::setDynamicMappingUpdateTimeout);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.common.component.AbstractComponent;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.EmptyTransportResponseHandler;
|
||||
|
@ -48,8 +47,7 @@ public class NodeMappingRefreshAction extends AbstractComponent {
|
|||
private final MetaDataMappingService metaDataMappingService;
|
||||
|
||||
@Inject
|
||||
public NodeMappingRefreshAction(Settings settings, TransportService transportService, MetaDataMappingService metaDataMappingService) {
|
||||
super(settings);
|
||||
public NodeMappingRefreshAction(TransportService transportService, MetaDataMappingService metaDataMappingService) {
|
||||
this.transportService = transportService;
|
||||
this.metaDataMappingService = metaDataMappingService;
|
||||
transportService.registerRequestHandler(ACTION_NAME,
|
||||
|
|
|
@ -46,7 +46,6 @@ import org.elasticsearch.common.component.AbstractComponent;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
|
||||
import org.elasticsearch.discovery.Discovery;
|
||||
|
@ -89,9 +88,8 @@ public class ShardStateAction extends AbstractComponent {
|
|||
private final ConcurrentMap<FailedShardEntry, CompositeListener> remoteFailedShardsCache = ConcurrentCollections.newConcurrentMap();
|
||||
|
||||
@Inject
|
||||
public ShardStateAction(Settings settings, ClusterService clusterService, TransportService transportService,
|
||||
public ShardStateAction(ClusterService clusterService, TransportService transportService,
|
||||
AllocationService allocationService, RoutingService routingService, ThreadPool threadPool) {
|
||||
super(settings);
|
||||
this.transportService = transportService;
|
||||
this.clusterService = clusterService;
|
||||
this.threadPool = threadPool;
|
||||
|
|
|
@ -22,8 +22,6 @@ package org.elasticsearch.cluster.metadata;
|
|||
import org.elasticsearch.action.admin.indices.alias.Alias;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
|
||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
|
@ -43,12 +41,7 @@ import static org.elasticsearch.index.query.AbstractQueryBuilder.parseInnerQuery
|
|||
* Validator for an alias, to be used before adding an alias to the index metadata
|
||||
* and make sure the alias is valid
|
||||
*/
|
||||
public class AliasValidator extends AbstractComponent {
|
||||
|
||||
public AliasValidator(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
public class AliasValidator {
|
||||
/**
|
||||
* Allows to validate an {@link org.elasticsearch.action.admin.indices.alias.Alias} and make sure
|
||||
* it's valid before it gets added to the index metadata. Doesn't validate the alias filter.
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
|
||||
package org.elasticsearch.cluster.metadata;
|
||||
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.regex.Regex;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -33,14 +31,10 @@ import java.util.stream.Collectors;
|
|||
* Resolves cluster names from an expression. The expression must be the exact match of a cluster
|
||||
* name or must be a wildcard expression.
|
||||
*/
|
||||
public final class ClusterNameExpressionResolver extends AbstractComponent {
|
||||
public final class ClusterNameExpressionResolver {
|
||||
|
||||
private final WildcardExpressionResolver wildcardResolver = new WildcardExpressionResolver();
|
||||
|
||||
public ClusterNameExpressionResolver(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the provided cluster expression to matching cluster names. This method only
|
||||
* supports exact or wildcard matches.
|
||||
|
|
|
@ -26,9 +26,7 @@ import org.elasticsearch.cluster.ClusterState;
|
|||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.collect.Tuple;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.regex.Regex;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.time.DateFormatter;
|
||||
import org.elasticsearch.common.time.DateFormatters;
|
||||
import org.elasticsearch.common.time.DateMathParser;
|
||||
|
@ -54,18 +52,14 @@ import java.util.SortedMap;
|
|||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class IndexNameExpressionResolver extends AbstractComponent {
|
||||
import static java.util.Collections.unmodifiableList;
|
||||
|
||||
private final List<ExpressionResolver> expressionResolvers;
|
||||
private final DateMathExpressionResolver dateMathExpressionResolver;
|
||||
public class IndexNameExpressionResolver {
|
||||
|
||||
public IndexNameExpressionResolver(Settings settings) {
|
||||
super(settings);
|
||||
expressionResolvers = Arrays.asList(
|
||||
dateMathExpressionResolver = new DateMathExpressionResolver(),
|
||||
new WildcardExpressionResolver()
|
||||
);
|
||||
}
|
||||
private final DateMathExpressionResolver dateMathExpressionResolver = new DateMathExpressionResolver();
|
||||
private final List<ExpressionResolver> expressionResolvers = unmodifiableList(Arrays.asList(
|
||||
dateMathExpressionResolver,
|
||||
new WildcardExpressionResolver()));
|
||||
|
||||
/**
|
||||
* Same as {@link #concreteIndexNames(ClusterState, IndicesOptions, String...)}, but the index expressions and options
|
||||
|
|
|
@ -128,7 +128,6 @@ public class MetaDataCreateIndexService extends AbstractComponent {
|
|||
final ThreadPool threadPool,
|
||||
final NamedXContentRegistry xContentRegistry,
|
||||
final boolean forbidPrivateIndexSettings) {
|
||||
super(settings);
|
||||
this.settings = settings;
|
||||
this.clusterService = clusterService;
|
||||
this.indicesService = indicesService;
|
||||
|
@ -136,7 +135,7 @@ public class MetaDataCreateIndexService extends AbstractComponent {
|
|||
this.aliasValidator = aliasValidator;
|
||||
this.env = env;
|
||||
this.indexScopedSettings = indexScopedSettings;
|
||||
this.activeShardsObserver = new ActiveShardsObserver(settings, clusterService, threadPool);
|
||||
this.activeShardsObserver = new ActiveShardsObserver(clusterService, threadPool);
|
||||
this.xContentRegistry = xContentRegistry;
|
||||
this.forbidPrivateIndexSettings = forbidPrivateIndexSettings;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@ public class MetaDataDeleteIndexService extends AbstractComponent {
|
|||
|
||||
@Inject
|
||||
public MetaDataDeleteIndexService(Settings settings, ClusterService clusterService, AllocationService allocationService) {
|
||||
super(settings);
|
||||
this.settings = settings;
|
||||
this.clusterService = clusterService;
|
||||
this.allocationService = allocationService;
|
||||
|
|
|
@ -29,9 +29,7 @@ import org.elasticsearch.cluster.metadata.AliasAction.NewAliasValidator;
|
|||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.IndexNotFoundException;
|
||||
|
@ -54,7 +52,7 @@ import static org.elasticsearch.indices.cluster.IndicesClusterStateService.Alloc
|
|||
/**
|
||||
* Service responsible for submitting add and remove aliases requests
|
||||
*/
|
||||
public class MetaDataIndexAliasesService extends AbstractComponent {
|
||||
public class MetaDataIndexAliasesService {
|
||||
|
||||
private final ClusterService clusterService;
|
||||
|
||||
|
@ -67,9 +65,8 @@ public class MetaDataIndexAliasesService extends AbstractComponent {
|
|||
private final NamedXContentRegistry xContentRegistry;
|
||||
|
||||
@Inject
|
||||
public MetaDataIndexAliasesService(Settings settings, ClusterService clusterService, IndicesService indicesService,
|
||||
public MetaDataIndexAliasesService(ClusterService clusterService, IndicesService indicesService,
|
||||
AliasValidator aliasValidator, MetaDataDeleteIndexService deleteIndexService, NamedXContentRegistry xContentRegistry) {
|
||||
super(settings);
|
||||
this.clusterService = clusterService;
|
||||
this.indicesService = indicesService;
|
||||
this.aliasValidator = aliasValidator;
|
||||
|
|
|
@ -42,7 +42,6 @@ import org.elasticsearch.common.ValidationException;
|
|||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.logging.DeprecationLogger;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.indices.IndicesService;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
|
@ -76,15 +75,14 @@ public class MetaDataIndexStateService extends AbstractComponent {
|
|||
private final ActiveShardsObserver activeShardsObserver;
|
||||
|
||||
@Inject
|
||||
public MetaDataIndexStateService(Settings settings, ClusterService clusterService, AllocationService allocationService,
|
||||
public MetaDataIndexStateService(ClusterService clusterService, AllocationService allocationService,
|
||||
MetaDataIndexUpgradeService metaDataIndexUpgradeService,
|
||||
IndicesService indicesService, ThreadPool threadPool) {
|
||||
super(settings);
|
||||
this.indicesService = indicesService;
|
||||
this.clusterService = clusterService;
|
||||
this.allocationService = allocationService;
|
||||
this.metaDataIndexUpgradeService = metaDataIndexUpgradeService;
|
||||
this.activeShardsObserver = new ActiveShardsObserver(settings, clusterService, threadPool);
|
||||
this.activeShardsObserver = new ActiveShardsObserver(clusterService, threadPool);
|
||||
}
|
||||
|
||||
public void closeIndex(final CloseIndexClusterStateUpdateRequest request, final ActionListener<ClusterStateUpdateResponse> listener) {
|
||||
|
|
|
@ -71,11 +71,10 @@ public class MetaDataIndexTemplateService extends AbstractComponent {
|
|||
private final NamedXContentRegistry xContentRegistry;
|
||||
|
||||
@Inject
|
||||
public MetaDataIndexTemplateService(Settings settings, ClusterService clusterService,
|
||||
public MetaDataIndexTemplateService(ClusterService clusterService,
|
||||
MetaDataCreateIndexService metaDataCreateIndexService,
|
||||
AliasValidator aliasValidator, IndicesService indicesService,
|
||||
IndexScopedSettings indexScopedSettings, NamedXContentRegistry xContentRegistry) {
|
||||
super(settings);
|
||||
this.clusterService = clusterService;
|
||||
this.aliasValidator = aliasValidator;
|
||||
this.indicesService = indicesService;
|
||||
|
|
|
@ -62,7 +62,6 @@ public class MetaDataIndexUpgradeService extends AbstractComponent {
|
|||
public MetaDataIndexUpgradeService(Settings settings, NamedXContentRegistry xContentRegistry, MapperRegistry mapperRegistry,
|
||||
IndexScopedSettings indexScopedSettings,
|
||||
Collection<UnaryOperator<IndexMetaData>> indexMetaDataUpgraders) {
|
||||
super(settings);
|
||||
this.settings = settings;
|
||||
this.xContentRegistry = xContentRegistry;
|
||||
this.mapperRegistry = mapperRegistry;
|
||||
|
|
|
@ -35,7 +35,6 @@ import org.elasticsearch.common.Priority;
|
|||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.compress.CompressedXContent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.IndexService;
|
||||
|
@ -68,8 +67,7 @@ public class MetaDataMappingService extends AbstractComponent {
|
|||
|
||||
|
||||
@Inject
|
||||
public MetaDataMappingService(Settings settings, ClusterService clusterService, IndicesService indicesService) {
|
||||
super(settings);
|
||||
public MetaDataMappingService(ClusterService clusterService, IndicesService indicesService) {
|
||||
this.clusterService = clusterService;
|
||||
this.indicesService = indicesService;
|
||||
}
|
||||
|
|
|
@ -75,9 +75,8 @@ public class MetaDataUpdateSettingsService extends AbstractComponent {
|
|||
private final ThreadPool threadPool;
|
||||
|
||||
@Inject
|
||||
public MetaDataUpdateSettingsService(Settings settings, ClusterService clusterService, AllocationService allocationService,
|
||||
public MetaDataUpdateSettingsService(ClusterService clusterService, AllocationService allocationService,
|
||||
IndexScopedSettings indexScopedSettings, IndicesService indicesService, ThreadPool threadPool) {
|
||||
super(settings);
|
||||
this.clusterService = clusterService;
|
||||
this.threadPool = threadPool;
|
||||
this.allocationService = allocationService;
|
||||
|
|
|
@ -35,7 +35,6 @@ import org.elasticsearch.common.bytes.BytesReference;
|
|||
import org.elasticsearch.common.collect.ImmutableOpenMap;
|
||||
import org.elasticsearch.common.collect.Tuple;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
|
@ -75,9 +74,8 @@ public class TemplateUpgradeService extends AbstractComponent implements Cluster
|
|||
|
||||
private ImmutableOpenMap<String, IndexTemplateMetaData> lastTemplateMetaData;
|
||||
|
||||
public TemplateUpgradeService(Settings settings, Client client, ClusterService clusterService, ThreadPool threadPool,
|
||||
public TemplateUpgradeService(Client client, ClusterService clusterService, ThreadPool threadPool,
|
||||
Collection<UnaryOperator<Map<String, IndexTemplateMetaData>>> indexTemplateMetaDataUpgraders) {
|
||||
super(settings);
|
||||
this.client = client;
|
||||
this.clusterService = clusterService;
|
||||
this.threadPool = threadPool;
|
||||
|
|
|
@ -54,7 +54,6 @@ public class OperationRouting extends AbstractComponent {
|
|||
private boolean useAdaptiveReplicaSelection;
|
||||
|
||||
public OperationRouting(Settings settings, ClusterSettings clusterSettings) {
|
||||
super(settings);
|
||||
this.awarenessAttributes = AwarenessAllocationDecider.CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING.get(settings);
|
||||
this.useAdaptiveReplicaSelection = USE_ADAPTIVE_REPLICA_SELECTION_SETTING.get(settings);
|
||||
clusterSettings.addSettingsUpdateConsumer(AwarenessAllocationDecider.CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING,
|
||||
|
|
|
@ -39,7 +39,6 @@ import org.elasticsearch.cluster.routing.allocation.command.AllocationCommands;
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders;
|
||||
import org.elasticsearch.common.collect.ImmutableOpenMap;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.gateway.GatewayAllocator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -69,16 +68,15 @@ public class AllocationService extends AbstractComponent {
|
|||
private final ShardsAllocator shardsAllocator;
|
||||
private final ClusterInfoService clusterInfoService;
|
||||
|
||||
public AllocationService(Settings settings, AllocationDeciders allocationDeciders,
|
||||
public AllocationService(AllocationDeciders allocationDeciders,
|
||||
GatewayAllocator gatewayAllocator,
|
||||
ShardsAllocator shardsAllocator, ClusterInfoService clusterInfoService) {
|
||||
this(settings, allocationDeciders, shardsAllocator, clusterInfoService);
|
||||
this(allocationDeciders, shardsAllocator, clusterInfoService);
|
||||
setGatewayAllocator(gatewayAllocator);
|
||||
}
|
||||
|
||||
public AllocationService(Settings settings, AllocationDeciders allocationDeciders,
|
||||
public AllocationService(AllocationDeciders allocationDeciders,
|
||||
ShardsAllocator shardsAllocator, ClusterInfoService clusterInfoService) {
|
||||
super(settings);
|
||||
this.allocationDeciders = allocationDeciders;
|
||||
this.shardsAllocator = shardsAllocator;
|
||||
this.clusterInfoService = clusterInfoService;
|
||||
|
|
|
@ -54,7 +54,6 @@ public class DiskThresholdMonitor extends AbstractComponent {
|
|||
|
||||
public DiskThresholdMonitor(Settings settings, Supplier<ClusterState> clusterStateSupplier, ClusterSettings clusterSettings,
|
||||
Client client) {
|
||||
super(settings);
|
||||
this.clusterStateSupplier = clusterStateSupplier;
|
||||
this.diskThresholdSettings = new DiskThresholdSettings(settings, clusterSettings);
|
||||
this.client = client;
|
||||
|
|
|
@ -97,7 +97,6 @@ public class BalancedShardsAllocator extends AbstractComponent implements Shards
|
|||
|
||||
@Inject
|
||||
public BalancedShardsAllocator(Settings settings, ClusterSettings clusterSettings) {
|
||||
super(settings);
|
||||
setWeightFunction(INDEX_BALANCE_FACTOR_SETTING.get(settings), SHARD_BALANCE_FACTOR_SETTING.get(settings));
|
||||
setThreshold(THRESHOLD_SETTING.get(settings));
|
||||
clusterSettings.addSettingsUpdateConsumer(INDEX_BALANCE_FACTOR_SETTING, SHARD_BALANCE_FACTOR_SETTING, this::setWeightFunction);
|
||||
|
|
|
@ -19,13 +19,12 @@
|
|||
|
||||
package org.elasticsearch.cluster.routing.allocation.decider;
|
||||
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||
import org.elasticsearch.cluster.routing.RoutingNode;
|
||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
||||
import org.elasticsearch.cluster.routing.allocation.decider.Decision.Type;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
/**
|
||||
* {@link AllocationDecider} is an abstract base class that allows to make
|
||||
|
@ -33,15 +32,6 @@ import org.elasticsearch.common.settings.Settings;
|
|||
* basis.
|
||||
*/
|
||||
public abstract class AllocationDecider extends AbstractComponent {
|
||||
|
||||
/**
|
||||
* Initializes a new {@link AllocationDecider}
|
||||
* @param settings {@link Settings} used by this {@link AllocationDecider}
|
||||
*/
|
||||
protected AllocationDecider(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Decision} whether the given shard routing can be
|
||||
* re-balanced to the given allocation. The default is
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.cluster.metadata.IndexMetaData;
|
|||
import org.elasticsearch.cluster.routing.RoutingNode;
|
||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
@ -38,8 +37,7 @@ public class AllocationDeciders extends AllocationDecider {
|
|||
|
||||
private final Collection<AllocationDecider> allocations;
|
||||
|
||||
public AllocationDeciders(Settings settings, Collection<AllocationDecider> allocations) {
|
||||
super(settings);
|
||||
public AllocationDeciders(Collection<AllocationDecider> allocations) {
|
||||
this.allocations = Collections.unmodifiableCollection(allocations);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,6 @@ public class AwarenessAllocationDecider extends AllocationDecider {
|
|||
private volatile Map<String, List<String>> forcedAwarenessAttributes;
|
||||
|
||||
public AwarenessAllocationDecider(Settings settings, ClusterSettings clusterSettings) {
|
||||
super(settings);
|
||||
this.awarenessAttributes = CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING.get(settings);
|
||||
clusterSettings.addSettingsUpdateConsumer(CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING, this::setAwarenessAttributes);
|
||||
setForcedAwarenessAttributes(CLUSTER_ROUTING_ALLOCATION_AWARENESS_FORCE_GROUP_SETTING.get(settings));
|
||||
|
|
|
@ -91,7 +91,6 @@ public class ClusterRebalanceAllocationDecider extends AllocationDecider {
|
|||
private volatile ClusterRebalanceType type;
|
||||
|
||||
public ClusterRebalanceAllocationDecider(Settings settings, ClusterSettings clusterSettings) {
|
||||
super(settings);
|
||||
try {
|
||||
type = CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.get(settings);
|
||||
} catch (IllegalStateException e) {
|
||||
|
|
|
@ -48,7 +48,6 @@ public class ConcurrentRebalanceAllocationDecider extends AllocationDecider {
|
|||
private volatile int clusterConcurrentRebalance;
|
||||
|
||||
public ConcurrentRebalanceAllocationDecider(Settings settings, ClusterSettings clusterSettings) {
|
||||
super(settings);
|
||||
this.clusterConcurrentRebalance = CLUSTER_ROUTING_ALLOCATION_CLUSTER_CONCURRENT_REBALANCE_SETTING.get(settings);
|
||||
logger.debug("using [cluster_concurrent_rebalance] with [{}]", clusterConcurrentRebalance);
|
||||
clusterSettings.addSettingsUpdateConsumer(CLUSTER_ROUTING_ALLOCATION_CLUSTER_CONCURRENT_REBALANCE_SETTING,
|
||||
|
|
|
@ -73,7 +73,6 @@ public class DiskThresholdDecider extends AllocationDecider {
|
|||
private final DiskThresholdSettings diskThresholdSettings;
|
||||
|
||||
public DiskThresholdDecider(Settings settings, ClusterSettings clusterSettings) {
|
||||
super(settings);
|
||||
this.diskThresholdSettings = new DiskThresholdSettings(settings, clusterSettings);
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,6 @@ public class EnableAllocationDecider extends AllocationDecider {
|
|||
private volatile Allocation enableAllocation;
|
||||
|
||||
public EnableAllocationDecider(Settings settings, ClusterSettings clusterSettings) {
|
||||
super(settings);
|
||||
this.enableAllocation = CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.get(settings);
|
||||
this.enableRebalance = CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.get(settings);
|
||||
clusterSettings.addSettingsUpdateConsumer(CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING, this::setEnableAllocation);
|
||||
|
|
|
@ -97,7 +97,6 @@ public class FilterAllocationDecider extends AllocationDecider {
|
|||
private volatile DiscoveryNodeFilters clusterExcludeFilters;
|
||||
|
||||
public FilterAllocationDecider(Settings settings, ClusterSettings clusterSettings) {
|
||||
super(settings);
|
||||
setClusterRequireFilters(CLUSTER_ROUTING_REQUIRE_GROUP_SETTING.getAsMap(settings));
|
||||
setClusterExcludeFilters(CLUSTER_ROUTING_EXCLUDE_GROUP_SETTING.getAsMap(settings));
|
||||
setClusterIncludeFilters(CLUSTER_ROUTING_INCLUDE_GROUP_SETTING.getAsMap(settings));
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.cluster.routing.ShardRouting;
|
|||
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
||||
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
/**
|
||||
* An allocation decider that prevents shards from being allocated on any node if the shards allocation has been retried N times without
|
||||
|
@ -42,15 +41,6 @@ public class MaxRetryAllocationDecider extends AllocationDecider {
|
|||
|
||||
public static final String NAME = "max_retry";
|
||||
|
||||
/**
|
||||
* Initializes a new {@link MaxRetryAllocationDecider}
|
||||
*
|
||||
* @param settings {@link Settings} used by this {@link AllocationDecider}
|
||||
*/
|
||||
public MaxRetryAllocationDecider(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Decision canAllocate(ShardRouting shardRouting, RoutingAllocation allocation) {
|
||||
final UnassignedInfo unassignedInfo = shardRouting.unassignedInfo();
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.cluster.routing.RoutingNode;
|
|||
import org.elasticsearch.cluster.routing.RoutingNodes;
|
||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
/**
|
||||
* An allocation decider that prevents relocation or allocation from nodes
|
||||
|
@ -38,10 +37,6 @@ public class NodeVersionAllocationDecider extends AllocationDecider {
|
|||
|
||||
public static final String NAME = "node_version";
|
||||
|
||||
public NodeVersionAllocationDecider(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) {
|
||||
if (shardRouting.primary()) {
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.cluster.routing.allocation.decider;
|
|||
|
||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
/**
|
||||
* Only allow rebalancing when all shards are active within the shard replication group.
|
||||
|
@ -30,10 +29,6 @@ public class RebalanceOnlyWhenActiveAllocationDecider extends AllocationDecider
|
|||
|
||||
public static final String NAME = "rebalance_only_when_active";
|
||||
|
||||
public RebalanceOnlyWhenActiveAllocationDecider(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Decision canRebalance(ShardRouting shardRouting, RoutingAllocation allocation) {
|
||||
if (!allocation.routingNodes().allReplicasActive(shardRouting.shardId(), allocation.metaData())) {
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.elasticsearch.cluster.routing.allocation.decider;
|
|||
import org.elasticsearch.cluster.routing.RoutingNode;
|
||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
/**
|
||||
* An allocation strategy that only allows for a replica to be allocated when the primary is active.
|
||||
|
@ -31,10 +30,6 @@ public class ReplicaAfterPrimaryActiveAllocationDecider extends AllocationDecide
|
|||
|
||||
private static final String NAME = "replica_after_primary_active";
|
||||
|
||||
public ReplicaAfterPrimaryActiveAllocationDecider(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) {
|
||||
return canAllocate(shardRouting, allocation);
|
||||
|
|
|
@ -26,11 +26,9 @@ import org.elasticsearch.cluster.routing.RoutingNode;
|
|||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
||||
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.shard.ShardId;
|
||||
|
||||
|
||||
/**
|
||||
* An allocation decider that ensures we allocate the shards of a target index for resize operations next to the source primaries
|
||||
*/
|
||||
|
@ -38,15 +36,6 @@ public class ResizeAllocationDecider extends AllocationDecider {
|
|||
|
||||
public static final String NAME = "resize";
|
||||
|
||||
/**
|
||||
* Initializes a new {@link ResizeAllocationDecider}
|
||||
*
|
||||
* @param settings {@link Settings} used by this {@link AllocationDecider}
|
||||
*/
|
||||
public ResizeAllocationDecider(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Decision canAllocate(ShardRouting shardRouting, RoutingAllocation allocation) {
|
||||
return canAllocate(shardRouting, null, allocation);
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.cluster.routing.RecoverySource;
|
|||
import org.elasticsearch.cluster.routing.RoutingNode;
|
||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.snapshots.Snapshot;
|
||||
|
||||
/**
|
||||
|
@ -35,16 +34,6 @@ public class RestoreInProgressAllocationDecider extends AllocationDecider {
|
|||
|
||||
public static final String NAME = "restore_in_progress";
|
||||
|
||||
/**
|
||||
* Creates a new {@link RestoreInProgressAllocationDecider} instance from
|
||||
* given settings
|
||||
*
|
||||
* @param settings {@link Settings} to use
|
||||
*/
|
||||
public RestoreInProgressAllocationDecider(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Decision canAllocate(final ShardRouting shardRouting, final RoutingNode node, final RoutingAllocation allocation) {
|
||||
return canAllocate(shardRouting, allocation);
|
||||
|
|
|
@ -53,7 +53,6 @@ public class SameShardAllocationDecider extends AllocationDecider {
|
|||
private volatile boolean sameHost;
|
||||
|
||||
public SameShardAllocationDecider(Settings settings, ClusterSettings clusterSettings) {
|
||||
super(settings);
|
||||
this.sameHost = CLUSTER_ROUTING_ALLOCATION_SAME_HOST_SETTING.get(settings);
|
||||
clusterSettings.addSettingsUpdateConsumer(CLUSTER_ROUTING_ALLOCATION_SAME_HOST_SETTING, this::setSameHost);
|
||||
}
|
||||
|
|
|
@ -76,7 +76,6 @@ public class ShardsLimitAllocationDecider extends AllocationDecider {
|
|||
private final Settings settings;
|
||||
|
||||
public ShardsLimitAllocationDecider(Settings settings, ClusterSettings clusterSettings) {
|
||||
super(settings);
|
||||
this.settings = settings;
|
||||
this.clusterShardLimit = CLUSTER_TOTAL_SHARDS_PER_NODE_SETTING.get(settings);
|
||||
clusterSettings.addSettingsUpdateConsumer(CLUSTER_TOTAL_SHARDS_PER_NODE_SETTING, this::setClusterShardLimit);
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.cluster.SnapshotsInProgress;
|
|||
import org.elasticsearch.cluster.routing.RoutingNode;
|
||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
/**
|
||||
* This {@link org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider} prevents shards that
|
||||
|
@ -33,16 +32,6 @@ public class SnapshotInProgressAllocationDecider extends AllocationDecider {
|
|||
|
||||
public static final String NAME = "snapshot_in_progress";
|
||||
|
||||
/**
|
||||
* Creates a new {@link org.elasticsearch.cluster.routing.allocation.decider.SnapshotInProgressAllocationDecider} instance from
|
||||
* given settings
|
||||
*
|
||||
* @param settings {@link org.elasticsearch.common.settings.Settings} to use
|
||||
*/
|
||||
public SnapshotInProgressAllocationDecider(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Decision} whether the given shard routing can be
|
||||
* re-balanced to the given allocation. The default is
|
||||
|
|
|
@ -81,7 +81,6 @@ public class ThrottlingAllocationDecider extends AllocationDecider {
|
|||
private volatile int concurrentOutgoingRecoveries;
|
||||
|
||||
public ThrottlingAllocationDecider(Settings settings, ClusterSettings clusterSettings) {
|
||||
super(settings);
|
||||
this.primariesInitialRecoveries = CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES_SETTING.get(settings);
|
||||
concurrentIncomingRecoveries = CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_INCOMING_RECOVERIES_SETTING.get(settings);
|
||||
concurrentOutgoingRecoveries = CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING.get(settings);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue