Class TransportCleanupRepositoryAction

java.lang.Object

public final class TransportCleanupRepositoryAction
extends TransportMasterNodeAction<CleanupRepositoryRequest,​CleanupRepositoryResponse>
Repository cleanup action for repository implementations based on BlobStoreRepository. The steps taken by the repository cleanup operation are as follows:
  1. Check that there are no running repository cleanup, snapshot create, or snapshot delete actions and add an entry for the repository that is to be cleaned up to RepositoryCleanupInProgress
  2. Run cleanup actions on the repository. Note, these are executed exclusively on the master node. For the precise operations execute see BlobStoreRepository.cleanup(long, boolean, org.elasticsearch.action.ActionListener<org.elasticsearch.repositories.RepositoryCleanupResult>)
  3. Remove the entry in RepositoryCleanupInProgress in the first step.
On master failover during the cleanup operation it is simply removed from the cluster state. This is safe because the logic in BlobStoreRepository.cleanup(long, boolean, org.elasticsearch.action.ActionListener<org.elasticsearch.repositories.RepositoryCleanupResult>) ensures that the repository state id has not changed between creation of the cluster state entry and any delete/write operations. TODO: This will not work if we also want to clean up at the shard level as those will involve writes as well as deletes.