Search in sources :

Example 16 with Status

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

the class StatusCombinerTest method fileClosedTimePropagated.

@Test
public void fileClosedTimePropagated() {
    Status stat1 = Status.newBuilder().setBegin(10).setEnd(20).setClosed(true).setInfiniteEnd(false).setCreatedTime(50).build();
    Status stat2 = Status.newBuilder().setBegin(10).setEnd(20).setClosed(true).setInfiniteEnd(false).build();
    Status combined = combiner.typedReduce(key, Arrays.asList(stat1, stat2).iterator());
    Assert.assertEquals(stat1, combined);
}
Also used : Status(org.apache.accumulo.server.replication.proto.Replication.Status) Test(org.junit.Test)

Example 17 with Status

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

the class StatusCombinerTest method commutativeNewFileSingleBuilder.

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

Example 18 with Status

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

the class StatusCombinerTest method newStatusWithNewIngest.

@Test
public void newStatusWithNewIngest() {
    Status orig = StatusUtil.fileCreated(100);
    Status status = StatusUtil.replicatedAndIngested(10, 20);
    Status ret = combiner.typedReduce(key, Arrays.asList(orig, status).iterator());
    Assert.assertEquals(10l, ret.getBegin());
    Assert.assertEquals(20l, ret.getEnd());
    Assert.assertEquals(100l, ret.getCreatedTime());
    Assert.assertEquals(false, ret.getClosed());
}
Also used : Status(org.apache.accumulo.server.replication.proto.Replication.Status) Test(org.junit.Test)

Example 19 with Status

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

the class StatusCombinerTest method fileClosedTimeChoosesEarliestIgnoringDefault.

@Test
public void fileClosedTimeChoosesEarliestIgnoringDefault() {
    Status stat1 = Status.newBuilder().setBegin(10).setEnd(20).setClosed(true).setInfiniteEnd(false).setCreatedTime(50).build();
    Status stat2 = Status.newBuilder().setBegin(10).setEnd(20).setClosed(true).setInfiniteEnd(false).setCreatedTime(100).build();
    Status combined = combiner.typedReduce(key, Arrays.asList(stat1, stat2).iterator());
    Assert.assertEquals(stat1, combined);
    Status stat3 = Status.newBuilder().setBegin(10).setEnd(20).setClosed(true).setInfiniteEnd(false).setCreatedTime(100).build();
    Status combined2 = combiner.typedReduce(key, Arrays.asList(combined, stat3).iterator());
    Assert.assertEquals(combined, combined2);
}
Also used : Status(org.apache.accumulo.server.replication.proto.Replication.Status) Test(org.junit.Test)

Example 20 with Status

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

the class StatusCombinerTest method commutativeNewFile.

@Test
public void commutativeNewFile() {
    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(secondSync, firstSync, newFile).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