You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2022/09/15 07:27:19 UTC

[hbase] branch master updated: HBASE-27368 Do not need to throw IllegalStateException when peer is not active in ReplicationSource.initialize (#4779)

This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new 460bb47c04c HBASE-27368 Do not need to throw IllegalStateException when peer is not active in ReplicationSource.initialize (#4779)
460bb47c04c is described below

commit 460bb47c04cf2ffa71c23b80c5680d8cbb69234b
Author: Duo Zhang <zh...@apache.org>
AuthorDate: Thu Sep 15 15:27:06 2022 +0800

    HBASE-27368 Do not need to throw IllegalStateException when peer is not active in ReplicationSource.initialize (#4779)
    
    Signed-off-by: Xin Sun <dd...@gmail.com>
---
 .../regionserver/ReplicationSource.java            | 24 ++++++++--------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
index 2373751afbb..c7dfbd38210 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
@@ -421,7 +421,7 @@ public class ReplicationSource implements ReplicationSourceInterface {
     return walEntryFilter;
   }
 
-  protected final void uncaughtException(Thread t, Throwable e, ReplicationSourceManager manager,
+  private void uncaughtException(Thread t, Throwable e, ReplicationSourceManager manager,
     String peerId) {
     OOMEChecker.exitIfOOME(e, getClass().getSimpleName());
     LOG.error("Unexpected exception in {} currentPath={}", t.getName(), getCurrentPath(), e);
@@ -539,15 +539,10 @@ public class ReplicationSource implements ReplicationSourceInterface {
     }
 
     if (!this.isSourceActive()) {
+      // this means the server is shutting down or the source is terminated, just give up
+      // initializing
       setSourceStartupStatus(false);
-      if (Thread.currentThread().isInterrupted()) {
-        // If source is not running and thread is interrupted this means someone has tried to
-        // remove this peer.
-        return;
-      }
-
-      retryStartup.set(!this.abortOnError);
-      throw new IllegalStateException("Source should be active.");
+      return;
     }
 
     sleepMultiplier = 1;
@@ -569,15 +564,12 @@ public class ReplicationSource implements ReplicationSourceInterface {
     }
 
     if (!this.isSourceActive()) {
+      // this means the server is shutting down or the source is terminated, just give up
+      // initializing
       setSourceStartupStatus(false);
-      if (Thread.currentThread().isInterrupted()) {
-        // If source is not running and thread is interrupted this means someone has tried to
-        // remove this peer.
-        return;
-      }
-      retryStartup.set(!this.abortOnError);
-      throw new IllegalStateException("Source should be active.");
+      return;
     }
+
     LOG.info("{} queueId={} (queues={}) is replicating from cluster={} to cluster={}", logPeerId(),
       this.replicationQueueInfo.getQueueId(), logQueue.getNumQueues(), clusterId, peerClusterId);
     initializeWALEntryFilter(peerClusterId);