Package org.elasticsearch.repositories
Class IndexMetaDataGenerations
org.elasticsearch.repositories.IndexMetaDataGenerations
public final class IndexMetaDataGenerations
extends
Tracks the blob uuids of blobs containing
IndexMetadata
for snapshots as well an identifier for each of these blobs.
Before writing a new IndexMetadata
blob during snapshot finalization in
BlobStoreRepository.finalizeSnapshot(org.elasticsearch.repositories.ShardGenerations, long, org.elasticsearch.cluster.metadata.Metadata, org.elasticsearch.snapshots.SnapshotInfo, org.elasticsearch.Version, java.util.function.Function<org.elasticsearch.cluster.ClusterState, org.elasticsearch.cluster.ClusterState>, org.elasticsearch.action.ActionListener<org.elasticsearch.repositories.RepositoryData>)
the identifier for an instance of
IndexMetadata
should be computed and then used to check if it already exists in the repository via
getIndexMetaBlobId(String)
.-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic
buildUniqueIdentifier(IndexMetadata indexMetaData)
Compute identifier forIndexMetadata
from its index- and history-uuid as well as its settings-, mapping- and alias-version.boolean
that)
metaIdentifier)
Gets the blob id by the identifier ofIndexMetadata
(computed viabuildUniqueIdentifier(org.elasticsearch.cluster.metadata.IndexMetadata)
) ornull
if none is tracked for the identifier.int
hashCode()
indexMetaBlobId(SnapshotId snapshotId, IndexId indexId)
Get the blob id bySnapshotId
andIndexId
and fall back to the value ofSnapshotId.getUUID()
if none is known to enable backwards compatibility with versions older thanSnapshotsService.SHARD_GEN_IN_REPO_DATA_VERSION
which used the snapshot uuid as index metadata blob uuid.boolean
isEmpty()
toString()
withAddedSnapshot(SnapshotId snapshotId, <> newLookup, <,> newIdentifiers)
Create a new instance with the given snapshot and index metadata uuids and identifiers added.<SnapshotId> snapshotIds)
Create a new instance with the given snapshot removed.Methods inherited from class java.lang.
, , , , , , ,
-
Field Details
-
EMPTY
-
-
Method Details
-
isEmpty
public boolean isEmpty() -
getIndexMetaBlobId
@Nullable public getIndexMetaBlobId( metaIdentifier)Gets the blob id by the identifier ofIndexMetadata
(computed viabuildUniqueIdentifier(org.elasticsearch.cluster.metadata.IndexMetadata)
) ornull
if none is tracked for the identifier.- Parameters:
metaIdentifier
- identifier forIndexMetadata
- Returns:
- blob id for the given metadata identifier or
null
if the identifier is not part of the repository yet
-
indexMetaBlobId
Get the blob id bySnapshotId
andIndexId
and fall back to the value ofSnapshotId.getUUID()
if none is known to enable backwards compatibility with versions older thanSnapshotsService.SHARD_GEN_IN_REPO_DATA_VERSION
which used the snapshot uuid as index metadata blob uuid.- Parameters:
snapshotId
- Snapshot IdindexId
- Index Id- Returns:
- blob id for the given index metadata
-
withAddedSnapshot
public IndexMetaDataGenerations withAddedSnapshot(SnapshotId snapshotId, <> newLookup, <,> newIdentifiers)Create a new instance with the given snapshot and index metadata uuids and identifiers added.- Parameters:
snapshotId
- SnapshotIdnewLookup
- new mappings of index + snapshot to index metadata identifiernewIdentifiers
- new mappings of index metadata identifier to blob id- Returns:
- instance with added snapshot
-
withRemovedSnapshots
public <SnapshotId> snapshotIds)Create a new instance with the given snapshot removed.- Parameters:
snapshotIds
- SnapshotIds to remove- Returns:
- new instance without the given snapshot
-
hashCode
public int hashCode()- Overrides:
in class
-
equals
public boolean equals( that)- Overrides:
in class
-
toString
public toString()- Overrides:
in class
-
buildUniqueIdentifier
Compute identifier forIndexMetadata
from its index- and history-uuid as well as its settings-, mapping- and alias-version. If an index did not see a change in its settings, mappings or aliases between two points in time then the identifier will not change between them either.- Parameters:
indexMetaData
- IndexMetaData- Returns:
- identifier string
-