hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1048922 - in /hbase/trunk: CHANGES.txt src/main/ruby/hbase/admin.rb
Date Tue, 14 Dec 2010 03:39:56 GMT
Author: stack
Date: Tue Dec 14 03:39:55 2010
New Revision: 1048922

URL: http://svn.apache.org/viewvc?rev=1048922&view=rev
Log:
HBASE-3352 enabling a non-existent table from shell prints no error

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/ruby/hbase/admin.rb

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1048922&r1=1048921&r2=1048922&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Tue Dec 14 03:39:55 2010
@@ -766,6 +766,7 @@ Release 0.90.0 - Unreleased
    HBASE-3347  Can't truncate/disable table that has rows in .META. that have empty
                info:regioninfo column
    HBASE-3321  Replication.join shouldn't clear the logs znode
+   HBASE-3352  enabling a non-existent table from shell prints no error
 
 
   IMPROVEMENTS

Modified: hbase/trunk/src/main/ruby/hbase/admin.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/ruby/hbase/admin.rb?rev=1048922&r1=1048921&r2=1048922&view=diff
==============================================================================
--- hbase/trunk/src/main/ruby/hbase/admin.rb (original)
+++ hbase/trunk/src/main/ruby/hbase/admin.rb Tue Dec 14 03:39:55 2010
@@ -92,6 +92,7 @@ module Hbase
     #----------------------------------------------------------------------------------------------
     # Enables a table
     def enable(table_name)
+      tableExists(table_name)
       return if enabled?(table_name)
       @admin.enableTable(table_name)
     end
@@ -99,10 +100,17 @@ module Hbase
     #----------------------------------------------------------------------------------------------
     # Disables a table
     def disable(table_name)
+      tableExists(table_name)
       return if disabled?(table_name)
       @admin.disableTable(table_name)
     end
 
+    #---------------------------------------------------------------------------------------------
+    # Throw exception if table doesn't exist
+    def tableExists(table_name)
+      raise ArgumentError, "Table #{table_name} does not exist.'" unless exists?(table_name)
+    end
+
     #----------------------------------------------------------------------------------------------
     # Is table disabled?
     def disabled?(table_name)
@@ -112,7 +120,7 @@ module Hbase
     #----------------------------------------------------------------------------------------------
     # Drops a table
     def drop(table_name)
-      raise ArgumentError, "Table #{table_name} does not exist.'" unless exists?(table_name)
+      tableExists(table_name)
       raise ArgumentError, "Table #{table_name} is enabled. Disable it first.'" if enabled?(table_name)
 
       @admin.deleteTable(table_name)



Mime
View raw message