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

Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org>
(cherry picked from commit d237106ae698d3632b9f26f1ea2f1b4fa41811c3)
This commit is contained in:
Karthik Palanisamy 2019-10-09 03:50:19 -07:00 committed by Wellington Chevreuil
parent 294db538d0
commit 928bd78ece
2 changed files with 13 additions and 1 deletions

View File

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

View File

@ -429,6 +429,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
#-------------------------------------------------------------------------------