Apache9 commented on a change in pull request #613: HBASE-22932 Add rs group
management methods in Admin and AsyncAdmin
URL: https://github.com/apache/hbase/pull/613#discussion_r325716358
##########
File path:
hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
##########
@@ -3864,23 +3886,130 @@ private void getProcedureResult(long procId,
CompletableFuture<Void> future, int
@Override
public CompletableFuture<Boolean> snapshotCleanupSwitch(final boolean on,
final boolean sync) {
- return this.<Boolean>newMasterCaller()
- .action((controller, stub) -> this
- .call(controller, stub,
- RequestConverter.buildSetSnapshotCleanupRequest(on, sync),
- MasterService.Interface::switchSnapshotCleanup,
- SetSnapshotCleanupResponse::getPrevSnapshotCleanup))
- .call();
+ return this.<Boolean>newMasterCaller().action((controller, stub) -> this
+ .call(controller, stub,
RequestConverter.buildSetSnapshotCleanupRequest(on, sync),
+ MasterService.Interface::switchSnapshotCleanup,
+ SetSnapshotCleanupResponse::getPrevSnapshotCleanup)).call();
}
@Override
public CompletableFuture<Boolean> isSnapshotCleanupEnabled() {
- return this.<Boolean>newMasterCaller()
+ return this.<Boolean>newMasterCaller().action((controller, stub) -> this
+ .call(controller, stub,
RequestConverter.buildIsSnapshotCleanupEnabledRequest(),
+ MasterService.Interface::isSnapshotCleanupEnabled,
+ IsSnapshotCleanupEnabledResponse::getEnabled)).call();
+ }
+
+ @Override
+ public CompletableFuture<RSGroupInfo> getRSGroupInfo(String groupName) {
+ return this.<RSGroupInfo> newMasterCaller()
+ .action(((controller, stub) -> this.
+ <GetRSGroupInfoRequest, GetRSGroupInfoResponse, RSGroupInfo>
call(controller, stub,
+ RequestConverter.buildGetRSGroupInfoRequest(groupName),
+ (s, c, req, done) -> s.getRSGroupInfo(c, req, done),
+ resp -> resp.hasRSGroupInfo() ?
+ ProtobufUtil.toGroupInfo(resp.getRSGroupInfo()) : null)))
+ .call();
+ }
+
+ @Override
+ public CompletableFuture<Void> moveServers(Set<Address> servers, String
targetGroup) {
+ return this.<Void> newMasterCaller()
+ .action((controller, stub) -> this.
+ <MoveServersRequest, MoveServersResponse, Void> call(controller,
stub,
+ RequestConverter.buildMoveServersRequest(servers, targetGroup),
+ (s, c, req, done) -> s.moveServers(c, req, done), resp -> null))
+ .call();
+ }
+
+ @Override
+ public CompletableFuture<Void> addRSGroup(String groupName) {
+ return this.<Void> newMasterCaller()
+ .action(((controller, stub) -> this.
+ <AddRSGroupRequest, AddRSGroupResponse, Void> call(controller,
stub,
+
AddRSGroupRequest.newBuilder().setRSGroupName(groupName).build(),
+ (s, c, req, done) -> s.addRSGroup(c, req, done), resp -> null)))
+ .call();
+ }
+
+ @Override
+ public CompletableFuture<Void> removeRSGroup(String groupName) {
+ return this.<Void> newMasterCaller()
+ .action((controller, stub) -> this.
+ <RemoveRSGroupRequest, RemoveRSGroupResponse, Void>
call(controller, stub,
+
RemoveRSGroupRequest.newBuilder().setRSGroupName(groupName).build(),
+ (s, c, req, done) -> s.removeRSGroup(c, req, done), resp ->
null))
+ .call();
+ }
+
+ @Override
+ public CompletableFuture<Boolean> balanceRSGroup(String groupName) {
+ return this.<Boolean> newMasterCaller()
+ .action((controller, stub) -> this.
+ <BalanceRSGroupRequest, BalanceRSGroupResponse, Boolean>
call(controller, stub,
+
BalanceRSGroupRequest.newBuilder().setRSGroupName(groupName).build(),
+ (s, c, req, done) -> s.balanceRSGroup(c, req, done),
+ resp -> resp.getBalanceRan()))
+ .call();
+ }
+
+ @Override
+ public CompletableFuture<List<RSGroupInfo>> listRSGroups() {
+ return this.<List<RSGroupInfo>> newMasterCaller()
.action((controller, stub) -> this
- .call(controller, stub,
- RequestConverter.buildIsSnapshotCleanupEnabledRequest(),
- MasterService.Interface::isSnapshotCleanupEnabled,
- IsSnapshotCleanupEnabledResponse::getEnabled))
+ .<ListRSGroupInfosRequest, ListRSGroupInfosResponse,
List<RSGroupInfo>> call(controller,
+ stub, ListRSGroupInfosRequest.getDefaultInstance(),
+ (s, c, req, done) -> s.listRSGroupInfos(c, req, done),
+ resp -> resp.getRSGroupInfoList().stream()
+ .map(r -> ProtobufUtil.toGroupInfo(r))
+ .collect(Collectors.toList())))
+ .call();
+ }
+
+ @Override
+ public CompletableFuture<RSGroupInfo> getRSGroupOfServer(Address hostPort) {
+ return this.<RSGroupInfo> newMasterCaller()
+ .action((controller, stub) -> this.
+ <GetRSGroupInfoOfServerRequest, GetRSGroupInfoOfServerResponse,
RSGroupInfo> call(
+ controller, stub,
+ RequestConverter.buildGetRSGroupInfoOfServerRequest(hostPort),
+ (s, c, req, done) -> s.getRSGroupInfoOfServer(c, req, done),
+ resp -> resp.hasRSGroupInfo() ?
+ ProtobufUtil.toGroupInfo(resp.getRSGroupInfo()) : null))
+ .call();
+ }
+
+ @Override
+ public CompletableFuture<Void> removeServers(Set<Address> servers) {
+ return this.<Void> newMasterCaller()
+ .action((controller, stub) -> this.
+ <RemoveServersRequest, RemoveServersResponse, Void>
call(controller, stub,
+ RequestConverter.buildRemoveServersRequest(servers),
+ (s, c, req, done) -> s.removeServers(c, req, done), resp ->
null))
+ .call();
+ }
+
+ @Override
+ public CompletableFuture<Void> setRSGroupForTables(Set<TableName> tables,
String groupName) {
+ return this.<Void> newMasterCaller()
+ .action((controller, stub) -> this.
+ <SetRSGroupForTablesRequest, SetRSGroupForTablesResponse, Void>
call(controller, stub,
+ RequestConverter.buildSetRSGroupForTablesRequest(tables,
groupName),
+ (s, c, req, done) -> s.setRSGroupForTables(c, req, done), resp
-> null))
+ .call();
+ }
+
+ @Override
+ public CompletableFuture<RSGroupInfo> getRSGroupInfoOfTable(TableName table)
{
Review comment:
I think this can be done at client side? Just get the table descriptor and
get its region server group config.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services