org.apache.hadoop.hbase.replication.regionserver
Class ReplicationSink

java.lang.Object
  extended by org.apache.hadoop.hbase.replication.regionserver.ReplicationSink

@InterfaceAudience.Private
public class ReplicationSink
extends Object

This class is responsible for replicating the edits coming from another cluster.

This replication process is currently waiting for the edits to be applied before the method can return. This means that the replication of edits is synchronized (after reading from HLogs in ReplicationSource) and that a single region server cannot receive edits from two sources at the same time

This class uses the native HBase client in order to replicate entries.

TODO make this class more like ReplicationSource wrt log handling


Constructor Summary
ReplicationSink(org.apache.hadoop.conf.Configuration conf, Stoppable stopper)
          Create a sink for replication
 
Method Summary
protected  void batch(TableName tableName, Collection<List<Row>> allRows)
          Do the changes and handle the pool
 MetricsSink getSinkMetrics()
          Get replication Sink Metrics
 String getStats()
          Get a string representation of this sink's metrics
 void replicateEntries(List<AdminProtos.WALEntry> entries, CellScanner cells)
          Replicate this array of entries directly into the local cluster using the native client.
 void stopReplicationSinkServices()
          stop the thread pool executor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplicationSink

public ReplicationSink(org.apache.hadoop.conf.Configuration conf,
                       Stoppable stopper)
                throws IOException
Create a sink for replication

Parameters:
conf - conf object
stopper - boolean to tell this thread to stop
Throws:
IOException - thrown when HDFS goes bad or bad file name
Method Detail

replicateEntries

public void replicateEntries(List<AdminProtos.WALEntry> entries,
                             CellScanner cells)
                      throws IOException
Replicate this array of entries directly into the local cluster using the native client. Only operates against raw protobuf type saving on a conversion from pb to pojo.

Parameters:
entries -
cells -
Throws:
IOException

stopReplicationSinkServices

public void stopReplicationSinkServices()
stop the thread pool executor. It is called when the regionserver is stopped.


batch

protected void batch(TableName tableName,
                     Collection<List<Row>> allRows)
              throws IOException
Do the changes and handle the pool

Parameters:
tableName - table to insert into
allRows - list of actions
Throws:
IOException

getStats

public String getStats()
Get a string representation of this sink's metrics

Returns:
string with the total replicated edits count and the date of the last edit that was applied

getSinkMetrics

public MetricsSink getSinkMetrics()
Get replication Sink Metrics

Returns:
MetricsSink


Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.