Search in sources :

Example 6 with StreamPlan

use of org.apache.cassandra.streaming.StreamPlan in project cassandra by apache.

the class StreamingRepairTaskTest method incrementalStreamPlan.

@Test
public void incrementalStreamPlan() throws NoSuchRepairSessionException {
    TimeUUID sessionID = registerSession(cfs, true, true);
    ActiveRepairService.ParentRepairSession prs = ActiveRepairService.instance.getParentRepairSession(sessionID);
    RepairJobDesc desc = new RepairJobDesc(sessionID, nextTimeUUID(), 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 : Generator.nextTimeUUID(org.apache.cassandra.utils.TimeUUID.Generator.nextTimeUUID) TimeUUID(org.apache.cassandra.utils.TimeUUID) StreamPlan(org.apache.cassandra.streaming.StreamPlan) ActiveRepairService(org.apache.cassandra.service.ActiveRepairService) SyncRequest(org.apache.cassandra.repair.messages.SyncRequest) Test(org.junit.Test)

Example 7 with StreamPlan

use of org.apache.cassandra.streaming.StreamPlan in project cassandra by apache.

the class StreamingRepairTaskTest method fullStreamPlan.

@Test
public void fullStreamPlan() throws Exception {
    TimeUUID sessionID = registerSession(cfs, false, true);
    ActiveRepairService.ParentRepairSession prs = ActiveRepairService.instance.getParentRepairSession(sessionID);
    RepairJobDesc desc = new RepairJobDesc(sessionID, nextTimeUUID(), 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, null, PreviewKind.NONE, false);
    StreamPlan plan = task.createStreamPlan(request.dst);
    Assert.assertTrue(plan.getFlushBeforeTransfer());
}
Also used : Generator.nextTimeUUID(org.apache.cassandra.utils.TimeUUID.Generator.nextTimeUUID) TimeUUID(org.apache.cassandra.utils.TimeUUID) StreamPlan(org.apache.cassandra.streaming.StreamPlan) ActiveRepairService(org.apache.cassandra.service.ActiveRepairService) SyncRequest(org.apache.cassandra.repair.messages.SyncRequest) Test(org.junit.Test)

Example 8 with StreamPlan

use of org.apache.cassandra.streaming.StreamPlan in project cassandra by apache.

the class LocalSyncTaskTest method transientRemoteStreamPlan.

/**
 * Don't reciprocate streams if the other endpoint is a transient replica
 */
@Test
public void transientRemoteStreamPlan() throws NoSuchRepairSessionException {
    TimeUUID sessionID = registerSession(cfs, true, true);
    ActiveRepairService.ParentRepairSession prs = ActiveRepairService.instance.getParentRepairSession(sessionID);
    RepairJobDesc desc = new RepairJobDesc(sessionID, nextTimeUUID(), KEYSPACE1, CF_STANDARD, prs.getRanges());
    TreeResponse r1 = new TreeResponse(local, createInitialTree(desc, DatabaseDescriptor.getPartitioner()));
    TreeResponse r2 = new TreeResponse(PARTICIPANT2, createInitialTree(desc, DatabaseDescriptor.getPartitioner()));
    LocalSyncTask task = new LocalSyncTask(desc, r1.endpoint, r2.endpoint, MerkleTrees.difference(r1.trees, r2.trees), desc.parentSessionId, true, false, PreviewKind.NONE);
    StreamPlan plan = task.createStreamPlan();
    assertNumInOut(plan, 1, 0);
}
Also used : Generator.nextTimeUUID(org.apache.cassandra.utils.TimeUUID.Generator.nextTimeUUID) TimeUUID(org.apache.cassandra.utils.TimeUUID) StreamPlan(org.apache.cassandra.streaming.StreamPlan) ActiveRepairService(org.apache.cassandra.service.ActiveRepairService) Test(org.junit.Test)

Example 9 with StreamPlan

use of org.apache.cassandra.streaming.StreamPlan in project cassandra by apache.

the class LocalSyncTaskTest method fullRepairStreamPlan.

@Test
public void fullRepairStreamPlan() throws Exception {
    TimeUUID sessionID = registerSession(cfs, true, true);
    ActiveRepairService.ParentRepairSession prs = ActiveRepairService.instance.getParentRepairSession(sessionID);
    RepairJobDesc desc = new RepairJobDesc(sessionID, nextTimeUUID(), KEYSPACE1, CF_STANDARD, prs.getRanges());
    TreeResponse r1 = new TreeResponse(local, createInitialTree(desc, DatabaseDescriptor.getPartitioner()));
    TreeResponse r2 = new TreeResponse(PARTICIPANT2, createInitialTree(desc, DatabaseDescriptor.getPartitioner()));
    LocalSyncTask task = new LocalSyncTask(desc, r1.endpoint, r2.endpoint, MerkleTrees.difference(r1.trees, r2.trees), NO_PENDING_REPAIR, true, true, PreviewKind.NONE);
    StreamPlan plan = task.createStreamPlan();
    assertEquals(NO_PENDING_REPAIR, plan.getPendingRepair());
    assertTrue(plan.getFlushBeforeTransfer());
}
Also used : Generator.nextTimeUUID(org.apache.cassandra.utils.TimeUUID.Generator.nextTimeUUID) TimeUUID(org.apache.cassandra.utils.TimeUUID) StreamPlan(org.apache.cassandra.streaming.StreamPlan) ActiveRepairService(org.apache.cassandra.service.ActiveRepairService) Test(org.junit.Test)

Aggregations

StreamPlan (org.apache.cassandra.streaming.StreamPlan)9 ActiveRepairService (org.apache.cassandra.service.ActiveRepairService)7 TimeUUID (org.apache.cassandra.utils.TimeUUID)6 Generator.nextTimeUUID (org.apache.cassandra.utils.TimeUUID.Generator.nextTimeUUID)6 Test (org.junit.Test)6 SyncRequest (org.apache.cassandra.repair.messages.SyncRequest)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 InetAddress (java.net.InetAddress)1 ArrayList (java.util.ArrayList)1 CassandraOutgoingFile (org.apache.cassandra.db.streaming.CassandraOutgoingFile)1 IPartitioner (org.apache.cassandra.dht.IPartitioner)1 Range (org.apache.cassandra.dht.Range)1 SSTableReader (org.apache.cassandra.io.sstable.format.SSTableReader)1 InetAddressAndPort (org.apache.cassandra.locator.InetAddressAndPort)1 OutgoingStream (org.apache.cassandra.streaming.OutgoingStream)1