MINOR: Cleanup Dead Code in o.e.c.metadata Package (#36587)
This commit is contained in:
parent
13cb0fb98b
commit
088d3f39c3
|
@ -250,14 +250,6 @@ public class AliasMetaData extends AbstractDiffable<AliasMetaData> implements To
|
|||
this.alias = alias;
|
||||
}
|
||||
|
||||
public Builder(AliasMetaData aliasMetaData) {
|
||||
this(aliasMetaData.alias());
|
||||
filter = aliasMetaData.filter();
|
||||
indexRouting = aliasMetaData.indexRouting();
|
||||
searchRouting = aliasMetaData.searchRouting();
|
||||
writeIndex = aliasMetaData.writeIndex();
|
||||
}
|
||||
|
||||
public String alias() {
|
||||
return alias;
|
||||
}
|
||||
|
@ -289,10 +281,6 @@ public class AliasMetaData extends AbstractDiffable<AliasMetaData> implements To
|
|||
}
|
||||
}
|
||||
|
||||
public Builder filter(XContentBuilder filterBuilder) {
|
||||
return filter(Strings.toString(filterBuilder));
|
||||
}
|
||||
|
||||
public Builder routing(String routing) {
|
||||
this.indexRouting = routing;
|
||||
this.searchRouting = routing;
|
||||
|
|
|
@ -66,14 +66,6 @@ public interface AliasOrIndex {
|
|||
public List<IndexMetaData> getIndices() {
|
||||
return Collections.singletonList(concreteIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return If this is an concrete index, its {@link IndexMetaData}
|
||||
*/
|
||||
public IndexMetaData getIndex() {
|
||||
return concreteIndex;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,7 +75,7 @@ public interface AliasOrIndex {
|
|||
|
||||
private final String aliasName;
|
||||
private final List<IndexMetaData> referenceIndexMetaDatas;
|
||||
private SetOnce<IndexMetaData> writeIndex = new SetOnce<>();
|
||||
private final SetOnce<IndexMetaData> writeIndex = new SetOnce<>();
|
||||
|
||||
public Alias(AliasMetaData aliasMetaData, IndexMetaData indexMetaData) {
|
||||
this.aliasName = aliasMetaData.getAlias();
|
||||
|
@ -118,30 +110,19 @@ public interface AliasOrIndex {
|
|||
* and filters)
|
||||
*/
|
||||
public Iterable<Tuple<String, AliasMetaData>> getConcreteIndexAndAliasMetaDatas() {
|
||||
return new Iterable<Tuple<String, AliasMetaData>>() {
|
||||
return () -> new Iterator<Tuple<String,AliasMetaData>>() {
|
||||
|
||||
int index = 0;
|
||||
|
||||
@Override
|
||||
public Iterator<Tuple<String, AliasMetaData>> iterator() {
|
||||
return new Iterator<Tuple<String,AliasMetaData>>() {
|
||||
public boolean hasNext() {
|
||||
return index < referenceIndexMetaDatas.size();
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return index < referenceIndexMetaDatas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tuple<String, AliasMetaData> next() {
|
||||
IndexMetaData indexMetaData = referenceIndexMetaDatas.get(index++);
|
||||
return new Tuple<>(indexMetaData.getIndex().getName(), indexMetaData.getAliases().get(aliasName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
};
|
||||
@Override
|
||||
public Tuple<String, AliasMetaData> next() {
|
||||
IndexMetaData indexMetaData = referenceIndexMetaDatas.get(index++);
|
||||
return new Tuple<>(indexMetaData.getIndex().getName(), indexMetaData.getAliases().get(aliasName));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -120,10 +120,6 @@ public final class AutoExpandReplicas {
|
|||
return enabled ? minReplicas + "-" + maxReplicas : "false";
|
||||
}
|
||||
|
||||
boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the are replicas with the auto-expand feature that need to be adapted.
|
||||
* Returns a map of updates, which maps the indices to be updated to the desired number of replicas.
|
||||
|
|
|
@ -77,11 +77,7 @@ public final class ClusterNameExpressionResolver {
|
|||
}
|
||||
|
||||
private static Set<String> matches(Set<String> remoteClusters, String expression) {
|
||||
if (expression.indexOf("*") == expression.length() - 1) {
|
||||
return otherWildcard(remoteClusters, expression);
|
||||
} else {
|
||||
return otherWildcard(remoteClusters, expression);
|
||||
}
|
||||
return otherWildcard(remoteClusters, expression);
|
||||
}
|
||||
|
||||
private static Set<String> otherWildcard(Set<String> remoteClusters, String expression) {
|
||||
|
|
|
@ -446,10 +446,6 @@ public final class IndexGraveyard implements MetaData.Custom {
|
|||
return builder.endObject();
|
||||
}
|
||||
|
||||
public static Tombstone fromXContent(final XContentParser parser) throws IOException {
|
||||
return TOMBSTONE_PARSER.parse(parser, null).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* A builder for building tombstone entries.
|
||||
*/
|
||||
|
|
|
@ -894,10 +894,6 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
|||
this.rolloverInfos = ImmutableOpenMap.builder(indexMetaData.rolloverInfos);
|
||||
}
|
||||
|
||||
public String index() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public Builder index(String index) {
|
||||
this.index = index;
|
||||
return this;
|
||||
|
@ -942,29 +938,11 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of replicas.
|
||||
*
|
||||
* @return the provided value or -1 if it has not been set.
|
||||
*/
|
||||
public int numberOfReplicas() {
|
||||
return settings.getAsInt(SETTING_NUMBER_OF_REPLICAS, -1);
|
||||
}
|
||||
|
||||
public Builder routingPartitionSize(int routingPartitionSize) {
|
||||
settings = Settings.builder().put(settings).put(SETTING_ROUTING_PARTITION_SIZE, routingPartitionSize).build();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the routing partition size.
|
||||
*
|
||||
* @return the provided value or -1 if it has not been set.
|
||||
*/
|
||||
public int routingPartitionSize() {
|
||||
return settings.getAsInt(SETTING_ROUTING_PARTITION_SIZE, -1);
|
||||
}
|
||||
|
||||
public Builder creationDate(long creationDate) {
|
||||
settings = Settings.builder().put(settings).put(SETTING_CREATION_DATE, creationDate).build();
|
||||
return this;
|
||||
|
@ -1036,10 +1014,6 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
|||
return this;
|
||||
}
|
||||
|
||||
public RolloverInfo getRolloverInfo(String alias) {
|
||||
return rolloverInfos.get(alias);
|
||||
}
|
||||
|
||||
public Builder putRolloverInfo(RolloverInfo rolloverInfo) {
|
||||
rolloverInfos.put(rolloverInfo.getAlias(), rolloverInfo);
|
||||
return this;
|
||||
|
|
|
@ -134,18 +134,10 @@ public class IndexTemplateMetaData extends AbstractDiffable<IndexTemplateMetaDat
|
|||
return this.patterns;
|
||||
}
|
||||
|
||||
public List<String> getPatterns() {
|
||||
return this.patterns;
|
||||
}
|
||||
|
||||
public Settings settings() {
|
||||
return this.settings;
|
||||
}
|
||||
|
||||
public Settings getSettings() {
|
||||
return settings();
|
||||
}
|
||||
|
||||
public ImmutableOpenMap<String, CompressedXContent> mappings() {
|
||||
return this.mappings;
|
||||
}
|
||||
|
@ -314,12 +306,7 @@ public class IndexTemplateMetaData extends AbstractDiffable<IndexTemplateMetaDat
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder removeMapping(String mappingType) {
|
||||
mappings.remove(mappingType);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder putMapping(String mappingType, CompressedXContent mappingSource) throws IOException {
|
||||
public Builder putMapping(String mappingType, CompressedXContent mappingSource) {
|
||||
mappings.put(mappingType, mappingSource);
|
||||
return this;
|
||||
}
|
||||
|
@ -465,7 +452,7 @@ public class IndexTemplateMetaData extends AbstractDiffable<IndexTemplateMetaDat
|
|||
|
||||
private static String skipTemplateName(XContentParser parser) throws IOException {
|
||||
XContentParser.Token token = parser.nextToken();
|
||||
if (token != null && token == XContentParser.Token.START_OBJECT) {
|
||||
if (token == XContentParser.Token.START_OBJECT) {
|
||||
token = parser.nextToken();
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
String currentFieldName = parser.currentName();
|
||||
|
|
|
@ -85,7 +85,7 @@ public class MappingMetaData extends AbstractDiffable<MappingMetaData> {
|
|||
this.routing = new Routing(docMapper.routingFieldMapper().required());
|
||||
}
|
||||
|
||||
public MappingMetaData(CompressedXContent mapping) throws IOException {
|
||||
public MappingMetaData(CompressedXContent mapping) {
|
||||
this.source = mapping;
|
||||
Map<String, Object> mappingMap = XContentHelper.convertToMap(mapping.compressedReference(), true).v2();
|
||||
if (mappingMap.size() != 1) {
|
||||
|
|
|
@ -172,7 +172,6 @@ public class MetaData implements Iterable<IndexMetaData>, Diffable<MetaData>, To
|
|||
|
||||
private final transient int totalNumberOfShards; // Transient ? not serializable anyway?
|
||||
private final int totalOpenIndexShards;
|
||||
private final int numberOfShards;
|
||||
|
||||
private final String[] allIndices;
|
||||
private final String[] allOpenIndices;
|
||||
|
@ -196,17 +195,14 @@ public class MetaData implements Iterable<IndexMetaData>, Diffable<MetaData>, To
|
|||
this.templates = templates;
|
||||
int totalNumberOfShards = 0;
|
||||
int totalOpenIndexShards = 0;
|
||||
int numberOfShards = 0;
|
||||
for (ObjectCursor<IndexMetaData> cursor : indices.values()) {
|
||||
totalNumberOfShards += cursor.value.getTotalNumberOfShards();
|
||||
numberOfShards += cursor.value.getNumberOfShards();
|
||||
if (IndexMetaData.State.OPEN.equals(cursor.value.getState())) {
|
||||
totalOpenIndexShards += cursor.value.getTotalNumberOfShards();
|
||||
}
|
||||
}
|
||||
this.totalNumberOfShards = totalNumberOfShards;
|
||||
this.totalOpenIndexShards = totalOpenIndexShards;
|
||||
this.numberOfShards = numberOfShards;
|
||||
|
||||
this.allIndices = allIndices;
|
||||
this.allOpenIndices = allOpenIndices;
|
||||
|
@ -709,15 +705,6 @@ public class MetaData implements Iterable<IndexMetaData>, Diffable<MetaData>, To
|
|||
return this.totalOpenIndexShards;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of primary shards from all indices, not including
|
||||
* replicas.
|
||||
* @return The number of primary shards from all indices.
|
||||
*/
|
||||
public int getNumberOfShards() {
|
||||
return this.numberOfShards;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifies whether the array containing type names given as argument refers to all types
|
||||
* The empty or null array identifies all types
|
||||
|
|
|
@ -53,7 +53,6 @@ import org.elasticsearch.common.UUIDs;
|
|||
import org.elasticsearch.common.ValidationException;
|
||||
import org.elasticsearch.common.compress.CompressedXContent;
|
||||
import org.elasticsearch.common.io.PathUtils;
|
||||
import org.elasticsearch.common.logging.DeprecationLogger;
|
||||
import org.elasticsearch.common.settings.IndexScopedSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -101,7 +100,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF
|
|||
*/
|
||||
public class MetaDataCreateIndexService {
|
||||
private static final Logger logger = LogManager.getLogger(MetaDataCreateIndexService.class);
|
||||
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);
|
||||
|
||||
public static final int MAX_INDEX_NAME_BYTES = 255;
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ import org.elasticsearch.cluster.service.ClusterService;
|
|||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.common.ValidationException;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.logging.DeprecationLogger;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.indices.IndicesService;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
|
@ -60,7 +59,6 @@ import java.util.Set;
|
|||
*/
|
||||
public class MetaDataIndexStateService {
|
||||
private static final Logger logger = LogManager.getLogger(MetaDataIndexStateService.class);
|
||||
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);
|
||||
|
||||
public static final ClusterBlock INDEX_CLOSED_BLOCK = new ClusterBlock(4, "index closed", false,
|
||||
false, false, RestStatus.FORBIDDEN, ClusterBlockLevel.READ_WRITE);
|
||||
|
|
|
@ -190,7 +190,7 @@ public class MetaDataIndexTemplateService {
|
|||
|
||||
@Override
|
||||
public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
|
||||
listener.onResponse(new PutResponse(true, templateBuilder.build()));
|
||||
listener.onResponse(new PutResponse(true));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -393,20 +393,14 @@ public class MetaDataIndexTemplateService {
|
|||
|
||||
public static class PutResponse {
|
||||
private final boolean acknowledged;
|
||||
private final IndexTemplateMetaData template;
|
||||
|
||||
public PutResponse(boolean acknowledged, IndexTemplateMetaData template) {
|
||||
public PutResponse(boolean acknowledged) {
|
||||
this.acknowledged = acknowledged;
|
||||
this.template = template;
|
||||
}
|
||||
|
||||
public boolean acknowledged() {
|
||||
return acknowledged;
|
||||
}
|
||||
|
||||
public IndexTemplateMetaData template() {
|
||||
return template;
|
||||
}
|
||||
}
|
||||
|
||||
public static class RemoveRequest {
|
||||
|
|
|
@ -38,7 +38,6 @@ import org.elasticsearch.common.Priority;
|
|||
import org.elasticsearch.common.ValidationException;
|
||||
import org.elasticsearch.common.collect.Tuple;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.logging.DeprecationLogger;
|
||||
import org.elasticsearch.common.regex.Regex;
|
||||
import org.elasticsearch.common.settings.IndexScopedSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
|
@ -63,7 +62,6 @@ import static org.elasticsearch.index.IndexSettings.same;
|
|||
*/
|
||||
public class MetaDataUpdateSettingsService {
|
||||
private static final Logger logger = LogManager.getLogger(MetaDataUpdateSettingsService.class);
|
||||
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);
|
||||
|
||||
private final ClusterService clusterService;
|
||||
|
||||
|
|
Loading…
Reference in New Issue