You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2019/10/09 17:39:30 UTC

[hbase] branch master updated: HBASE-23123 Merge_region fails from shell (#690)

This is an automated email from the ASF dual-hosted git repository.

stack pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new ba12d5b  HBASE-23123 Merge_region fails from shell (#690)
ba12d5b is described below

commit ba12d5b9deff81acfdf1fc88dc7713c2ca304c34
Author: Karthik Palanisamy <kp...@hortonworks.com>
AuthorDate: Wed Oct 9 10:39:23 2019 -0700

    HBASE-23123 Merge_region fails from shell (#690)
    
    Signed-off-by: Viraj Jasani <vi...@gmail.com>
    Signed-off-by: Duo Zhang <zh...@apache.org>
---
 hbase-shell/src/main/ruby/hbase/admin.rb      |  9 ++++++---
 hbase-shell/src/test/ruby/hbase/admin_test.rb | 11 +++++++++++
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/hbase-shell/src/main/ruby/hbase/admin.rb b/hbase-shell/src/main/ruby/hbase/admin.rb
index 9cb99d8..b854eaf 100644
--- a/hbase-shell/src/main/ruby/hbase/admin.rb
+++ b/hbase-shell/src/main/ruby/hbase/admin.rb
@@ -533,9 +533,12 @@ module Hbase
     #----------------------------------------------------------------------------------------------
     # 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
 
     #----------------------------------------------------------------------------------------------
diff --git a/hbase-shell/src/test/ruby/hbase/admin_test.rb b/hbase-shell/src/test/ruby/hbase/admin_test.rb
index 35807e3..1461c7f 100644
--- a/hbase-shell/src/test/ruby/hbase/admin_test.rb
+++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb
@@ -574,6 +574,17 @@ module Hbase
     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