use of org.apache.hadoop.hbase.client.MasterSwitchType in project hbase by apache.
the class MasterRpcServices method setSplitOrMergeEnabled.
@Override
public SetSplitOrMergeEnabledResponse setSplitOrMergeEnabled(RpcController controller, SetSplitOrMergeEnabledRequest request) throws ServiceException {
SetSplitOrMergeEnabledResponse.Builder response = SetSplitOrMergeEnabledResponse.newBuilder();
try {
server.checkInitialized();
boolean newValue = request.getEnabled();
for (MasterProtos.MasterSwitchType masterSwitchType : request.getSwitchTypesList()) {
MasterSwitchType switchType = convert(masterSwitchType);
boolean oldValue = server.isSplitOrMergeEnabled(switchType);
response.addPrevValue(oldValue);
if (server.cpHost != null) {
server.cpHost.preSetSplitOrMergeEnabled(newValue, switchType);
}
server.getSplitOrMergeTracker().setSplitOrMergeEnabled(newValue, switchType);
if (server.cpHost != null) {
server.cpHost.postSetSplitOrMergeEnabled(newValue, switchType);
}
}
} catch (IOException | KeeperException e) {
throw new ServiceException(e);
}
return response.build();
}
use of org.apache.hadoop.hbase.client.MasterSwitchType in project hbase by apache.
the class RequestConverter method buildSetSplitOrMergeEnabledRequest.
/**
* Creates a protocol buffer SetSplitOrMergeEnabledRequest
*
* @param enabled switch is enabled or not
* @param synchronous set switch sync?
* @param switchTypes see {@link org.apache.hadoop.hbase.client.MasterSwitchType}, it is
* a list.
* @return a SetSplitOrMergeEnabledRequest
*/
public static SetSplitOrMergeEnabledRequest buildSetSplitOrMergeEnabledRequest(boolean enabled, boolean synchronous, MasterSwitchType... switchTypes) {
SetSplitOrMergeEnabledRequest.Builder builder = SetSplitOrMergeEnabledRequest.newBuilder();
builder.setEnabled(enabled);
builder.setSynchronous(synchronous);
for (MasterSwitchType switchType : switchTypes) {
builder.addSwitchTypes(convert(switchType));
}
return builder.build();
}
Aggregations