Skip to content

Commit

Permalink
HBASE-23138 Drop_all table by regex fail (#704)
Browse files Browse the repository at this point in the history
Signed-off-by: Wellington Chevreuil <[email protected]>
  • Loading branch information
Karthik Palanisamy authored and wchevreuil committed Oct 9, 2019
1 parent bb83e42 commit d237106
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions hbase-shell/src/main/ruby/hbase/admin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,15 @@ def drop(table_name)
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

#----------------------------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions hbase-shell/src/test/ruby/hbase/admin_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,10 @@ def teardown
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

#-------------------------------------------------------------------------------
Expand Down

0 comments on commit d237106

Please sign in to comment.