HBASE-4651 ConcurrentModificationException might be thrown in

TestHCM.testConnectionUniqueness (Jinchao)


git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1188259 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2011-10-24 17:52:39 +00:00
parent a46a91cc36
commit e495e04c78
2 changed files with 5 additions and 23 deletions

View File

@ -399,6 +399,8 @@ Release 0.92.0 - Unreleased
HBASE-4492 TestRollingRestart fails intermittently (Ted Yu and Ram) HBASE-4492 TestRollingRestart fails intermittently (Ted Yu and Ram)
HBASE-4512 JVMClusterUtil throwing wrong exception when master thread cannot be created (Ram) HBASE-4512 JVMClusterUtil throwing wrong exception when master thread cannot be created (Ram)
HBASE-4479 TestMasterFailover failure in Hbase-0.92#17(Ram) HBASE-4479 TestMasterFailover failure in Hbase-0.92#17(Ram)
HBASE-4651 ConcurrentModificationException might be thrown in
TestHCM.testConnectionUniqueness (Jinchao)
IMPROVEMENTS IMPROVEMENTS
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack) HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)

View File

@ -105,15 +105,11 @@ public class TestHCM {
// to remove them, so the LRU strategy does not work. // to remove them, so the LRU strategy does not work.
configuration.set("someotherkey", String.valueOf(_randy.nextInt())); configuration.set("someotherkey", String.valueOf(_randy.nextInt()));
last = connection; last = connection;
LOG.info("Cache Size: " LOG.info("Cache Size: " + getHConnectionManagerCacheSize());
+ getHConnectionManagerCacheSize() + ", Valid Keys: "
+ getValidKeyCount());
Thread.sleep(100); Thread.sleep(100);
} }
Assert.assertEquals(1, Assert.assertEquals(1,
getHConnectionManagerCacheSize()); getHConnectionManagerCacheSize());
Assert.assertEquals(1,
getValidKeyCount());
} }
private static int getHConnectionManagerCacheSize() private static int getHConnectionManagerCacheSize()
@ -126,21 +122,6 @@ public class TestHCM {
return cache.size(); return cache.size();
} }
private static int getValidKeyCount() throws SecurityException,
NoSuchFieldException, IllegalArgumentException,
IllegalAccessException {
Field cacheField =
HConnectionManager.class.getDeclaredField("HBASE_INSTANCES");
cacheField.setAccessible(true);
Map<?, ?> cache = (Map<?, ?>) cacheField.get(null);
List<Object> keys = new ArrayList<Object>(cache.keySet());
Set<Object> values = new HashSet<Object>();
for (Object key : keys) {
values.add(cache.get(key));
}
return values.size();
}
/** /**
* Test that when we delete a location using the first row of a region * Test that when we delete a location using the first row of a region
* that we really delete it. * that we really delete it.
@ -220,8 +201,7 @@ public class TestHCM {
previousConnection = currentConnection; previousConnection = currentConnection;
LOG.info("The current HConnectionManager#HBASE_INSTANCES cache size is: " LOG.info("The current HConnectionManager#HBASE_INSTANCES cache size is: "
+ getHConnectionManagerCacheSize() + getHConnectionManagerCacheSize());
+ ", and the number of valid keys is: " + getValidKeyCount());
Thread.sleep(50); Thread.sleep(50);
} }
} }