public class RecoveriesCollection extends Object
RecoveriesCollection.StatusRef
inner class verifies that recovery temporary files
and store will only be cleared once on going usage is finished.Modifier and Type | Class and Description |
---|---|
static class |
RecoveriesCollection.StatusRef
a reference to
RecoveryStatus , which implements AutoCloseable . |
Constructor and Description |
---|
RecoveriesCollection(ESLogger logger,
ThreadPool threadPool) |
Modifier and Type | Method and Description |
---|---|
boolean |
cancelRecoveriesForShard(ShardId shardId,
String reason)
cancel all ongoing recoveries for the given shard.
|
boolean |
cancelRecoveriesForShard(ShardId shardId,
String reason,
com.google.common.base.Predicate<RecoveryStatus> shouldCancel)
cancel all ongoing recoveries for the given shard, if their status match a predicate
|
boolean |
cancelRecovery(long id,
String reason)
cancel the recovery with the given id (if found) and remove it from the recovery collection
|
void |
failRecovery(long id,
RecoveryFailedException e,
boolean sendShardFailure)
fail the recovery with the given id (if found) and remove it from the recovery collection
|
RecoveriesCollection.StatusRef |
getStatus(long id)
gets the
RecoveryStatus for a given id. |
RecoveriesCollection.StatusRef |
getStatusSafe(long id,
ShardId shardId)
Similar to
getStatus(long) but throws an exception if no recovery is found |
void |
markRecoveryAsDone(long id)
mark the recovery with the given id as done (if found)
|
int |
size()
the number of ongoing recoveries
|
long |
startRecovery(IndexShard indexShard,
DiscoveryNode sourceNode,
RecoveryTarget.RecoveryListener listener,
TimeValue activityTimeout)
Starts are new recovery for the given shard, source node and state
|
public RecoveriesCollection(ESLogger logger, ThreadPool threadPool)
public long startRecovery(IndexShard indexShard, DiscoveryNode sourceNode, RecoveryTarget.RecoveryListener listener, TimeValue activityTimeout)
public RecoveriesCollection.StatusRef getStatus(long id)
RecoveryStatus
for a given id. The RecoveryStatus returned has it's ref count already incremented
to make sure it's safe to use. However, you must call AbstractRefCounted.decRef()
when you are done with it, typically
by using this method in a try-with-resources clause.
Returns null if recovery is not found
public RecoveriesCollection.StatusRef getStatusSafe(long id, ShardId shardId)
getStatus(long)
but throws an exception if no recovery is foundpublic boolean cancelRecovery(long id, String reason)
public void failRecovery(long id, RecoveryFailedException e, boolean sendShardFailure)
id
- id of the recovery to faile
- exception with reason for the failuresendShardFailure
- true a shard failed message should be sent to the masterpublic void markRecoveryAsDone(long id)
public int size()
public boolean cancelRecoveriesForShard(ShardId shardId, String reason)
public boolean cancelRecoveriesForShard(ShardId shardId, String reason, com.google.common.base.Predicate<RecoveryStatus> shouldCancel)
reason
- reason for cancellationshardId
- shardId for which to cancel recoveriesshouldCancel
- a predicate to check if a recovery should be cancelled or not.
Note that the recovery state can change after this check, but before it is being cancelled via other
already issued outstanding references.Copyright © 2009–2016. All rights reserved.