Package org.elasticsearch.repositories
Class ShardGenerations
java.lang.Object
org.elasticsearch.repositories.ShardGenerations
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic String
Special generation that signifies that the shard has been deleted from the repository.static ShardGenerations
static String
Special generation that signifies that a shard is new and the repository does not yet contain a validBlobStoreIndexShardSnapshots
blob for it. -
Method Summary
Modifier and TypeMethodDescriptionstatic ShardGenerations.Builder
builder()
boolean
static String
fixShardGeneration(String shardGeneration)
Filters out unreliable numeric shard generations read fromRepositoryData
orIndexShardSnapshotStatus
, returningnull
in their place.getShardGen(IndexId indexId, int shardId)
Get the generation of theBlobStoreIndexShardSnapshots
blob for a given index and shard.int
hashCode()
indices()
Returns all indices for which shard generations are tracked.obsoleteShardGenerations(ShardGenerations previous)
Computes the obsolete shard index generations that can be deleted once this instance was written to the repository.toString()
int
Returns the total number of shards tracked by this instance.
-
Field Details
-
EMPTY
-
NEW_SHARD_GEN
Special generation that signifies that a shard is new and the repository does not yet contain a validBlobStoreIndexShardSnapshots
blob for it.- See Also:
- Constant Field Values
-
DELETED_SHARD_GEN
Special generation that signifies that the shard has been deleted from the repository. This generation is only used during computations. It should never be written to disk.- See Also:
- Constant Field Values
-
-
Method Details
-
fixShardGeneration
Filters out unreliable numeric shard generations read fromRepositoryData
orIndexShardSnapshotStatus
, returningnull
in their place.- Parameters:
shardGeneration
- shard generation to fix- Returns:
- given shard generation or
null
if it was filtered out ornull
was passed - See Also:
- Issue #57988
-
totalShards
public int totalShards()Returns the total number of shards tracked by this instance. -
indices
Returns all indices for which shard generations are tracked.- Returns:
- indices for which shard generations are tracked
-
obsoleteShardGenerations
Computes the obsolete shard index generations that can be deleted once this instance was written to the repository. Note: This method should only be used when finalizing a snapshot and we can safely assume that data has only been added but not removed from shard paths.- Parameters:
previous
- PreviousShardGenerations
- Returns:
- Map of obsolete shard index generations in indices that are still tracked by this instance
-
getShardGen
Get the generation of theBlobStoreIndexShardSnapshots
blob for a given index and shard. There are three special kinds of generations that can be returned here.DELETED_SHARD_GEN
a deleted shard that isn't referenced by any snapshot in the repository any longerNEW_SHARD_GEN
a new shard that we know doesn't hold any valid data yet in the repositorynull
unknown state. The shard either does not exist at all or it was created by a node older thanSnapshotsService.SHARD_GEN_IN_REPO_DATA_VERSION
. If a caller expects a shard to exist in the repository but sees anull
return, it should try to recover the generation by falling back to listing the contents of the respective shard directory.
- Parameters:
indexId
- IndexIdshardId
- Shard Id- Returns:
- generation of the
BlobStoreIndexShardSnapshots
blob
-
getGens
-
equals
-
hashCode
public int hashCode() -
toString
-
builder
-