saintstack commented on a change in pull request #2643:
URL: https://github.com/apache/hbase/pull/2643#discussion_r524581124
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
##########
@@ -1154,4 +1181,68 @@ int activeFailoverTaskCount() {
MetricsReplicationGlobalSourceSource getGlobalMetrics() {
return this.globalMetrics;
}
+
+ /**
+ * Add an hbase:meta Catalog replication source. Called on open of an
hbase:meta Region.
+ * Create it once only. If exists already, use the existing one.
+ * @see #removeCatalogReplicationSource(RegionInfo)
+ * @see #addSource(String) This is specialization on the addSource method.
+ */
+ public ReplicationSourceInterface addCatalogReplicationSource(RegionInfo
regionInfo)
+ throws IOException {
+ // Poor-man's putIfAbsent
+ synchronized (this.catalogReplicationSource) {
+ ReplicationSourceInterface rs = this.catalogReplicationSource.get();
+ return rs != null ? rs :
+
this.catalogReplicationSource.getAndSet(createCatalogReplicationSource(regionInfo));
+ }
+ }
+
+ /**
+ * Remove the hbase:meta Catalog replication source.
+ * Called when we close hbase:meta.
+ * @see #addCatalogReplicationSource(RegionInfo regionInfo)
+ */
+ public void removeCatalogReplicationSource(RegionInfo regionInfo) {
+ // Nothing to do. Leave any CatalogReplicationSource in place in case an
hbase:meta Region
+ // comes back to this server.
+ }
+
+ /**
+ * Create, initialize, and start the Catalog ReplicationSource.
+ * Presumes called one-time only (caller must ensure one-time only call).
+ * @see #addSource(String) This is a specialization of the addSource call.
+ */
+ private ReplicationSourceInterface createCatalogReplicationSource(RegionInfo
regionInfo)
+ throws IOException {
+ // Instantiate meta walProvider. Instantiated here or over in the
#warmupRegion call made by the
+ // Master on a 'move' operation. Need to do extra work if we did NOT
instantiate the provider.
+ WALProvider walProvider = this.walFactory.getMetaWALProvider();
+ boolean instantiate = walProvider == null;
+ if (instantiate) {
+ walProvider = this.walFactory.getMetaProvider();
+ }
+ CatalogReplicationSourcePeer peer = new
CatalogReplicationSourcePeer(this.conf,
+ this.clusterId.toString(), "meta_" +
ServerRegionReplicaUtil.REGION_REPLICA_REPLICATION_PEER);
+ final ReplicationSourceInterface crs = new CatalogReplicationSource();
+ crs.init(conf, fs, this, new NoopReplicationQueueStorage(), peer, server,
peer.getId(),
Review comment:
Will do.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]