use of org.apache.cassandra.repair.RepairJobDesc 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.RepairJobDesc in project cassandra by apache.
the class CompactionManagerGetSSTablesForValidationTest method registerRepair.
private void registerRepair(boolean incremental) throws Exception {
sessionID = UUIDGen.getTimeUUID();
Range<Token> range = new Range<>(MT, MT);
ActiveRepairService.instance.registerParentRepairSession(sessionID, coordinator, Lists.newArrayList(cfs), Sets.newHashSet(range), incremental, incremental ? System.currentTimeMillis() : ActiveRepairService.UNREPAIRED_SSTABLE, true);
desc = new RepairJobDesc(sessionID, UUIDGen.getTimeUUID(), ks, tbl, Collections.singleton(range));
}
use of org.apache.cassandra.repair.RepairJobDesc in project cassandra by apache.
the class SerializationsTest method defineSchema.
@BeforeClass
public static void defineSchema() throws Exception {
DatabaseDescriptor.daemonInitialization();
partitionerSwitcher = Util.switchPartitioner(RandomPartitioner.instance);
RANDOM_UUID = UUID.fromString("b5c3d033-75aa-4c2f-a819-947aac7a0c54");
FULL_RANGE = new Range<>(Util.testPartitioner().getMinimumToken(), Util.testPartitioner().getMinimumToken());
DESC = new RepairJobDesc(RANDOM_UUID, RANDOM_UUID, "Keyspace1", "Standard1", Arrays.asList(FULL_RANGE));
}
use of org.apache.cassandra.repair.RepairJobDesc in project cassandra by apache.
the class LeveledCompactionStrategyTest method testValidationMultipleSSTablePerLevel.
/*
* This exercises in particular the code of #4142
*/
@Test
public void testValidationMultipleSSTablePerLevel() throws Exception {
byte[] b = new byte[100 * 1024];
new Random().nextBytes(b);
// 100 KiB value, make it easy to have multiple files
ByteBuffer value = ByteBuffer.wrap(b);
// Enough data to have a level 1 and 2
int rows = 40;
int columns = 20;
// Adds enough data to trigger multiple sstable per level
for (int r = 0; r < rows; r++) {
UpdateBuilder update = UpdateBuilder.create(cfs.metadata(), String.valueOf(r));
for (int c = 0; c < columns; c++) update.newRow("column" + c).add("val", value);
update.applyUnsafe();
cfs.forceBlockingFlush();
}
waitForLeveling(cfs);
CompactionStrategyManager strategyManager = cfs.getCompactionStrategyManager();
// Checking we're not completely bad at math
assertTrue(strategyManager.getSSTableCountPerLevel()[1] > 0);
assertTrue(strategyManager.getSSTableCountPerLevel()[2] > 0);
Range<Token> range = new Range<>(Util.token(""), Util.token(""));
int gcBefore = keyspace.getColumnFamilyStore(CF_STANDARDDLEVELED).gcBefore(FBUtilities.nowInSeconds());
UUID parentRepSession = UUID.randomUUID();
ActiveRepairService.instance.registerParentRepairSession(parentRepSession, FBUtilities.getBroadcastAddressAndPort(), Arrays.asList(cfs), Arrays.asList(range), false, ActiveRepairService.UNREPAIRED_SSTABLE, true, PreviewKind.NONE);
RepairJobDesc desc = new RepairJobDesc(parentRepSession, UUID.randomUUID(), KEYSPACE1, CF_STANDARDDLEVELED, Arrays.asList(range));
Validator validator = new Validator(desc, FBUtilities.getBroadcastAddressAndPort(), gcBefore, PreviewKind.NONE);
ValidationManager.instance.submitValidation(cfs, validator).get();
}
use of org.apache.cassandra.repair.RepairJobDesc in project cassandra by apache.
the class ActiveRepairService method handleMessage.
public void handleMessage(Message<? extends RepairMessage> message) {
RepairMessage payload = message.payload;
RepairJobDesc desc = payload.desc;
RepairSession session = sessions.get(desc.sessionId);
if (session == null) {
if (payload instanceof ValidationResponse) {
// The trees may be off-heap, and will therefore need to be released.
ValidationResponse validation = (ValidationResponse) payload;
MerkleTrees trees = validation.trees;
// The response from a failed validation won't have any trees.
if (trees != null)
trees.release();
}
return;
}
switch(message.verb()) {
case VALIDATION_RSP:
ValidationResponse validation = (ValidationResponse) payload;
session.validationComplete(desc, message.from(), validation.trees);
break;
case SYNC_RSP:
// one of replica is synced.
SyncResponse sync = (SyncResponse) payload;
session.syncComplete(desc, sync.nodes, sync.success, sync.summaries);
break;
default:
break;
}
}
Aggregations