HBASE-4973 On failure, HBaseAdmin sleeps one time too many
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1212165 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c5cf90b09d
commit
1f12fbf6d3
|
@ -100,11 +100,14 @@ public class HBaseAdmin implements Abortable, Closeable {
|
|||
this.numRetries = this.conf.getInt("hbase.client.retries.number", 10);
|
||||
this.retryLongerMultiplier = this.conf.getInt(
|
||||
"hbase.client.retries.longer.multiplier", 10);
|
||||
|
||||
int tries = 0;
|
||||
for (; tries < numRetries; ++tries) {
|
||||
while ( true ){
|
||||
try {
|
||||
|
||||
this.connection.getMaster();
|
||||
break;
|
||||
return;
|
||||
|
||||
} catch (MasterNotRunningException mnre) {
|
||||
HConnectionManager.deleteStaleConnection(this.connection);
|
||||
this.connection = HConnectionManager.getConnection(this.conf);
|
||||
|
@ -112,20 +115,24 @@ public class HBaseAdmin implements Abortable, Closeable {
|
|||
HConnectionManager.deleteStaleConnection(this.connection);
|
||||
this.connection = HConnectionManager.getConnection(this.conf);
|
||||
}
|
||||
try { // Sleep
|
||||
|
||||
tries++;
|
||||
if (tries >= numRetries) {
|
||||
// we should delete connection between client and zookeeper
|
||||
HConnectionManager.deleteStaleConnection(this.connection);
|
||||
throw new MasterNotRunningException("Retried " + numRetries + " times");
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.sleep(getPauseTime(tries));
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
// we should delete connection between client and zookeeper
|
||||
HConnectionManager.deleteStaleConnection(this.connection);
|
||||
throw new MasterNotRunningException("Interrupted");
|
||||
throw new MasterNotRunningException(
|
||||
"Interrupted after "+tries+" tries");
|
||||
}
|
||||
}
|
||||
if (tries >= numRetries) {
|
||||
// we should delete connection between client and zookeeper
|
||||
HConnectionManager.deleteStaleConnection(this.connection);
|
||||
throw new MasterNotRunningException("Retried " + numRetries + " times");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue