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:24:26 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.2 734def4fd -> 9117141eb


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

Branch: refs/heads/branch-1.2
Commit: 9117141ebb7b585921e2b17d1b82cb390576b6a2
Parents: 734def4
Author: tedyu <yuzhihong@gmail.com>
Authored: Sat Oct 10 15:24:17 2015 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Sat Oct 10 15:24:17 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/hbase/blob/9117141e/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 bac3347..e8dae75 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
@@ -605,9 +605,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/9117141e/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 f1732bb..989efe4 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
@@ -247,7 +247,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;
   }
@@ -255,7 +255,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/9117141e/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 7f04eb3..a710d29 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
@@ -541,17 +541,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);
 
       RegionData[] regions = createTable(htd, TEST_NUM_REGIONS);
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/9117141e/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 7e629cd..8dc2fe1 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
@@ -230,11 +230,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", "tableWithRefsV1");
     testSnapshotWithRefsExportFileSystemState(builder);
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/9117141e/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 4ae558c..4ec81f0 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
@@ -76,10 +76,20 @@ 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("snapshot", tableName);
     builder.addRegionV1();
     builder.addRegionV2();
     builder.addRegionV2();


Mime
View raw message