diff --git src/test/java/org/apache/hadoop/hbase/regionserver/TestCacheOnWriteInSchema.java src/test/java/org/apache/hadoop/hbase/regionserver/TestCacheOnWriteInSchema.java index 4e5aff6..46633e2 100644 --- src/test/java/org/apache/hadoop/hbase/regionserver/TestCacheOnWriteInSchema.java +++ src/test/java/org/apache/hadoop/hbase/regionserver/TestCacheOnWriteInSchema.java @@ -20,7 +20,7 @@ package org.apache.hadoop.hbase.regionserver; -import static org.junit.Assert.*; +import static org.junit.Assert.assertTrue; import java.io.IOException; import java.util.ArrayList; @@ -54,7 +54,6 @@ import org.apache.hadoop.hbase.io.hfile.TestHFileWriterV2; import org.apache.hadoop.hbase.regionserver.StoreFile.BloomType; import org.apache.hadoop.hbase.regionserver.wal.HLog; import org.apache.hadoop.hbase.util.Bytes; - import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -65,7 +64,7 @@ import org.junit.runners.Parameterized.Parameters; /** * Tests {@link HFile} cache-on-write functionality for data blocks, non-root - * index blocks, and Bloom filter blocks, as specified by the column family. + * index blocks, and Bloom filter blocks, as specified by the column family. */ @RunWith(Parameterized.class) @Category(MediumTests.class) @@ -122,7 +121,9 @@ public class TestCacheOnWriteInSchema { private final CacheOnWriteType cowType; private Configuration conf; private final String testDescription; + private HRegion region; private Store store; + private HLog hlog; private FileSystem fs; public TestCacheOnWriteInSchema(CacheOnWriteType cowType) { @@ -163,13 +164,15 @@ public class TestCacheOnWriteInSchema { Path oldLogDir = new Path(basedir, HConstants.HREGION_OLDLOGDIR_NAME); fs.delete(logdir, true); HRegionInfo info = new HRegionInfo(htd.getName(), null, null, false); - HLog hlog = new HLog(fs, logdir, oldLogDir, conf); - HRegion region = new HRegion(basedir, hlog, fs, conf, info, htd, null); + hlog = new HLog(fs, logdir, oldLogDir, conf); + region = new HRegion(basedir, hlog, fs, conf, info, htd, null); store = new Store(basedir, region, hcd, fs, conf); } @After - public void tearDown() { + public void tearDown() throws IOException { + region.close(); + hlog.close(); try { fs.delete(new Path(DIR), true); } catch (IOException e) { @@ -189,7 +192,7 @@ public class TestCacheOnWriteInSchema { } private void readStoreFile(Path path) throws IOException { - CacheConfig cacheConf = store.getCacheConfig(); + CacheConfig cacheConf = store.getCacheConfig(); BlockCache cache = cacheConf.getBlockCache(); StoreFile sf = new StoreFile(fs, path, conf, cacheConf, BloomType.ROWCOL, null);