Package org.elasticsearch.repositories
Class ShardGenerations
org.elasticsearch.repositories.ShardGenerations
public final class ShardGenerations
extends
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic
Special generation that signifies that the shard has been deleted from the repository.static ShardGenerations
static
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
o)
static
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()
<IndexId>
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.Methods inherited from class java.lang.
, , , , , , ,
-
Field Details
-
EMPTY
-
NEW_SHARD_GEN
public static final NEW_SHARD_GENSpecial 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
public static final DELETED_SHARD_GENSpecial 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
@Nullable public static fixShardGeneration(@Nullable shardGeneration)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:
-
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
public boolean equals( o)- Overrides:
in class
-
hashCode
public int hashCode()- Overrides:
in class
-
toString
public toString()- Overrides:
in class
-
builder
-