Search in sources :

Example 1 with SyncRequest

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);
}
Also used : InetAddressAndPort(org.apache.cassandra.locator.InetAddressAndPort) SyncRequest(org.apache.cassandra.repair.messages.SyncRequest)

Example 2 with SyncRequest

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);
}
Also used : SyncRequest(org.apache.cassandra.repair.messages.SyncRequest) InetAddress(java.net.InetAddress)

Example 3 with SyncRequest

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);
}
Also used : InetAddressAndPort(org.apache.cassandra.locator.InetAddressAndPort) SyncRequest(org.apache.cassandra.repair.messages.SyncRequest)

Example 4 with SyncRequest

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;
    });
}
Also used : RepairMessage(org.apache.cassandra.repair.messages.RepairMessage) SyncRequest(org.apache.cassandra.repair.messages.SyncRequest)

Example 5 with SyncRequest

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());
}
Also used : StreamPlan(org.apache.cassandra.streaming.StreamPlan) ActiveRepairService(org.apache.cassandra.service.ActiveRepairService) SyncRequest(org.apache.cassandra.repair.messages.SyncRequest) UUID(java.util.UUID) Test(org.junit.Test)

Aggregations

SyncRequest (org.apache.cassandra.repair.messages.SyncRequest)6 UUID (java.util.UUID)2 InetAddressAndPort (org.apache.cassandra.locator.InetAddressAndPort)2 ActiveRepairService (org.apache.cassandra.service.ActiveRepairService)2 StreamPlan (org.apache.cassandra.streaming.StreamPlan)2 Test (org.junit.Test)2 InetAddress (java.net.InetAddress)1 RepairMessage (org.apache.cassandra.repair.messages.RepairMessage)1