Search in sources :

Example 6 with QueryResult

use of org.apache.cassandra.distributed.api.QueryResult 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;
}
Also used : QueryResult(org.apache.cassandra.distributed.api.QueryResult) StorageMetrics(org.apache.cassandra.metrics.StorageMetrics) ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) ICluster(org.apache.cassandra.distributed.api.ICluster) ArrayUtils(org.apache.commons.lang3.ArrayUtils) ConsistencyLevel(org.apache.cassandra.distributed.api.ConsistencyLevel) Consumer(java.util.function.Consumer) Row(org.apache.cassandra.distributed.api.Row) IInvokableInstance(org.apache.cassandra.distributed.api.IInvokableInstance) Assert(org.junit.Assert) Retry.retryWithBackoffBlocking(org.apache.cassandra.utils.Retry.retryWithBackoffBlocking) Collections(java.util.Collections) AbstractCluster(org.apache.cassandra.distributed.impl.AbstractCluster) NodeToolResult(org.apache.cassandra.distributed.api.NodeToolResult) QueryResult(org.apache.cassandra.distributed.api.QueryResult)

Aggregations

QueryResult (org.apache.cassandra.distributed.api.QueryResult)6 IInstance (org.apache.cassandra.distributed.api.IInstance)2 Test (org.junit.Test)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 IOException (java.io.IOException)1 Collections (java.util.Collections)1 Set (java.util.Set)1 Consumer (java.util.function.Consumer)1 ConsistencyLevel (org.apache.cassandra.distributed.api.ConsistencyLevel)1 ICluster (org.apache.cassandra.distributed.api.ICluster)1 IInvokableInstance (org.apache.cassandra.distributed.api.IInvokableInstance)1 NodeToolResult (org.apache.cassandra.distributed.api.NodeToolResult)1 Row (org.apache.cassandra.distributed.api.Row)1 AbstractCluster (org.apache.cassandra.distributed.impl.AbstractCluster)1 StorageMetrics (org.apache.cassandra.metrics.StorageMetrics)1 Retry.retryWithBackoffBlocking (org.apache.cassandra.utils.Retry.retryWithBackoffBlocking)1 ArrayUtils (org.apache.commons.lang3.ArrayUtils)1 Assert (org.junit.Assert)1