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>
This commit is contained in:
Wellington Ramos Chevreuil 2020-07-27 10:08:13 +01:00 committed by GitHub
parent 975cdf7b88
commit 8c0d7fa5b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 * Get a list of all the addresses of all the available region servers
* for this peer cluster * for this peer cluster, or an empty list if no region servers available at peer cluster.
* @return list of addresses * @return list of addresses
*/ */
// Synchronize peer cluster connection attempts to avoid races and rate // Synchronize peer cluster connection attempts to avoid races and rate

View File

@ -127,6 +127,8 @@ public class HBaseInterClusterReplicationEndpoint extends HBaseReplicationEndpoi
private boolean dropOnDeletedTables; private boolean dropOnDeletedTables;
private boolean dropOnDeletedColumnFamilies; private boolean dropOnDeletedColumnFamilies;
private boolean isSerial = false; private boolean isSerial = false;
//Initialising as 0 to guarantee at least one logging message
private long lastSinkFetchTime = 0;
/* /*
* Some implementations of HBaseInterClusterReplicationEndpoint may require instantiate different * Some implementations of HBaseInterClusterReplicationEndpoint may require instantiate different
@ -513,8 +515,14 @@ public class HBaseInterClusterReplicationEndpoint extends HBaseReplicationEndpoi
int numSinks = replicationSinkMgr.getNumSinks(); int numSinks = replicationSinkMgr.getNumSinks();
if (numSinks == 0) { if (numSinks == 0) {
LOG.warn("{} No replication sinks found, returning without replicating. " if((System.currentTimeMillis() - lastSinkFetchTime) >= (maxRetriesMultiplier*1000)) {
+ "The source should retry with the same set of edits.", logPeerId()); 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; return false;
} }

View File

@ -150,6 +150,9 @@ public class ReplicationSinkManager {
*/ */
public synchronized void chooseSinks() { public synchronized void chooseSinks() {
List<ServerName> slaveAddresses = endpoint.getRegionServers(); List<ServerName> slaveAddresses = endpoint.getRegionServers();
if(slaveAddresses.isEmpty()){
LOG.warn("No sinks available at peer. Will not be able to replicate");
}
Collections.shuffle(slaveAddresses, ThreadLocalRandom.current()); Collections.shuffle(slaveAddresses, ThreadLocalRandom.current());
int numSinks = (int) Math.ceil(slaveAddresses.size() * ratio); int numSinks = (int) Math.ceil(slaveAddresses.size() * ratio);
sinks = slaveAddresses.subList(0, numSinks); sinks = slaveAddresses.subList(0, numSinks);