Internal: remove ForceSyncDirectory
Historical code, not used anymore. Closes #7804
This commit is contained in:
parent
8e742c2096
commit
dbe4e6e674
|
@ -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<String> 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() + ")";
|
||||
|
|
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue