Class Replication
java.lang.Object
org.apache.hadoop.hbase.replication.regionserver.Replication
- All Implemented Interfaces:
ConfigurationObserver
,PropagatingConfigurationObserver
,ReplicationService
,ReplicationSinkService
,ReplicationSourceService
@Private
public class Replication
extends Object
implements ReplicationSourceService, ReplicationSinkService, PropagatingConfigurationObserver
Gateway to Replication. Used by
HRegionServer
.
Implement PropagatingConfigurationObserver
mainly for registering
ReplicationPeers
, so we can recreating the replication peer storage.
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static final class
Statistics task. -
Field Summary
Modifier and TypeFieldDescriptionprivate org.apache.hadoop.conf.Configuration
private boolean
private static final org.slf4j.Logger
private PeerProcedureHandler
private ReplicationQueueStorage
private ReplicationLoad
private ReplicationSourceManager
private ReplicationPeers
private ReplicationSink
private ScheduledExecutorService
Statistics thread schedule poolprivate Server
private int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) void
addHFileRefsToQueue
(TableName tableName, byte[] family, List<Pair<org.apache.hadoop.fs.Path, org.apache.hadoop.fs.Path>> pairs) private void
void
deregisterChildren
(ConfigurationManager manager) Needs to be called to deregister the children from the manager.Returns a Handler to handle peer procedures.Get the replication sources managervoid
initialize
(Server server, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path logDir, org.apache.hadoop.fs.Path oldLogDir, WALFactory walFactory) Initializes the replication service object.void
join()
Join with the replication threadsvoid
onConfigurationChange
(org.apache.hadoop.conf.Configuration conf) This method would be called by theConfigurationManager
object when theConfiguration
object is reloaded from disk.Refresh and Get ReplicationLoadvoid
registerChildren
(ConfigurationManager manager) Needs to be called to register the children to the manager.void
replicateLogEntries
(List<org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.WALEntry> entries, CellScanner cells, String replicationClusterId, String sourceBaseNamespaceDirPath, String sourceHFileArchiveDirPath) Carry on the list of log entries down to the sinkvoid
If replication is enabled and this cluster is a master, it startsvoid
Stops replication service.
-
Field Details
-
LOG
-
isReplicationForBulkLoadDataEnabled
-
replicationManager
-
queueStorage
-
replicationPeers
-
conf
-
replicationSink
-
server
-
scheduleThreadPool
Statistics thread schedule pool -
statsThreadPeriod
-
replicationLoad
-
globalMetricsSource
-
peerProcedureHandler
-
-
Constructor Details
-
Replication
public Replication()Empty constructor
-
-
Method Details
-
initialize
public void initialize(Server server, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path logDir, org.apache.hadoop.fs.Path oldLogDir, WALFactory walFactory) throws IOException Description copied from interface:ReplicationService
Initializes the replication service object.- Specified by:
initialize
in interfaceReplicationService
- Throws:
IOException
-
getPeerProcedureHandler
Description copied from interface:ReplicationSourceService
Returns a Handler to handle peer procedures.- Specified by:
getPeerProcedureHandler
in interfaceReplicationSourceService
-
stopReplicationService
Stops replication service.- Specified by:
stopReplicationService
in interfaceReplicationService
-
join
Join with the replication threads -
replicateLogEntries
public void replicateLogEntries(List<org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.WALEntry> entries, CellScanner cells, String replicationClusterId, String sourceBaseNamespaceDirPath, String sourceHFileArchiveDirPath) throws IOException Carry on the list of log entries down to the sink- Specified by:
replicateLogEntries
in interfaceReplicationSinkService
- Parameters:
entries
- list of entries to replicatecells
- The data -- the cells -- thatentries
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 directory- Throws:
IOException
-
startReplicationService
If replication is enabled and this cluster is a master, it starts- Specified by:
startReplicationService
in interfaceReplicationService
- Throws:
IOException
-
getReplicationManager
Get the replication sources manager- Specified by:
getReplicationManager
in interfaceReplicationSourceService
- Returns:
- the manager if replication is enabled, else returns false
-
addHFileRefsToQueue
void addHFileRefsToQueue(TableName tableName, byte[] family, List<Pair<org.apache.hadoop.fs.Path, org.apache.hadoop.fs.Path>> pairs) throws IOException- Throws:
IOException
-
refreshAndGetReplicationLoad
Description copied from interface:ReplicationService
Refresh and Get ReplicationLoad- Specified by:
refreshAndGetReplicationLoad
in interfaceReplicationService
-
buildReplicationLoad
-
onConfigurationChange
Description copied from interface:ConfigurationObserver
This method would be called by theConfigurationManager
object when theConfiguration
object is reloaded from disk.- Specified by:
onConfigurationChange
in interfaceConfigurationObserver
-
registerChildren
Description copied from interface:PropagatingConfigurationObserver
Needs to be called to register the children to the manager.- Specified by:
registerChildren
in interfacePropagatingConfigurationObserver
- Parameters:
manager
- : to register to
-
deregisterChildren
Description copied from interface:PropagatingConfigurationObserver
Needs to be called to deregister the children from the manager.- Specified by:
deregisterChildren
in interfacePropagatingConfigurationObserver
- Parameters:
manager
- : to deregister from
-