Class InvalidRepository

All Implemented Interfaces:
Closeable, AutoCloseable, LifecycleComponent, Releasable, Repository

public class InvalidRepository extends AbstractLifecycleComponent implements Repository
Represents a repository that exists in the cluster state but could not be instantiated on a node, typically due to invalid configuration.
  • Constructor Details

  • Method Details

    • getMetadata

      public RepositoryMetadata getMetadata()
      Description copied from interface: Repository
      Returns metadata about this repository.
      Specified by:
      getMetadata in interface Repository
    • getSnapshotInfo

      public void getSnapshotInfo(Collection<SnapshotId> snapshotIds, boolean abortOnFailure, BooleanSupplier isCancelled, CheckedConsumer<SnapshotInfo,Exception> consumer, ActionListener<Void> listener)
      Description copied from interface: Repository
      Reads a collection of SnapshotInfo instances from the repository.
      Specified by:
      getSnapshotInfo in interface Repository
      Parameters:
      snapshotIds - The IDs of the snapshots whose SnapshotInfo instances should be retrieved.
      abortOnFailure - Whether to stop fetching further SnapshotInfo instances if a single fetch fails.
      isCancelled - Supplies whether the enclosing task is cancelled, which should stop fetching SnapshotInfo instances.
      consumer - A consumer for each SnapshotInfo retrieved. Called concurrently from multiple threads. If the consumer throws an exception and abortOnFailure is true then the fetching will stop.
      listener - If abortOnFailure is true and any operation fails then the failure is passed to this listener. Also completed exceptionally on cancellation. Otherwise, completed once all requested SnapshotInfo instances have been processed by the consumer.
    • getSnapshotGlobalMetadata

      public Metadata getSnapshotGlobalMetadata(SnapshotId snapshotId)
      Description copied from interface: Repository
      Returns global metadata associated with the snapshot.
      Specified by:
      getSnapshotGlobalMetadata in interface Repository
      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 interface Repository
      Parameters:
      repositoryData - current RepositoryData
      snapshotId - the snapshot id to load the index metadata from
      index - the IndexId to load the metadata from
      Returns:
      the index metadata about the given index for the given snapshot
      Throws:
      IOException
    • getRepositoryData

      public void getRepositoryData(Executor responseExecutor, ActionListener<RepositoryData> listener)
      Description copied from interface: Repository
      Fetches the RepositoryData and passes it into the listener. May completes the listener with a RepositoryException if there is an error in reading the repository data.
      Specified by:
      getRepositoryData in interface Repository
      Parameters:
      responseExecutor - Executor to use to complete the listener if not using the calling thread. Using EsExecutors.DIRECT_EXECUTOR_SERVICE means to complete the listener on the thread which ultimately resolved the RepositoryData, 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 the RepositoryData is immediately available, e.g. from an in-memory cache), otherwise it is completed using responseExecutor.
    • finalizeSnapshot

      public void finalizeSnapshot(FinalizeSnapshotContext finalizeSnapshotContext)
      Description copied from interface: Repository
      Finalizes snapshotting process

      This method is called on master after all shards are snapshotted.

      Specified by:
      finalizeSnapshot in interface Repository
      Parameters:
      finalizeSnapshotContext - finalization context
    • deleteSnapshots

      public void deleteSnapshots(Collection<SnapshotId> snapshotIds, long repositoryDataGeneration, IndexVersion minimumNodeVersion, ActionListener<RepositoryData> repositoryDataUpdateListener, Runnable onCompletion)
      Description copied from interface: Repository
      Deletes snapshots
      Specified by:
      deleteSnapshots in interface Repository
      Parameters:
      snapshotIds - snapshot ids to delete
      repositoryDataGeneration - the generation of the RepositoryData in the repository at the start of the deletion
      minimumNodeVersion - the minimum IndexVersion across the nodes in the cluster, with which the repository format must remain compatible
      repositoryDataUpdateListener - listener completed when the RepositoryData is 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 successful RepositoryData update; not called if repositoryDataUpdateListener completes exceptionally.
    • getSnapshotThrottleTimeInNanos

      public long getSnapshotThrottleTimeInNanos()
      Description copied from interface: Repository
      Returns snapshot throttle time in nanoseconds
      Specified by:
      getSnapshotThrottleTimeInNanos in interface Repository
    • getRestoreThrottleTimeInNanos

      public long getRestoreThrottleTimeInNanos()
      Description copied from interface: Repository
      Returns restore throttle time in nanoseconds
      Specified by:
      getRestoreThrottleTimeInNanos in interface Repository
    • startVerification

      public String 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 interface Repository
      Returns:
      verification token that should be passed to all Index Shard Repositories for additional verification or null
    • endVerification

      public void endVerification(String verificationToken)
      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 interface Repository
      Parameters:
      verificationToken - verification request generated by Repository.startVerification() command
    • verify

      public void verify(String verificationToken, DiscoveryNode localNode)
      Description copied from interface: Repository
      Verifies repository settings on data node.
      Specified by:
      verify in interface Repository
      Parameters:
      verificationToken - value returned by Repository.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 interface Repository
      Returns:
      true if the repository is read/only
    • snapshotShard

      public void snapshotShard(SnapshotShardContext snapshotShardContext)
      Description copied from interface: Repository
      Creates a snapshot of the shard referenced by the given SnapshotShardContext.

      As snapshot process progresses, implementation of this method should update IndexShardSnapshotStatus object returned by SnapshotShardContext.status() and call IndexShardSnapshotStatus.ensureNotAborted() to see if the snapshot process should be aborted.

      Specified by:
      snapshotShard in interface Repository
      Parameters:
      snapshotShardContext - snapshot shard context that must be completed via SnapshotShardContext.onResponse(org.elasticsearch.repositories.ShardSnapshotResult) or DelegatingActionListener.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 and snapshotShardId are supplied.

      Specified by:
      restoreShard in interface Repository
      Parameters:
      store - the store to restore the index into
      snapshotId - snapshot id
      indexId - id of the index in the repository from which the restore is occurring
      snapshotShardId - shard id (in the snapshot)
      recoveryState - recovery state
      listener - 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 interface Repository
      Parameters:
      snapshotId - snapshot id
      indexId - the snapshotted index id for the shard to get status for
      shardId - shard id
      Returns:
      snapshot status
    • updateState

      public void updateState(ClusterState state)
      Description copied from interface: Repository
      Update the repository with the incoming cluster state. This method is invoked from RepositoriesService.applyClusterState(org.elasticsearch.cluster.ClusterChangedEvent) and thus the same semantics as with ClusterStateApplier.applyClusterState(org.elasticsearch.cluster.ClusterChangedEvent) apply for the ClusterState that is passed here.
      Specified by:
      updateState in interface Repository
      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 interface Repository
      Parameters:
      source - source snapshot
      target - target snapshot
      shardId - shard id
      shardGeneration - shard generation in repo
      listener - 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 stop Releasable.close(). Waiting for ongoing operations should be implemented here instead of in LifecycleComponent.stop() or Releasable.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 interface Repository
    • 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 class AbstractLifecycleComponent
    • doStop

      protected void doStop()
      Description copied from class: AbstractLifecycleComponent
      Stop this component. Typically that means doing the reverse of whatever AbstractLifecycleComponent.doStart() does.

      This method is called while synchronized on AbstractLifecycleComponent.lifecycle. It is only called once in the lifetime of a component, after calling AbstractLifecycleComponent.doStart(), although it will not be called at all if this component did not successfully start.

      Specified by:
      doStop in class AbstractLifecycleComponent
    • doClose

      protected void doClose() throws IOException
      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 class AbstractLifecycleComponent
      Throws:
      IOException