HBASE-8957 TestDrainingServer. testDrainingServerWithAbort fails

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1504005 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2013-07-17 05:36:42 +00:00
parent 00175ae834
commit 549a152a38
5 changed files with 28 additions and 32 deletions

View File

@ -783,8 +783,7 @@ public class ZKAssign {
throws KeeperException {
String encoded = region.getEncodedName();
if(LOG.isDebugEnabled()) {
LOG.debug(zkw.prefix("Attempting to transition node " +
HRegionInfo.prettyPrint(encoded) +
LOG.debug(zkw.prefix("Transitioning " + HRegionInfo.prettyPrint(encoded) +
" from " + beginState.toString() + " to " + endState.toString()));
}
@ -995,9 +994,7 @@ public class ZKAssign {
List<String> znodes =
ZKUtil.listChildrenAndWatchForNewChildren(zkw, zkw.assignmentZNode);
if (znodes != null && !znodes.isEmpty()) {
for (String znode : znodes) {
LOG.debug("ZK RIT -> " + znode);
}
LOG.debug("Waiting on RIT: " + znodes);
}
Thread.sleep(100);
}

View File

@ -1851,7 +1851,7 @@ public class AssignmentManager extends ZooKeeperListener {
LOG.debug("Server stopped/aborted; skipping assign of " + region);
return;
}
LOG.info("Assigning region " + region.getRegionNameAsString() +
LOG.info("Assigning " + region.getRegionNameAsString() +
" to " + plan.getDestination().toString());
// Transition RegionState to PENDING_OPEN
currentState = regionStates.updateRegionState(region,

View File

@ -1431,17 +1431,12 @@ public class HRegionServer implements ClientProtos.ClientService.BlockingInterfa
}
private HLog getMetaWAL() throws IOException {
if (this.hlogForMeta == null) {
final String logName
= HLogUtil.getHLogDirectoryName(this.serverNameFromMasterPOV.toString());
Path logdir = new Path(rootDir, logName);
if (LOG.isDebugEnabled()) LOG.debug("logdir=" + logdir);
this.hlogForMeta = HLogFactory.createMetaHLog(this.fs.getBackingFs(),
rootDir, logName, this.conf, getMetaWALActionListeners(),
this.serverNameFromMasterPOV.toString());
}
if (this.hlogForMeta != null) return this.hlogForMeta;
final String logName = HLogUtil.getHLogDirectoryName(this.serverNameFromMasterPOV.toString());
Path logdir = new Path(rootDir, logName);
if (LOG.isDebugEnabled()) LOG.debug("logdir=" + logdir);
this.hlogForMeta = HLogFactory.createMetaHLog(this.fs.getBackingFs(), rootDir, logName,
this.conf, getMetaWALActionListeners(), this.serverNameFromMasterPOV.toString());
return this.hlogForMeta;
}
@ -1483,7 +1478,7 @@ public class HRegionServer implements ClientProtos.ClientService.BlockingInterfa
MetaLogRoller tmpLogRoller = new MetaLogRoller(this, this);
String n = Thread.currentThread().getName();
Threads.setDaemonThreadRunning(tmpLogRoller.getThread(),
n + "MetaLogRoller", uncaughtExceptionHandler);
n + "-MetaLogRoller", uncaughtExceptionHandler);
this.metaHLogRoller = tmpLogRoller;
tmpLogRoller = null;
listeners.add(this.metaHLogRoller);
@ -1665,8 +1660,7 @@ public class HRegionServer implements ClientProtos.ClientService.BlockingInterfa
//currently, we don't care about the region as much as we care about the
//table.. (hence checking the tablename below)
//_ROOT_ and .META. regions have separate WAL.
if (regionInfo != null &&
regionInfo.isMetaTable()) {
if (regionInfo != null && regionInfo.isMetaTable()) {
return getMetaWAL();
}
return this.hlog;

View File

@ -559,7 +559,7 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility {
if (readOnProp != null){
return Boolean.parseBoolean(readOnProp);
} else {
return conf.getBoolean(propName, true);
return conf.getBoolean(propName, false);
}
}

View File

@ -35,6 +35,7 @@ import org.apache.hadoop.hbase.regionserver.HRegion;
import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.JVMClusterUtil;
import org.apache.hadoop.hbase.util.Threads;
import org.apache.hadoop.hbase.zookeeper.ZKAssign;
import org.apache.hadoop.hbase.zookeeper.ZKUtil;
import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
@ -184,11 +185,8 @@ public class TestDrainingServer {
final long regionCount = TEST_UTIL.getMiniHBaseCluster().countServedRegions();
// Let's get a copy of the regions today.
Collection<HRegion> regions = new ArrayList<HRegion>();
for (int i = 0; i < NB_SLAVES; i++) {
HRegionServer hrs = TEST_UTIL.getMiniHBaseCluster().getRegionServer(i);
regions.addAll( hrs.getCopyOfOnlineRegionsSortedBySize().values() );
}
Collection<HRegion> regions = getRegions();
LOG.info("All regions: " + regions);
// Choose the draining server
HRegionServer drainingServer = TEST_UTIL.getMiniHBaseCluster().getRegionServer(0);
@ -229,8 +227,7 @@ public class TestDrainingServer {
Collection<HRegion> regionsAfter =
drainingServer.getCopyOfOnlineRegionsSortedBySize().values();
LOG.info("Regions of drained server are: " + regionsAfter);
LOG.info("Regions of drained server: " + regionsAfter + ", all regions: " + getRegions());
Assert.assertEquals("Test conditions are not met: regions were" +
" created/deleted during the test. ",
regionCount, TEST_UTIL.getMiniHBaseCluster().countServedRegions());
@ -260,9 +257,17 @@ public class TestDrainingServer {
}
}
private Collection<HRegion> getRegions() {
Collection<HRegion> regions = new ArrayList<HRegion>();
for (int i = 0; i < NB_SLAVES; i++) {
HRegionServer hrs = TEST_UTIL.getMiniHBaseCluster().getRegionServer(i);
regions.addAll( hrs.getCopyOfOnlineRegionsSortedBySize().values() );
}
return regions;
}
private static void waitForAllRegionsOnline() throws Exception {
// Wait for regions to come back on line again.
boolean done = false;
while (!done) {
Thread.sleep(1);
@ -284,6 +289,8 @@ public class TestDrainingServer {
if (!rs.getRegionServer().getRegionsInTransitionInRS().isEmpty()) {
done = false;
}
// Sleep some else we spam the log w/ notice that servers are not yet alive.
Threads.sleep(10);
}
}
}
@ -292,6 +299,4 @@ public class TestDrainingServer {
return TEST_UTIL.getMiniHBaseCluster().countServedRegions() ==
(COUNT_OF_REGIONS + 1 /*catalog regions*/);
}
}