use of org.apache.cassandra.distributed.api.QueryResult in project cassandra by apache.
the class DistributedRepairUtils method assertParentRepairNotExist.
public static void assertParentRepairNotExist(ICluster<IInvokableInstance> cluster, int coordinator, String ks, String table) {
QueryResult rs = queryParentRepairHistory(cluster, coordinator, ks, table);
Assert.assertFalse("No repairs should be found but at least one found", rs.hasNext());
}
use of org.apache.cassandra.distributed.api.QueryResult in project cassandra by apache.
the class TableEstimatesTest method refreshSizeEstimatesClearsInvalidEntries.
/**
* Replaces Python Dtest: nodetool_test.py#test_refresh_size_estimates_clears_invalid_entries
*/
@Test
public void refreshSizeEstimatesClearsInvalidEntries() {
String size_estimatesInsert = "INSERT INTO system.size_estimates (keyspace_name, table_name, range_start, range_end, mean_partition_size, partitions_count) VALUES (?, ?, ?, ?, ?, ?)";
IInstance node = CLUSTER.get(1);
node.executeInternal(size_estimatesInsert, "system_auth", "bad_table", "-5", "5", 0L, 0L);
node.executeInternal(size_estimatesInsert, "bad_keyspace", "bad_table", "-5", "5", 0L, 0L);
node.nodetoolResult("refreshsizeestimates").asserts().success();
QueryResult qr = CLUSTER.coordinator(1).executeWithResult("SELECT * FROM system.size_estimates WHERE keyspace_name=? AND table_name=?", ConsistencyLevel.ONE, "system_auth", "bad_table");
Assertions.assertThat(qr).isExhausted();
qr = CLUSTER.coordinator(1).executeWithResult("SELECT * FROM system.size_estimates WHERE keyspace_name=?", ConsistencyLevel.ONE, "bad_keyspace");
Assertions.assertThat(qr).isExhausted();
}
use of org.apache.cassandra.distributed.api.QueryResult in project cassandra by apache.
the class TableEstimatesTest method refreshTableEstimatesClearsInvalidEntries.
/**
* Replaces Python Dtest: nodetool_test.py#test_refresh_size_estimates_clears_invalid_entries
*/
@Test
public void refreshTableEstimatesClearsInvalidEntries() {
String table_estimatesInsert = "INSERT INTO system.table_estimates (keyspace_name, table_name, range_type, range_start, range_end, mean_partition_size, partitions_count) VALUES (?, ?, ?, ?, ?, ?, ?)";
IInstance node = CLUSTER.get(1);
try {
node.executeInternal(table_estimatesInsert, "system_auth", "bad_table", "local_primary", "-5", "5", 0L, 0L);
node.executeInternal(table_estimatesInsert, "bad_keyspace", "bad_table", "local_primary", "-5", "5", 0L, 0L);
} catch (Exception e) {
// to make this test portable (with the intent to extract out), handle the case where the table_estimates isn't defined
Assertions.assertThat(e.getClass().getCanonicalName()).isEqualTo("org.apache.cassandra.exceptions.InvalidRequestException");
Assertions.assertThat(e).hasMessageContaining("does not exist");
Assume.assumeTrue("system.table_estimates not present", false);
}
node.nodetoolResult("refreshsizeestimates").asserts().success();
QueryResult qr = CLUSTER.coordinator(1).executeWithResult("SELECT * FROM system.table_estimates WHERE keyspace_name=? AND table_name=?", ConsistencyLevel.ONE, "system_auth", "bad_table");
Assertions.assertThat(qr).isExhausted();
qr = CLUSTER.coordinator(1).executeWithResult("SELECT * FROM system.table_estimates WHERE keyspace_name=?", ConsistencyLevel.ONE, "bad_keyspace");
Assertions.assertThat(qr).isExhausted();
}
use of org.apache.cassandra.distributed.api.QueryResult in project cassandra by apache.
the class DistributedRepairUtils method assertParentRepairFailedWithMessageContains.
public static void assertParentRepairFailedWithMessageContains(ICluster<IInvokableInstance> cluster, int coordinator, String ks, String table, String message) {
QueryResult rs = queryParentRepairHistory(cluster, coordinator, ks, table);
validateExistingParentRepair(rs, row -> {
// check completed
Assert.assertNotNull("finished_at not found, the repair is not complete?", row.getTimestamp("finished_at"));
// check failed
Assert.assertNotNull("Exception not found", row.getString("exception_stacktrace"));
String exceptionMessage = row.getString("exception_message");
Assert.assertNotNull("Exception not found", exceptionMessage);
Assert.assertTrue("Unable to locate message '" + message + "' in repair error message: " + exceptionMessage, exceptionMessage.contains(message));
});
}
use of org.apache.cassandra.distributed.api.QueryResult in project cassandra by apache.
the class DistributedRepairUtils method assertParentRepairSuccess.
public static void assertParentRepairSuccess(ICluster<IInvokableInstance> cluster, int coordinator, String ks, String table, Consumer<Row> moreSuccessCriteria) {
Assert.assertNotNull("Invalid null value for moreSuccessCriteria", moreSuccessCriteria);
QueryResult rs = queryParentRepairHistory(cluster, coordinator, ks, table);
validateExistingParentRepair(rs, row -> {
// check completed
Assert.assertNotNull("finished_at not found, the repair is not complete?", row.getTimestamp("finished_at"));
// check not failed (aka success)
Assert.assertNull("Exception found", row.getString("exception_stacktrace"));
Assert.assertNull("Exception found", row.getString("exception_message"));
moreSuccessCriteria.accept(row);
});
}
Aggregations