From 1049de29b1c9c7c34ba112b814ae43e21e768aed Mon Sep 17 00:00:00 2001 From: Karthik Palanisamy Date: Tue, 26 Nov 2019 03:20:33 -0800 Subject: [PATCH] HBASE-23336 [CLI] Incorrect row(s) count 'clear_deadservers' (#875) Signed-off-by: Guangxu Cheng Signed-off-by: Lijin Bin --- .../src/main/ruby/shell/commands/clear_deadservers.rb | 3 +-- hbase-shell/src/test/ruby/hbase/admin_test.rb | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hbase-shell/src/main/ruby/shell/commands/clear_deadservers.rb b/hbase-shell/src/main/ruby/shell/commands/clear_deadservers.rb index 0849e71e2c6..d1f9059513a 100644 --- a/hbase-shell/src/main/ruby/shell/commands/clear_deadservers.rb +++ b/hbase-shell/src/main/ruby/shell/commands/clear_deadservers.rb @@ -37,7 +37,6 @@ module Shell # rubocop:disable Metrics/AbcSize # rubocop:disable Metrics/MethodLength def command(*dead_servers) - now = Time.now servers = admin.clear_deadservers(dead_servers) if servers.size <= 0 formatter.row(['true']) @@ -47,7 +46,7 @@ module Shell servers.each do |server| formatter.row([server.toString]) end - formatter.footer(now, servers.size) + formatter.footer(servers.size) end end # rubocop:enable Metrics/AbcSize diff --git a/hbase-shell/src/test/ruby/hbase/admin_test.rb b/hbase-shell/src/test/ruby/hbase/admin_test.rb index a9286737643..c8f56a04837 100644 --- a/hbase-shell/src/test/ruby/hbase/admin_test.rb +++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb @@ -103,6 +103,11 @@ module Hbase assert(output.include?('0 row(s)')) end + define_test 'clear_deadservers should show exact row(s) count' do + output = capture_stdout { command(:clear_deadservers, 'test.server.com,16020,1574583397867') } + assert(output.include?('1 row(s)')) + end + #------------------------------------------------------------------------------- define_test "flush should work" do