@InterfaceAudience.Private public class Replication extends WALActionsListener.Base implements ReplicationSourceService, ReplicationSinkService
HRegionServer.WALActionsListener.Base| Constructor and Description |
|---|
Replication()
Empty constructor
|
Replication(Server server,
FileSystem fs,
Path logDir,
Path oldLogDir)
Instantiate the replication management (if rep is enabled).
|
| Modifier and Type | Method and Description |
|---|---|
static void |
decorateMasterConfiguration(Configuration conf)
This method modifies the master's configuration in order to inject replication-related features
|
static void |
decorateRegionServerConfiguration(Configuration conf)
This method modifies the region server'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,
FileSystem fs,
Path logDir,
Path oldLogDir)
Initializes the replication service object.
|
static boolean |
isReplication(Configuration c) |
static boolean |
isReplicationForBulkLoadDataEnabled(Configuration c) |
void |
join()
Join with the replication threads
|
void |
postLogRoll(Path oldPath,
Path newPath)
The WAL has been rolled.
|
void |
preLogRoll(Path oldPath,
Path newPath)
The WAL is going to be rolled.
|
ReplicationLoad |
refreshAndGetReplicationLoad()
Refresh and Get ReplicationLoad
|
void |
replicateLogEntries(java.util.List<AdminProtos.WALEntry> entries,
CellScanner cells,
java.lang.String replicationClusterId,
java.lang.String sourceBaseNamespaceDirPath,
java.lang.String sourceHFileArchiveDirPath)
Carry on the list of log entries down to the sink
|
static void |
scopeWALEdits(HTableDescriptor htd,
WALKey logKey,
WALEdit logEdit,
Configuration conf,
ReplicationSourceManager replicationManager)
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, visitLogEntryBeforeWritepublic Replication(Server server, FileSystem fs, Path logDir, Path oldLogDir) throws java.io.IOException
server - Hosting serverfs - handle to the filesystemlogDir - oldLogDir - directory where logs are archivedjava.io.IOExceptionpublic Replication()
public void initialize(Server server, FileSystem fs, Path logDir, Path oldLogDir) throws java.io.IOException
ReplicationServiceinitialize in interface ReplicationServicejava.io.IOExceptionpublic static boolean isReplication(Configuration c)
c - Configuration to look atpublic static boolean isReplicationForBulkLoadDataEnabled(Configuration c)
c - Configuration to look atpublic WALActionsListener getWALActionsListener()
ReplicationSourceServicegetWALActionsListener in interface ReplicationSourceServicepublic void stopReplicationService()
stopReplicationService in interface ReplicationServicepublic void join()
public void replicateLogEntries(java.util.List<AdminProtos.WALEntry> entries, CellScanner cells, java.lang.String replicationClusterId, java.lang.String sourceBaseNamespaceDirPath, java.lang.String sourceHFileArchiveDirPath) throws java.io.IOException
replicateLogEntries in interface ReplicationSinkServiceentries - 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).replicationClusterId - Id which will uniquely identify source cluster FS client
configurations in the replication configuration directorysourceBaseNamespaceDirPath - Path that point to the source cluster base namespace
directory required for replicating hfilessourceHFileArchiveDirPath - Path that point to the source cluster hfile archive directoryjava.io.IOExceptionpublic void startReplicationService()
throws java.io.IOException
startReplicationService in interface ReplicationServicejava.io.IOExceptionpublic ReplicationSourceManager getReplicationManager()
public void visitLogEntryBeforeWrite(HTableDescriptor htd, WALKey logKey, WALEdit logEdit) throws java.io.IOException
visitLogEntryBeforeWrite in interface WALActionsListenervisitLogEntryBeforeWrite in class WALActionsListener.BaselogEdit - 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.java.io.IOException - If failed to parse the WALEditpublic static void scopeWALEdits(HTableDescriptor htd, WALKey logKey, WALEdit logEdit, Configuration conf, ReplicationSourceManager replicationManager) throws java.io.IOException
htd - Descriptor used to find the scope to uselogKey - Key that may get scoped according to its editslogEdit - Edits used to lookup the scopesreplicationManager - Manager used to add bulk load events hfile referencesjava.io.IOException - If failed to parse the WALEditpublic void preLogRoll(Path oldPath,
Path newPath)
throws java.io.IOException
WALActionsListenerpreLogRoll in interface WALActionsListenerpreLogRoll in class WALActionsListener.BaseoldPath - the path to the old walnewPath - the path to the new waljava.io.IOExceptionpublic void postLogRoll(Path oldPath,
Path newPath)
throws java.io.IOException
WALActionsListenerpostLogRoll in interface WALActionsListenerpostLogRoll in class WALActionsListener.BaseoldPath - the path to the old walnewPath - the path to the new waljava.io.IOExceptionpublic static void decorateMasterConfiguration(Configuration conf)
conf - public static void decorateRegionServerConfiguration(Configuration conf)
conf - region server configurationspublic ReplicationLoad refreshAndGetReplicationLoad()
ReplicationServicerefreshAndGetReplicationLoad in interface ReplicationService