You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2010/12/14 04:40:33 UTC
svn commit: r1048923 - in /hbase/branches/0.90: CHANGES.txt
src/main/ruby/hbase/admin.rb
Author: stack
Date: Tue Dec 14 03:40:32 2010
New Revision: 1048923
URL: http://svn.apache.org/viewvc?rev=1048923&view=rev
Log:
HBASE-3352 enabling a non-existent table from shell prints no error
Modified:
hbase/branches/0.90/CHANGES.txt
hbase/branches/0.90/src/main/ruby/hbase/admin.rb
Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1048923&r1=1048922&r2=1048923&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Tue Dec 14 03:40:32 2010
@@ -737,6 +737,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/branches/0.90/src/main/ruby/hbase/admin.rb
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/ruby/hbase/admin.rb?rev=1048923&r1=1048922&r2=1048923&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/ruby/hbase/admin.rb (original)
+++ hbase/branches/0.90/src/main/ruby/hbase/admin.rb Tue Dec 14 03:40:32 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)