Skip to content

Commit 8c0d7fa

Browse files
authored
HBASE-24758 Avoid flooding replication source RSes logs when no sinks… (apache#2118)
Signed-off-by: Josh Elser <[email protected]> Signed-off-by: Viraj Jasani <[email protected]>
1 parent 975cdf7 commit 8c0d7fa

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ protected static List<ServerName> fetchSlavesAddresses(ZKWatcher zkw)
168168
}
169169

170170
/**
171-
* Get a list of all the addresses of all the region servers
172-
* for this peer cluster
171+
* Get a list of all the addresses of all the available region servers
172+
* for this peer cluster, or an empty list if no region servers available at peer cluster.
173173
* @return list of addresses
174174
*/
175175
// Synchronize peer cluster connection attempts to avoid races and rate

hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/HBaseInterClusterReplicationEndpoint.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ public class HBaseInterClusterReplicationEndpoint extends HBaseReplicationEndpoi
127127
private boolean dropOnDeletedTables;
128128
private boolean dropOnDeletedColumnFamilies;
129129
private boolean isSerial = false;
130+
//Initialising as 0 to guarantee at least one logging message
131+
private long lastSinkFetchTime = 0;
130132

131133
/*
132134
* Some implementations of HBaseInterClusterReplicationEndpoint may require instantiate different
@@ -513,8 +515,14 @@ public boolean replicate(ReplicateContext replicateContext) {
513515

514516
int numSinks = replicationSinkMgr.getNumSinks();
515517
if (numSinks == 0) {
516-
LOG.warn("{} No replication sinks found, returning without replicating. "
517-
+ "The source should retry with the same set of edits.", logPeerId());
518+
if((System.currentTimeMillis() - lastSinkFetchTime) >= (maxRetriesMultiplier*1000)) {
519+
LOG.warn(
520+
"No replication sinks found, returning without replicating. "
521+
+ "The source should retry with the same set of edits. Not logging this again for "
522+
+ "the next {} seconds.", maxRetriesMultiplier);
523+
lastSinkFetchTime = System.currentTimeMillis();
524+
}
525+
sleepForRetries("No sinks available at peer", sleepMultiplier);
518526
return false;
519527
}
520528

hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSinkManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ public synchronized void reportSinkSuccess(SinkPeer sinkPeer) {
150150
*/
151151
public synchronized void chooseSinks() {
152152
List<ServerName> slaveAddresses = endpoint.getRegionServers();
153+
if(slaveAddresses.isEmpty()){
154+
LOG.warn("No sinks available at peer. Will not be able to replicate");
155+
}
153156
Collections.shuffle(slaveAddresses, ThreadLocalRandom.current());
154157
int numSinks = (int) Math.ceil(slaveAddresses.size() * ratio);
155158
sinks = slaveAddresses.subList(0, numSinks);

0 commit comments

Comments
 (0)