sandeepvinayak commented on a change in pull request #3204:
URL: https://github.com/apache/hbase/pull/3204#discussion_r625388141



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
##########
@@ -653,6 +658,30 @@ public void regionServerRemoved(String regionserver) {
     transferQueues(regionserver);
   }
 
+  /**
+   * We want to run the peer removal in a separate thread when the peer removal
+   * is called from ReplicationSource shipper thread on encountering 
NoNodeException
+   * because peerRemoved terminate the source which might leave replication 
source
+   * in orphaned state.
+   * See HBASE-25741.
+   * @param peerId peer ID to be removed.
+   */
+  public void schedulePeerRemoval(final String peerId) {
+    final ExecutorService threadPool =
+      
Executors.newSingleThreadExecutor(Threads.getNamedThreadFactory("peer-removal"));
+    try {
+      Future<?> res = threadPool.submit(new Runnable() {
+        @Override public void run() {
+          peerRemoved(peerId);
+        }
+      });
+      res.get();

Review comment:
       @bharathv We are creating a new executor in this method and replication 
shipper thread calls this method and wait till it complete the execution. As 
part of this execution the shipper thread will also be terminated and this new 
thread make sure that it do the clean up after termination as well. In short, 
this make sure that thread calling the `peerRemoved` is not the one getting 
terminated within this method. Does it make sense?




-- 
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:
us...@infra.apache.org


Reply via email to