HBASE-7066 Some HMaster coprocessor exceptions are being swallowed in try catch blocks (Francis Liu)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1404146 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fb983be9e3
commit
756840a814
|
@ -426,7 +426,7 @@ public class LocalHBaseCluster {
|
||||||
/**
|
/**
|
||||||
* Shut down the mini HBase cluster
|
* Shut down the mini HBase cluster
|
||||||
*/
|
*/
|
||||||
public void shutdown() {
|
public void shutdown() throws IOException {
|
||||||
JVMClusterUtil.shutdown(this.masterThreads, this.regionThreads);
|
JVMClusterUtil.shutdown(this.masterThreads, this.regionThreads);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1256,7 +1256,7 @@ Server {
|
||||||
return balancerCutoffTime;
|
return balancerCutoffTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean balance() {
|
public boolean balance() throws IOException {
|
||||||
// if master not initialized, don't run balancer.
|
// if master not initialized, don't run balancer.
|
||||||
if (!this.initialized) {
|
if (!this.initialized) {
|
||||||
LOG.debug("Master has not been initialized, don't run balancer.");
|
LOG.debug("Master has not been initialized, don't run balancer.");
|
||||||
|
@ -1285,13 +1285,8 @@ Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.cpHost != null) {
|
if (this.cpHost != null) {
|
||||||
try {
|
if (this.cpHost.preBalance()) {
|
||||||
if (this.cpHost.preBalance()) {
|
LOG.debug("Coprocessor bypassing balancer request");
|
||||||
LOG.debug("Coprocessor bypassing balancer request");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} catch (IOException ioe) {
|
|
||||||
LOG.error("Error invoking master coprocessor preBalance()", ioe);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1326,12 +1321,7 @@ Server {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.cpHost != null) {
|
if (this.cpHost != null) {
|
||||||
try {
|
this.cpHost.postBalance();
|
||||||
this.cpHost.postBalance();
|
|
||||||
} catch (IOException ioe) {
|
|
||||||
// balancing already succeeded so don't change the result
|
|
||||||
LOG.error("Error invoking master coprocessor postBalance()", ioe);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return balancerRan;
|
return balancerRan;
|
||||||
|
@ -1339,7 +1329,11 @@ Server {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BalanceResponse balance(RpcController c, BalanceRequest request) throws ServiceException {
|
public BalanceResponse balance(RpcController c, BalanceRequest request) throws ServiceException {
|
||||||
return BalanceResponse.newBuilder().setBalancerRan(balance()).build();
|
try {
|
||||||
|
return BalanceResponse.newBuilder().setBalancerRan(balance()).build();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new ServiceException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum BalanceSwitchMode {
|
enum BalanceSwitchMode {
|
||||||
|
@ -2005,14 +1999,10 @@ Server {
|
||||||
return rsFatals;
|
return rsFatals;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shutdown() {
|
public void shutdown() throws IOException {
|
||||||
spanReceiverHost.closeReceivers();
|
spanReceiverHost.closeReceivers();
|
||||||
if (cpHost != null) {
|
if (cpHost != null) {
|
||||||
try {
|
cpHost.preShutdown();
|
||||||
cpHost.preShutdown();
|
|
||||||
} catch (IOException ioe) {
|
|
||||||
LOG.error("Error call master coprocessor preShutdown()", ioe);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (mxBean != null) {
|
if (mxBean != null) {
|
||||||
MBeanUtil.unregisterMBean(mxBean);
|
MBeanUtil.unregisterMBean(mxBean);
|
||||||
|
@ -2032,17 +2022,17 @@ Server {
|
||||||
@Override
|
@Override
|
||||||
public ShutdownResponse shutdown(RpcController controller, ShutdownRequest request)
|
public ShutdownResponse shutdown(RpcController controller, ShutdownRequest request)
|
||||||
throws ServiceException {
|
throws ServiceException {
|
||||||
shutdown();
|
try {
|
||||||
|
shutdown();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new ServiceException(e);
|
||||||
|
}
|
||||||
return ShutdownResponse.newBuilder().build();
|
return ShutdownResponse.newBuilder().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopMaster() {
|
public void stopMaster() throws IOException {
|
||||||
if (cpHost != null) {
|
if (cpHost != null) {
|
||||||
try {
|
cpHost.preStopMaster();
|
||||||
cpHost.preStopMaster();
|
|
||||||
} catch (IOException ioe) {
|
|
||||||
LOG.error("Error call master coprocessor preStopMaster()", ioe);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
stop("Stopped by " + Thread.currentThread().getName());
|
stop("Stopped by " + Thread.currentThread().getName());
|
||||||
}
|
}
|
||||||
|
@ -2050,7 +2040,11 @@ Server {
|
||||||
@Override
|
@Override
|
||||||
public StopMasterResponse stopMaster(RpcController controller, StopMasterRequest request)
|
public StopMasterResponse stopMaster(RpcController controller, StopMasterRequest request)
|
||||||
throws ServiceException {
|
throws ServiceException {
|
||||||
stopMaster();
|
try {
|
||||||
|
stopMaster();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new ServiceException(e);
|
||||||
|
}
|
||||||
return StopMasterResponse.newBuilder().build();
|
return StopMasterResponse.newBuilder().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,17 +18,21 @@
|
||||||
|
|
||||||
package org.apache.hadoop.hbase.master.balancer;
|
package org.apache.hadoop.hbase.master.balancer;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.Chore;
|
import org.apache.hadoop.hbase.Chore;
|
||||||
import org.apache.hadoop.hbase.master.HMaster;
|
import org.apache.hadoop.hbase.master.HMaster;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chore that will call HMaster.balance{@link org.apache.hadoop.hbase.master.HMaster#balance()} when
|
* Chore that will call HMaster.balance{@link org.apache.hadoop.hbase.master.HMaster#balance()} when
|
||||||
* needed.
|
* needed.
|
||||||
*/
|
*/
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
public class BalancerChore extends Chore {
|
public class BalancerChore extends Chore {
|
||||||
|
private static final Log LOG = LogFactory.getLog(BalancerChore.class);
|
||||||
private final HMaster master;
|
private final HMaster master;
|
||||||
|
|
||||||
public BalancerChore(HMaster master) {
|
public BalancerChore(HMaster master) {
|
||||||
|
@ -40,6 +44,10 @@ public class BalancerChore extends Chore {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void chore() {
|
protected void chore() {
|
||||||
master.balance();
|
try {
|
||||||
|
master.balance();
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
LOG.error("Error invoking balancer", ioe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,7 +222,7 @@ public class JVMClusterUtil {
|
||||||
* @param regionservers
|
* @param regionservers
|
||||||
*/
|
*/
|
||||||
public static void shutdown(final List<MasterThread> masters,
|
public static void shutdown(final List<MasterThread> masters,
|
||||||
final List<RegionServerThread> regionservers) {
|
final List<RegionServerThread> regionservers) throws IOException {
|
||||||
LOG.debug("Shutting down HBase Cluster");
|
LOG.debug("Shutting down HBase Cluster");
|
||||||
if (masters != null) {
|
if (masters != null) {
|
||||||
// Do backups first.
|
// Do backups first.
|
||||||
|
|
Loading…
Reference in New Issue