Skip to content

HBASE-23123 Merge_region fails from shell #690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions hbase-shell/src/main/ruby/hbase/admin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,12 @@ def move(encoded_region_name, server = nil)
#----------------------------------------------------------------------------------------------
# Merge two regions
def merge_region(region_a_name, region_b_name, force)
@admin.mergeRegions(region_a_name.to_java_bytes,
region_b_name.to_java_bytes,
java.lang.Boolean.valueOf(force))
@admin.mergeRegionsAsync(
region_a_name.to_java_bytes,
region_b_name.to_java_bytes,
java.lang.Boolean.valueOf(force)
)
return nil
end

#----------------------------------------------------------------------------------------------
Expand Down
11 changes: 11 additions & 0 deletions hbase-shell/src/test/ruby/hbase/admin_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,17 @@ def teardown
define_test "list regions should allow table name" do
command(:list_regions, @test_name)
end

define_test 'merge two regions' do
@t_name = 'hbase_shell_merge'
drop_test_table(@t_name)
admin.create(@t_name, 'a', NUMREGIONS => 10, SPLITALGO => 'HexStringSplit')
r1 = command(:locate_region, @t_name, '')
r2 = command(:locate_region, @t_name, '1')
region1 = r1.getRegion.getRegionNameAsString
region2 = r2.getRegion.getRegionNameAsString
command(:merge_region, region1, region2, true)
end
end

# Simple administration methods tests
Expand Down