commit 2550754f0ee834b955843a0df232ed9ec39a1314 Author: Nicolas Spiegelberg Date: 9 minutes ago HBASE-4932 Block cache can be mistakenly instantiated by tools Summary: disable block cache for HFile writers created for tools Test Plan: ran the following tests that call getWriterFactory test/java/org/apache/hadoop/hbase/io/hfile/TestHFile.java test/java/org/apache/hadoop/hbase/io/hfile/TestHFileBlockIndex.java test/java/org/apache/hadoop/hbase/io/hfile/TestHFilePerformance.java test/java/org/apache/hadoop/hbase/io/hfile/TestHFileSeek.java test/java/org/apache/hadoop/hbase/io/hfile/TestReseekTo.java test/java/org/apache/hadoop/hbase/io/hfile/TestSeekTo.java test/java/org/apache/hadoop/hbase/io/TestHalfStoreFileReader.java test/java/org/apache/hadoop/hbase/mapreduce/TestLoadIncrementalHFiles.java test/java/org/apache/hadoop/hbase/regionserver/TestHRegionServerBulkLoad.java test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplay.java Reviewers: dhruba, jgray, nspiegelberg, JIRA, mbautin Reviewed By: nspiegelberg CC: HBase Diffs Facebook Group, mbautin, khemani, nspiegelberg Differential Revision: 573 git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1210697 13f79535-47bb-0310-9956-ffa450edef68 diff --git src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java index 5882af9..dd60b7a 100644 --- src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java +++ src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java @@ -259,9 +259,14 @@ public class HFile { /** * Returns the factory to be used to create {@link HFile} writers. + * Disables block cache access for all writers created through the + * returned factory. */ - public static final WriterFactory getWriterFactory(Configuration conf) { - return HFile.getWriterFactory(conf, new CacheConfig(conf)); + public static final WriterFactory getWriterFactoryNoCache(Configuration + conf) { + Configuration tempConf = new Configuration(conf); + tempConf.setFloat(CacheConfig.HFILE_BLOCK_CACHE_SIZE_KEY, 0.0f); + return HFile.getWriterFactory(conf, new CacheConfig(tempConf)); } /** diff --git src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat.java src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat.java index 8c8e64e..ce1c45b 100644 --- src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat.java +++ src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat.java @@ -173,7 +173,7 @@ public class HFileOutputFormat extends FileOutputFormat