HBASE-4722 TestGlobalMemStoreSize has started failing; commit some extra logging to help debug whats going on up on jenkins

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1196464 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-11-02 06:12:38 +00:00
parent 1b63b76e69
commit 3fab67a8b5
1 changed files with 19 additions and 11 deletions

View File

@ -32,6 +32,7 @@ import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.regionserver.HRegion; import org.apache.hadoop.hbase.regionserver.HRegion;
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.junit.Test; import org.junit.Test;
/** /**
@ -40,9 +41,7 @@ import org.junit.Test;
*/ */
public class TestGlobalMemStoreSize { public class TestGlobalMemStoreSize {
private final Log LOG = LogFactory.getLog(this.getClass().getName()); private final Log LOG = LogFactory.getLog(this.getClass().getName());
private static final HBaseTestingUtility UTIL = new HBaseTestingUtility(); private static int regionServerNum = 4;
private static int regionServerNum =4;
private static int regionNum = 16; private static int regionNum = 16;
// total region num = region num + root and meta regions // total region num = region num + root and meta regions
private static int totalRegionNum = regionNum+2; private static int totalRegionNum = regionNum+2;
@ -80,24 +79,33 @@ public class TestGlobalMemStoreSize {
for (HRegionServer server : getOnlineRegionServers()) { for (HRegionServer server : getOnlineRegionServers()) {
long globalMemStoreSize = 0; long globalMemStoreSize = 0;
for(HRegionInfo regionInfo : server.getOnlineRegions()) { for (HRegionInfo regionInfo : server.getOnlineRegions()) {
globalMemStoreSize += globalMemStoreSize +=
server.getFromOnlineRegions(regionInfo.getEncodedName()). server.getFromOnlineRegions(regionInfo.getEncodedName()).
getMemstoreSize().get(); getMemstoreSize().get();
} }
assertEquals(server.getRegionServerAccounting().getGlobalMemstoreSize(), assertEquals(server.getRegionServerAccounting().getGlobalMemstoreSize(),
globalMemStoreSize); globalMemStoreSize);
} }
// check the global memstore size after flush // check the global memstore size after flush
LOG.info("Starting flushes");
int i = 0;
for (HRegionServer server : getOnlineRegionServers()) { for (HRegionServer server : getOnlineRegionServers()) {
for(HRegionInfo regionInfo : server.getOnlineRegions()) { for (HRegionInfo regionInfo : server.getOnlineRegions()) {
HRegion region= HRegion r = server.getFromOnlineRegions(regionInfo.getEncodedName());
server.getFromOnlineRegions(regionInfo.getEncodedName()); LOG.info("Flushing " + r.toString());
region.flushcache(); r.flushcache();
} }
assertEquals(server.getRegionServerAccounting().getGlobalMemstoreSize(), LOG.info("Post flush on " + server.getServerName());
0); long now = System.currentTimeMillis();
long timeout = now + 3000;
while(server.getRegionServerAccounting().getGlobalMemstoreSize() != 0 &&
timeout < System.currentTimeMillis()) {
Threads.sleep(10);
}
assertEquals("Server=" + server.getServerName() + ", i=" + i++, 0,
server.getRegionServerAccounting().getGlobalMemstoreSize());
} }
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();