HBASE-10967 CatalogTracker.waitForMeta should not wait indefinitely silently

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1587284 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2014-04-14 19:01:23 +00:00
parent 95974d97eb
commit 94875900c6
1 changed files with 7 additions and 0 deletions

View File

@ -17,6 +17,7 @@
*/
package org.apache.hadoop.hbase.catalog;
import com.google.common.base.Stopwatch;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience;
@ -299,9 +300,15 @@ public class CatalogTracker {
* @throws InterruptedException if interrupted while waiting
*/
public void waitForMeta() throws InterruptedException {
Stopwatch stopwatch = new Stopwatch().start();
while (!this.stopped) {
try {
if (waitForMeta(100) != null) break;
long sleepTime = stopwatch.elapsedMillis();
// +1 in case sleepTime=0
if ((sleepTime + 1) % 10000 == 0) {
LOG.warn("Have been waiting for meta to be assigned for " + sleepTime + "ms");
}
} catch (NotAllMetaRegionsOnlineException e) {
if (LOG.isTraceEnabled()) {
LOG.trace("hbase:meta still not available, sleeping and retrying." +