HBASE-2614 killing server in TestMasterTransitions causes NPEs and test deadlock

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@951652 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-06-05 05:22:33 +00:00
parent 9cacbb074c
commit 64c6a071d7
7 changed files with 22 additions and 14 deletions

View File

@ -373,6 +373,7 @@ Release 0.21.0 - Unreleased
HBASE-2657 TestTableResource is broken in trunk HBASE-2657 TestTableResource is broken in trunk
HBASE-2662 TestScannerResource.testScannerResource broke in trunk HBASE-2662 TestScannerResource.testScannerResource broke in trunk
HBASE-2667 TestHLog.testSplit failing in trunk HBASE-2667 TestHLog.testSplit failing in trunk
HBASE-2614 killing server in TestMasterTransitions causes NPEs and test deadlock
IMPROVEMENTS IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable HBASE-1760 Cleanup TODOs in HTable

View File

@ -589,6 +589,7 @@ abstract class BaseScanner extends Chore implements HConstants {
synchronized(scannerLock){ synchronized(scannerLock){
if (isAlive()) { if (isAlive()) {
super.interrupt(); super.interrupt();
LOG.info("Interrupted");
} }
} }
} }

View File

@ -447,6 +447,9 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
if (this.serverManager.numServers() == 0) { if (this.serverManager.numServers() == 0) {
startShutdown(); startShutdown();
break; break;
} else {
LOG.debug("Waiting on " +
this.serverManager.getServersToServerInfo().keySet().toString());
} }
} }
final HServerAddress root = this.regionManager.getRootRegionLocation(); final HServerAddress root = this.regionManager.getRootRegionLocation();

View File

@ -592,17 +592,8 @@ public class RegionManager implements HConstants {
* regions can shut down. * regions can shut down.
*/ */
public void stopScanners() { public void stopScanners() {
if (LOG.isDebugEnabled()) { this.rootScannerThread.interruptAndStop();
LOG.debug("telling root scanner to stop"); this.metaScannerThread.interruptAndStop();
}
rootScannerThread.interruptAndStop();
if (LOG.isDebugEnabled()) {
LOG.debug("telling meta scanner to stop");
}
metaScannerThread.interruptAndStop();
if (LOG.isDebugEnabled()) {
LOG.debug("meta and root scanners notified");
}
} }
/** Stop the region assigner */ /** Stop the region assigner */
@ -1152,7 +1143,8 @@ public class RegionManager implements HConstants {
*/ */
public void waitForRootRegionLocation() { public void waitForRootRegionLocation() {
synchronized (rootRegionLocation) { synchronized (rootRegionLocation) {
while (!master.isClosed() && rootRegionLocation.get() == null) { while (!master.getShutdownRequested().get() &&
!master.isClosed() && rootRegionLocation.get() == null) {
// rootRegionLocation will be filled in when we get an 'open region' // rootRegionLocation will be filled in when we get an 'open region'
// regionServerReport message from the HRegionServer that has been // regionServerReport message from the HRegionServer that has been
// allocated the ROOT region below. // allocated the ROOT region below.

View File

@ -1121,7 +1121,9 @@ public class HRegionServer implements HConstants, HRegionInterface,
public void abort() { public void abort() {
this.abortRequested = true; this.abortRequested = true;
this.reservedSpace.clear(); this.reservedSpace.clear();
if (this.metrics != null) {
LOG.info("Dump of metrics: " + this.metrics.toString()); LOG.info("Dump of metrics: " + this.metrics.toString());
}
stop(); stop();
} }

View File

@ -55,7 +55,12 @@ public class JVMClusterUtil {
* to be used. * to be used.
*/ */
public void waitForServerOnline() { public void waitForServerOnline() {
while (!regionServer.isOnline()) { // The server is marked online after the init method completes inside of
// the HRS#run method. HRS#init can fail for whatever region. In those
// cases, we'll jump out of the run without setting online flag. Check
// stopRequested so we don't wait here a flag that will never be flipped.
while (!this.regionServer.isOnline() &&
!this.regionServer.isStopRequested()) {
try { try {
Thread.sleep(1000); Thread.sleep(1000);
} catch (InterruptedException e) { } catch (InterruptedException e) {

View File

@ -74,6 +74,10 @@ public class TestMasterTransitions {
*/ */
@BeforeClass public static void beforeAllTests() throws Exception { @BeforeClass public static void beforeAllTests() throws Exception {
TEST_UTIL.getConfiguration().setBoolean("dfs.support.append", true); TEST_UTIL.getConfiguration().setBoolean("dfs.support.append", true);
// Parcel out the regions, don't give them out in big lumps. We've only
// a few in this test. Let a couple of cycles pass is more realistic and
// gives stuff a chance to work.
TEST_UTIL.getConfiguration().setInt("hbase.regions.percheckin", 2);
// Start a cluster of two regionservers. // Start a cluster of two regionservers.
TEST_UTIL.startMiniCluster(2); TEST_UTIL.startMiniCluster(2);
// Create a table of three families. This will assign a region. // Create a table of three families. This will assign a region.