HBASE-8525 Use sleep multilier when choosing sinks in ReplicationSource

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1485316 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
larsh 2013-05-22 18:00:06 +00:00
parent 8bd59042ba
commit ba653fb8e4
1 changed files with 10 additions and 8 deletions

View File

@ -170,9 +170,9 @@ public class ReplicationSource extends Thread
for (int i = 0; i < this.replicationQueueNbCapacity; i++) {
this.entriesArray[i] = new HLog.Entry();
}
this.maxRetriesMultiplier =
this.conf.getInt("replication.source.maxretriesmultiplier", 10);
this.socketTimeoutMultiplier = maxRetriesMultiplier * maxRetriesMultiplier;
this.maxRetriesMultiplier = this.conf.getInt("replication.source.maxretriesmultiplier", 10);
this.socketTimeoutMultiplier = this.conf.getInt("replication.source.socketTimeoutMultiplier",
maxRetriesMultiplier * maxRetriesMultiplier);
this.queue =
new PriorityBlockingQueue<Path>(
conf.getInt("hbase.regionserver.maxlogs", 32),
@ -452,14 +452,16 @@ public class ReplicationSource extends Thread
}
private void connectToPeers() {
int sleepMultiplier = 1;
// Connect to peer cluster first, unless we have to stop
while (this.isActive() && this.currentPeers.size() == 0) {
try {
chooseSinks();
Thread.sleep(this.sleepForRetries);
} catch (InterruptedException e) {
LOG.error("Interrupted while trying to connect to sinks", e);
chooseSinks();
if (this.isActive() && this.currentPeers.size() == 0) {
if (sleepForRetries("Waiting for peers", sleepMultiplier)) {
sleepMultiplier++;
}
}
}
}