HBASE-6576 HBaseAdmin.createTable should wait until the table is enabled (Gregory Chanan)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1373074 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f69a7e8e74
commit
214c751fb9
|
@ -49,6 +49,7 @@ import org.apache.hadoop.hbase.NotServingRegionException;
|
|||
import org.apache.hadoop.hbase.RegionException;
|
||||
import org.apache.hadoop.hbase.ServerName;
|
||||
import org.apache.hadoop.hbase.TableExistsException;
|
||||
import org.apache.hadoop.hbase.TableNotEnabledException;
|
||||
import org.apache.hadoop.hbase.TableNotFoundException;
|
||||
import org.apache.hadoop.hbase.UnknownRegionException;
|
||||
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
|
||||
|
@ -399,8 +400,10 @@ public class HBaseAdmin implements Abortable, Closeable {
|
|||
}
|
||||
int numRegs = splitKeys == null ? 1 : splitKeys.length + 1;
|
||||
int prevRegCount = 0;
|
||||
boolean doneWithMetaScan = false;
|
||||
for (int tries = 0; tries < this.numRetries * this.retryLongerMultiplier;
|
||||
++tries) {
|
||||
if (!doneWithMetaScan) {
|
||||
// Wait for new table to come on-line
|
||||
final AtomicInteger actualRegCount = new AtomicInteger(0);
|
||||
MetaScannerVisitor visitor = new MetaScannerVisitorBase() {
|
||||
|
@ -447,9 +450,16 @@ public class HBaseAdmin implements Abortable, Closeable {
|
|||
tries = -1;
|
||||
}
|
||||
} else {
|
||||
doneWithMetaScan = true;
|
||||
}
|
||||
}
|
||||
if (doneWithMetaScan && isTableEnabled(desc.getName())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new TableNotEnabledException(
|
||||
"Retries exhausted while still waiting for table: "
|
||||
+ desc.getNameAsString() + " to be enabled");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue