You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2016/09/01 20:09:04 UTC

hbase git commit: HBASE-16366 Restore operation into new table may fail (Vladimir Rodionov)

Repository: hbase
Updated Branches:
  refs/heads/HBASE-7912 d7022551c -> 4eea1c211


HBASE-16366 Restore operation into new table may fail (Vladimir Rodionov)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/4eea1c21
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/4eea1c21
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/4eea1c21

Branch: refs/heads/HBASE-7912
Commit: 4eea1c21192be5441379347f8203593b8c920674
Parents: d702255
Author: tedyu <yu...@gmail.com>
Authored: Thu Sep 1 13:08:56 2016 -0700
Committer: tedyu <yu...@gmail.com>
Committed: Thu Sep 1 13:08:56 2016 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/backup/util/RestoreServerUtil.java     | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/4eea1c21/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/util/RestoreServerUtil.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/util/RestoreServerUtil.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/util/RestoreServerUtil.java
index ad32207..6f83f25 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/util/RestoreServerUtil.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/util/RestoreServerUtil.java
@@ -54,6 +54,7 @@ import org.apache.hadoop.hbase.regionserver.StoreFileInfo;
 import org.apache.hadoop.hbase.snapshot.SnapshotDescriptionUtils;
 import org.apache.hadoop.hbase.snapshot.SnapshotManifest;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
 
 /**
  * A collection for methods used by multiple classes to restore HBase tables.
@@ -65,6 +66,8 @@ public class RestoreServerUtil {
   public static final Log LOG = LogFactory.getLog(RestoreServerUtil.class);
 
   private final String[] ignoreDirs = { "recovered.edits" };
+  
+  private final long TABLE_AVAILABILITY_WAIT_TIME = 180000;
 
   protected Configuration conf = null;
 
@@ -600,6 +603,14 @@ public class RestoreServerUtil {
         byte[][] keys = generateBoundaryKeys(regionDirList);
         // create table using table descriptor and region boundaries
         hbadmin.createTable(htd, keys);
+        long startTime = EnvironmentEdgeManager.currentTime();
+        while (!hbadmin.isTableAvailable(targetTableName, keys)) {
+          Thread.sleep(100);
+          if (EnvironmentEdgeManager.currentTime() - startTime > TABLE_AVAILABILITY_WAIT_TIME) {
+            throw new IOException("Time out "+TABLE_AVAILABILITY_WAIT_TIME+
+              "ms expired, table " + targetTableName + " is still not available");
+          }
+        }
       }
     } catch (Exception e) {
       throw new IOException(e);
@@ -612,5 +623,4 @@ public class RestoreServerUtil {
       }
     }
   }
-
 }