Package org.elasticsearch.index.shard
Class ShardPath
- java.lang.Object
-
- org.elasticsearch.index.shard.ShardPath
-
public final class ShardPath extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringINDEX_FOLDER_NAMEstatic StringTRANSLOG_FOLDER_NAME
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voiddeleteLeftoverShardDirectory(org.apache.logging.log4j.Logger logger, NodeEnvironment env, ShardLock lock, IndexSettings indexSettings)This method tries to delete left-over shards where the index name has been reused but the UUID is different to allow the new shard to be allocated.booleanequals(Object o)booleanexists()PathgetDataPath()PathgetRootDataPath()Returns the data-path root for this shard.PathgetRootStatePath()Returns the state-path root for this shard.ShardIdgetShardId()PathgetShardStatePath()inthashCode()booleanisCustomDataPath()Returnstrueiff the data location is a custom data location and therefore outside of the nodes configured data paths.static ShardPathloadShardPath(org.apache.logging.log4j.Logger logger, NodeEnvironment env, ShardId shardId, IndexSettings indexSettings)This method walks through the nodes shard paths to find the data and state path for the given shard.static ShardPathloadShardPath(org.apache.logging.log4j.Logger logger, ShardId shardId, IndexSettings indexSettings, Path[] availableShardPaths, int nodeLockId, Path sharedDataPath)This method walks through the nodes shard paths to find the data and state path for the given shard.PathresolveIndex()PathresolveTranslog()static ShardPathselectNewPathForShard(NodeEnvironment env, ShardId shardId, IndexSettings indexSettings, long avgShardSizeInBytes, Map<Path,Integer> dataPathToShardCount)StringtoString()
-
-
-
Field Detail
-
INDEX_FOLDER_NAME
public static final String INDEX_FOLDER_NAME
- See Also:
- Constant Field Values
-
TRANSLOG_FOLDER_NAME
public static final String TRANSLOG_FOLDER_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
resolveTranslog
public Path resolveTranslog()
-
resolveIndex
public Path resolveIndex()
-
getDataPath
public Path getDataPath()
-
exists
public boolean exists()
-
getShardId
public ShardId getShardId()
-
getShardStatePath
public Path getShardStatePath()
-
getRootDataPath
public Path getRootDataPath()
Returns the data-path root for this shard. The root is a parent ofgetDataPath()without the index name and the shard ID.
-
getRootStatePath
public Path getRootStatePath()
Returns the state-path root for this shard. The root is a parent ofgetRootStatePath()()} without the index name and the shard ID.
-
isCustomDataPath
public boolean isCustomDataPath()
Returnstrueiff the data location is a custom data location and therefore outside of the nodes configured data paths.
-
loadShardPath
public static ShardPath loadShardPath(org.apache.logging.log4j.Logger logger, NodeEnvironment env, ShardId shardId, IndexSettings indexSettings) throws IOException
This method walks through the nodes shard paths to find the data and state path for the given shard. If multiple directories with a valid shard state exist the one with the highest version will be used. Note: this method resolves custom data locations for the shard.- Throws:
IOException
-
loadShardPath
public static ShardPath loadShardPath(org.apache.logging.log4j.Logger logger, ShardId shardId, IndexSettings indexSettings, Path[] availableShardPaths, int nodeLockId, Path sharedDataPath) throws IOException
This method walks through the nodes shard paths to find the data and state path for the given shard. If multiple directories with a valid shard state exist the one with the highest version will be used. Note: this method resolves custom data locations for the shard.- Throws:
IOException
-
deleteLeftoverShardDirectory
public static void deleteLeftoverShardDirectory(org.apache.logging.log4j.Logger logger, NodeEnvironment env, ShardLock lock, IndexSettings indexSettings) throws IOExceptionThis method tries to delete left-over shards where the index name has been reused but the UUID is different to allow the new shard to be allocated.- Throws:
IOException
-
selectNewPathForShard
public static ShardPath selectNewPathForShard(NodeEnvironment env, ShardId shardId, IndexSettings indexSettings, long avgShardSizeInBytes, Map<Path,Integer> dataPathToShardCount) throws IOException
- Throws:
IOException
-
-