HBASE-5351 hbase completebulkload to a new table fails in a race
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1293479 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d229b63a28
commit
3544e1c5f7
|
@ -447,7 +447,9 @@ public class HBaseAdmin implements Abortable, Closeable {
|
|||
|
||||
/**
|
||||
* Creates a new table but does not block and wait for it to come online.
|
||||
* Asynchronous operation.
|
||||
* Asynchronous operation. To check if the table exists, use
|
||||
* {@link: #isTableAvailable} -- it is not safe to create an HTable
|
||||
* instance to this table before it is available.
|
||||
*
|
||||
* @param desc table descriptor for table
|
||||
*
|
||||
|
|
|
@ -673,23 +673,9 @@ public class LoadIncrementalHFiles extends Configured implements Tool {
|
|||
}
|
||||
|
||||
keys = LoadIncrementalHFiles.inferBoundaries(map);
|
||||
try {
|
||||
this.hbAdmin.createTableAsync(htd, keys);
|
||||
} catch (java.net.SocketTimeoutException e) {
|
||||
System.err.println("Caught Socket timeout.. Mostly caused by a slow region assignment by master!");
|
||||
}
|
||||
this.hbAdmin.createTable(htd,keys);
|
||||
|
||||
HTable table = new HTable(this.cfg, tableName);
|
||||
|
||||
HConnection conn = table.getConnection();
|
||||
int ctr = 0;
|
||||
while (!conn.isTableAvailable(table.getTableName()) && (ctr<TABLE_CREATE_MAX_RETRIES)) {
|
||||
LOG.info("Table " + tableName + "not yet available... Sleeping for 60 more seconds...");
|
||||
/* Every TABLE_CREATE_SLEEP milliseconds, wakes up and checks if the table is available*/
|
||||
Thread.sleep(TABLE_CREATE_SLEEP);
|
||||
ctr++;
|
||||
}
|
||||
LOG.info("Table "+ tableName +" is finally available!!");
|
||||
LOG.info("Table "+ tableName +" is available!!");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue