You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by wc...@apache.org on 2020/07/27 11:44:45 UTC

[hbase] branch branch-2 updated: HBASE-24758 Avoid flooding replication source RSes logs when no sinks… (#2118)

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

wchevreuil pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new fce52fe  HBASE-24758 Avoid flooding replication source RSes logs when no sinks… (#2118)
fce52fe is described below

commit fce52fe6bb320e6c8fd4e6c1073569d686a0ffb3
Author: Wellington Ramos Chevreuil <wc...@apache.org>
AuthorDate: Mon Jul 27 10:08:13 2020 +0100

    HBASE-24758 Avoid flooding replication source RSes logs when no sinks… (#2118)
    
    Signed-off-by: Josh Elser <el...@apache.org>
    Signed-off-by: Viraj Jasani <vj...@apache.org>
    
    (cherry picked from commit 8c0d7fa5b8971de8bc7062675ba96a6091263776)
---
 .../hadoop/hbase/replication/HBaseReplicationEndpoint.java   |  4 ++--
 .../regionserver/HBaseInterClusterReplicationEndpoint.java   | 12 ++++++++++--
 .../replication/regionserver/ReplicationSinkManager.java     |  3 +++
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java
index 1ca70ad..3cde0d5 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java
@@ -168,8 +168,8 @@ public abstract class HBaseReplicationEndpoint extends BaseReplicationEndpoint
   }
 
   /**
-   * Get a list of all the addresses of all the region servers
-   * for this peer cluster
+   * Get a list of all the addresses of all the available region servers
+   * for this peer cluster, or an empty list if no region servers available at peer cluster.
    * @return list of addresses
    */
   // Synchronize peer cluster connection attempts to avoid races and rate
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/HBaseInterClusterReplicationEndpoint.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/HBaseInterClusterReplicationEndpoint.java
index 9539d30..4fb6146 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/HBaseInterClusterReplicationEndpoint.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/HBaseInterClusterReplicationEndpoint.java
@@ -128,6 +128,8 @@ public class HBaseInterClusterReplicationEndpoint extends HBaseReplicationEndpoi
   private boolean dropOnDeletedTables;
   private boolean dropOnDeletedColumnFamilies;
   private boolean isSerial = false;
+  //Initialising as 0 to guarantee at least one logging message
+  private long lastSinkFetchTime = 0;
 
   /*
    * Some implementations of HBaseInterClusterReplicationEndpoint may require instantiating
@@ -518,8 +520,14 @@ public class HBaseInterClusterReplicationEndpoint extends HBaseReplicationEndpoi
 
     int numSinks = replicationSinkMgr.getNumSinks();
     if (numSinks == 0) {
-      LOG.warn("{} No replication sinks found, returning without replicating. "
-        + "The source should retry with the same set of edits.", logPeerId());
+      if((System.currentTimeMillis() - lastSinkFetchTime) >= (maxRetriesMultiplier*1000)) {
+        LOG.warn(
+          "No replication sinks found, returning without replicating. "
+            + "The source should retry with the same set of edits. Not logging this again for "
+            + "the next {} seconds.", maxRetriesMultiplier);
+        lastSinkFetchTime = System.currentTimeMillis();
+      }
+      sleepForRetries("No sinks available at peer", sleepMultiplier);
       return false;
     }
 
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSinkManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSinkManager.java
index 3cd7884..4dc5b33 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSinkManager.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSinkManager.java
@@ -160,6 +160,9 @@ public class ReplicationSinkManager {
    */
   public synchronized void chooseSinks() {
     List<ServerName> slaveAddresses = endpoint.getRegionServers();
+    if(slaveAddresses.isEmpty()){
+      LOG.warn("No sinks available at peer. Will not be able to replicate");
+    }
     Collections.shuffle(slaveAddresses, random);
     int numSinks = (int) Math.ceil(slaveAddresses.size() * ratio);
     sinks = slaveAddresses.subList(0, numSinks);