@InterfaceAudience.Private public class Replication extends WALActionsListener.Base implements ReplicationSourceService, ReplicationSinkService
HRegionServer
.Modifier and Type | Class and Description |
---|---|
(package private) static class |
Replication.ReplicationStatisticsThread |
WALActionsListener.Base
Modifier and Type | Field and Description |
---|---|
private org.apache.hadoop.conf.Configuration |
conf |
private static org.apache.commons.logging.Log |
LOG |
private boolean |
replication |
private ReplicationLoad |
replicationLoad |
private ReplicationSourceManager |
replicationManager |
private ReplicationPeers |
replicationPeers |
private ReplicationQueues |
replicationQueues |
private ReplicationSink |
replicationSink |
private ReplicationTracker |
replicationTracker |
private ScheduledExecutorService |
scheduleThreadPool
Statistics thread schedule pool
|
private Server |
server |
private int |
statsThreadPeriod |
Constructor and Description |
---|
Replication()
Empty constructor
|
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).
|
Modifier and Type | Method and Description |
---|---|
private void |
buildReplicationLoad() |
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
|
WALActionsListener |
getWALActionsListener()
Returns a WALObserver for the service.
|
void |
initialize(Server server,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path logDir,
org.apache.hadoop.fs.Path oldLogDir)
Initializes the replication service object.
|
static boolean |
isReplication(org.apache.hadoop.conf.Configuration c) |
void |
join()
Join with the replication threads
|
void |
postLogRoll(org.apache.hadoop.fs.Path oldPath,
org.apache.hadoop.fs.Path newPath)
The WAL has been rolled.
|
void |
preLogRoll(org.apache.hadoop.fs.Path oldPath,
org.apache.hadoop.fs.Path newPath)
The WAL is going to be rolled.
|
ReplicationLoad |
refreshAndGetReplicationLoad()
Refresh and Get ReplicationLoad
|
void |
replicateLogEntries(List<org.apache.hadoop.hbase.protobuf.generated.AdminProtos.WALEntry> entries,
CellScanner cells)
Carry on the list of log entries down to the sink
|
static void |
scopeWALEdits(HTableDescriptor htd,
WALKey logKey,
WALEdit logEdit)
Utility method used to set the correct scopes on each log key.
|
void |
startReplicationService()
If replication is enabled and this cluster is a master,
it starts
|
void |
stopReplicationService()
Stops replication service.
|
void |
visitLogEntryBeforeWrite(HTableDescriptor htd,
WALKey logKey,
WALEdit logEdit) |
logCloseRequested, logRollRequested, postAppend, postLogArchive, postSync, preLogArchive, visitLogEntryBeforeWrite
private static final org.apache.commons.logging.Log LOG
private boolean replication
private ReplicationSourceManager replicationManager
private ReplicationQueues replicationQueues
private ReplicationPeers replicationPeers
private ReplicationTracker replicationTracker
private org.apache.hadoop.conf.Configuration conf
private ReplicationSink replicationSink
private Server server
private ScheduledExecutorService scheduleThreadPool
private int statsThreadPeriod
private ReplicationLoad replicationLoad
public Replication(Server server, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path logDir, org.apache.hadoop.fs.Path oldLogDir) throws IOException
server
- Hosting serverfs
- handle to the filesystemlogDir
- oldLogDir
- directory where logs are archivedIOException
public Replication()
public void initialize(Server server, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path logDir, org.apache.hadoop.fs.Path oldLogDir) throws IOException
ReplicationService
initialize
in interface ReplicationService
IOException
public static boolean isReplication(org.apache.hadoop.conf.Configuration c)
c
- Configuration to look atpublic WALActionsListener getWALActionsListener()
ReplicationSourceService
getWALActionsListener
in interface ReplicationSourceService
public void stopReplicationService()
stopReplicationService
in interface ReplicationService
public void join()
public void replicateLogEntries(List<org.apache.hadoop.hbase.protobuf.generated.AdminProtos.WALEntry> entries, CellScanner cells) throws IOException
replicateLogEntries
in interface ReplicationSinkService
entries
- list of entries to replicatecells
- The data -- the cells -- that entries
describes (the entries
do not contain the Cells we are replicating; they are passed here on the side in this
CellScanner).IOException
public void startReplicationService() throws IOException
startReplicationService
in interface ReplicationService
IOException
public ReplicationSourceManager getReplicationManager()
public void visitLogEntryBeforeWrite(HTableDescriptor htd, WALKey logKey, WALEdit logEdit)
visitLogEntryBeforeWrite
in interface WALActionsListener
visitLogEntryBeforeWrite
in class WALActionsListener.Base
logEdit
- TODO: Retire this in favor of WALActionsListener.visitLogEntryBeforeWrite(HRegionInfo, WALKey, WALEdit)
It only exists to get scope when replicating. Scope should be in the WALKey and not need
us passing in a htd
.public static void scopeWALEdits(HTableDescriptor htd, WALKey logKey, WALEdit logEdit)
htd
- Descriptor used to find the scope to uselogKey
- Key that may get scoped according to its editslogEdit
- Edits used to lookup the scopespublic void preLogRoll(org.apache.hadoop.fs.Path oldPath, org.apache.hadoop.fs.Path newPath) throws IOException
WALActionsListener
preLogRoll
in interface WALActionsListener
preLogRoll
in class WALActionsListener.Base
oldPath
- the path to the old walnewPath
- the path to the new walIOException
public void postLogRoll(org.apache.hadoop.fs.Path oldPath, org.apache.hadoop.fs.Path newPath) throws IOException
WALActionsListener
postLogRoll
in interface WALActionsListener
postLogRoll
in class WALActionsListener.Base
oldPath
- the path to the old walnewPath
- the path to the new walIOException
public static void decorateMasterConfiguration(org.apache.hadoop.conf.Configuration conf)
conf
- public ReplicationLoad refreshAndGetReplicationLoad()
ReplicationService
refreshAndGetReplicationLoad
in interface ReplicationService
private void buildReplicationLoad()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.