Skip to content

HBASE-23152 Compaction_switch does not work by RegionServer name #713

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 1 commit into from
Oct 12, 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
Original file line number Diff line number Diff line change
Expand Up @@ -3165,6 +3165,8 @@ private CompletableFuture<List<ServerName>> getRegionServerList(List<String> ser
if (serverName == null) {
future.completeExceptionally(
new IllegalArgumentException(String.format("Null ServerName: %s", regionServerName)));
} else {
serverList.add(serverName);
}
}
future.complete(serverList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,26 @@ public void testCompactionSwitchStates() throws Exception {
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
Expand Down
4 changes: 2 additions & 2 deletions hbase-shell/src/main/ruby/shell/commands/compaction_switch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def help
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
Expand Down