From 9a66fe79df826ba787ce85df6393d2794c460576 Mon Sep 17 00:00:00 2001 From: Zhihong Yu Date: Wed, 31 Aug 2011 03:05:05 +0000 Subject: [PATCH] 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 --- CHANGES.txt | 1 + .../org/apache/hadoop/hbase/io/hfile/CacheTestUtils.java | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index d7cf0f51911..a07196c7ff5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -227,6 +227,7 @@ Release 0.91.0 - Unreleased HBASE-4290 HLogSplitter doesn't mark its MonitoredTask as complete in non-distributed case (todd) HBASE-4303 HRegionInfo.toString has bad quoting (todd) + HBASE-4307 race condition in CacheTestUtils (Li Pi) IMPROVEMENTS HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack) diff --git a/src/test/java/org/apache/hadoop/hbase/io/hfile/CacheTestUtils.java b/src/test/java/org/apache/hadoop/hbase/io/hfile/CacheTestUtils.java index 895a9fe7780..ed315039f0a 100644 --- a/src/test/java/org/apache/hadoop/hbase/io/hfile/CacheTestUtils.java +++ b/src/test/java/org/apache/hadoop/hbase/io/hfile/CacheTestUtils.java @@ -56,7 +56,12 @@ public class CacheTestUtils { @Override public void doAnAction() throws Exception { 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); Cacheable retrievedBlock = toBeTested.getBlock(ourBlock.blockName, false);