You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/09/24 17:41:20 UTC
[GitHub] [hbase] saintstack commented on a change in pull request #2452: HBASE-25071 ReplicationServer support start ReplicationSource internal
saintstack commented on a change in pull request #2452:
URL: https://github.com/apache/hbase/pull/2452#discussion_r494486576
##########
File path: hbase-protocol-shaded/src/main/protobuf/server/master/Master.proto
##########
@@ -721,7 +721,8 @@ message ListReplicationSinkServersRequest {
}
message ListReplicationSinkServersResponse {
- repeated ServerName server_name = 1;
+ required bool is_replication_server = 1;
Review comment:
Is this right name for the attribute? The method name for a boolean should be isATTRIBUTE but the ATTRIBUTE itself should not have the 'is' prefix.
##########
File path: hbase-protocol-shaded/src/main/protobuf/server/replication/ReplicationServer.proto
##########
@@ -24,9 +24,21 @@ option java_generic_services = true;
option java_generate_equals_and_hash = true;
Review comment:
Does the replication server belong in the core? Should it be done outside in hbase-operator-tools? Just add the communication bits to core?
##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HReplicationServer.java
##########
@@ -78,27 +104,44 @@
*/
private ServerName serverName;
- protected final Configuration conf;
+ private final Configuration conf;
- private ReplicationSinkService replicationSinkService;
+ // zookeeper connection and watcher
+ private final ZKWatcher zooKeeper;
- final int msgInterval;
- // A sleeper that sleeps for msgInterval.
- protected final Sleeper sleeper;
+ private final UUID clusterId;
- // zookeeper connection and watcher
- protected final ZKWatcher zooKeeper;
+ private HFileSystem walFs;
+ private Path walRootDir;
+
+ /**
+ * ChoreService used to schedule tasks that we want to run periodically
+ */
+ private ChoreService choreService;
/**
* The asynchronous cluster connection to be shared by services.
*/
- protected AsyncClusterConnection asyncClusterConnection;
+ private AsyncClusterConnection asyncClusterConnection;
private UserProvider userProvider;
- protected final ReplicationServerRpcServices rpcServices;
+ private final ReplicationServerRpcServices rpcServices;
Review comment:
We have to do this? Just because we do it for HMaster and HRegionServer, it doesn't make it a good pattern. This is an Interface to pass instead of the impl?
##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HReplicationServer.java
##########
@@ -50,7 +72,7 @@
*/
@InterfaceAudience.Private
@SuppressWarnings({ "deprecation"})
-public class HReplicationServer extends Thread implements Server {
+public class HReplicationServer extends Thread implements Server, ReplicationSourceController {
Review comment:
Looks like ReplicationServer already committed (why have the 'H' prefix?)
##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java
##########
@@ -118,6 +118,7 @@
private boolean fetchServersUseZk = false;
private FetchServersChore fetchServersChore;
private int shortOperationTimeout;
+ private boolean isReplicationServer = false;
Review comment:
Yeah, boolean should be named replicationServer and the method to access this data member is named isReplicationServer.
##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HReplicationServer.java
##########
@@ -226,13 +302,16 @@ protected final synchronized void setupClusterConnection() throws IOException {
}
/**
- * Wait on all threads to finish. Presumption is that all closes and stops
+ * Wait on all threads to fnish. Presumption is that all closes and stops
Review comment:
Undo this change. Misspelling.
##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java
##########
@@ -295,6 +296,7 @@ private synchronized AsyncClusterConnection getPeerConnection() throws IOExcepti
.createBlockingRpcChannel(master, User.getCurrent(), shortOperationTimeout));
ListReplicationSinkServersResponse resp = masterStub
.listReplicationSinkServers(null, ListReplicationSinkServersRequest.newBuilder().build());
+ isReplicationServer = resp.getIsReplicationServer();
Review comment:
Do you have to do hasReplicationServer first? And then read it if present? Or maybe this defaults false if not present?
##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HReplicationServer.java
##########
@@ -78,27 +104,44 @@
*/
private ServerName serverName;
- protected final Configuration conf;
+ private final Configuration conf;
- private ReplicationSinkService replicationSinkService;
+ // zookeeper connection and watcher
+ private final ZKWatcher zooKeeper;
- final int msgInterval;
- // A sleeper that sleeps for msgInterval.
- protected final Sleeper sleeper;
+ private final UUID clusterId;
- // zookeeper connection and watcher
- protected final ZKWatcher zooKeeper;
+ private HFileSystem walFs;
+ private Path walRootDir;
+
+ /**
+ * ChoreService used to schedule tasks that we want to run periodically
+ */
+ private ChoreService choreService;
/**
* The asynchronous cluster connection to be shared by services.
*/
- protected AsyncClusterConnection asyncClusterConnection;
+ private AsyncClusterConnection asyncClusterConnection;
private UserProvider userProvider;
- protected final ReplicationServerRpcServices rpcServices;
+ private final ReplicationServerRpcServices rpcServices;
Review comment:
Maybe it is to mock?
##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
##########
@@ -360,8 +360,8 @@ private ReplicationSourceInterface createSource(String queueId, ReplicationPeer
MetricsSource metrics = new MetricsSource(queueId);
sourceMetrics.put(queueId, metrics);
// init replication source
- src.init(conf, fs, logDir, this, queueStorage, replicationPeer, server, queueId, clusterId,
- walFileLengthProvider, metrics);
+ src.init(conf, fs, logDir, this, queueStorage, replicationPeer, server, server.getServerName(),
Review comment:
Perhaps say more about this?
##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HReplicationServer.java
##########
@@ -78,27 +104,44 @@
*/
private ServerName serverName;
- protected final Configuration conf;
+ private final Configuration conf;
- private ReplicationSinkService replicationSinkService;
+ // zookeeper connection and watcher
+ private final ZKWatcher zooKeeper;
- final int msgInterval;
- // A sleeper that sleeps for msgInterval.
- protected final Sleeper sleeper;
+ private final UUID clusterId;
- // zookeeper connection and watcher
- protected final ZKWatcher zooKeeper;
+ private HFileSystem walFs;
+ private Path walRootDir;
+
+ /**
+ * ChoreService used to schedule tasks that we want to run periodically
+ */
+ private ChoreService choreService;
/**
* The asynchronous cluster connection to be shared by services.
*/
- protected AsyncClusterConnection asyncClusterConnection;
+ private AsyncClusterConnection asyncClusterConnection;
private UserProvider userProvider;
- protected final ReplicationServerRpcServices rpcServices;
+ private final ReplicationServerRpcServices rpcServices;
+
+ // Total buffer size on this RegionServer for holding batched edits to be shipped.
+ private final long totalBufferLimit;
+ private AtomicLong totalBufferUsed = new AtomicLong();
+
+ private final MetricsReplicationGlobalSourceSource globalMetrics;
+ private final Map<String, MetricsSource> sourceMetrics = new HashMap<>();
+ private final ConcurrentMap<String, ReplicationSourceInterface> sources = new ConcurrentHashMap<>();
+
+ private final ReplicationQueueStorage queueStorage;
+ private final ReplicationPeers replicationPeers;
Review comment:
Is this stuff normally inside a ReplicationSourceManager? Or maybe the Replication instance? Can you not use these instead?
##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceInterface.java
##########
@@ -52,15 +52,17 @@
* @param queueStorage the replication queue storage
* @param replicationPeer the replication peer
* @param server the server which start and run this replication source
+ * @param producer the name of region server which produce the replication queue
Review comment:
This is for the RecoveryReplicationSource only?
##########
File path: hbase-protocol-shaded/src/main/protobuf/server/master/Master.proto
##########
@@ -721,7 +721,8 @@ message ListReplicationSinkServersRequest {
}
message ListReplicationSinkServersResponse {
- repeated ServerName server_name = 1;
+ required bool is_replication_server = 1;
Review comment:
Oh, you can't change the protobuf index.... it breaks compatibility. Give the replication_server '2' and leave server_name as '1'.
##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
##########
@@ -360,8 +360,8 @@ private ReplicationSourceInterface createSource(String queueId, ReplicationPeer
MetricsSource metrics = new MetricsSource(queueId);
sourceMetrics.put(queueId, metrics);
// init replication source
- src.init(conf, fs, logDir, this, queueStorage, replicationPeer, server, queueId, clusterId,
- walFileLengthProvider, metrics);
+ src.init(conf, fs, logDir, this, queueStorage, replicationPeer, server, server.getServerName(),
Review comment:
There will be a time when the passed in 'server' differs from server.getServerName?
----------------------------------------------------------------
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:
users@infra.apache.org