public class Store extends AbstractIndexShardComponentimplements CloseableIndexComponent , Closeable , RefCounted
store.incRef();
try {
// use the store...
} finally {
store.decRef();
}
| Modifier and Type | Class and Description |
|---|---|
static class |
Store
|
static class |
Store
Represents a snapshot of the current directory build from the latest Lucene commit.
|
static interface |
Store
A listener that is executed once the store is closed and all references to it are released
|
static class |
Store
A class representing the diff between a recovery source and recovery target
|
class |
Store
This exists so
BloomFilterPostingsFormat can load its boolean setting; can we find a more straightforward way?
|
| Modifier and Type | Field and Description |
|---|---|
static String |
CHECKSUMS_PREFIX
|
static String |
INDEX_STORE_STATS_REFRESH_INTERVAL
|
componentSettings, indexSettings, logger, shardId| Constructor and Description |
|---|
Store(ShardId
|
Store(ShardId
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
canOpenIndex(ESLogger
Returns
true iff the given location contains an index an the index can be successfully opened.
|
boolean |
checkIntegrity(StoreFileMetaData
|
static boolean |
checkIntegrity(StoreFileMetaData
|
void |
cleanup(String
This method deletes every file in this store that is not contained in the given source meta data or is a legacy checksum file.
|
void |
cleanupAndVerify(String
This method deletes every file in this store that is not contained in the given source meta data or is a legacy checksum file.
|
void |
close()
Closes the index component.
|
org |
createVerifyingOutput(String
The returned IndexOutput might validate the files checksum if the file has been written with a newer lucene version and the metadata holds the necessary information to detect that it was been written by Lucene 4.8 or newer.
|
void |
decRef()
Decreases the refCount of this Store instance.If the refCount drops to 0, then this store is closed.
|
void |
deleteQuiet(String
|
static String |
digestToString(long digest)
Produces a string representation of the given digest value.
|
org |
directory()
|
void |
failIfCorrupted()
|
Store |
getMetadata()
Returns a new MetadataSnapshot for the latest commit in this store.
|
Store |
getMetadata(org
Returns a new MetadataSnapshot for the given commit.
|
Store |
getMetadataOrEmpty()
Returns a new MetadataSnapshot for the latest commit in this store or an empty snapshot if no index exists or can not be opened.
|
void |
incRef()
Increments the refCount of this Store instance.
|
static boolean |
isChecksum(String
|
boolean |
isMarkedCorrupted()
|
static void |
logDeleteFile(org
Log that we are about to delete this file, to the index.store.deletes component.
|
void |
logDeleteFile(String
Log that we are about to delete this file, to the index.store.deletes component.
|
void |
markStoreCorrupted(IOException
Marks this store as corrupted.
|
org |
openVerifyingInput(String
|
org |
readLastCommittedSegmentsInfo()
Returns the last committed segments info for this store
|
static Store |
readMetadataSnapshot(File
Reads a MetadataSnapshot from the given index locations or returns an empty snapshot if it can't be read.
|
int |
refCount()
Returns the current reference count.
|
void |
removeCorruptionMarker()
Deletes all corruption markers from this store.
|
void |
renameFile(String
|
void |
renameTempFilesSafe(Map
Renames all the given files form the key of the map to the value of the map.
|
StoreStats |
stats()
|
boolean |
tryIncRef()
Tries to increment the refCount of this Store instance.
|
static void |
verify(org
|
static void |
verify(org
|
indexSettings, nodeName, shardIdpublic static final StringINDEX_STORE_STATS_REFRESH_INTERVAL
public static final StringCHECKSUMS_PREFIX
public Store(ShardIdshardId, @IndexSettings Settings indexSettings, DirectoryService directoryService, Distributor distributor, ShardLock shardLock) throws IOException
IOException
@Inject public Store(ShardIdshardId, @IndexSettings Settings indexSettings, DirectoryService directoryService, Distributor distributor, ShardLock shardLock, Store .OnClose onClose) throws IOException
IOException
public org.apache .lucene .store .Directory directory()
public org.apache .lucene .index .SegmentInfos readLastCommittedSegmentsInfo() throws IOException
IOException - if the index is corrupted or the segments file is not present
public Store.MetadataSnapshot getMetadataOrEmpty() throws IOException
org.apache.lucene.index.CorruptIndexException - if the lucene index is corrupted. This can be caused by a checksum mismatch or an unexpected exception when opening the index reading the segments file.
IOException
public Store.MetadataSnapshot getMetadata() throws IOException
org.apache.lucene.index.CorruptIndexException - if the lucene index is corrupted. This can be caused by a checksum mismatch or an unexpected exception when opening the index reading the segments file.
FileNotFoundException - if one or more files referenced by a commit are not present.
NoSuchFileException - if one or more files referenced by a commit are not present.
org.apache.lucene.index.IndexNotFoundException - if no index / valid commit-point can be found in this store
IOException
public Store.MetadataSnapshot getMetadata(org .apache .lucene .index .IndexCommit commit) throws IOException
null the latest commit point is used.
org.apache.lucene.index.CorruptIndexException - if the lucene index is corrupted. This can be caused by a checksum mismatch or an unexpected exception when opening the index reading the segments file.
FileNotFoundException - if one or more files referenced by a commit are not present.
NoSuchFileException - if one or more files referenced by a commit are not present.
org.apache.lucene.index.IndexNotFoundException - if the commit point can't be found in this store
IOException
public void renameTempFilesSafe(Map<String ,String > tempFileMap) throws IOException
IOException
public StoreStatsstats() throws IOException
IOException
public void renameFile(Stringfrom, String to) throws IOException
IOException
public final void incRef()
decRef(), in a finally clause; otherwise the store may never be closed. Note that
close() simply calls decRef(), which means that the Store will not really be closed until
decRef() has been called for all outstanding references.
Note: Close can safely be called multiple times.
incRef in interface
RefCounted
org.apache.lucene.store.AlreadyClosedException - iff the reference counter can not be incremented.
decRef(),
tryIncRef()
public final boolean tryIncRef()
decRef(), in a finally clause; otherwise the store may never be closed. Note that
close() simply calls decRef(), which means that the Store will not really be closed until
decRef() has been called for all outstanding references.
Note: Close can safely be called multiple times.
tryIncRef in interface
RefCounted
decRef(),
incRef()
public final void decRef()
decRef in interface
RefCounted
incRef()
public void close()
CloseableIndexComponent
public static Store.MetadataSnapshot readMetadataSnapshot(File [] indexLocations, ESLogger logger) throws IOException
IOException - if the index we try to read is corrupted
public static boolean canOpenIndex(ESLoggerlogger, File ... indexLocations) throws IOException
true iff the given location contains an index an the index can be successfully opened. This includes reading the segment infos and possible corruption markers.
IOException
public org.apache .lucene .store .IndexOutput createVerifyingOutput(String fileName, StoreFileMetaData metadata, org .apache .lucene .store .IOContext context) throws IOException
IOException
public static void verify(org.apache .lucene .store .IndexOutput output) throws IOException
IOException
public org.apache .lucene .store .IndexInput openVerifyingInput(String filename, org .apache .lucene .store .IOContext context, StoreFileMetaData metadata) throws IOException
IOException
public static void verify(org.apache .lucene .store .IndexInput input) throws IOException
IOException
public boolean checkIntegrity(StoreFileMetaDatamd)
public static boolean checkIntegrity(StoreFileMetaDatamd, org .apache .lucene .store .Directory directory)
public boolean isMarkedCorrupted()
throws IOException
IOException
public void removeCorruptionMarker()
throws IOException
IOException
public void failIfCorrupted()
throws IOException
IOException
public void cleanup(Stringreason, Set <String > filesToClean) throws IOException
reason - the reason for this cleanup operation logged for each deleted file
filesToClean - the file names used for cleanup. all files names in this metadata should be kept around.
IOException - if an IOException occurs
public void cleanupAndVerify(Stringreason, Store .MetadataSnapshot sourceMetaData) throws IOException
reason - the reason for this cleanup operation logged for each deleted file
sourceMetaData - the metadata used for cleanup. all files in this metadata should be kept around.
IOException - if an IOException occurs
ElasticsearchIllegalStateException - if the latest snapshot in this store differs from the given one after the cleanup.
public int refCount()
public void logDeleteFile(Stringmessage, String fileName)
public static void logDeleteFile(org.apache .lucene .store .Directory dir, String message, String fileName)
public static final boolean isChecksum(Stringname)
public static StringdigestToString(long digest)
public void deleteQuiet(String... files)
public void markStoreCorrupted(IOExceptionexception) throws IOException
isMarkedCorrupted() will return
true.
IOException