HBASE-18058 Zookeeper retry sleep time should have an upper limit (Allan Yang)

This commit is contained in:
tedyu 2017-05-19 10:58:38 -07:00
parent f348caf7fe
commit 300c5388f2
3 changed files with 13 additions and 5 deletions

View File

@ -100,20 +100,20 @@ public class RecoverableZooKeeper {
private static final int ID_LENGTH_SIZE = Bytes.SIZEOF_INT;
public RecoverableZooKeeper(String quorumServers, int sessionTimeout,
Watcher watcher, int maxRetries, int retryIntervalMillis)
Watcher watcher, int maxRetries, int retryIntervalMillis, int maxSleepTime)
throws IOException {
this(quorumServers, sessionTimeout, watcher, maxRetries, retryIntervalMillis,
this(quorumServers, sessionTimeout, watcher, maxRetries, retryIntervalMillis, maxSleepTime,
null);
}
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="DE_MIGHT_IGNORE",
justification="None. Its always been this way.")
public RecoverableZooKeeper(String quorumServers, int sessionTimeout,
Watcher watcher, int maxRetries, int retryIntervalMillis, String identifier)
Watcher watcher, int maxRetries, int retryIntervalMillis, int maxSleepTime, String identifier)
throws IOException {
// TODO: Add support for zk 'chroot'; we don't add it to the quorumServers String as we should.
this.retryCounterFactory =
new RetryCounterFactory(maxRetries+1, retryIntervalMillis);
new RetryCounterFactory(maxRetries+1, retryIntervalMillis, maxSleepTime);
if (identifier == null || identifier.length() == 0) {
// the identifier = processID@hostName

View File

@ -133,10 +133,11 @@ public class ZKUtil {
int retry = conf.getInt("zookeeper.recovery.retry", 3);
int retryIntervalMillis =
conf.getInt("zookeeper.recovery.retry.intervalmill", 1000);
int maxSleepTime = conf.getInt("zookeeper.recovery.retry.maxsleeptime", 60000);
zkDumpConnectionTimeOut = conf.getInt("zookeeper.dump.connection.timeout",
1000);
return new RecoverableZooKeeper(ensemble, timeout, watcher,
retry, retryIntervalMillis, identifier);
retry, retryIntervalMillis, maxSleepTime, identifier);
}
/**

View File

@ -102,6 +102,13 @@ possible configurations would overwhelm and obscure the important.
<!--The above are the important configurations for getting hbase up
and running -->
<property>
<name>zookeeper.recovery.retry.maxsleeptime</name>
<value>60000</value>
<description>Max sleep time before retry zookeeper operations in milliseconds,
a max time is needed here so that sleep time won't grow unboundedly
</description>
</property>
<property>
<name>hbase.local.dir</name>
<value>${hbase.tmp.dir}/local/</value>