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/12 16:10:32 UTC
[hbase] branch branch-2.2 updated: HBASE-23152 Compaction_switch
does not work by RegionServer name (#713)
This is an automated email from the ASF dual-hosted git repository.
stack pushed a commit to branch branch-2.2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.2 by this push:
new 5d5cf90 HBASE-23152 Compaction_switch does not work by RegionServer name (#713)
5d5cf90 is described below
commit 5d5cf90e67faf0ea00ce7d790b6c8ab562beb45e
Author: Karthik Palanisamy <kp...@hortonworks.com>
AuthorDate: Sat Oct 12 09:08:20 2019 -0700
HBASE-23152 Compaction_switch does not work by RegionServer name (#713)
Signed-off-by: Duo Zhang <zh...@apache.org>
Signed-off-by: stack <st...@apache.org>
---
.../hadoop/hbase/client/RawAsyncHBaseAdmin.java | 2 ++
.../hadoop/hbase/client/TestAsyncRegionAdminApi.java | 20 ++++++++++++++++++++
.../main/ruby/shell/commands/compaction_switch.rb | 4 ++--
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
index 09f6ecb..618bdaf 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
@@ -3158,6 +3158,8 @@ class RawAsyncHBaseAdmin implements AsyncAdmin {
if (serverName == null) {
future.completeExceptionally(
new IllegalArgumentException(String.format("Null ServerName: %s", regionServerName)));
+ } else {
+ serverList.add(serverName);
}
}
future.complete(serverList);
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java
index 28e60d2..aeff96e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java
@@ -335,6 +335,26 @@ public class TestAsyncRegionAdminApi extends TestAsyncAdminBase {
assertEquals("Last compaction state, expected=disabled actual=enabled",
false, p.getValue());
}
+ ServerName serverName = TEST_UTIL.getHBaseCluster().getRegionServer(0)
+ .getServerName();
+ List<String> serverNameList = new ArrayList<String>();
+ serverNameList.add(serverName.getServerName());
+ CompletableFuture<Map<ServerName, Boolean>> listCompletableFuture3 =
+ admin.compactionSwitch(false, serverNameList);
+ Map<ServerName, Boolean> pairs3 = listCompletableFuture3.get();
+ assertEquals(pairs3.entrySet().size(), 1);
+ for (Map.Entry<ServerName, Boolean> p : pairs3.entrySet()) {
+ assertEquals("Last compaction state, expected=enabled actual=disabled",
+ true, p.getValue());
+ }
+ CompletableFuture<Map<ServerName, Boolean>> listCompletableFuture4 =
+ admin.compactionSwitch(true, serverNameList);
+ Map<ServerName, Boolean> pairs4 = listCompletableFuture4.get();
+ assertEquals(pairs4.entrySet().size(), 1);
+ for (Map.Entry<ServerName, Boolean> p : pairs4.entrySet()) {
+ assertEquals("Last compaction state, expected=disabled actual=enabled",
+ false, p.getValue());
+ }
}
@Test
diff --git a/hbase-shell/src/main/ruby/shell/commands/compaction_switch.rb b/hbase-shell/src/main/ruby/shell/commands/compaction_switch.rb
index 94db700..6a58bbe 100644
--- a/hbase-shell/src/main/ruby/shell/commands/compaction_switch.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/compaction_switch.rb
@@ -33,9 +33,9 @@ module Shell
To disable compactions on all region servers
hbase> compaction_switch false
To enable compactions on specific region servers
- hbase> compaction_switch true 'server2','server1'
+ hbase> compaction_switch true, 'server2','server1'
To disable compactions on specific region servers
- hbase> compaction_switch false 'server2','server1'
+ hbase> compaction_switch false, 'server2','server1'
NOTE: A server name is its host, port plus startcode. For example:
host187.example.com,60020,1289493121758
EOF