Search in sources :

Example 1 with SetSplitOrMergeEnabledResponse

use of org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetSplitOrMergeEnabledResponse 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 {
        master.checkInitialized();
        boolean newValue = request.getEnabled();
        for (MasterProtos.MasterSwitchType masterSwitchType : request.getSwitchTypesList()) {
            MasterSwitchType switchType = convert(masterSwitchType);
            boolean oldValue = master.isSplitOrMergeEnabled(switchType);
            response.addPrevValue(oldValue);
            boolean bypass = false;
            if (master.cpHost != null) {
                bypass = master.cpHost.preSetSplitOrMergeEnabled(newValue, switchType);
            }
            if (!bypass) {
                master.getSplitOrMergeTracker().setSplitOrMergeEnabled(newValue, switchType);
            }
            if (master.cpHost != null) {
                master.cpHost.postSetSplitOrMergeEnabled(newValue, switchType);
            }
        }
    } catch (IOException e) {
        throw new ServiceException(e);
    } catch (KeeperException e) {
        throw new ServiceException(e);
    }
    return response.build();
}
Also used : MasterSwitchType(org.apache.hadoop.hbase.client.MasterSwitchType) ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException) SetSplitOrMergeEnabledResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetSplitOrMergeEnabledResponse) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) KeeperException(org.apache.zookeeper.KeeperException)

Aggregations

IOException (java.io.IOException)1 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)1 MasterSwitchType (org.apache.hadoop.hbase.client.MasterSwitchType)1 ServiceException (org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException)1 SetSplitOrMergeEnabledResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetSplitOrMergeEnabledResponse)1 KeeperException (org.apache.zookeeper.KeeperException)1