java.lang.Object
org.elasticsearch.cluster.SnapshotsInProgress.Entry
- All Implemented Interfaces:
Diffable<SnapshotsInProgress.Entry>,Writeable,RepositoryOperation,ToXContent,ToXContentObject
- Enclosing class:
SnapshotsInProgress
public static class SnapshotsInProgress.Entry
extends Object
implements Writeable, ToXContentObject, RepositoryOperation, Diffable<SnapshotsInProgress.Entry>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.repositories.RepositoryOperation
RepositoryOperation.ProjectRepoNested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields inherited from interface org.elasticsearch.repositories.RepositoryOperation
PROJECT_REPO_SERIALIZERFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Method Summary
Modifier and TypeMethodDescriptionabort()Create a new instance by aborting this instance.diff(SnapshotsInProgress.Entry previousState) Returns serializable object representing differences between this and previousStatebooleanfailure()inthashCode()booleanSeehasShardsInInitState.booleanindexByName(String name) indices()booleanisClone()booleanpartial()Project for which repository belongs to.Name of the repository affected.longThe repository state id at the time the operation began.shardId(RepositoryShardId repositoryShardId) shards()Returns a map of shards to their snapshot status.snapshot()static SnapshotsInProgress.Entrysnapshot(Snapshot snapshot, boolean includeGlobalState, boolean partial, SnapshotsInProgress.State state, Map<String, IndexId> indices, List<String> dataStreams, List<SnapshotFeatureInfo> featureStates, long startTime, long repositoryStateId, Map<ShardId, SnapshotsInProgress.ShardSnapshotStatus> shards, String failure, Map<String, Object> userMetadata, IndexVersion version) source()longstate()toString()toXContent(XContentBuilder builder, ToXContent.Params params) version()What version of metadata to use for the snapshot in the repositorywithClones(Map<RepositoryShardId, SnapshotsInProgress.ShardSnapshotStatus> updatedClones) withRepoGen(long newRepoGen) Create a new instance that has its shard assignments replaced by the given shard assignment map.Same aswithShardStates(java.util.Map<org.elasticsearch.index.shard.ShardId, org.elasticsearch.cluster.SnapshotsInProgress.ShardSnapshotStatus>)but does not check if the snapshot completed and thus is only to be used when starting new shard snapshots on data nodes for a running snapshot.withUpdatedIndexIds(Map<IndexId, IndexId> updates) voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentObject
isFragment
-
Method Details
-
snapshot
public static SnapshotsInProgress.Entry snapshot(Snapshot snapshot, boolean includeGlobalState, boolean partial, SnapshotsInProgress.State state, Map<String, IndexId> indices, List<String> dataStreams, List<SnapshotFeatureInfo> featureStates, long startTime, long repositoryStateId, Map<ShardId, SnapshotsInProgress.ShardSnapshotStatus> shards, String failure, Map<String, Object> userMetadata, IndexVersion version) -
withRepoGen
-
withUpdatedIndexIds
Reassigns allIndexIdin a snapshot that can be found as keys in the givenupdatesto theIndexIdvalue that they map to. This method is used in an edge case of removing aSnapshotDeletionsInProgress.Entryfrom the cluster state at the end of a delete. If the delete removed the last use of a certainIndexIdfrom the repository then we do not want to reuse thatIndexIdbecause the implementation ofBlobStoreRepositoryassumes that a givenIndexIdwill never be reused if it went from referenced to unreferenced in theRepositoryDatain a delete. -
withClones
public SnapshotsInProgress.Entry withClones(Map<RepositoryShardId, SnapshotsInProgress.ShardSnapshotStatus> updatedClones) -
abort
Create a new instance by aborting this instance. Moving all in-progress shards toSnapshotsInProgress.ShardState.ABORTEDif assigned to a data node or toSnapshotsInProgress.ShardState.FAILEDif not assigned to any data node. If the instance had no in-progress shard snapshots assigned to data nodes it's moved to stateSnapshotsInProgress.State.SUCCESS, otherwise it's moved to stateSnapshotsInProgress.State.ABORTED. In the special case where this instance has not yet made any progress on any shard this method just returnsnullsince no abort is needed and the snapshot can simply be removed from the cluster state outright.- Returns:
- aborted snapshot entry or
nullif entry can be removed from the cluster state directly
-
withShardStates
public SnapshotsInProgress.Entry withShardStates(Map<ShardId, SnapshotsInProgress.ShardSnapshotStatus> shards) Create a new instance that has its shard assignments replaced by the given shard assignment map. If the given shard assignments show all shard snapshots in a completed state then the returned instance will be of stateSnapshotsInProgress.State.SUCCESS, otherwise the state remains unchanged.- Parameters:
shards- new shard snapshot states- Returns:
- new snapshot entry
-
withStartedShards
public SnapshotsInProgress.Entry withStartedShards(Map<ShardId, SnapshotsInProgress.ShardSnapshotStatus> shards) Same aswithShardStates(java.util.Map<org.elasticsearch.index.shard.ShardId, org.elasticsearch.cluster.SnapshotsInProgress.ShardSnapshotStatus>)but does not check if the snapshot completed and thus is only to be used when starting new shard snapshots on data nodes for a running snapshot. -
projectId
Description copied from interface:RepositoryOperationProject for which repository belongs to.- Specified by:
projectIdin interfaceRepositoryOperation
-
repository
Description copied from interface:RepositoryOperationName of the repository affected.- Specified by:
repositoryin interfaceRepositoryOperation
-
snapshot
-
shardSnapshotStatusByRepoShardId
public Map<RepositoryShardId,SnapshotsInProgress.ShardSnapshotStatus> shardSnapshotStatusByRepoShardId()Returns a map of shards to their snapshot status. -
indexByName
-
shards
-
shardId
-
state
-
indices
-
includeGlobalState
public boolean includeGlobalState() -
userMetadata
-
hasShardsInInitState
public boolean hasShardsInInitState()SeehasShardsInInitState.- Returns:
- true if this entry can contain shard snapshots that have yet to be started on a data node.
-
partial
public boolean partial() -
startTime
public long startTime() -
dataStreams
-
featureStates
-
repositoryStateId
public long repositoryStateId()Description copied from interface:RepositoryOperationThe repository state id at the time the operation began.- Specified by:
repositoryStateIdin interfaceRepositoryOperation
-
failure
-
version
What version of metadata to use for the snapshot in the repository -
source
-
isClone
public boolean isClone() -
equals
-
hashCode
public int hashCode() -
toString
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
diff
Description copied from interface:DiffableReturns serializable object representing differences between this and previousState- Specified by:
diffin interfaceDiffable<SnapshotsInProgress.Entry>
-