HADOOP-1469 Asychronous table creation

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk/src/contrib/hbase@546635 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jim Kellerman 2007-06-12 21:08:27 +00:00
parent 0dd5f2759e
commit cc8d45bd47
2 changed files with 35 additions and 24 deletions

View File

@ -30,3 +30,4 @@ Trunk (unreleased changes)
visibility (HADOOP-1466)
16. HADOOP-1479 Fix NPE in HStore#get if store file only has keys < passed key.
17. HADOOP-1476 Distributed version of 'Performance Evaluation' script
18. HADOOP-1469 Asychronous table creation

View File

@ -207,39 +207,49 @@ public class HClient implements HConstants {
/**
* Creates a new table
*
* @param desc - table descriptor for table
* @param desc table descriptor for table
*
* @throws IllegalArgumentException - if the table name is reserved
* @throws MasterNotRunningException - if master is not running
* @throws NoServerForRegionException - if root region is not being served
* @throws IllegalArgumentException if the table name is reserved
* @throws MasterNotRunningException if master is not running
* @throws NoServerForRegionException if root region is not being served
* @throws IOException
*/
public synchronized void createTable(HTableDescriptor desc) throws IOException {
public synchronized void createTable(HTableDescriptor desc)
throws IOException {
createTableAsync(desc);
// Save the current table
SortedMap<Text, RegionLocation> oldServers = this.tableServers;
try {
// Wait for new table to come on-line
findServersForTable(desc.getName());
} finally {
if(oldServers != null && oldServers.size() != 0) {
// Restore old current table if there was one
this.tableServers = oldServers;
}
}
}
/**
* Creates a new table but does not block and wait for it to come online.
*
* @param desc table descriptor for table
*
* @throws IllegalArgumentException if the table name is reserved
* @throws MasterNotRunningException if master is not running
* @throws NoServerForRegionException if root region is not being served
* @throws IOException
*/
public synchronized void createTableAsync(HTableDescriptor desc)
throws IOException {
checkReservedTableName(desc.getName());
checkMaster();
try {
this.master.createTable(desc);
} catch(RemoteException e) {
} catch (RemoteException e) {
handleRemoteException(e);
}
// Save the current table
SortedMap<Text, RegionLocation> oldServers = this.tableServers;
try {
// Wait for new table to come on-line
findServersForTable(desc.getName());
} finally {
if(oldServers != null && oldServers.size() != 0) {
// Restore old current table if there was one
this.tableServers = oldServers;
}
}
}
/**