use of org.apache.cassandra.repair.RepairSession in project cassandra by apache.
the class ActiveRepairService method submitRepairSession.
/**
* Requests repairs for the given keyspace and column families.
*
* @return Future for asynchronous call or null if there is no need to repair
*/
public RepairSession submitRepairSession(UUID parentRepairSession, Collection<Range<Token>> range, String keyspace, RepairParallelism parallelismDegree, Set<InetAddress> endpoints, long repairedAt, boolean isConsistent, boolean pullRepair, ListeningExecutorService executor, String... cfnames) {
if (endpoints.isEmpty())
return null;
if (cfnames.length == 0)
return null;
final RepairSession session = new RepairSession(parentRepairSession, UUIDGen.getTimeUUID(), range, keyspace, parallelismDegree, endpoints, repairedAt, isConsistent, pullRepair, cfnames);
sessions.put(session.getId(), session);
// register listeners
registerOnFdAndGossip(session);
// remove session at completion
session.addListener(new Runnable() {
/**
* When repair finished, do clean up
*/
public void run() {
sessions.remove(session.getId());
}
}, MoreExecutors.directExecutor());
session.start(executor);
return session;
}
use of org.apache.cassandra.repair.RepairSession in project cassandra by apache.
the class ActiveRepairService method handleMessage.
public void handleMessage(InetAddress endpoint, RepairMessage message) {
RepairJobDesc desc = message.desc;
RepairSession session = sessions.get(desc.sessionId);
if (session == null)
return;
switch(message.messageType) {
case VALIDATION_COMPLETE:
ValidationComplete validation = (ValidationComplete) message;
session.validationComplete(desc, endpoint, validation.trees);
break;
case SYNC_COMPLETE:
// one of replica is synced.
SyncComplete sync = (SyncComplete) message;
session.syncComplete(desc, sync.nodes, sync.success);
break;
default:
break;
}
}
use of org.apache.cassandra.repair.RepairSession in project cassandra by apache.
the class ActiveRepairService method terminateSessions.
public synchronized void terminateSessions() {
Throwable cause = new IOException("Terminate session is called");
for (RepairSession session : sessions.values()) {
session.forceShutdown(cause);
}
parentRepairSessions.clear();
}
Aggregations