HBASE-20670 NPE in HMaster#isInMaintenanceMode
This commit is contained in:
parent
3ea999d95c
commit
409531209e
@ -2710,7 +2710,10 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
|
||||
* @return true if master is in maintenanceMode
|
||||
*/
|
||||
@Override
|
||||
public boolean isInMaintenanceMode() {
|
||||
public boolean isInMaintenanceMode() throws IOException {
|
||||
if (!isInitialized()) {
|
||||
throw new PleaseHoldException("Master is initializing");
|
||||
}
|
||||
return maintenanceModeTracker.isInMaintenanceMode();
|
||||
}
|
||||
|
||||
@ -3208,7 +3211,11 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
|
||||
* @return The state of the load balancer, or false if the load balancer isn't defined.
|
||||
*/
|
||||
public boolean isBalancerOn() {
|
||||
if (null == loadBalancerTracker || isInMaintenanceMode()) {
|
||||
try {
|
||||
if (null == loadBalancerTracker || isInMaintenanceMode()) {
|
||||
return false;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
return loadBalancerTracker.isBalancerOn();
|
||||
@ -3219,8 +3226,12 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
|
||||
* false is returned.
|
||||
*/
|
||||
public boolean isNormalizerOn() {
|
||||
return (null == regionNormalizerTracker || isInMaintenanceMode()) ?
|
||||
false: regionNormalizerTracker.isNormalizerOn();
|
||||
try {
|
||||
return (null == regionNormalizerTracker || isInMaintenanceMode()) ?
|
||||
false: regionNormalizerTracker.isNormalizerOn();
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3230,7 +3241,11 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
|
||||
* @return The state of the switch
|
||||
*/
|
||||
public boolean isSplitOrMergeEnabled(Admin.MasterSwitchType switchType) {
|
||||
if (null == splitOrMergeTracker || isInMaintenanceMode()) {
|
||||
try {
|
||||
if (null == splitOrMergeTracker || isInMaintenanceMode()) {
|
||||
return false;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
return splitOrMergeTracker.isSplitOrMergeEnabled(switchType);
|
||||
|
@ -1432,7 +1432,11 @@ public class MasterRpcServices extends RSRpcServices
|
||||
final RpcController controller,
|
||||
final IsInMaintenanceModeRequest request) throws ServiceException {
|
||||
IsInMaintenanceModeResponse.Builder response = IsInMaintenanceModeResponse.newBuilder();
|
||||
response.setInMaintenanceMode(master.isInMaintenanceMode());
|
||||
try {
|
||||
response.setInMaintenanceMode(master.isInMaintenanceMode());
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
return response.build();
|
||||
}
|
||||
|
||||
|
@ -341,15 +341,16 @@ public interface MasterServices extends Server {
|
||||
|
||||
/**
|
||||
* @return true if master is in maintanceMode
|
||||
* @throws IOException
|
||||
*/
|
||||
boolean isInMaintenanceMode();
|
||||
boolean isInMaintenanceMode() throws IOException;
|
||||
|
||||
/**
|
||||
* Abort a procedure.
|
||||
* @param procId ID of the procedure
|
||||
* @param mayInterruptIfRunning if the proc completed at least one step, should it be aborted?
|
||||
* @return true if aborted, false if procedure already completed or does not exist
|
||||
* @throws IOException
|
||||
* @throws IOException
|
||||
*/
|
||||
public boolean abortProcedure(final long procId, final boolean mayInterruptIfRunning)
|
||||
throws IOException;
|
||||
|
Loading…
x
Reference in New Issue
Block a user