Search in sources :

Example 51 with Status

use of org.apache.accumulo.server.replication.proto.Replication.Status in project accumulo by apache.

the class StatusCombinerTest method commutativeWithMultipleUpdatesSingleBuilder.

@Test
public void commutativeWithMultipleUpdatesSingleBuilder() {
    Status newFile = StatusUtil.fileCreated(100), update1 = StatusUtil.ingestedUntil(builder, 100), update2 = StatusUtil.ingestedUntil(builder, 200), repl1 = StatusUtil.replicated(builder, 50), repl2 = StatusUtil.replicated(builder, 150);
    Status order1 = combiner.typedReduce(key, Arrays.asList(newFile, update1, repl1, update2, repl2).iterator());
    // Got all replication updates before ingest updates
    Status permutation = combiner.typedReduce(key, Arrays.asList(newFile, repl1, update1, repl2, update2).iterator());
    Assert.assertEquals(order1, permutation);
    // All replications before updates
    permutation = combiner.typedReduce(key, Arrays.asList(newFile, repl1, repl2, update1, update2).iterator());
    Assert.assertEquals(order1, permutation);
    // All updates before replications
    permutation = combiner.typedReduce(key, Arrays.asList(newFile, update1, update2, repl1, repl2).iterator());
    Assert.assertEquals(order1, permutation);
}
Also used : Status(org.apache.accumulo.server.replication.proto.Replication.Status) Test(org.junit.Test)

Example 52 with Status

use of org.apache.accumulo.server.replication.proto.Replication.Status in project accumulo by apache.

the class StatusCombinerTest method testCombination.

@Test
public void testCombination() {
    List<Status> status = new ArrayList<>();
    long time = System.currentTimeMillis();
    status.add(StatusUtil.fileCreated(time));
    status.add(StatusUtil.openWithUnknownLength());
    status.add(StatusUtil.fileClosed());
    Status combined = combiner.typedReduce(new Key("row"), status.iterator());
    Assert.assertEquals(time, combined.getCreatedTime());
    Assert.assertTrue(combined.getInfiniteEnd());
    Assert.assertTrue(combined.getClosed());
}
Also used : Status(org.apache.accumulo.server.replication.proto.Replication.Status) ArrayList(java.util.ArrayList) Key(org.apache.accumulo.core.data.Key) Test(org.junit.Test)

Example 53 with Status

use of org.apache.accumulo.server.replication.proto.Replication.Status in project accumulo by apache.

the class StatusCombinerTest method returnsSameObject.

@Test
public void returnsSameObject() {
    Status status = StatusUtil.ingestedUntil(10);
    // When combining only one message, we should get back the same instance
    Status ret = combiner.typedReduce(key, Collections.singleton(status).iterator());
    Assert.assertEquals(status, ret);
    Assert.assertTrue(status == ret);
}
Also used : Status(org.apache.accumulo.server.replication.proto.Replication.Status) Test(org.junit.Test)

Example 54 with Status

use of org.apache.accumulo.server.replication.proto.Replication.Status in project accumulo by apache.

the class StatusCombinerTest method commutativeNewUpdates.

@Test
public void commutativeNewUpdates() {
    Status newFile = StatusUtil.fileCreated(100), firstSync = StatusUtil.ingestedUntil(100), secondSync = StatusUtil.ingestedUntil(200);
    Status order1 = combiner.typedReduce(key, Arrays.asList(newFile, firstSync, secondSync).iterator()), order2 = combiner.typedReduce(key, Arrays.asList(newFile, secondSync, firstSync).iterator());
    Assert.assertEquals(order1, order2);
}
Also used : Status(org.apache.accumulo.server.replication.proto.Replication.Status) Test(org.junit.Test)

Example 55 with Status

use of org.apache.accumulo.server.replication.proto.Replication.Status in project accumulo by apache.

the class StatusCombinerTest method commutativeWithCloseSingleBuilder.

@Test
public void commutativeWithCloseSingleBuilder() {
    Status newFile = StatusUtil.fileCreated(100), closed = StatusUtil.fileClosed(), secondSync = StatusUtil.ingestedUntil(builder, 200);
    Status order1 = combiner.typedReduce(key, Arrays.asList(newFile, closed, secondSync).iterator()), order2 = combiner.typedReduce(key, Arrays.asList(newFile, secondSync, closed).iterator());
    Assert.assertEquals(order1, order2);
}
Also used : Status(org.apache.accumulo.server.replication.proto.Replication.Status) Test(org.junit.Test)

Aggregations

Status (org.apache.accumulo.server.replication.proto.Replication.Status)77 Test (org.junit.Test)57 Mutation (org.apache.accumulo.core.data.Mutation)30 Text (org.apache.hadoop.io.Text)29 BatchWriter (org.apache.accumulo.core.client.BatchWriter)28 Key (org.apache.accumulo.core.data.Key)27 Value (org.apache.accumulo.core.data.Value)26 Scanner (org.apache.accumulo.core.client.Scanner)21 ReplicationTarget (org.apache.accumulo.core.replication.ReplicationTarget)20 Path (org.apache.hadoop.fs.Path)17 HashMap (java.util.HashMap)14 BatchWriterConfig (org.apache.accumulo.core.client.BatchWriterConfig)14 Table (org.apache.accumulo.core.client.impl.Table)14 ReplicationTable (org.apache.accumulo.core.replication.ReplicationTable)13 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)12 AccumuloException (org.apache.accumulo.core.client.AccumuloException)11 Connector (org.apache.accumulo.core.client.Connector)11 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)10 TableNotFoundException (org.apache.accumulo.core.client.TableNotFoundException)10 DataInputStream (java.io.DataInputStream)9