From f0b22120a09f27c730b4a06c34a9b3f24433bd49 Mon Sep 17 00:00:00 2001 From: Karthik Palanisamy Date: Fri, 11 Oct 2019 00:08:57 -0700 Subject: [PATCH] HBASE-23144 Compact_rs throw wrong number of arguments Signed-off-by: Reid Chan --- hbase-shell/src/main/ruby/hbase/admin.rb | 6 +++++- hbase-shell/src/test/ruby/hbase/admin_test.rb | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/hbase-shell/src/main/ruby/hbase/admin.rb b/hbase-shell/src/main/ruby/hbase/admin.rb index b854eaf0f9a..5f4f16d9a30 100644 --- a/hbase-shell/src/main/ruby/hbase/admin.rb +++ b/hbase-shell/src/main/ruby/hbase/admin.rb @@ -115,7 +115,11 @@ module Hbase # Requests to compact all regions on the regionserver def compact_regionserver(servername, major = false) - @admin.compactRegionServer(ServerName.valueOf(servername), major) + if major + @admin.majorCompactRegionServer(ServerName.valueOf(servername)) + else + @admin.compactRegionServer(ServerName.valueOf(servername)) + end end #---------------------------------------------------------------------------------------------- diff --git a/hbase-shell/src/test/ruby/hbase/admin_test.rb b/hbase-shell/src/test/ruby/hbase/admin_test.rb index 1461c7f4ef1..e0014452ab6 100644 --- a/hbase-shell/src/test/ruby/hbase/admin_test.rb +++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb @@ -107,6 +107,16 @@ module Hbase command(:flush, s.toString) end end + #------------------------------------------------------------------------------- + define_test 'compact all regions by server name' do + servers = admin.list_liveservers + servers.each do |s| + command(:compact_rs, s.to_s) + # major compact + command(:compact_rs, s.to_s, true) + break + end + end #-------------------------------------------------------------------------------