HBASE-4307 race condition in CacheTestUtils (Li Pi)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1163476 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2011-08-31 03:05:05 +00:00
parent 547e9a60a1
commit 9a66fe79df
2 changed files with 7 additions and 1 deletions

View File

@ -227,6 +227,7 @@ Release 0.91.0 - Unreleased
HBASE-4290 HLogSplitter doesn't mark its MonitoredTask as complete in HBASE-4290 HLogSplitter doesn't mark its MonitoredTask as complete in
non-distributed case (todd) non-distributed case (todd)
HBASE-4303 HRegionInfo.toString has bad quoting (todd) HBASE-4303 HRegionInfo.toString has bad quoting (todd)
HBASE-4307 race condition in CacheTestUtils (Li Pi)
IMPROVEMENTS IMPROVEMENTS
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack) HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)

View File

@ -56,7 +56,12 @@ public class CacheTestUtils {
@Override @Override
public void doAnAction() throws Exception { public void doAnAction() throws Exception {
if (!blocksToTest.isEmpty()) { if (!blocksToTest.isEmpty()) {
HFileBlockPair ourBlock = blocksToTest.remove(); HFileBlockPair ourBlock = blocksToTest.poll();
//if we run out of blocks to test, then we should stop the tests.
if(ourBlock == null){
ctx.stop();
return;
}
toBeTested.cacheBlock(ourBlock.blockName, ourBlock.block); toBeTested.cacheBlock(ourBlock.blockName, ourBlock.block);
Cacheable retrievedBlock = toBeTested.getBlock(ourBlock.blockName, Cacheable retrievedBlock = toBeTested.getBlock(ourBlock.blockName,
false); false);