Search in sources :

Example 1 with COMPLETE

use of org.apache.cassandra.utils.progress.ProgressEventType.COMPLETE in project cassandra by apache.

the class RepairBoundaryTest method singleTokenRangeRepair.

@Test
public void singleTokenRangeRepair() {
    populate();
    verify();
    delete(cluster.get(1), 999, 1000);
    delete(cluster.get(3), 1001);
    cluster.get(2).runOnInstance(() -> {
        try {
            Map<String, String> options = new HashMap<>();
            options.put("ranges", "999:1000");
            options.put("incremental", "false");
            Condition await = newOneTimeCondition();
            instance.repair(KEYSPACE, options, of((tag, event) -> {
                if (event.getType() == COMPLETE)
                    await.signalAll();
            })).right.get();
            await.await(1L, MINUTES);
        } catch (Exception e) {
        }
    });
    assertRows(c2Row(999, 1001, 1999, 2000, 3001), cluster.get(2).executeInternal(ALL));
}
Also used : Condition(org.apache.cassandra.utils.concurrent.Condition) Condition.newOneTimeCondition(org.apache.cassandra.utils.concurrent.Condition.newOneTimeCondition) AfterClass(org.junit.AfterClass) BeforeClass(org.junit.BeforeClass) IOException(java.io.IOException) HashMap(java.util.HashMap) Condition(org.apache.cassandra.utils.concurrent.Condition) Test(org.junit.Test) MINUTES(java.util.concurrent.TimeUnit.MINUTES) ConsistencyLevel(org.apache.cassandra.distributed.api.ConsistencyLevel) LongToken.keyForToken(org.apache.cassandra.dht.Murmur3Partitioner.LongToken.keyForToken) ByteBuffer(java.nio.ByteBuffer) AssertUtils.assertRows(org.apache.cassandra.distributed.shared.AssertUtils.assertRows) IInvokableInstance(org.apache.cassandra.distributed.api.IInvokableInstance) COMPLETE(org.apache.cassandra.utils.progress.ProgressEventType.COMPLETE) Map(java.util.Map) Murmur3Partitioner(org.apache.cassandra.dht.Murmur3Partitioner) Cluster(org.apache.cassandra.distributed.Cluster) Condition.newOneTimeCondition(org.apache.cassandra.utils.concurrent.Condition.newOneTimeCondition) StorageService.instance(org.apache.cassandra.service.StorageService.instance) NETWORK(org.apache.cassandra.distributed.api.Feature.NETWORK) ImmutableList.of(com.google.common.collect.ImmutableList.of) GOSSIP(org.apache.cassandra.distributed.api.Feature.GOSSIP) HashMap(java.util.HashMap) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

ImmutableList.of (com.google.common.collect.ImmutableList.of)1 IOException (java.io.IOException)1 ByteBuffer (java.nio.ByteBuffer)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 MINUTES (java.util.concurrent.TimeUnit.MINUTES)1 Murmur3Partitioner (org.apache.cassandra.dht.Murmur3Partitioner)1 LongToken.keyForToken (org.apache.cassandra.dht.Murmur3Partitioner.LongToken.keyForToken)1 Cluster (org.apache.cassandra.distributed.Cluster)1 ConsistencyLevel (org.apache.cassandra.distributed.api.ConsistencyLevel)1 GOSSIP (org.apache.cassandra.distributed.api.Feature.GOSSIP)1 NETWORK (org.apache.cassandra.distributed.api.Feature.NETWORK)1 IInvokableInstance (org.apache.cassandra.distributed.api.IInvokableInstance)1 AssertUtils.assertRows (org.apache.cassandra.distributed.shared.AssertUtils.assertRows)1 StorageService.instance (org.apache.cassandra.service.StorageService.instance)1 Condition (org.apache.cassandra.utils.concurrent.Condition)1 Condition.newOneTimeCondition (org.apache.cassandra.utils.concurrent.Condition.newOneTimeCondition)1 COMPLETE (org.apache.cassandra.utils.progress.ProgressEventType.COMPLETE)1 AfterClass (org.junit.AfterClass)1 BeforeClass (org.junit.BeforeClass)1