Search in sources :

Example 1 with RpcRetryingCallerFactory

use of org.apache.hadoop.hbase.client.RpcRetryingCallerFactory in project hbase by apache.

the class WALEditsReplaySink method replayEdits.

private void replayEdits(final HRegionLocation regionLoc, final HRegionInfo regionInfo, final List<Entry> entries) throws IOException {
    try {
        RpcRetryingCallerFactory factory = RpcRetryingCallerFactory.instantiate(conf, null);
        ReplayServerCallable<ReplicateWALEntryResponse> callable = new ReplayServerCallable<>(this.conn, this.rpcControllerFactory, this.tableName, regionLoc, entries);
        factory.<ReplicateWALEntryResponse>newCaller().callWithRetries(callable, this.replayTimeout);
    } catch (IOException ie) {
        if (skipErrors) {
            LOG.warn(HConstants.HREGION_EDITS_REPLAY_SKIP_ERRORS + "=true so continuing replayEdits with error:" + ie.getMessage());
        } else {
            throw ie;
        }
    }
}
Also used : ReplicateWALEntryResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ReplicateWALEntryResponse) RpcRetryingCallerFactory(org.apache.hadoop.hbase.client.RpcRetryingCallerFactory) IOException(java.io.IOException)

Example 2 with RpcRetryingCallerFactory

use of org.apache.hadoop.hbase.client.RpcRetryingCallerFactory in project hbase by apache.

the class TestRegionReplicaReplicationEndpointNoMaster method replicateUsingCallable.

private void replicateUsingCallable(ClusterConnection connection, Queue<Entry> entries) throws IOException, RuntimeException {
    Entry entry;
    while ((entry = entries.poll()) != null) {
        byte[] row = CellUtil.cloneRow(entry.getEdit().getCells().get(0));
        RegionLocations locations = connection.locateRegion(tableName, row, true, true);
        RegionReplicaReplayCallable callable = new RegionReplicaReplayCallable(connection, RpcControllerFactory.instantiate(connection.getConfiguration()), table.getName(), locations.getRegionLocation(1), locations.getRegionLocation(1).getRegionInfo(), row, Lists.newArrayList(entry), new AtomicLong());
        RpcRetryingCallerFactory factory = RpcRetryingCallerFactory.instantiate(connection.getConfiguration());
        factory.<ReplicateWALEntryResponse>newCaller().callWithRetries(callable, 10000);
    }
}
Also used : RegionLocations(org.apache.hadoop.hbase.RegionLocations) Entry(org.apache.hadoop.hbase.wal.WAL.Entry) AtomicLong(java.util.concurrent.atomic.AtomicLong) RpcRetryingCallerFactory(org.apache.hadoop.hbase.client.RpcRetryingCallerFactory) RegionReplicaReplayCallable(org.apache.hadoop.hbase.replication.regionserver.RegionReplicaReplicationEndpoint.RegionReplicaReplayCallable)

Aggregations

RpcRetryingCallerFactory (org.apache.hadoop.hbase.client.RpcRetryingCallerFactory)2 IOException (java.io.IOException)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 RegionLocations (org.apache.hadoop.hbase.RegionLocations)1 RegionReplicaReplayCallable (org.apache.hadoop.hbase.replication.regionserver.RegionReplicaReplicationEndpoint.RegionReplicaReplayCallable)1 ReplicateWALEntryResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ReplicateWALEntryResponse)1 Entry (org.apache.hadoop.hbase.wal.WAL.Entry)1