Author: jimk
Date: Tue Jun 12 14:08:27 2007
New Revision: 546635

URL: http://svn.apache.org/viewvc?view=rev&rev=546635
Log:
HADOOP-1469 Asychronous table creation

Modified:
    lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt
    
lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HClient.java

Modified: lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt?view=diff&rev=546635&r1=546634&r2=546635
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt (original)
+++ lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt Tue Jun 12 14:08:27 2007
@@ -30,3 +30,4 @@
      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

Modified: 
lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HClient.java
URL: 
http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HClient.java?view=diff&rev=546635&r1=546634&r2=546635
==============================================================================
--- 
lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HClient.java
 (original)
+++ 
lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HClient.java
 Tue Jun 12 14:08:27 2007
@@ -207,38 +207,48 @@
   /**
    * 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 {
-    checkReservedTableName(desc.getName());
-    checkMaster();
-    try {
-      this.master.createTable(desc);
-      
-    } catch(RemoteException e) {
-      handleRemoteException(e);
-    }
+  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) {
+      handleRemoteException(e);
     }
   }
 


Reply via email to