use of org.apache.cassandra.distributed.api.NodeToolResult in project cassandra by apache.
the class RepairCoordinatorFast method onlyCoordinator.
@Test
public void onlyCoordinator() {
// this is very similar to ::desiredHostNotCoordinator but has the difference that the only host to do repair
// is the coordinator
String table = tableName("onlycoordinator");
assertTimeoutPreemptively(Duration.ofMinutes(1), () -> {
CLUSTER.schemaChange(format("CREATE TABLE %s.%s (key text, value text, PRIMARY KEY (key))", KEYSPACE, table));
long repairExceptions = getRepairExceptions(CLUSTER, 2);
NodeToolResult result = repair(1, KEYSPACE, table, "--in-hosts", "localhost");
result.asserts().failure().errorContains("Specified hosts [localhost] do not share range");
if (withNotifications) {
result.asserts().notificationContains(ProgressEventType.START, "Starting repair command").notificationContains(ProgressEventType.START, "repairing keyspace " + KEYSPACE + " with repair options").notificationContains(ProgressEventType.ERROR, "Specified hosts [localhost] do not share range").notificationContains(ProgressEventType.COMPLETE, "finished with error");
}
assertParentRepairNotExist(CLUSTER, KEYSPACE, table);
// TODO should this be marked as fail to match others? Should they not be marked?
Assert.assertEquals(repairExceptions, getRepairExceptions(CLUSTER, 2));
});
}
use of org.apache.cassandra.distributed.api.NodeToolResult in project cassandra by apache.
the class RepairCoordinatorFast method desiredHostNotCoordinator.
@Test
public void desiredHostNotCoordinator() {
// current limitation is that the coordinator must be apart of the repair, so as long as that exists this test
// verifies that the validation logic will termniate the repair properly
String table = tableName("desiredhostnotcoordinator");
assertTimeoutPreemptively(Duration.ofMinutes(1), () -> {
CLUSTER.schemaChange(format("CREATE TABLE %s.%s (key text, value text, PRIMARY KEY (key))", KEYSPACE, table));
long repairExceptions = getRepairExceptions(CLUSTER, 2);
NodeToolResult result = repair(2, KEYSPACE, table, "--in-hosts", "localhost");
result.asserts().failure().errorContains("The current host must be part of the repair");
if (withNotifications) {
result.asserts().notificationContains(ProgressEventType.START, "Starting repair command").notificationContains(ProgressEventType.START, "repairing keyspace " + KEYSPACE + " with repair options").notificationContains(ProgressEventType.ERROR, "The current host must be part of the repair").notificationContains(ProgressEventType.COMPLETE, "finished with error");
}
assertParentRepairNotExist(CLUSTER, KEYSPACE, table);
Assert.assertEquals(repairExceptions + 1, getRepairExceptions(CLUSTER, 2));
});
}
use of org.apache.cassandra.distributed.api.NodeToolResult in project cassandra by apache.
the class RepairCoordinatorFast method prepareFailure.
@Test
public void prepareFailure() {
String table = tableName("preparefailure");
assertTimeoutPreemptively(Duration.ofMinutes(1), () -> {
CLUSTER.schemaChange(format("CREATE TABLE %s.%s (key text, value text, PRIMARY KEY (key))", KEYSPACE, table));
IMessageFilters.Filter filter = CLUSTER.verbs(Verb.PREPARE_MSG).messagesMatching(of(m -> {
throw new RuntimeException("prepare fail");
})).drop();
try {
long repairExceptions = getRepairExceptions(CLUSTER, 1);
NodeToolResult result = repair(1, KEYSPACE, table);
result.asserts().failure().errorContains("Got negative replies from endpoints");
if (withNotifications) {
result.asserts().notificationContains(ProgressEventType.START, "Starting repair command").notificationContains(ProgressEventType.START, "repairing keyspace " + KEYSPACE + " with repair options").notificationContains(ProgressEventType.ERROR, "Got negative replies from endpoints").notificationContains(ProgressEventType.COMPLETE, "finished with error");
}
Assert.assertEquals(repairExceptions + 1, getRepairExceptions(CLUSTER, 1));
if (repairType != RepairType.PREVIEW) {
assertParentRepairFailedWithMessageContains(CLUSTER, KEYSPACE, table, "Got negative replies from endpoints");
} else {
assertParentRepairNotExist(CLUSTER, KEYSPACE, table);
}
} finally {
filter.off();
}
});
}
use of org.apache.cassandra.distributed.api.NodeToolResult in project cassandra by apache.
the class ClusterUtils method gossipInfo.
/**
* Get the gossip information from the node. Currently only address, generation, and heartbeat are returned
*
* @param inst to check on
* @return gossip info
*/
public static Map<String, Map<String, String>> gossipInfo(IInstance inst) {
NodeToolResult results = inst.nodetoolResult("gossipinfo");
results.asserts().success();
return parseGossipInfo(results.getStdout());
}
Aggregations