- 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
(RepositoryMetadata repositoryMetadata, RepositoryException creationException) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Block until all in-flight operations for this repository have completed.void
cloneShardSnapshot
(SnapshotId source, SnapshotId target, RepositoryShardId shardId, ShardGeneration shardGeneration, ActionListener<ShardSnapshotResult> listener) Clones a shard snapshot.void
deleteSnapshots
(Collection<SnapshotId> snapshotIds, long repositoryDataGeneration, IndexVersion minimumNodeVersion, SnapshotDeleteListener listener) Deletes snapshotsprotected void
doClose()
Close this component.protected void
doStart()
Start this component.protected void
doStop()
Stop this component.void
endVerification
(String verificationToken) Called at the end of repository verification process.void
finalizeSnapshot
(FinalizeSnapshotContext finalizeSnapshotContext) Finalizes snapshotting processReturns metadata about this repository.void
getRepositoryData
(Executor responseExecutor, ActionListener<RepositoryData> listener) Returns aRepositoryData
to describe the data in the repository, including the snapshots and the indices across all snapshots found in the repository.long
Returns 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.void
getSnapshotInfo
(GetSnapshotInfoContext context) Reads snapshot descriptions from the repository.long
Returns snapshot throttle time in nanosecondsboolean
Returns true if the repository supports only read operationsvoid
restoreShard
(Store store, SnapshotId snapshotId, IndexId indexId, ShardId snapshotShardId, RecoveryState recoveryState, ActionListener<Void> listener) Restores snapshot of the shard.void
snapshotShard
(SnapshotShardContext snapshotShardContext) Creates a snapshot of the shard referenced by the givenSnapshotShardContext
.Verifies repository on the master node and returns the verification token.void
updateState
(ClusterState state) Update the repository with the incoming cluster state.void
verify
(String verificationToken, DiscoveryNode localNode) Verifies repository settings on data node.Methods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, start, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.common.component.LifecycleComponent
addLifecycleListener, lifecycleState, start, stop
Methods inherited from interface org.elasticsearch.core.Releasable
close
Methods inherited from interface org.elasticsearch.repositories.Repository
canUpdateInPlace, getSnapshotInfo, stats
-
Constructor Details
-
InvalidRepository
public InvalidRepository(RepositoryMetadata repositoryMetadata, RepositoryException creationException)
-
-
Method Details
-
getMetadata
Description copied from interface:Repository
Returns metadata about this repository.- Specified by:
getMetadata
in interfaceRepository
-
getSnapshotInfo
Description copied from interface:Repository
Reads snapshot descriptions from the repository.- Specified by:
getSnapshotInfo
in interfaceRepository
- Parameters:
context
- get-snapshot-info-context
-
getSnapshotGlobalMetadata
Description copied from interface:Repository
Returns global metadata associated with the snapshot.- Specified by:
getSnapshotGlobalMetadata
in 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:Repository
Returns the index metadata associated with the snapshot.- Specified by:
getSnapshotIndexMetaData
in interfaceRepository
- Parameters:
repositoryData
- currentRepositoryData
snapshotId
- the snapshot id to load the index metadata fromindex
- theIndexId
to load the metadata from- Returns:
- the index metadata about the given index for the given snapshot
- Throws:
IOException
-
getRepositoryData
Description copied from interface:Repository
Returns aRepositoryData
to describe the data in the repository, including the snapshots and the indices across all snapshots found in the repository. Completes the listener with aRepositoryException
if there was an error in reading the data.- Specified by:
getRepositoryData
in interfaceRepository
- Parameters:
responseExecutor
- Executor to use to complete the listener if not using the calling thread. UsingEsExecutors.DIRECT_EXECUTOR_SERVICE
means 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 theRepositoryData
is immediately available, e.g. from an in-memory cache), otherwise it is completed usingresponseExecutor
.
-
finalizeSnapshot
Description copied from interface:Repository
Finalizes snapshotting processThis method is called on master after all shards are snapshotted.
- Specified by:
finalizeSnapshot
in interfaceRepository
- Parameters:
finalizeSnapshotContext
- finalization context
-
deleteSnapshots
public void deleteSnapshots(Collection<SnapshotId> snapshotIds, long repositoryDataGeneration, IndexVersion minimumNodeVersion, SnapshotDeleteListener listener) Description copied from interface:Repository
Deletes snapshots- Specified by:
deleteSnapshots
in interfaceRepository
- Parameters:
snapshotIds
- snapshot ids to deleterepositoryDataGeneration
- the generation of theRepositoryData
in the repository at the start of the deletionminimumNodeVersion
- the minimumIndexVersion
across the nodes in the cluster, with which the repository format must remain compatiblelistener
- completion listener, seeSnapshotDeleteListener
.
-
getSnapshotThrottleTimeInNanos
public long getSnapshotThrottleTimeInNanos()Description copied from interface:Repository
Returns snapshot throttle time in nanoseconds- Specified by:
getSnapshotThrottleTimeInNanos
in interfaceRepository
-
getRestoreThrottleTimeInNanos
public long getRestoreThrottleTimeInNanos()Description copied from interface:Repository
Returns restore throttle time in nanoseconds- Specified by:
getRestoreThrottleTimeInNanos
in interfaceRepository
-
startVerification
Description copied from interface:Repository
Verifies 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:
startVerification
in interfaceRepository
- Returns:
- verification token that should be passed to all Index Shard Repositories for additional verification or null
-
endVerification
Description copied from interface:Repository
Called at the end of repository verification process.This method should perform all necessary cleanup of the temporary files created in the repository
- Specified by:
endVerification
in interfaceRepository
- Parameters:
verificationToken
- verification request generated byRepository.startVerification()
command
-
verify
Description copied from interface:Repository
Verifies repository settings on data node.- Specified by:
verify
in 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:Repository
Returns true if the repository supports only read operations- Specified by:
isReadOnly
in interfaceRepository
- Returns:
- true if the repository is read/only
-
snapshotShard
Description copied from interface:Repository
Creates a snapshot of the shard referenced by the givenSnapshotShardContext
.As snapshot process progresses, implementation of this method should update
IndexShardSnapshotStatus
object returned bySnapshotShardContext.status()
and callIndexShardSnapshotStatus.ensureNotAborted()
to see if the snapshot process should be aborted.- Specified by:
snapshotShard
in 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:Repository
Restores snapshot of the shard.The index can be renamed on restore, hence different
shardId
andsnapshotShardId
are supplied.- Specified by:
restoreShard
in 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:Repository
Retrieve shard snapshot status for the stored snapshot- Specified by:
getShardSnapshotStatus
in 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:Repository
Update 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 theClusterState
that is passed here.- Specified by:
updateState
in 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:Repository
Clones a shard snapshot.- Specified by:
cloneShardSnapshot
in 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:Repository
Block 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:
awaitIdle
in interfaceRepository
-
doStart
protected void doStart()Description copied from class:AbstractLifecycleComponent
Start 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:
doStart
in classAbstractLifecycleComponent
-
doStop
protected void doStop()Description copied from class:AbstractLifecycleComponent
Stop 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:
doStop
in classAbstractLifecycleComponent
-
doClose
Description copied from class:AbstractLifecycleComponent
Close 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:
doClose
in classAbstractLifecycleComponent
- Throws:
IOException
-