java.lang.Object
org.elasticsearch.common.component.AbstractLifecycleComponent
org.elasticsearch.repositories.InvalidRepository
- All Implemented Interfaces:
Closeable,AutoCloseable,LifecycleComponent,Releasable,Repository
Represents a repository that exists in the cluster state but could not be instantiated on a node, typically due to invalid configuration.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.repositories.Repository
Repository.Factory -
Field Summary
Fields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
lifecycle -
Constructor Summary
ConstructorsConstructorDescriptionInvalidRepository(RepositoryMetadata repositoryMetadata, RepositoryException creationException) -
Method Summary
Modifier and TypeMethodDescriptionvoidBlock until all in-flight operations for this repository have completed.voidcloneShardSnapshot(SnapshotId source, SnapshotId target, RepositoryShardId shardId, ShardGeneration shardGeneration, ActionListener<ShardSnapshotResult> listener) Clones a shard snapshot.voiddeleteSnapshots(Collection<SnapshotId> snapshotIds, long repositoryStateId, Version repositoryMetaVersion, SnapshotDeleteListener listener) Deletes snapshotsprotected voiddoClose()protected voiddoStart()protected voiddoStop()voidendVerification(String verificationToken) Called at the end of repository verification process.voidexecuteConsistentStateUpdate(Function<RepositoryData, ClusterStateUpdateTask> createUpdateTask, String source, Consumer<Exception> onFailure) Execute a cluster state update with a consistent view of the currentRepositoryData.voidfinalizeSnapshot(FinalizeSnapshotContext finalizeSnapshotContext) Finalizes snapshotting processReturns metadata about this repository.voidgetRepositoryData(ActionListener<RepositoryData> listener) Returns aRepositoryDatato describe the data in the repository, including the snapshots and the indices across all snapshots found in the repository.longReturns restore throttle time in nanosecondsgetShardSnapshotStatus(SnapshotId snapshotId, IndexId indexId, ShardId shardId) Retrieve shard snapshot status for the stored snapshotgetSnapshotGlobalMetadata(SnapshotId snapshotId) Returns global metadata associated with the snapshot.getSnapshotIndexMetaData(RepositoryData repositoryData, SnapshotId snapshotId, IndexId index) Returns the index metadata associated with the snapshot.voidgetSnapshotInfo(GetSnapshotInfoContext context) Reads snapshot descriptions from the repository.longReturns snapshot throttle time in nanosecondsbooleanReturns true if the repository supports only read operationsvoidrestoreShard(Store store, SnapshotId snapshotId, IndexId indexId, ShardId snapshotShardId, RecoveryState recoveryState, ActionListener<Void> listener) Restores snapshot of the shard.voidsnapshotShard(SnapshotShardContext snapshotShardContext) Creates a snapshot of the shard referenced by the givenSnapshotShardContext.Verifies repository on the master node and returns the verification token.voidupdateState(ClusterState state) Update the repository with the incoming cluster state.voidverify(String verificationToken, DiscoveryNode localNode) Verifies repository settings on data node.Methods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.common.component.LifecycleComponent
addLifecycleListener, lifecycleState, start, stopMethods inherited from interface org.elasticsearch.core.Releasable
closeMethods inherited from interface org.elasticsearch.repositories.Repository
adaptUserMetadata, canUpdateInPlace, getSnapshotInfo, stats
-
Constructor Details
-
InvalidRepository
public InvalidRepository(RepositoryMetadata repositoryMetadata, RepositoryException creationException)
-
-
Method Details
-
getMetadata
Description copied from interface:RepositoryReturns metadata about this repository.- Specified by:
getMetadatain interfaceRepository
-
getSnapshotInfo
Description copied from interface:RepositoryReads snapshot descriptions from the repository.- Specified by:
getSnapshotInfoin interfaceRepository- Parameters:
context- get-snapshot-info-context
-
getSnapshotGlobalMetadata
Description copied from interface:RepositoryReturns global metadata associated with the snapshot.- Specified by:
getSnapshotGlobalMetadatain interfaceRepository- Parameters:
snapshotId- the snapshot id to load the global metadata from- Returns:
- the global metadata about the snapshot
-
getSnapshotIndexMetaData
public IndexMetadata getSnapshotIndexMetaData(RepositoryData repositoryData, SnapshotId snapshotId, IndexId index) throws IOException Description copied from interface:RepositoryReturns the index metadata associated with the snapshot.- Specified by:
getSnapshotIndexMetaDatain interfaceRepository- Parameters:
repositoryData- currentRepositoryDatasnapshotId- the snapshot id to load the index metadata fromindex- theIndexIdto load the metadata from- Returns:
- the index metadata about the given index for the given snapshot
- Throws:
IOException
-
getRepositoryData
Description copied from interface:RepositoryReturns aRepositoryDatato describe the data in the repository, including the snapshots and the indices across all snapshots found in the repository. Throws aRepositoryExceptionif there was an error in reading the data.- Specified by:
getRepositoryDatain interfaceRepository- Parameters:
listener- listener that may be resolved on different kinds of threads including transport and cluster state applier threads and therefore must fork to a new thread for executing any long running actions
-
finalizeSnapshot
Description copied from interface:RepositoryFinalizes snapshotting processThis method is called on master after all shards are snapshotted.
- Specified by:
finalizeSnapshotin interfaceRepository- Parameters:
finalizeSnapshotContext- finalization context
-
deleteSnapshots
public void deleteSnapshots(Collection<SnapshotId> snapshotIds, long repositoryStateId, Version repositoryMetaVersion, SnapshotDeleteListener listener) Description copied from interface:RepositoryDeletes snapshots- Specified by:
deleteSnapshotsin interfaceRepository- Parameters:
snapshotIds- snapshot idsrepositoryStateId- the unique id identifying the state of the repository when the snapshot deletion beganrepositoryMetaVersion- version of the updated repository metadata to writelistener- completion listener
-
getSnapshotThrottleTimeInNanos
public long getSnapshotThrottleTimeInNanos()Description copied from interface:RepositoryReturns snapshot throttle time in nanoseconds- Specified by:
getSnapshotThrottleTimeInNanosin interfaceRepository
-
getRestoreThrottleTimeInNanos
public long getRestoreThrottleTimeInNanos()Description copied from interface:RepositoryReturns restore throttle time in nanoseconds- Specified by:
getRestoreThrottleTimeInNanosin interfaceRepository
-
startVerification
Description copied from interface:RepositoryVerifies repository on the master node and returns the verification token.If the verification token is not null, it's passed to all data nodes for verification. If it's null - no additional verification is required
- Specified by:
startVerificationin interfaceRepository- Returns:
- verification token that should be passed to all Index Shard Repositories for additional verification or null
-
endVerification
Description copied from interface:RepositoryCalled at the end of repository verification process.This method should perform all necessary cleanup of the temporary files created in the repository
- Specified by:
endVerificationin interfaceRepository- Parameters:
verificationToken- verification request generated byRepository.startVerification()command
-
verify
Description copied from interface:RepositoryVerifies repository settings on data node.- Specified by:
verifyin interfaceRepository- Parameters:
verificationToken- value returned byRepository.startVerification()localNode- the local node information, for inclusion in verification errors
-
isReadOnly
public boolean isReadOnly()Description copied from interface:RepositoryReturns true if the repository supports only read operations- Specified by:
isReadOnlyin interfaceRepository- Returns:
- true if the repository is read/only
-
snapshotShard
Description copied from interface:RepositoryCreates a snapshot of the shard referenced by the givenSnapshotShardContext.As snapshot process progresses, implementation of this method should update
IndexShardSnapshotStatusobject returned bySnapshotShardContext.status()and check itsIndexShardSnapshotStatus.isAborted()to see if the snapshot process should be aborted.- Specified by:
snapshotShardin interfaceRepository- Parameters:
snapshotShardContext- snapshot shard context that must be completed viaSnapshotShardContext.onResponse(org.elasticsearch.repositories.ShardSnapshotResult)orActionListener.Delegating.onFailure(java.lang.Exception)
-
restoreShard
public void restoreShard(Store store, SnapshotId snapshotId, IndexId indexId, ShardId snapshotShardId, RecoveryState recoveryState, ActionListener<Void> listener) Description copied from interface:RepositoryRestores snapshot of the shard.The index can be renamed on restore, hence different
shardIdandsnapshotShardIdare supplied.- Specified by:
restoreShardin interfaceRepository- Parameters:
store- the store to restore the index intosnapshotId- snapshot idindexId- id of the index in the repository from which the restore is occurringsnapshotShardId- shard id (in the snapshot)recoveryState- recovery statelistener- listener to invoke once done
-
getShardSnapshotStatus
public IndexShardSnapshotStatus getShardSnapshotStatus(SnapshotId snapshotId, IndexId indexId, ShardId shardId) Description copied from interface:RepositoryRetrieve shard snapshot status for the stored snapshot- Specified by:
getShardSnapshotStatusin interfaceRepository- Parameters:
snapshotId- snapshot idindexId- the snapshotted index id for the shard to get status forshardId- shard id- Returns:
- snapshot status
-
updateState
Description copied from interface:RepositoryUpdate the repository with the incoming cluster state. This method is invoked fromRepositoriesService.applyClusterState(org.elasticsearch.cluster.ClusterChangedEvent)and thus the same semantics as withClusterStateApplier.applyClusterState(org.elasticsearch.cluster.ClusterChangedEvent)apply for theClusterStatethat is passed here.- Specified by:
updateStatein interfaceRepository- Parameters:
state- new cluster state
-
executeConsistentStateUpdate
public void executeConsistentStateUpdate(Function<RepositoryData, ClusterStateUpdateTask> createUpdateTask, String source, Consumer<Exception> onFailure) Description copied from interface:RepositoryExecute a cluster state update with a consistent view of the currentRepositoryData. TheClusterStatepassed to the task generated throughcreateUpdateTaskis guaranteed to point at the same state for this repository as the did the state at the time theRepositoryDatawas loaded. This allows for operations on the repository that need a consistent view of both the cluster state and the repository contents at one point in time like for example, checking if a snapshot is in the repository before adding the delete operation for it to the cluster state.- Specified by:
executeConsistentStateUpdatein interfaceRepository- Parameters:
createUpdateTask- function to supply cluster state update tasksource- the source of the cluster state update taskonFailure- error handler invoked on failure to get a consistent view of the currentRepositoryData
-
cloneShardSnapshot
public void cloneShardSnapshot(SnapshotId source, SnapshotId target, RepositoryShardId shardId, ShardGeneration shardGeneration, ActionListener<ShardSnapshotResult> listener) Description copied from interface:RepositoryClones a shard snapshot.- Specified by:
cloneShardSnapshotin interfaceRepository- Parameters:
source- source snapshottarget- target snapshotshardId- shard idshardGeneration- shard generation in repolistener- listener to complete with new shard generation once clone has completed
-
awaitIdle
public void awaitIdle()Description copied from interface:RepositoryBlock until all in-flight operations for this repository have completed. Must only be called after this instance has been closed by a call to stopReleasable.close(). Waiting for ongoing operations should be implemented here instead of inLifecycleComponent.stop()orReleasable.close()hooks of this interface as these are expected to be called on the cluster state applier thread (which must not block) if a repository is removed from the cluster. This method is intended to be called on node shutdown instead as a means to ensure no repository operations are leaked.- Specified by:
awaitIdlein interfaceRepository
-
doStart
protected void doStart()- Specified by:
doStartin classAbstractLifecycleComponent
-
doStop
protected void doStop()- Specified by:
doStopin classAbstractLifecycleComponent
-
doClose
- Specified by:
doClosein classAbstractLifecycleComponent- Throws:
IOException
-