HBASE-23138 Drop_all table by regex fail (#704)

Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org>
This commit is contained in:
Karthik Palanisamy 2019-10-09 03:50:19 -07:00 committed by Wellington Ramos Chevreuil
parent bb83e423cc
commit d237106ae6
2 changed files with 7 additions and 3 deletions

View File

@ -390,15 +390,15 @@ module Hbase
def drop_all(regex)
pattern = Pattern.compile(regex.to_s)
failed = java.util.ArrayList.new
admin.listTableNames(pattern).each do |table_name|
@admin.listTableNames(pattern).each do |table_name|
begin
admin.deleteTable(table_name)
@admin.deleteTable(table_name)
rescue java.io.IOException => e
puts puts "table:#{table_name}, error:#{e.toString}"
failed.add(table_name)
end
end
@failed
failed
end
#----------------------------------------------------------------------------------------------

View File

@ -441,6 +441,10 @@ module Hbase
admin.enable_all(@regex)
assert(command(:is_enabled, @t1))
assert(command(:is_enabled, @t2))
admin.disable_all(@regex)
admin.drop_all(@regex)
assert(!command(:exists, @t1))
assert(!command(:exists, @t2))
end
#-------------------------------------------------------------------------------