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:
parent
294db538d0
commit
928bd78ece
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user