- All Implemented Interfaces:
Closeable,AutoCloseable,LifecycleComponent,Releasable,Repository
-
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(ProjectId projectId, 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 repositoryDataGeneration, IndexVersion minimumNodeVersion, ActionListener<RepositoryData> repositoryDataUpdateListener, Runnable onCompletion) Deletes snapshotsprotected voiddoClose()Close this component.protected voiddoStart()Start this component.protected voiddoStop()Stop this component.voidendVerification(String verificationToken) Called at the end of repository verification process.voidfinalizeSnapshot(FinalizeSnapshotContext finalizeSnapshotContext) Finalizes snapshotting processReturns metadata about this repository.Get the project-id for the repository.voidgetRepositoryData(Executor responseExecutor, ActionListener<RepositoryData> listener) Fetches theRepositoryDataand passes it into the listener.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(Collection<SnapshotId> snapshotIds, boolean abortOnFailure, BooleanSupplier isCancelled, CheckedConsumer<SnapshotInfo, Exception> consumer, ActionListener<Void> listener) Reads a collection ofSnapshotInfoinstances 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
canUpdateInPlace, getSnapshotInfo, getUsageFeatures, stats
-
Constructor Details
-
InvalidRepository
public InvalidRepository(ProjectId projectId, RepositoryMetadata repositoryMetadata, RepositoryException creationException)
-
-
Method Details
-
getProjectId
Description copied from interface:RepositoryGet the project-id for the repository.- Specified by:
getProjectIdin interfaceRepository- Returns:
- the project-id, or
nullif the repository is at the cluster level.
-
getMetadata
Description copied from interface:RepositoryReturns metadata about this repository.- Specified by:
getMetadatain interfaceRepository
-
getSnapshotInfo
public void getSnapshotInfo(Collection<SnapshotId> snapshotIds, boolean abortOnFailure, BooleanSupplier isCancelled, CheckedConsumer<SnapshotInfo, Exception> consumer, ActionListener<Void> listener) Description copied from interface:RepositoryReads a collection ofSnapshotInfoinstances from the repository.- Specified by:
getSnapshotInfoin interfaceRepository- Parameters:
snapshotIds- The IDs of the snapshots whoseSnapshotInfoinstances should be retrieved.abortOnFailure- Whether to stop fetching furtherSnapshotInfoinstances if a single fetch fails.isCancelled- Supplies whether the enclosing task is cancelled, which should stop fetchingSnapshotInfoinstances.consumer- A consumer for eachSnapshotInforetrieved. Called concurrently from multiple threads. If the consumer throws an exception andabortOnFailureistruethen the fetching will stop.listener- IfabortOnFailureistrueand any operation fails then the failure is passed to this listener. Also completed exceptionally on cancellation. Otherwise, completed once all requestedSnapshotInfoinstances have been processed by theconsumer.
-
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:RepositoryFetches theRepositoryDataand passes it into the listener. May completes the listener with aRepositoryExceptionif there is an error in reading the repository data.- Specified by:
getRepositoryDatain interfaceRepository- Parameters:
responseExecutor- Executor to use to complete the listener if not using the calling thread. UsingEsExecutors.DIRECT_EXECUTOR_SERVICEmeans to complete the listener on the thread which ultimately resolved theRepositoryData, which might be a low-latency transport or cluster applier thread so make sure not to do anything slow or expensive in that case.listener- Listener which is either completed on the calling thread (if theRepositoryDatais immediately available, e.g. from an in-memory cache), otherwise it is completed usingresponseExecutor.
-
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 repositoryDataGeneration, IndexVersion minimumNodeVersion, ActionListener<RepositoryData> repositoryDataUpdateListener, Runnable onCompletion) Description copied from interface:RepositoryDeletes snapshots- Specified by:
deleteSnapshotsin interfaceRepository- Parameters:
snapshotIds- snapshot ids to deleterepositoryDataGeneration- the generation of theRepositoryDatain the repository at the start of the deletionminimumNodeVersion- the minimumIndexVersionacross the nodes in the cluster, with which the repository format must remain compatiblerepositoryDataUpdateListener- listener completed when theRepositoryDatais updated, or when the process fails without changing the repository contents - in either case, it is now safe for the next operation on this repository to proceed.onCompletion- action executed on completion of the cleanup actions that follow a successfulRepositoryDataupdate; not called ifrepositoryDataUpdateListenercompletes exceptionally.
-
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 callIndexShardSnapshotStatus.ensureNotAborted()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)orDelegatingActionListener.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.Copy 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
-
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()Description copied from class:AbstractLifecycleComponentStart this component. Typically that means doing things like launching background processes and registering listeners on other components. Other components have been initialized by this point, but may not yet be started.If this method throws an exception then the startup process will fail, but this component will not be stopped before it is closed.
This method is called while synchronized on
AbstractLifecycleComponent.lifecycle. It is only called once in the lifetime of a component, although it may not be called at all if the startup process encountered some kind of fatal error, such as the failure of some other component to initialize or start.- Specified by:
doStartin classAbstractLifecycleComponent
-
doStop
protected void doStop()Description copied from class:AbstractLifecycleComponentStop this component. Typically that means doing the reverse of whateverAbstractLifecycleComponent.doStart()does.This method is called while synchronized on
AbstractLifecycleComponent.lifecycle. It is only called once in the lifetime of a component, after callingAbstractLifecycleComponent.doStart(), although it will not be called at all if this component did not successfully start.- Specified by:
doStopin classAbstractLifecycleComponent
-
doClose
Description copied from class:AbstractLifecycleComponentClose this component. Typically that means doing the reverse of whatever happened during initialization, such as releasing resources acquired there.This method is called while synchronized on
AbstractLifecycleComponent.lifecycle. It is called once in the lifetime of a component. If the component was started then it will be stopped before it is closed, and once it is closed it will not be started or stopped.- Specified by:
doClosein classAbstractLifecycleComponent- Throws:
IOException
-