hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bus...@apache.org
Subject hbase git commit: HBASE-15297 Correct handling of namespace existence checks in shell.
Date Tue, 13 Sep 2016 07:36:12 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.3 d40140784 -> 05d8b248f


HBASE-15297 Correct handling of namespace existence checks in shell.

Changes namespace_exists? method in SecurityAdmin ruby code to catch NamespaceNotFoundException
and modified Admin.java file to document the exception.

Signed-off-by: Sean Busbey <busbey@apache.org>

 Conflicts:
	hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
	hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java


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

Branch: refs/heads/branch-1.3
Commit: 05d8b248f81440d9974613b1a6e5abaa4cbc2f16
Parents: d401407
Author: Umesh Agashe <uagashe@cloudera.com>
Authored: Mon Sep 12 16:24:44 2016 -0700
Committer: Sean Busbey <busbey@apache.org>
Committed: Tue Sep 13 00:02:53 2016 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/hadoop/hbase/client/Admin.java | 6 ++++--
 .../java/org/apache/hadoop/hbase/client/HBaseAdmin.java     | 4 +++-
 hbase-shell/src/main/ruby/hbase/security.rb                 | 9 +++------
 3 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/05d8b248/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
index a7f93af..291183e 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
@@ -32,6 +32,7 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.NamespaceDescriptor;
+import org.apache.hadoop.hbase.NamespaceNotFoundException;
 import org.apache.hadoop.hbase.ProcedureInfo;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableExistsException;
@@ -890,10 +891,11 @@ public interface Admin extends Abortable, Closeable {
    *
    * @param name name of namespace descriptor
    * @return A descriptor
-   * @throws IOException
+   * @throws org.apache.hadoop.hbase.NamespaceNotFoundException
+   * @throws IOException if a remote or network exception occurs
    */
   NamespaceDescriptor getNamespaceDescriptor(final String name)
-      throws IOException;
+      throws NamespaceNotFoundException, IOException;
 
   /**
    * List available namespace descriptors

http://git-wip-us.apache.org/repos/asf/hbase/blob/05d8b248/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
index 37d7735..7074f97 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
@@ -51,6 +51,7 @@ import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MasterNotRunningException;
 import org.apache.hadoop.hbase.MetaTableAccessor;
 import org.apache.hadoop.hbase.NamespaceDescriptor;
+import org.apache.hadoop.hbase.NamespaceNotFoundException;
 import org.apache.hadoop.hbase.NotServingRegionException;
 import org.apache.hadoop.hbase.ProcedureInfo;
 import org.apache.hadoop.hbase.RegionException;
@@ -3022,7 +3023,8 @@ public class HBaseAdmin implements Admin {
    * @throws IOException
    */
   @Override
-  public NamespaceDescriptor getNamespaceDescriptor(final String name) throws IOException
{
+  public NamespaceDescriptor getNamespaceDescriptor(final String name)
+      throws NamespaceNotFoundException, IOException {
     return
         executeCallable(new MasterCallable<NamespaceDescriptor>(getConnection()) {
           @Override

http://git-wip-us.apache.org/repos/asf/hbase/blob/05d8b248/hbase-shell/src/main/ruby/hbase/security.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/security.rb b/hbase-shell/src/main/ruby/hbase/security.rb
index f061e8c..aef2309 100644
--- a/hbase-shell/src/main/ruby/hbase/security.rb
+++ b/hbase-shell/src/main/ruby/hbase/security.rb
@@ -174,12 +174,9 @@ module Hbase
 
      # Does Namespace exist
     def namespace_exists?(namespace_name)
-      namespaceDesc = @admin.getNamespaceDescriptor(namespace_name)
-      if(namespaceDesc == nil)
-        return false
-      else
-        return true
-      end
+      return @admin.getNamespaceDescriptor(namespace_name) != nil
+    rescue org.apache.hadoop.hbase.NamespaceNotFoundException => e
+      return false
     end
 
     # Make sure that security features are available


Mime
View raw message