You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by jm...@apache.org on 2013/02/14 14:02:38 UTC

svn commit: r1446152 - /hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java

Author: jmhsieh
Date: Thu Feb 14 13:02:37 2013
New Revision: 1446152

URL: http://svn.apache.org/r1446152
Log:
HBASE-7788 [snapshot 130201 merge] Fix flakey TestRestore*SnapshotFromClient#testCloneSnapshot
    
Adds table availability check on post clone wait.



Modified:
    hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java

Modified: hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java?rev=1446152&r1=1446151&r2=1446152&view=diff
==============================================================================
--- hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (original)
+++ hbase/branches/hbase-7290v2/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java Thu Feb 14 13:02:37 2013
@@ -75,7 +75,6 @@ import org.apache.hadoop.hbase.protobuf.
 import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest;
 import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanResponse;
 import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
-import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription.Type;
 import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableSchema;
 import org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.AddColumnRequest;
 import org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.AssignRegionRequest;
@@ -695,7 +694,7 @@ public class HBaseAdmin implements Abort
   }
 
   /**
-   * Wait for the table to be enabled.
+   * Wait for the table to be enabled and available
    * If enabling the table exceeds the retry period, an exception is thrown.
    * @param tableName name of the table
    * @throws IOException if a remote or network exception occurs or
@@ -705,7 +704,7 @@ public class HBaseAdmin implements Abort
     boolean enabled = false;
     long start = EnvironmentEdgeManager.currentTimeMillis();
     for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
-      enabled = isTableEnabled(tableName);
+      enabled = isTableEnabled(tableName) && isTableAvailable(tableName);
       if (enabled) {
         break;
       }
@@ -2407,7 +2406,8 @@ public class HBaseAdmin implements Abort
 
   /**
    * Execute Restore/Clone snapshot and wait for the server to complete (blocking).
-   *
+   * To check if the cloned table exists, use {@link #isTableAvailable} -- it is not safe to
+   * create an HTable instance to this table before it is available.
    * @param snapshot snapshot to restore
    * @param tableName table name to restore the snapshot on
    * @throws IOException if a remote or network exception occurs