You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by wc...@apache.org on 2020/03/06 10:27:50 UTC

[hbase-operator-tools] branch master updated: HBASE-23934 [operator tools] Add forbiddennapis plugin to pom.xml so that we can permanently ban references to hbase I.A. private classes from hbck2 (#54)

This is an automated email from the ASF dual-hosted git repository.

wchevreuil pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase-operator-tools.git


The following commit(s) were added to refs/heads/master by this push:
     new 1271fea  HBASE-23934 [operator tools] Add forbiddennapis plugin to pom.xml so that we can permanently ban references to hbase I.A. private classes from hbck2 (#54)
1271fea is described below

commit 1271fea67f71870763e89ccc402d5f290705dfc1
Author: Wellington Ramos Chevreuil <wc...@apache.org>
AuthorDate: Fri Mar 6 10:27:40 2020 +0000

    HBASE-23934 [operator tools] Add forbiddennapis plugin to pom.xml so that we can permanently ban references to hbase I.A. private classes from hbck2 (#54)
    
    Signed-off-by: Sean Busbey <bu...@apache.org>
    Signed-off-by: Josh Elser <el...@apache.org>
    Signed-off-by: Jan Hentschel <ja...@ultratendency.com>
---
 hbase-hbck2/pom.xml                                     | 17 +++++++++++++++++
 .../java/org/apache/hbase/HBCKMetaTableAccessor.java    |  3 +--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/hbase-hbck2/pom.xml b/hbase-hbck2/pom.xml
index 0c0b1ac..482fbda 100644
--- a/hbase-hbck2/pom.xml
+++ b/hbase-hbck2/pom.xml
@@ -143,6 +143,23 @@
           <failOnViolation>true</failOnViolation>
         </configuration>
       </plugin>
+      <!-- Forbidden APIs plugin used here to ban usage of hbase I.A. private classes-->
+      <plugin>
+        <groupId>de.thetaphi</groupId>
+        <artifactId>forbiddenapis</artifactId>
+        <version>2.6</version>
+        <configuration>
+          <signatures>org.apache.hadoop.hbase.MetaTableAccessor</signatures>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>check</goal>
+              <goal>testCheck</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
   <dependencies>
diff --git a/hbase-hbck2/src/main/java/org/apache/hbase/HBCKMetaTableAccessor.java b/hbase-hbck2/src/main/java/org/apache/hbase/HBCKMetaTableAccessor.java
index efc1f4b..e5e4acc 100644
--- a/hbase-hbck2/src/main/java/org/apache/hbase/HBCKMetaTableAccessor.java
+++ b/hbase-hbck2/src/main/java/org/apache/hbase/HBCKMetaTableAccessor.java
@@ -21,7 +21,6 @@ import static org.apache.hadoop.hbase.HConstants.CATALOG_FAMILY;
 import static org.apache.hadoop.hbase.HConstants.REGIONINFO_QUALIFIER;
 import static org.apache.hadoop.hbase.HConstants.TABLE_FAMILY;
 import static org.apache.hadoop.hbase.HConstants.TABLE_STATE_QUALIFIER;
-import static org.apache.hadoop.hbase.MetaTableAccessor.getMetaHTable;
 
 import edu.umd.cs.findbugs.annotations.Nullable;
 
@@ -418,7 +417,7 @@ public final class HBCKMetaTableAccessor {
     if (tableName.equals(TableName.META_TABLE_NAME)) {
       return new TableState(tableName, TableState.State.ENABLED);
     }
-    Table metaHTable = getMetaHTable(conn);
+    Table metaHTable = conn.getTable(TableName.META_TABLE_NAME);
     Get get = new Get(tableName.getName()).addColumn(TABLE_FAMILY, TABLE_STATE_QUALIFIER);
     Result result = metaHTable.get(get);
     return getTableState(result);