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:
parent
95974d97eb
commit
94875900c6
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hbase.catalog;
|
package org.apache.hadoop.hbase.catalog;
|
||||||
|
|
||||||
|
import com.google.common.base.Stopwatch;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
@ -299,9 +300,15 @@ public class CatalogTracker {
|
||||||
* @throws InterruptedException if interrupted while waiting
|
* @throws InterruptedException if interrupted while waiting
|
||||||
*/
|
*/
|
||||||
public void waitForMeta() throws InterruptedException {
|
public void waitForMeta() throws InterruptedException {
|
||||||
|
Stopwatch stopwatch = new Stopwatch().start();
|
||||||
while (!this.stopped) {
|
while (!this.stopped) {
|
||||||
try {
|
try {
|
||||||
if (waitForMeta(100) != null) break;
|
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) {
|
} catch (NotAllMetaRegionsOnlineException e) {
|
||||||
if (LOG.isTraceEnabled()) {
|
if (LOG.isTraceEnabled()) {
|
||||||
LOG.trace("hbase:meta still not available, sleeping and retrying." +
|
LOG.trace("hbase:meta still not available, sleeping and retrying." +
|
||||||
|
|
Loading…
Reference in New Issue