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 08:51:05 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 4969879df -> f13591291


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/f1359129
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/f1359129
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/f1359129

Branch: refs/heads/master
Commit: f1359129122c96ccc4af1b7d0bd9e692ab48ee65
Parents: 4969879
Author: tedyu <yuzhihong@gmail.com>
Authored: Sat Oct 10 01:50:56 2015 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Sat Oct 10 01:50:56 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/hbase/blob/f1359129/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 c587fe8..81e653d 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
@@ -682,9 +682,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/f1359129/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 a95e0cc..da446e3 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
@@ -208,7 +208,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;
   }
@@ -216,7 +216,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/f1359129/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 5e8e7d2..6c58d62 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
@@ -550,18 +550,19 @@ public class SnapshotTestingUtils {
       this.rootDir = rootDir;
     }
 
-    public SnapshotBuilder createSnapshotV1(final String snapshotName) throws IOException
{
-      return createSnapshot(snapshotName, SnapshotManifestV1.DESCRIPTOR_VERSION);
-    }
-
-    public SnapshotBuilder createSnapshotV2(final String snapshotName) throws IOException
{
-      return createSnapshot(snapshotName, SnapshotManifestV2.DESCRIPTOR_VERSION);
+    public SnapshotBuilder createSnapshotV1(final String snapshotName, final String tableName)
+        throws IOException {
+      return createSnapshot(snapshotName, tableName, SnapshotManifestV1.DESCRIPTOR_VERSION);
     }
 
-    private SnapshotBuilder createSnapshot(final String snapshotName, final int version)
+    public SnapshotBuilder createSnapshotV2(final String snapshotName, final String tableName)
         throws IOException {
-      HTableDescriptor htd = createHtd(snapshotName);
+      return createSnapshot(snapshotName, tableName, SnapshotManifestV2.DESCRIPTOR_VERSION);
+    }
 
+    private SnapshotBuilder createSnapshot(final String snapshotName, final String tableName,
+        final int version) throws IOException {
+      HTableDescriptor htd = createHtd(tableName);
       RegionData[] regions = createTable(htd, TEST_NUM_REGIONS);
 
       SnapshotDescription desc = SnapshotDescription.newBuilder()

http://git-wip-us.apache.org/repos/asf/hbase/blob/f1359129/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java
index 69f1fdb..e8446e4 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java
@@ -235,11 +235,12 @@ public class TestExportSnapshot {
     FileSystem fs = TEST_UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getFileSystem();
 
     SnapshotMock snapshotMock = new SnapshotMock(TEST_UTIL.getConfiguration(), fs, rootDir);
-    SnapshotMock.SnapshotBuilder builder = snapshotMock.createSnapshotV2("tableWithRefsV1");
+    SnapshotMock.SnapshotBuilder builder = snapshotMock.createSnapshotV2("tableWithRefsV1",
+      "tableWithRefsV1");
     testSnapshotWithRefsExportFileSystemState(builder);
 
     snapshotMock = new SnapshotMock(TEST_UTIL.getConfiguration(), fs, rootDir);
-    builder = snapshotMock.createSnapshotV2("tableWithRefsV2");
+    builder = snapshotMock.createSnapshotV2("tableWithRefsV2", "tableWithRefsV2");
     testSnapshotWithRefsExportFileSystemState(builder);
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/f1359129/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 365d56c..0b28cb2 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
@@ -85,10 +85,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 = createSnapshotMock();
-    SnapshotMock.SnapshotBuilder builder = snapshotMock.createSnapshotV2("snapshot");
+    SnapshotMock.SnapshotBuilder builder = snapshotMock.createSnapshotV2("snapshot", tableName);
     builder.addRegionV1();
     builder.addRegionV2();
     builder.addRegionV2();


Mime
View raw message