HBASE-24758 Avoid flooding replication source RSes logs when no sinks… (#2118)

Signed-off-by: Josh Elser <elserj@apache.org>
Signed-off-by: Viraj Jasani <vjasani@apache.org>

(cherry picked from commit 8c0d7fa5b8)
This commit is contained in:
Wellington Ramos Chevreuil 2020-07-27 10:08:13 +01:00 committed by Wellington Chevreuil
parent 2bb76c0a51
commit fce52fe6bb
3 changed files with 15 additions and 4 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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);