HBASE-3352 enabling a non-existent table from shell prints no error
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1048922 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
702766bd2f
commit
5a36e4032a
|
@ -766,6 +766,7 @@ Release 0.90.0 - Unreleased
|
||||||
HBASE-3347 Can't truncate/disable table that has rows in .META. that have empty
|
HBASE-3347 Can't truncate/disable table that has rows in .META. that have empty
|
||||||
info:regioninfo column
|
info:regioninfo column
|
||||||
HBASE-3321 Replication.join shouldn't clear the logs znode
|
HBASE-3321 Replication.join shouldn't clear the logs znode
|
||||||
|
HBASE-3352 enabling a non-existent table from shell prints no error
|
||||||
|
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
|
|
|
@ -92,6 +92,7 @@ module Hbase
|
||||||
#----------------------------------------------------------------------------------------------
|
#----------------------------------------------------------------------------------------------
|
||||||
# Enables a table
|
# Enables a table
|
||||||
def enable(table_name)
|
def enable(table_name)
|
||||||
|
tableExists(table_name)
|
||||||
return if enabled?(table_name)
|
return if enabled?(table_name)
|
||||||
@admin.enableTable(table_name)
|
@admin.enableTable(table_name)
|
||||||
end
|
end
|
||||||
|
@ -99,10 +100,17 @@ module Hbase
|
||||||
#----------------------------------------------------------------------------------------------
|
#----------------------------------------------------------------------------------------------
|
||||||
# Disables a table
|
# Disables a table
|
||||||
def disable(table_name)
|
def disable(table_name)
|
||||||
|
tableExists(table_name)
|
||||||
return if disabled?(table_name)
|
return if disabled?(table_name)
|
||||||
@admin.disableTable(table_name)
|
@admin.disableTable(table_name)
|
||||||
end
|
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?
|
# Is table disabled?
|
||||||
def disabled?(table_name)
|
def disabled?(table_name)
|
||||||
|
@ -112,7 +120,7 @@ module Hbase
|
||||||
#----------------------------------------------------------------------------------------------
|
#----------------------------------------------------------------------------------------------
|
||||||
# Drops a table
|
# Drops a table
|
||||||
def drop(table_name)
|
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)
|
raise ArgumentError, "Table #{table_name} is enabled. Disable it first.'" if enabled?(table_name)
|
||||||
|
|
||||||
@admin.deleteTable(table_name)
|
@admin.deleteTable(table_name)
|
||||||
|
|
Loading…
Reference in New Issue