hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-14578 URISyntaxException during snapshot restore for table with user defined namespace (Pankaj Kumar)
Date Sat, 10 Oct 2015 22:27:15 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 aaf7e2246 -> e6517d837


HBASE-14578 URISyntaxException during snapshot restore for table with user defined namespace
(Pankaj Kumar)


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

Branch: refs/heads/0.98
Commit: e6517d837eba86f66cdcc4b942938a6191e88551
Parents: aaf7e22
Author: tedyu <yuzhihong@gmail.com>
Authored: Sat Oct 10 15:26:59 2015 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Sat Oct 10 15:26:59 2015 -0700

----------------------------------------------------------------------
 .../hbase/snapshot/RestoreSnapshotHelper.java       |  7 ++++---
 .../master/snapshot/TestSnapshotFileCache.java      |  4 ++--
 .../hadoop/hbase/snapshot/SnapshotTestingUtils.java | 16 +++++++++-------
 .../hbase/snapshot/TestRestoreSnapshotHelper.java   | 11 ++++++++++-
 4 files changed, 25 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/e6517d83/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotHelper.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotHelper.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotHelper.java
index 0c5b21f..4bdfed7 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotHelper.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotHelper.java
@@ -607,9 +607,10 @@ public class RestoreSnapshotHelper {
     String hfileName = storeFile.getName();
 
     // Extract the referred information (hfile name and parent region)
-    Path refPath = StoreFileInfo.getReferredToFile(new Path(new Path(new Path(
-        snapshotTable.getNameAsString(), regionInfo.getEncodedName()), familyDir.getName()),
-        hfileName));
+    Path refPath =
+        StoreFileInfo.getReferredToFile(new Path(new Path(new Path(new Path(snapshotTable
+            .getNamespaceAsString(), snapshotTable.getQualifierAsString()), regionInfo
+            .getEncodedName()), familyDir.getName()), hfileName));    
     String snapshotRegionName = refPath.getParent().getParent().getName();
     String fileName = refPath.getName();
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/e6517d83/hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestSnapshotFileCache.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestSnapshotFileCache.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestSnapshotFileCache.java
index 4bb2cbe..69a4211 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestSnapshotFileCache.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestSnapshotFileCache.java
@@ -258,7 +258,7 @@ public class TestSnapshotFileCache {
   private SnapshotMock.SnapshotBuilder createAndTestSnapshotV1(final SnapshotFileCache cache,
       final String name, final boolean tmp, final boolean removeOnExit) throws IOException
{
     SnapshotMock snapshotMock = new SnapshotMock(UTIL.getConfiguration(), fs, rootDir);
-    SnapshotMock.SnapshotBuilder builder = snapshotMock.createSnapshotV1(name);
+    SnapshotMock.SnapshotBuilder builder = snapshotMock.createSnapshotV1(name, name);
     createAndTestSnapshot(cache, builder, tmp, removeOnExit);
     return builder;
   }
@@ -266,7 +266,7 @@ public class TestSnapshotFileCache {
   private void createAndTestSnapshotV2(final SnapshotFileCache cache, final String name,
       final boolean tmp, final boolean removeOnExit) throws IOException {
     SnapshotMock snapshotMock = new SnapshotMock(UTIL.getConfiguration(), fs, rootDir);
-    SnapshotMock.SnapshotBuilder builder = snapshotMock.createSnapshotV2(name);
+    SnapshotMock.SnapshotBuilder builder = snapshotMock.createSnapshotV2(name, name);
     createAndTestSnapshot(cache, builder, tmp, removeOnExit);
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/e6517d83/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
index 072e044..9261b78 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
@@ -540,17 +540,19 @@ public class SnapshotTestingUtils {
       this.rootDir = rootDir;
     }
 
-    public SnapshotBuilder createSnapshotV1(final String snapshotName) throws IOException
{
-      return createSnapshot(snapshotName, SnapshotManifestV1.DESCRIPTOR_VERSION);
+    public SnapshotBuilder createSnapshotV1(final String snapshotName, final String tableName)
+        throws IOException {
+      return createSnapshot(snapshotName, tableName, SnapshotManifestV1.DESCRIPTOR_VERSION);
     }
 
-    public SnapshotBuilder createSnapshotV2(final String snapshotName) throws IOException
{
-      return createSnapshot(snapshotName, SnapshotManifestV2.DESCRIPTOR_VERSION);
+    public SnapshotBuilder createSnapshotV2(final String snapshotName, final String tableName)
+        throws IOException {
+      return createSnapshot(snapshotName, tableName, SnapshotManifestV2.DESCRIPTOR_VERSION);
     }
 
-    private SnapshotBuilder createSnapshot(final String snapshotName, final int version)
-        throws IOException {
-      HTableDescriptor htd = createHtd(snapshotName);
+    private SnapshotBuilder createSnapshot(final String snapshotName, final String tableName,
+        final int version) throws IOException {
+      HTableDescriptor htd = createHtd(tableName);
       htd.addFamily(new HColumnDescriptor(TEST_FAMILY));
 
       RegionData[] regions = createTable(htd, TEST_NUM_REGIONS);

http://git-wip-us.apache.org/repos/asf/hbase/blob/e6517d83/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestRestoreSnapshotHelper.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestRestoreSnapshotHelper.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestRestoreSnapshotHelper.java
index e3b5d2c..4624102 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestRestoreSnapshotHelper.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestRestoreSnapshotHelper.java
@@ -77,10 +77,19 @@ public class TestRestoreSnapshotHelper {
 
   @Test
   public void testRestore() throws IOException {
+    restoreAndVerify("snapshot", "testRestore");
+  }
+
+  @Test
+  public void testRestoreWithNamespace() throws IOException {
+    restoreAndVerify("snapshot", "namespace1:testRestoreWithNamespace");
+  }
+
+  private void restoreAndVerify(final String snapshotName, final String tableName) throws
IOException {
     // Test Rolling-Upgrade like Snapshot.
     // half machines writing using v1 and the others using v2 format.
     SnapshotMock snapshotMock = new SnapshotMock(TEST_UTIL.getConfiguration(), fs, rootDir);
-    SnapshotMock.SnapshotBuilder builder = snapshotMock.createSnapshotV2("snapshot");
+    SnapshotMock.SnapshotBuilder builder = snapshotMock.createSnapshotV2(snapshotName, tableName);
     builder.addRegionV1();
     builder.addRegionV2();
     builder.addRegionV2();


Mime
View raw message