-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-24758 Avoid flooding replication source RSes logs when no sinks… #2118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -127,6 +127,7 @@ public class HBaseInterClusterReplicationEndpoint extends HBaseReplicationEndpoi | |
| private boolean dropOnDeletedTables; | ||
| private boolean dropOnDeletedColumnFamilies; | ||
| private boolean isSerial = false; | ||
| private long lastSinkFetchTime; | ||
|
|
||
| /* | ||
| * Some implementations of HBaseInterClusterReplicationEndpoint may require instantiate different | ||
|
|
@@ -513,8 +514,14 @@ public boolean replicate(ReplicateContext replicateContext) { | |
|
|
||
| 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 " + maxRetriesMultiplier + " seconds."); | ||
|
||
| lastSinkFetchTime = System.currentTimeMillis(); | ||
| } | ||
| sleepForRetries("No sinks available at peer", sleepMultiplier); | ||
joshelser marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return false; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
| package org.apache.hadoop.hbase.replication.regionserver; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.ArrayList; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
@@ -150,9 +151,14 @@ public synchronized void reportSinkSuccess(SinkPeer sinkPeer) { | |
| */ | ||
| public synchronized void chooseSinks() { | ||
| List<ServerName> slaveAddresses = endpoint.getRegionServers(); | ||
virajjasani marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Collections.shuffle(slaveAddresses, ThreadLocalRandom.current()); | ||
| int numSinks = (int) Math.ceil(slaveAddresses.size() * ratio); | ||
| sinks = slaveAddresses.subList(0, numSinks); | ||
| if(slaveAddresses==null){ | ||
|
||
| LOG.warn("No sinks available at peer. Will not be able to replicate"); | ||
| sinks = new ArrayList<ServerName>(); | ||
| } else { | ||
| Collections.shuffle(slaveAddresses, ThreadLocalRandom.current()); | ||
| int numSinks = (int) Math.ceil(slaveAddresses.size() * ratio); | ||
| sinks = slaveAddresses.subList(0, numSinks); | ||
| } | ||
| lastUpdateToPeers = System.currentTimeMillis(); | ||
| badReportCounts.clear(); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JVM will initialize this to zero which is of consequence to the log message (will make sure that you get the
LOG.warnthe first time).Explicitly initialize it here so with a comment so we know that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1