Search in sources :

Example 1 with WalClientExecReturn

use of org.apache.accumulo.tserver.replication.AccumuloReplicaSystem.WalClientExecReturn in project accumulo by apache.

the class AccumuloReplicaSystemTest method dontSendEmptyDataToPeer.

@Test
public void dontSendEmptyDataToPeer() throws Exception {
    Client replClient = createMock(Client.class);
    AccumuloReplicaSystem ars = createMock(AccumuloReplicaSystem.class);
    WalEdits edits = new WalEdits(Collections.emptyList());
    WalReplication walReplication = new WalReplication(edits, 0, 0, 0);
    ReplicationTarget target = new ReplicationTarget("peer", "2", Table.ID.of("1"));
    DataInputStream input = null;
    Path p = new Path("/accumulo/wals/tserver+port/" + UUID.randomUUID().toString());
    Status status = null;
    long sizeLimit = Long.MAX_VALUE;
    String remoteTableId = target.getRemoteIdentifier();
    TCredentials tcreds = null;
    Set<Integer> tids = new HashSet<>();
    WalClientExecReturn walClientExec = ars.new WalClientExecReturn(target, input, p, status, sizeLimit, remoteTableId, tcreds, tids);
    expect(ars.getWalEdits(target, input, p, status, sizeLimit, tids)).andReturn(walReplication);
    replay(replClient, ars);
    ReplicationStats stats = walClientExec.execute(replClient);
    verify(replClient, ars);
    Assert.assertEquals(new ReplicationStats(0l, 0l, 0l), stats);
}
Also used : Path(org.apache.hadoop.fs.Path) Status(org.apache.accumulo.server.replication.proto.Replication.Status) TCredentials(org.apache.accumulo.core.security.thrift.TCredentials) WalReplication(org.apache.accumulo.tserver.replication.AccumuloReplicaSystem.WalReplication) WalClientExecReturn(org.apache.accumulo.tserver.replication.AccumuloReplicaSystem.WalClientExecReturn) DataInputStream(java.io.DataInputStream) WalEdits(org.apache.accumulo.core.replication.thrift.WalEdits) ReplicationTarget(org.apache.accumulo.core.replication.ReplicationTarget) ReplicationStats(org.apache.accumulo.tserver.replication.AccumuloReplicaSystem.ReplicationStats) Client(org.apache.accumulo.core.replication.thrift.ReplicationServicer.Client) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with WalClientExecReturn

use of org.apache.accumulo.tserver.replication.AccumuloReplicaSystem.WalClientExecReturn in project accumulo by apache.

the class AccumuloReplicaSystemTest method consumedButNotSentDataShouldBeRecorded.

@Test
public void consumedButNotSentDataShouldBeRecorded() throws Exception {
    Client replClient = createMock(Client.class);
    AccumuloReplicaSystem ars = createMock(AccumuloReplicaSystem.class);
    WalEdits edits = new WalEdits(Collections.emptyList());
    WalReplication walReplication = new WalReplication(edits, 0, 5, 0);
    ReplicationTarget target = new ReplicationTarget("peer", "2", Table.ID.of("1"));
    DataInputStream input = null;
    Path p = new Path("/accumulo/wals/tserver+port/" + UUID.randomUUID().toString());
    Status status = null;
    long sizeLimit = Long.MAX_VALUE;
    String remoteTableId = target.getRemoteIdentifier();
    TCredentials tcreds = null;
    Set<Integer> tids = new HashSet<>();
    WalClientExecReturn walClientExec = ars.new WalClientExecReturn(target, input, p, status, sizeLimit, remoteTableId, tcreds, tids);
    expect(ars.getWalEdits(target, input, p, status, sizeLimit, tids)).andReturn(walReplication);
    replay(replClient, ars);
    ReplicationStats stats = walClientExec.execute(replClient);
    verify(replClient, ars);
    Assert.assertEquals(new ReplicationStats(0l, 0l, 5l), stats);
}
Also used : Path(org.apache.hadoop.fs.Path) Status(org.apache.accumulo.server.replication.proto.Replication.Status) TCredentials(org.apache.accumulo.core.security.thrift.TCredentials) WalReplication(org.apache.accumulo.tserver.replication.AccumuloReplicaSystem.WalReplication) WalClientExecReturn(org.apache.accumulo.tserver.replication.AccumuloReplicaSystem.WalClientExecReturn) DataInputStream(java.io.DataInputStream) WalEdits(org.apache.accumulo.core.replication.thrift.WalEdits) ReplicationTarget(org.apache.accumulo.core.replication.ReplicationTarget) ReplicationStats(org.apache.accumulo.tserver.replication.AccumuloReplicaSystem.ReplicationStats) Client(org.apache.accumulo.core.replication.thrift.ReplicationServicer.Client) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

DataInputStream (java.io.DataInputStream)2 HashSet (java.util.HashSet)2 ReplicationTarget (org.apache.accumulo.core.replication.ReplicationTarget)2 Client (org.apache.accumulo.core.replication.thrift.ReplicationServicer.Client)2 WalEdits (org.apache.accumulo.core.replication.thrift.WalEdits)2 TCredentials (org.apache.accumulo.core.security.thrift.TCredentials)2 Status (org.apache.accumulo.server.replication.proto.Replication.Status)2 ReplicationStats (org.apache.accumulo.tserver.replication.AccumuloReplicaSystem.ReplicationStats)2 WalClientExecReturn (org.apache.accumulo.tserver.replication.AccumuloReplicaSystem.WalClientExecReturn)2 WalReplication (org.apache.accumulo.tserver.replication.AccumuloReplicaSystem.WalReplication)2 Path (org.apache.hadoop.fs.Path)2 Test (org.junit.Test)2