use of org.apache.cassandra.distributed.api.Row in project cassandra by apache.
the class DistributedRepairUtils method validateExistingParentRepair.
private static void validateExistingParentRepair(QueryResult rs, Consumer<Row> fn) {
Assert.assertTrue("No rows found", rs.hasNext());
Row row = rs.next();
Assert.assertNotNull("parent_id (which is the primary key) was null", row.getUUID("parent_id"));
fn.accept(row);
// make sure no other records found
Assert.assertFalse("Only one repair expected, but found more than one", rs.hasNext());
}
use of org.apache.cassandra.distributed.api.Row in project cassandra by apache.
the class DistributedRepairUtils method queryParentRepairHistory.
public static QueryResult queryParentRepairHistory(ICluster<IInvokableInstance> cluster, int coordinator, String ks, String table) {
// This is kinda brittle since the caller never gets the ID and can't ask for the ID; it needs to infer the id
// this logic makes the assumption the ks/table pairs are unique (should be or else create should fail) so any
// repair for that pair will be the repair id
Set<String> tableNames = table == null ? Collections.emptySet() : ImmutableSet.of(table);
QueryResult rs = retryWithBackoffBlocking(10, () -> cluster.coordinator(coordinator).executeWithResult("SELECT * FROM system_distributed.parent_repair_history", ConsistencyLevel.QUORUM).filter(row -> ks.equals(row.getString("keyspace_name"))).filter(row -> tableNames.equals(row.getSet("columnfamily_names"))));
return rs;
}
Aggregations