Class IndexMetaDataGenerations


public final class IndexMetaDataGenerations extends Object
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.FinalizeSnapshotContext) 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 Details

  • Method Details

    • isEmpty

      public boolean isEmpty()
    • getIndexMetaBlobId

      @Nullable public String getIndexMetaBlobId(String metaIdentifier)
      Gets the blob id by the identifier of IndexMetadata (computed via buildUniqueIdentifier(org.elasticsearch.cluster.metadata.IndexMetadata)) or null if none is tracked for the identifier.
      metaIdentifier - identifier for IndexMetadata
      blob id for the given metadata identifier or null if the identifier is not part of the repository yet
    • indexMetaBlobId

      public String indexMetaBlobId(SnapshotId snapshotId, IndexId indexId)
      Get the blob id by SnapshotId and IndexId and fall back to the value of SnapshotId.getUUID() if none is known to enable backwards compatibility with versions older than SnapshotsService.SHARD_GEN_IN_REPO_DATA_VERSION which used the snapshot uuid as index metadata blob uuid.
      snapshotId - Snapshot Id
      indexId - Index Id
      blob id for the given index metadata
    • snapshotIndexMetadataIdentifier

      @Nullable public String snapshotIndexMetadataIdentifier(SnapshotId snapshotId, IndexId indexId)
      Gets the IndexMetadata identifier for the given snapshot if the snapshot contains the referenced index, otherwise it returns null.
    • 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.
      snapshotId - SnapshotId
      newLookup - new mappings of index + snapshot to index metadata identifier
      newIdentifiers - new mappings of index metadata identifier to blob id
      instance with added snapshot
    • withRemovedSnapshots

      public IndexMetaDataGenerations withRemovedSnapshots(Collection<SnapshotId> snapshotIds)
      Create a new instance with the given snapshot removed.
      snapshotIds - SnapshotIds to remove
      new instance without the given snapshot
    • hashCode

      public int hashCode()
      hashCode in class Object
    • equals

      public boolean equals(Object that)
      equals in class Object
    • toString

      public String toString()
      toString in class Object
    • buildUniqueIdentifier

      public static String buildUniqueIdentifier(IndexMetadata indexMetaData)
      Compute identifier for IndexMetadata 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.
      indexMetaData - IndexMetaData
      identifier string