Package org.elasticsearch.repositories
Class IndexMetaDataGenerations
java.lang.Object
org.elasticsearch.repositories.IndexMetaDataGenerations
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 String
buildUniqueIdentifier(IndexMetadata indexMetaData)
Compute identifier forIndexMetadata
from its index- and history-uuid as well as its settings-, mapping- and alias-version.boolean
getIndexMetaBlobId(String 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, Map<IndexId,String> newLookup, Map<String,String> newIdentifiers)
Create a new instance with the given snapshot and index metadata uuids and identifiers added.withRemovedSnapshots(Collection<SnapshotId> snapshotIds)
Create a new instance with the given snapshot removed.
-
Field Details
-
EMPTY
-
-
Method Details
-
isEmpty
public boolean isEmpty() -
getIndexMetaBlobId
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, Map<IndexId,String> newLookup, Map<String,String> 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
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() -
equals
-
toString
-
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
-