java.lang.Object
org.elasticsearch.cluster.AbstractNamedDiffable<ClusterState.Custom>
org.elasticsearch.cluster.SnapshotsInProgress
- All Implemented Interfaces:
ClusterState.Custom,Diffable<ClusterState.Custom>,NamedDiffable<ClusterState.Custom>,NamedWriteable,VersionedNamedWriteable,Writeable,ChunkedToXContent
public class SnapshotsInProgress
extends AbstractNamedDiffable<ClusterState.Custom>
implements ClusterState.Custom
Meta data about snapshots that are currently executing
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final recordstatic enumThe current stage/phase of the shard snapshot, and whether it has completed or failed.static enumNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final SnapshotsInProgressstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasStream()static booleanChecks if all shards in the list have completedintcount()diff(ClusterState.Custom previousState) Returns serializable object representing differences between this and previousStatebooleanReturns the list of snapshots in the specified repository.static SnapshotsInProgressget(ClusterState state) Returns the SnapshotInProgress metadata present within the given cluster state.The minimal version of the recipient this object can be sent toReturns the name of the writeable objectinthashCode()booleanisEmpty()booleanisNodeIdForRemoval(String nodeId) booleanobsoleteGenerations(String repository, SnapshotsInProgress oldClusterStateSnapshots) Computes a map of repository shard id to set of shard generations, containing all shard generations that became obsolete and may be deleted from the repository as the cluster state moves from the given old value ofSnapshotsInProgressto this instance.static NamedDiff<ClusterState.Custom> static SnapshotsInProgress.EntrystartClone(Snapshot snapshot, SnapshotId source, Map<String, IndexId> indices, long startTime, long repositoryStateId, IndexVersion version) Creates the initial snapshot clone entrystatic SnapshotsInProgress.EntrystartedEntry(Snapshot snapshot, boolean includeGlobalState, boolean partial, Map<String, IndexId> indices, List<String> dataStreams, long startTime, long repositoryStateId, Map<ShardId, SnapshotsInProgress.ShardSnapshotStatus> shards, Map<String, Object> userMetadata, IndexVersion version, List<SnapshotFeatureInfo> featureStates) Creates the initialSnapshotsInProgress.Entrywhen starting a snapshot, if no shard-level snapshot work is to be done the resulting entry will be in stateSnapshotsInProgress.State.SUCCESSright away otherwise it will be in stateSnapshotsInProgress.State.STARTED.toString()Iterator<? extends ToXContent> toXContentChunked(ToXContent.Params ignored) Serialize thisClusterState.Customfor diagnostic purposes, exposed by thewithUpdatedEntriesForRepo(String repository, List<SnapshotsInProgress.Entry> updatedEntries) withUpdatedNodeIdsForRemoval(ClusterState clusterState) Adds any new node IDs tonodesIdsForRemoval, and removes any node IDs that are no longer marked for shutdown if they have no running shard snapshots.voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class org.elasticsearch.cluster.AbstractNamedDiffable
get, readDiffFromMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContent
isFragment, toXContentChunkedV7Methods inherited from interface org.elasticsearch.cluster.ClusterState.Custom
isPrivate
-
Field Details
-
EMPTY
-
TYPE
- See Also:
-
ABORTED_FAILURE_TEXT
- See Also:
-
-
Constructor Details
-
SnapshotsInProgress
- Throws:
IOException
-
-
Method Details
-
get
Returns the SnapshotInProgress metadata present within the given cluster state. -
withUpdatedEntriesForRepo
public SnapshotsInProgress withUpdatedEntriesForRepo(String repository, List<SnapshotsInProgress.Entry> updatedEntries) -
withAddedEntry
-
forRepo
Returns the list of snapshots in the specified repository. -
isEmpty
public boolean isEmpty() -
count
public int count() -
entriesByRepo
-
asStream
-
snapshot
-
obsoleteGenerations
public Map<RepositoryShardId,Set<ShardGeneration>> obsoleteGenerations(String repository, SnapshotsInProgress oldClusterStateSnapshots) Computes a map of repository shard id to set of shard generations, containing all shard generations that became obsolete and may be deleted from the repository as the cluster state moves from the given old value ofSnapshotsInProgressto this instance.An unique shard generation is created for every in-progress shard snapshot. The shard generation file contains information about all the files needed by pre-existing and any new shard snapshots that were in-progress. When a shard snapshot is finalized, its file list is promoted to the official shard snapshot list for the index shard. This final list will contain metadata about any other in-progress shard snapshots that were not yet finalized when it began. All these other in-progress shard snapshot lists are scheduled for deletion now.
-
getWriteableName
Description copied from interface:VersionedNamedWriteableReturns the name of the writeable object- Specified by:
getWriteableNamein interfaceNamedWriteable- Specified by:
getWriteableNamein interfaceVersionedNamedWriteable
-
getMinimalSupportedVersion
Description copied from interface:VersionedNamedWriteableThe minimal version of the recipient this object can be sent to- Specified by:
getMinimalSupportedVersionin interfaceVersionedNamedWriteable
-
readDiffFrom
- Throws:
IOException
-
diff
Description copied from interface:DiffableReturns serializable object representing differences between this and previousState- Specified by:
diffin interfaceDiffable<ClusterState.Custom>- Overrides:
diffin classAbstractNamedDiffable<ClusterState.Custom>
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
toXContentChunked
Description copied from interface:ClusterState.CustomSerialize thisClusterState.Customfor diagnostic purposes, exposed by theGET _cluster/state
API etc. The XContent representation does not need to be 100% faithful since we never reconstruct a cluster state from its XContent representation, but the more faithful it is the more useful it is for diagnostics.- Specified by:
toXContentChunkedin interfaceChunkedToXContent- Specified by:
toXContentChunkedin interfaceClusterState.Custom- Returns:
- iterator over chunks of
ToXContent
-
equals
-
hashCode
public int hashCode() -
toString
-
startedEntry
public static SnapshotsInProgress.Entry startedEntry(Snapshot snapshot, boolean includeGlobalState, boolean partial, Map<String, IndexId> indices, List<String> dataStreams, long startTime, long repositoryStateId, Map<ShardId, SnapshotsInProgress.ShardSnapshotStatus> shards, Map<String, Object> userMetadata, IndexVersion version, List<SnapshotFeatureInfo> featureStates) Creates the initialSnapshotsInProgress.Entrywhen starting a snapshot, if no shard-level snapshot work is to be done the resulting entry will be in stateSnapshotsInProgress.State.SUCCESSright away otherwise it will be in stateSnapshotsInProgress.State.STARTED. -
startClone
public static SnapshotsInProgress.Entry startClone(Snapshot snapshot, SnapshotId source, Map<String, IndexId> indices, long startTime, long repositoryStateId, IndexVersion version) Creates the initial snapshot clone entry- Parameters:
snapshot- snapshot to clone intosource- snapshot to clone fromindices- indices to clonestartTime- start timerepositoryStateId- repository state id that this clone is based onversion- repository metadata version to write- Returns:
- snapshot clone entry
-
completed
Checks if all shards in the list have completed- Parameters:
shards- list of shard statuses- Returns:
- true if all shards have completed (either successfully or failed), false otherwise
-
isNodeIdForRemoval
-
withUpdatedNodeIdsForRemoval
Adds any new node IDs tonodesIdsForRemoval, and removes any node IDs that are no longer marked for shutdown if they have no running shard snapshots. -
nodeIdsForRemovalChanged
-