use of org.apache.cassandra.repair.messages.SyncRequest in project cassandra by apache.
the class AsymmetricRemoteSyncTask method startSync.
public void startSync() {
InetAddressAndPort local = FBUtilities.getBroadcastAddressAndPort();
SyncRequest request = new SyncRequest(desc, local, nodePair.coordinator, nodePair.peer, rangesToSync, previewKind, true);
String message = String.format("Forwarding streaming repair of %d ranges to %s (to be streamed with %s)", request.ranges.size(), request.src, request.dst);
Tracing.traceRepair(message);
MessagingService.instance().send(Message.out(SYNC_REQ, request), request.src);
}
use of org.apache.cassandra.repair.messages.SyncRequest in project cassandra by apache.
the class RemoteSyncTask method startSync.
protected void startSync(List<Range<Token>> differences) {
InetAddress local = FBUtilities.getBroadcastAddress();
SyncRequest request = new SyncRequest(desc, local, r1.endpoint, r2.endpoint, differences);
String message = String.format("Forwarding streaming repair of %d ranges to %s (to be streamed with %s)", request.ranges.size(), request.src, request.dst);
logger.info("[repair #{}] {}", desc.sessionId, message);
Tracing.traceRepair(message);
MessagingService.instance().sendOneWay(request.createMessage(), request.src);
}
use of org.apache.cassandra.repair.messages.SyncRequest in project cassandra by apache.
the class SymmetricRemoteSyncTask method startSync.
@Override
protected void startSync() {
InetAddressAndPort local = FBUtilities.getBroadcastAddressAndPort();
SyncRequest request = new SyncRequest(desc, local, nodePair.coordinator, nodePair.peer, rangesToSync, previewKind, false);
Preconditions.checkArgument(nodePair.coordinator.equals(request.src));
String message = String.format("Forwarding streaming repair of %d ranges to %s (to be streamed with %s)", request.ranges.size(), request.src, request.dst);
logger.info("{} {}", previewKind.logPrefix(desc.sessionId), message);
Tracing.traceRepair(message);
sendRequest(request, request.src);
}
use of org.apache.cassandra.repair.messages.SyncRequest in project cassandra by apache.
the class RepairJobTest method interceptRepairMessages.
private void interceptRepairMessages(Map<InetAddressAndPort, MerkleTrees> mockTrees, List<Message<?>> messageCapture) {
MessagingService.instance().inboundSink.add(message -> message.verb().isResponse());
MessagingService.instance().outboundSink.add((message, to) -> {
if (message == null || !(message.payload instanceof RepairMessage))
return false;
// So different Thread's messages don't overwrite each other.
synchronized (MESSAGE_LOCK) {
messageCapture.add(message);
}
switch(message.verb()) {
case SNAPSHOT_MSG:
MessagingService.instance().callbacks.removeAndRespond(message.id(), to, message.emptyResponse());
break;
case VALIDATION_REQ:
session.validationComplete(sessionJobDesc, to, mockTrees.get(to));
break;
case SYNC_REQ:
SyncRequest syncRequest = (SyncRequest) message.payload;
session.syncComplete(sessionJobDesc, new SyncNodePair(syncRequest.src, syncRequest.dst), true, Collections.emptyList());
break;
default:
break;
}
return false;
});
}
use of org.apache.cassandra.repair.messages.SyncRequest in project cassandra by apache.
the class StreamingRepairTaskTest method incrementalStreamPlan.
@Test
public void incrementalStreamPlan() throws NoSuchRepairSessionException {
UUID sessionID = registerSession(cfs, true, true);
ActiveRepairService.ParentRepairSession prs = ActiveRepairService.instance.getParentRepairSession(sessionID);
RepairJobDesc desc = new RepairJobDesc(sessionID, UUIDGen.getTimeUUID(), ks, tbl, prs.getRanges());
SyncRequest request = new SyncRequest(desc, PARTICIPANT1, PARTICIPANT2, PARTICIPANT3, prs.getRanges(), PreviewKind.NONE, false);
StreamingRepairTask task = new StreamingRepairTask(desc, request.initiator, request.src, request.dst, request.ranges, desc.sessionId, PreviewKind.NONE, false);
StreamPlan plan = task.createStreamPlan(request.dst);
Assert.assertFalse(plan.getFlushBeforeTransfer());
}
Aggregations