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-18743 HFiles in use by a table which has the same name and namespace with a default table cloned from snapshot may be deleted when that snapshot and default table are deleted (wenbang)
Date Mon, 04 Sep 2017 14:53:51 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.4 ccaef7c02 -> c97f0f2f2


HBASE-18743 HFiles in use by a table which has the same name and namespace with a default
table cloned from snapshot may be deleted when that snapshot and default table are deleted
(wenbang)


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

Branch: refs/heads/branch-1.4
Commit: c97f0f2f24ab760d61ac74d159ee4f47a7c7d2d6
Parents: ccaef7c
Author: tedyu <yuzhihong@gmail.com>
Authored: Mon Sep 4 07:53:43 2017 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Mon Sep 4 07:53:43 2017 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/hadoop/hbase/TableName.java    |  2 +-
 .../java/org/apache/hadoop/hbase/TestNamespace.java     | 12 ++++++++++++
 .../java/org/apache/hadoop/hbase/io/TestHFileLink.java  |  5 +++--
 3 files changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/c97f0f2f/hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java
index 198a5eb..9904c78 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java
@@ -388,7 +388,7 @@ public final class TableName implements Comparable<TableName> {
 
     for (TableName tn : tableCache) {
       if (qualifierAsString.equals(tn.getQualifierAsString()) &&
-          namespaceAsString.equals(tn.getNameAsString())) {
+          namespaceAsString.equals(tn.getNamespaceAsString())) {
         return tn;
       }
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/c97f0f2f/hbase-server/src/test/java/org/apache/hadoop/hbase/TestNamespace.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestNamespace.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestNamespace.java
index f0dc132..662cba6 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestNamespace.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestNamespace.java
@@ -393,4 +393,16 @@ public class TestNamespace {
     fail("Should have thrown exception " + exceptionClass);
   }
 
+  @Test
+  public void testValueOfNamespaceAndQualifier() {
+    TableName name0 = TableName.valueOf("table");
+    TableName name1 = TableName.valueOf("table", "table");
+    assertEquals(NamespaceDescriptor.DEFAULT_NAMESPACE_NAME_STR, name0.getNamespaceAsString());
+    assertEquals("table", name0.getQualifierAsString());
+    assertEquals("table", name0.getNameAsString());
+    assertEquals("table", name1.getNamespaceAsString());
+    assertEquals("table", name1.getQualifierAsString());
+    assertEquals("table:table", name1.getNameAsString());
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/c97f0f2f/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHFileLink.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHFileLink.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHFileLink.java
index 044975d..e4d09c3 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHFileLink.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHFileLink.java
@@ -102,7 +102,8 @@ public class TestHFileLink {
           TableName.NAMESPACE_DELIM, '=') + "=" + encodedRegion + "-" + storeFileName;
 
       TableName tableNames[] = {TableName.valueOf("tableName1"),
-          TableName.valueOf("ns", "tableName2")};
+          TableName.valueOf("ns", "tableName2"),
+              TableName.valueOf("refTable:refTable")};
 
       for( TableName tableName : tableNames) {
         Path tableDir = FSUtils.getTableDir(rootDir, tableName);
@@ -112,7 +113,7 @@ public class TestHFileLink {
         //Verify back reference creation
         assertEquals(encodedRegion+"."+
             tableName.getNameAsString().replace(TableName.NAMESPACE_DELIM, '='),
-            HFileLink.createBackReferenceName(tableName.getNameAsString(),
+            HFileLink.createBackReferenceName(FSUtils.getTableName(tableDir).getNameAsString(),
                 encodedRegion));
 
         //verify parsing back reference


Mime
View raw message