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

View File

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

View File

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

View File

@ -559,7 +559,7 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility {
if (readOnProp != null){ if (readOnProp != null){
return Boolean.parseBoolean(readOnProp); return Boolean.parseBoolean(readOnProp);
} else { } 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.regionserver.HRegionServer;
import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.JVMClusterUtil; 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.ZKAssign;
import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKUtil;
import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher; import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
@ -184,11 +185,8 @@ public class TestDrainingServer {
final long regionCount = TEST_UTIL.getMiniHBaseCluster().countServedRegions(); final long regionCount = TEST_UTIL.getMiniHBaseCluster().countServedRegions();
// Let's get a copy of the regions today. // Let's get a copy of the regions today.
Collection<HRegion> regions = new ArrayList<HRegion>(); Collection<HRegion> regions = getRegions();
for (int i = 0; i < NB_SLAVES; i++) { LOG.info("All regions: " + regions);
HRegionServer hrs = TEST_UTIL.getMiniHBaseCluster().getRegionServer(i);
regions.addAll( hrs.getCopyOfOnlineRegionsSortedBySize().values() );
}
// Choose the draining server // Choose the draining server
HRegionServer drainingServer = TEST_UTIL.getMiniHBaseCluster().getRegionServer(0); HRegionServer drainingServer = TEST_UTIL.getMiniHBaseCluster().getRegionServer(0);
@ -229,8 +227,7 @@ public class TestDrainingServer {
Collection<HRegion> regionsAfter = Collection<HRegion> regionsAfter =
drainingServer.getCopyOfOnlineRegionsSortedBySize().values(); 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" + Assert.assertEquals("Test conditions are not met: regions were" +
" created/deleted during the test. ", " created/deleted during the test. ",
regionCount, TEST_UTIL.getMiniHBaseCluster().countServedRegions()); 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 { private static void waitForAllRegionsOnline() throws Exception {
// Wait for regions to come back on line again. // Wait for regions to come back on line again.
boolean done = false; boolean done = false;
while (!done) { while (!done) {
Thread.sleep(1); Thread.sleep(1);
@ -284,6 +289,8 @@ public class TestDrainingServer {
if (!rs.getRegionServer().getRegionsInTransitionInRS().isEmpty()) { if (!rs.getRegionServer().getRegionsInTransitionInRS().isEmpty()) {
done = false; 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() == return TEST_UTIL.getMiniHBaseCluster().countServedRegions() ==
(COUNT_OF_REGIONS + 1 /*catalog regions*/); (COUNT_OF_REGIONS + 1 /*catalog regions*/);
} }
} }