HBASE-7665 retry time sequence usage in HConnectionManager has off-by-one error (Sergey)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1438332 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2013-01-25 06:04:45 +00:00
parent 474163397a
commit a650c87f1f

View File

@ -762,7 +762,8 @@ public class HConnectionManager {
if (exceptionCaught != null) if (exceptionCaught != null)
// It failed. If it's not the last try, we're going to wait a little // It failed. If it's not the last try, we're going to wait a little
if (tries < numRetries) { if (tries < numRetries) {
long pauseTime = ConnectionUtils.getPauseTime(this.pause, tries); // tries at this point is 1 or more; decrement to start from 0.
long pauseTime = ConnectionUtils.getPauseTime(this.pause, tries - 1);
LOG.info("getMaster attempt " + tries + " of " + numRetries + LOG.info("getMaster attempt " + tries + " of " + numRetries +
" failed; retrying after sleep of " +pauseTime, exceptionCaught); " failed; retrying after sleep of " +pauseTime, exceptionCaught);
@ -1966,9 +1967,10 @@ public class HConnectionManager {
* @throws IOException * @throws IOException
*/ */
private void doRetry() throws IOException{ private void doRetry() throws IOException{
final long sleepTime = ConnectionUtils.getPauseTime(hci.pause, this.curNumRetries); // curNumRetries at this point is 1 or more; decrement to start from 0.
submit(this.toReplay, sleepTime); final long sleepTime = ConnectionUtils.getPauseTime(hci.pause, this.curNumRetries - 1);
this.toReplay.clear(); submit(this.toReplay, sleepTime);
this.toReplay.clear();
} }
/** /**