From dbe4e6e6743773f59b1d38e2b4badda060f767e4 Mon Sep 17 00:00:00 2001 From: mikemccand Date: Fri, 19 Sep 2014 14:15:06 -0400 Subject: [PATCH] Internal: remove ForceSyncDirectory Historical code, not used anymore. Closes #7804 --- .../org/elasticsearch/index/store/Store.java | 23 +++---------- .../store/support/ForceSyncDirectory.java | 34 ------------------- 2 files changed, 4 insertions(+), 53 deletions(-) delete mode 100644 src/main/java/org/elasticsearch/index/store/support/ForceSyncDirectory.java diff --git a/src/main/java/org/elasticsearch/index/store/Store.java b/src/main/java/org/elasticsearch/index/store/Store.java index 832a0287b70..5095c477555 100644 --- a/src/main/java/org/elasticsearch/index/store/Store.java +++ b/src/main/java/org/elasticsearch/index/store/Store.java @@ -48,7 +48,6 @@ import org.elasticsearch.index.settings.IndexSettings; import org.elasticsearch.index.shard.AbstractIndexShardComponent; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.store.distributor.Distributor; -import org.elasticsearch.index.store.support.ForceSyncDirectory; import java.io.*; import java.nio.file.NoSuchFileException; @@ -60,8 +59,8 @@ import java.util.zip.Checksum; /** * A Store provides plain access to files written by an elasticsearch index shard. Each shard - * has a dedicated store that is uses to access lucenes Directory which represents the lowest level - * of file abstraction in lucene used to read and write Lucene indices to. + * has a dedicated store that is uses to access Lucene's Directory which represents the lowest level + * of file abstraction in Lucene used to read and write Lucene indices. * This class also provides access to metadata information like checksums for committed files. A committed * file is a file that belongs to a segment written by a Lucene commit. Files that have not been committed * ie. created during a merge or a shard refresh / NRT reopen are not considered in the MetadataSnapshot. @@ -91,7 +90,6 @@ public class Store extends AbstractIndexShardComponent implements CloseableIndex private final CodecService codecService; private final DirectoryService directoryService; private final StoreDirectory directory; - private final boolean sync; private final DistributorDirectory distributorDirectory; @Inject @@ -99,7 +97,6 @@ public class Store extends AbstractIndexShardComponent implements CloseableIndex super(shardId, indexSettings); this.codecService = codecService; this.directoryService = directoryService; - this.sync = componentSettings.getAsBoolean("sync", true); this.distributorDirectory = new DistributorDirectory(distributor); this.directory = new StoreDirectory(distributorDirectory); } @@ -387,9 +384,9 @@ public class Store extends AbstractIndexShardComponent implements CloseableIndex } /** - * The idea of the store directory is to cache file level meta data, as well as md5 of it + * This exists so {@link BloomFilteringPostingsFormat} can load its boolean setting; can we find a more straightforward way? */ - public class StoreDirectory extends FilterDirectory implements ForceSyncDirectory { + public class StoreDirectory extends FilterDirectory { StoreDirectory(Directory delegateDirectory) throws IOException { super(delegateDirectory); @@ -432,22 +429,10 @@ public class Store extends AbstractIndexShardComponent implements CloseableIndex assert false : "Nobody should close this directory except of the Store itself"; } - @Override - public void sync(Collection names) throws IOException { - if (sync) { - super.sync(names); - } - } - private void innerClose() throws IOException { super.close(); } - @Override - public void forceSync(String name) throws IOException { - sync(ImmutableList.of(name)); - } - @Override public String toString() { return "store(" + in.toString() + ")"; diff --git a/src/main/java/org/elasticsearch/index/store/support/ForceSyncDirectory.java b/src/main/java/org/elasticsearch/index/store/support/ForceSyncDirectory.java deleted file mode 100644 index e14885d1f63..00000000000 --- a/src/main/java/org/elasticsearch/index/store/support/ForceSyncDirectory.java +++ /dev/null @@ -1,34 +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.support; - -import java.io.IOException; - -/** - * A custom directory that allows to forceSync (since the actual directory might disable it) - */ -public interface ForceSyncDirectory { - - /** - * Similar to {@link org.apache.lucene.store.Directory#sync(java.util.Collection)} but forces it even if its - * disabled. - */ - void forceSync(String name) throws IOException; -}