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

java.lang.Object
  extended by org.apache.hadoop.hbase.replication.regionserver.Replication
All Implemented Interfaces:
WALObserver

public class Replication
extends Object
implements WALObserver

Gateway to Replication. Used by HRegionServer.


Constructor Summary
Replication(Server server, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path logDir, org.apache.hadoop.fs.Path oldLogDir)
          Instantiate the replication management (if rep is enabled).
 
Method Summary
static void decorateMasterConfiguration(org.apache.hadoop.conf.Configuration conf)
          This method modifies the master's configuration in order to inject replication-related features
 ReplicationSourceManager getReplicationManager()
          Get the replication sources manager
static boolean isReplication(org.apache.hadoop.conf.Configuration c)
           
 void join()
          Join with the replication threads
 void logCloseRequested()
          The WAL is about to close.
 void logRolled(org.apache.hadoop.fs.Path p)
          The WAL was rolled.
 void logRollRequested()
          A request was made that the WAL be rolled.
 void replicateLogEntries(HLog.Entry[] entries)
          Carry on the list of log entries down to the sink
 void startReplicationServices()
          If replication is enabled and this cluster is a master, it starts
 void visitLogEntryBeforeWrite(HRegionInfo info, HLogKey logKey, WALEdit logEdit)
          Called before each write.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Replication

public Replication(Server server,
                   org.apache.hadoop.fs.FileSystem fs,
                   org.apache.hadoop.fs.Path logDir,
                   org.apache.hadoop.fs.Path oldLogDir)
            throws IOException,
                   org.apache.zookeeper.KeeperException
Instantiate the replication management (if rep is enabled).

Parameters:
server - Hosting server
fs - handle to the filesystem
logDir -
oldLogDir - directory where logs are archived
Throws:
IOException
org.apache.zookeeper.KeeperException
Method Detail

isReplication

public static boolean isReplication(org.apache.hadoop.conf.Configuration c)
Parameters:
c - Configuration to look at
Returns:
True if replication is enabled.

join

public void join()
Join with the replication threads


replicateLogEntries

public void replicateLogEntries(HLog.Entry[] entries)
                         throws IOException
Carry on the list of log entries down to the sink

Parameters:
entries - list of entries to replicate
Throws:
IOException

startReplicationServices

public void startReplicationServices()
                              throws IOException
If replication is enabled and this cluster is a master, it starts

Throws:
IOException

getReplicationManager

public ReplicationSourceManager getReplicationManager()
Get the replication sources manager

Returns:
the manager if replication is enabled, else returns false

visitLogEntryBeforeWrite

public void visitLogEntryBeforeWrite(HRegionInfo info,
                                     HLogKey logKey,
                                     WALEdit logEdit)
Description copied from interface: WALObserver
Called before each write.

Specified by:
visitLogEntryBeforeWrite in interface WALObserver

logRolled

public void logRolled(org.apache.hadoop.fs.Path p)
Description copied from interface: WALObserver
The WAL was rolled.

Specified by:
logRolled in interface WALObserver
Parameters:
p - the path to the new hlog

decorateMasterConfiguration

public static void decorateMasterConfiguration(org.apache.hadoop.conf.Configuration conf)
This method modifies the master's configuration in order to inject replication-related features

Parameters:
conf -

logRollRequested

public void logRollRequested()
Description copied from interface: WALObserver
A request was made that the WAL be rolled.

Specified by:
logRollRequested in interface WALObserver

logCloseRequested

public void logCloseRequested()
Description copied from interface: WALObserver
The WAL is about to close.

Specified by:
logCloseRequested in interface WALObserver


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.