From b77ef1f61bc945477a896a8540e06ea245ca7422 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Sat, 8 Feb 2020 12:14:51 +0100 Subject: [PATCH] Cleanup some Dead Code in o.e.index.store (#52045) (#52084) One obviously unused method and an incorrect Javadoc that referenced an otherwise unused class. --- .../org/elasticsearch/index/IndexModule.java | 4 +-- .../index/store/DirectoryService.java | 36 ------------------- .../org/elasticsearch/index/store/Store.java | 12 ------- 3 files changed, 2 insertions(+), 50 deletions(-) delete mode 100644 server/src/main/java/org/elasticsearch/index/store/DirectoryService.java diff --git a/server/src/main/java/org/elasticsearch/index/IndexModule.java b/server/src/main/java/org/elasticsearch/index/IndexModule.java index f1ce91b212b..c70e4c8f441 100644 --- a/server/src/main/java/org/elasticsearch/index/IndexModule.java +++ b/server/src/main/java/org/elasticsearch/index/IndexModule.java @@ -53,7 +53,6 @@ import org.elasticsearch.index.shard.IndexEventListener; import org.elasticsearch.index.shard.IndexingOperationListener; import org.elasticsearch.index.shard.SearchOperationListener; import org.elasticsearch.index.similarity.SimilarityService; -import org.elasticsearch.index.store.DirectoryService; import org.elasticsearch.index.store.FsDirectoryFactory; import org.elasticsearch.indices.IndicesQueryCache; import org.elasticsearch.indices.breaker.CircuitBreakerService; @@ -85,7 +84,8 @@ import java.util.function.Function; * {@link #addSimilarity(String, TriFunction)} while existing Providers can be referenced through Settings under the * {@link IndexModule#SIMILARITY_SETTINGS_PREFIX} prefix along with the "type" value. For example, to reference the * {@link BM25Similarity}, the configuration {@code "index.similarity.my_similarity.type : "BM25"} can be used. - *
  • {@link DirectoryService} - Custom {@link DirectoryService} instances can be registered via {@link IndexStorePlugin}
  • + *
  • {@link IndexStorePlugin.DirectoryFactory} - Custom {@link IndexStorePlugin.DirectoryFactory} instances can be registered + * via {@link IndexStorePlugin}
  • *
  • {@link IndexEventListener} - Custom {@link IndexEventListener} instances can be registered via * {@link #addIndexEventListener(IndexEventListener)}
  • *
  • Settings update listener - Custom settings update listener can be registered via diff --git a/server/src/main/java/org/elasticsearch/index/store/DirectoryService.java b/server/src/main/java/org/elasticsearch/index/store/DirectoryService.java deleted file mode 100644 index fbef32876ad..00000000000 --- a/server/src/main/java/org/elasticsearch/index/store/DirectoryService.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.index.store; - -import org.apache.lucene.store.Directory; -import org.elasticsearch.index.IndexSettings; -import org.elasticsearch.index.shard.AbstractIndexShardComponent; -import org.elasticsearch.index.shard.ShardId; - -import java.io.IOException; - -public abstract class DirectoryService extends AbstractIndexShardComponent { - - protected DirectoryService(ShardId shardId, IndexSettings indexSettings) { - super(shardId, indexSettings); - } - - public abstract Directory newDirectory() throws IOException; -} \ No newline at end of file diff --git a/server/src/main/java/org/elasticsearch/index/store/Store.java b/server/src/main/java/org/elasticsearch/index/store/Store.java index 57448307c44..16c5e636edb 100644 --- a/server/src/main/java/org/elasticsearch/index/store/Store.java +++ b/server/src/main/java/org/elasticsearch/index/store/Store.java @@ -217,18 +217,6 @@ public class Store extends AbstractIndexShardComponent implements Closeable, Ref } - /** - * Loads the maximum sequence number and local checkpoint from the given Lucene commit point or the latest if not provided. - * - * @param commit the commit point to load seqno stats, or the last commit in the store if the parameter is null - * @return {@link SequenceNumbers.CommitInfo} containing information about the last commit - * @throws IOException if an I/O exception occurred reading the latest Lucene commit point from disk - */ - public static SequenceNumbers.CommitInfo loadSeqNoInfo(final IndexCommit commit) throws IOException { - final Map userData = commit.getUserData(); - return SequenceNumbers.loadSeqNoInfoFromLuceneCommit(userData.entrySet()); - } - final void ensureOpen() { if (this.refCounter.refCount() <= 0) { throw new AlreadyClosedException("store is already closed");