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
Nested ClassesModifier and TypeClassDescriptionprivate static final classStatistics task. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.hadoop.conf.Configurationprivate booleanprivate static final org.slf4j.Loggerprivate PeerProcedureHandlerprivate ReplicationQueueStorageprivate ReplicationLoadprivate ReplicationSourceManagerprivate ReplicationPeersprivate ReplicationSinkprivate ScheduledExecutorServiceStatistics thread schedule poolprivate Serverprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddHFileRefsToQueue(TableName tableName, byte[] family, List<Pair<org.apache.hadoop.fs.Path, org.apache.hadoop.fs.Path>> pairs) private voidvoidderegisterChildren(ConfigurationManager manager) Needs to be called to deregister the children from the manager.Returns a Handler to handle peer procedures.Get the replication sources managervoidinitialize(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.voidjoin()Join with the replication threadsvoidonConfigurationChange(org.apache.hadoop.conf.Configuration conf) This method would be called by theConfigurationManagerobject when theConfigurationobject is reloaded from disk.Refresh and Get ReplicationLoadvoidregisterChildren(ConfigurationManager manager) Needs to be called to register the children to the manager.voidreplicateLogEntries(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 sinkvoidIf replication is enabled and this cluster is a master, it startsvoidStops 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:ReplicationServiceInitializes the replication service object.- Specified by:
initializein interfaceReplicationService- Throws:
IOException
-
getPeerProcedureHandler
Description copied from interface:ReplicationSourceServiceReturns a Handler to handle peer procedures.- Specified by:
getPeerProcedureHandlerin interfaceReplicationSourceService
-
stopReplicationService
Stops replication service.- Specified by:
stopReplicationServicein 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:
replicateLogEntriesin interfaceReplicationSinkService- Parameters:
entries- list of entries to replicatecells- The data -- the cells -- thatentriesdescribes (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:
startReplicationServicein interfaceReplicationService- Throws:
IOException
-
getReplicationManager
Get the replication sources manager- Specified by:
getReplicationManagerin 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:ReplicationServiceRefresh and Get ReplicationLoad- Specified by:
refreshAndGetReplicationLoadin interfaceReplicationService
-
buildReplicationLoad
-
onConfigurationChange
Description copied from interface:ConfigurationObserverThis method would be called by theConfigurationManagerobject when theConfigurationobject is reloaded from disk.- Specified by:
onConfigurationChangein interfaceConfigurationObserver
-
registerChildren
Description copied from interface:PropagatingConfigurationObserverNeeds to be called to register the children to the manager.- Specified by:
registerChildrenin interfacePropagatingConfigurationObserver- Parameters:
manager- : to register to
-
deregisterChildren
Description copied from interface:PropagatingConfigurationObserverNeeds to be called to deregister the children from the manager.- Specified by:
deregisterChildrenin interfacePropagatingConfigurationObserver- Parameters:
manager- : to deregister from
-