HBASE-7788 [snapshot 130201 merge] Fix flakey TestRestore*SnapshotFromClient#testCloneSnapshot

Adds table availability check on post clone wait.




git-svn-id: https://svn.apache.org/repos/asf/hbase/branches/hbase-7290v2@1446152 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Hsieh 2013-02-14 13:02:37 +00:00
parent ec857a7cde
commit 55cf256b36
1 changed files with 4 additions and 4 deletions

View File

@ -75,7 +75,6 @@ import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.StopServerRequest;
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; 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.ClientProtos.ScanResponse;
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription; 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.HBaseProtos.TableSchema;
import org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.AddColumnRequest; import org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.AddColumnRequest;
import org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.AssignRegionRequest; import org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.AssignRegionRequest;
@ -695,7 +694,7 @@ public class HBaseAdmin implements Abortable, Closeable {
} }
/** /**
* 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. * If enabling the table exceeds the retry period, an exception is thrown.
* @param tableName name of the table * @param tableName name of the table
* @throws IOException if a remote or network exception occurs or * @throws IOException if a remote or network exception occurs or
@ -705,7 +704,7 @@ public class HBaseAdmin implements Abortable, Closeable {
boolean enabled = false; boolean enabled = false;
long start = EnvironmentEdgeManager.currentTimeMillis(); long start = EnvironmentEdgeManager.currentTimeMillis();
for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) { for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
enabled = isTableEnabled(tableName); enabled = isTableEnabled(tableName) && isTableAvailable(tableName);
if (enabled) { if (enabled) {
break; break;
} }
@ -2407,7 +2406,8 @@ public class HBaseAdmin implements Abortable, Closeable {
/** /**
* Execute Restore/Clone snapshot and wait for the server to complete (blocking). * 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 snapshot snapshot to restore
* @param tableName table name to restore the snapshot on * @param tableName table name to restore the snapshot on
* @throws IOException if a remote or network exception occurs * @throws IOException if a remote or network exception occurs