HBASE-7961 truncate on disabled table should throw TableNotEnabledException.

(Rajesh)



git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1454677 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ramkrishna 2013-03-09 09:25:22 +00:00
parent 0437c8fcdd
commit 6372e2dcff
1 changed files with 3 additions and 2 deletions

View File

@ -327,11 +327,12 @@ module Hbase
def truncate(table_name, conf = @conf) def truncate(table_name, conf = @conf)
h_table = org.apache.hadoop.hbase.client.HTable.new(conf, table_name) h_table = org.apache.hadoop.hbase.client.HTable.new(conf, table_name)
table_description = h_table.getTableDescriptor() table_description = h_table.getTableDescriptor()
raise ArgumentError, "Table #{table_name} is not enabled. Enable it first.'" unless enabled?(table_name)
yield 'Disabling table...' if block_given? yield 'Disabling table...' if block_given?
disable(table_name) @admin.disableTable(table_name)
yield 'Dropping table...' if block_given? yield 'Dropping table...' if block_given?
drop(table_name) @admin.deleteTable(table_name)
yield 'Creating table...' if block_given? yield 'Creating table...' if block_given?
@admin.createTable(table_description) @admin.createTable(table_description)