From 6372e2dcff414ac838bbcdf41bc5ab69c5ae52ef Mon Sep 17 00:00:00 2001 From: ramkrishna Date: Sat, 9 Mar 2013 09:25:22 +0000 Subject: [PATCH] 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 --- hbase-server/src/main/ruby/hbase/admin.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/main/ruby/hbase/admin.rb b/hbase-server/src/main/ruby/hbase/admin.rb index 7e4ae2a3706..247cbe95cf5 100644 --- a/hbase-server/src/main/ruby/hbase/admin.rb +++ b/hbase-server/src/main/ruby/hbase/admin.rb @@ -327,11 +327,12 @@ module Hbase def truncate(table_name, conf = @conf) h_table = org.apache.hadoop.hbase.client.HTable.new(conf, table_name) 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? - disable(table_name) + @admin.disableTable(table_name) yield 'Dropping table...' if block_given? - drop(table_name) + @admin.deleteTable(table_name) yield 'Creating table...' if block_given? @admin.createTable(table_description)