HBASE-21568 Use CacheConfig.DISABLED where we don't expect to have blockcache running
This includes removing the "old way" of disabling blockcache in favor of the new API. Signed-off-by: Guanghao Zhang <zghao@apache.org>
This commit is contained in:
parent
f88224ee34
commit
67d6d5084c
|
@ -414,8 +414,6 @@ public class HFileOutputFormat2
|
|||
DataBlockEncoding encoding = overriddenEncoding;
|
||||
encoding = encoding == null ? datablockEncodingMap.get(tableAndFamily) : encoding;
|
||||
encoding = encoding == null ? DataBlockEncoding.NONE : encoding;
|
||||
Configuration tempConf = new Configuration(conf);
|
||||
tempConf.setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0.0f);
|
||||
HFileContextBuilder contextBuilder = new HFileContextBuilder()
|
||||
.withCompression(compression)
|
||||
.withChecksumType(HStore.getChecksumType(conf))
|
||||
|
@ -430,12 +428,12 @@ public class HFileOutputFormat2
|
|||
HFileContext hFileContext = contextBuilder.build();
|
||||
if (null == favoredNodes) {
|
||||
wl.writer =
|
||||
new StoreFileWriter.Builder(conf, new CacheConfig(tempConf), fs)
|
||||
new StoreFileWriter.Builder(conf, CacheConfig.DISABLED, fs)
|
||||
.withOutputDir(familydir).withBloomType(bloomType)
|
||||
.withComparator(CellComparator.getInstance()).withFileContext(hFileContext).build();
|
||||
} else {
|
||||
wl.writer =
|
||||
new StoreFileWriter.Builder(conf, new CacheConfig(tempConf), new HFileSystem(fs))
|
||||
new StoreFileWriter.Builder(conf, CacheConfig.DISABLED, new HFileSystem(fs))
|
||||
.withOutputDir(familydir).withBloomType(bloomType)
|
||||
.withComparator(CellComparator.getInstance()).withFileContext(hFileContext)
|
||||
.withFavoredNodes(favoredNodes).build();
|
||||
|
|
|
@ -356,9 +356,7 @@ public class HFile {
|
|||
*/
|
||||
public static final WriterFactory getWriterFactoryNoCache(Configuration
|
||||
conf) {
|
||||
Configuration tempConf = new Configuration(conf);
|
||||
tempConf.setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0.0f);
|
||||
return HFile.getWriterFactory(conf, new CacheConfig(tempConf));
|
||||
return HFile.getWriterFactory(conf, CacheConfig.DISABLED);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -309,7 +309,7 @@ public class HFilePrettyPrinter extends Configured implements Tool {
|
|||
return -2;
|
||||
}
|
||||
|
||||
HFile.Reader reader = HFile.createReader(fs, file, new CacheConfig(getConf()), true, getConf());
|
||||
HFile.Reader reader = HFile.createReader(fs, file, CacheConfig.DISABLED, true, getConf());
|
||||
|
||||
Map<byte[], byte[]> fileInfo = reader.loadFileInfo();
|
||||
|
||||
|
|
|
@ -710,7 +710,7 @@ public class LoadIncrementalHFiles extends Configured implements Tool {
|
|||
Path hfilePath = item.getFilePath();
|
||||
Optional<byte[]> first, last;
|
||||
try (HFile.Reader hfr = HFile.createReader(hfilePath.getFileSystem(getConf()), hfilePath,
|
||||
new CacheConfig(getConf()), true, getConf())) {
|
||||
CacheConfig.DISABLED, true, getConf())) {
|
||||
hfr.loadFileInfo();
|
||||
first = hfr.getFirstRowKey();
|
||||
last = hfr.getLastRowKey();
|
||||
|
@ -847,7 +847,7 @@ public class LoadIncrementalHFiles extends Configured implements Tool {
|
|||
throws IOException {
|
||||
Path hfile = hfileStatus.getPath();
|
||||
try (HFile.Reader reader =
|
||||
HFile.createReader(fs, hfile, new CacheConfig(getConf()), true, getConf())) {
|
||||
HFile.createReader(fs, hfile, CacheConfig.DISABLED, true, getConf())) {
|
||||
if (builder.getCompressionType() != reader.getFileContext().getCompression()) {
|
||||
builder.setCompressionType(reader.getFileContext().getCompression());
|
||||
LOG.info("Setting compression " + reader.getFileContext().getCompression().name() +
|
||||
|
@ -1083,7 +1083,7 @@ public class LoadIncrementalHFiles extends Configured implements Tool {
|
|||
private static void copyHFileHalf(Configuration conf, Path inFile, Path outFile,
|
||||
Reference reference, ColumnFamilyDescriptor familyDescriptor) throws IOException {
|
||||
FileSystem fs = inFile.getFileSystem(conf);
|
||||
CacheConfig cacheConf = new CacheConfig(conf);
|
||||
CacheConfig cacheConf = CacheConfig.DISABLED;
|
||||
HalfStoreFileReader halfReader = null;
|
||||
StoreFileWriter halfWriter = null;
|
||||
try {
|
||||
|
|
|
@ -134,7 +134,7 @@ public class CompressionTest {
|
|||
writer.appendFileInfo(Bytes.toBytes("compressioninfokey"), Bytes.toBytes("compressioninfoval"));
|
||||
writer.close();
|
||||
Cell cc = null;
|
||||
HFile.Reader reader = HFile.createReader(fs, path, new CacheConfig(conf), true, conf);
|
||||
HFile.Reader reader = HFile.createReader(fs, path, CacheConfig.DISABLED, true, conf);
|
||||
try {
|
||||
reader.loadFileInfo();
|
||||
HFileScanner scanner = reader.getScanner(false, true);
|
||||
|
|
|
@ -922,7 +922,7 @@ public class HBaseFsck extends Configured implements Closeable {
|
|||
// For all the stores in this column family.
|
||||
for (FileStatus storeFile : storeFiles) {
|
||||
HFile.Reader reader = HFile.createReader(fs, storeFile.getPath(),
|
||||
new CacheConfig(getConf()), true, getConf());
|
||||
CacheConfig.DISABLED, true, getConf());
|
||||
if ((reader.getFirstKey() != null)
|
||||
&& ((storeFirstKey == null) || (comparator.compare(storeFirstKey,
|
||||
((KeyValue.KeyOnlyKeyValue) reader.getFirstKey().get()).getKey()) > 0))) {
|
||||
|
@ -1025,8 +1025,7 @@ public class HBaseFsck extends Configured implements Closeable {
|
|||
byte[] start, end;
|
||||
HFile.Reader hf = null;
|
||||
try {
|
||||
CacheConfig cacheConf = new CacheConfig(getConf());
|
||||
hf = HFile.createReader(fs, hfile.getPath(), cacheConf, true, getConf());
|
||||
hf = HFile.createReader(fs, hfile.getPath(), CacheConfig.DISABLED, true, getConf());
|
||||
hf.loadFileInfo();
|
||||
Optional<Cell> startKv = hf.getFirstKey();
|
||||
start = CellUtil.cloneRow(startKv.get());
|
||||
|
|
|
@ -82,7 +82,7 @@ public class HFileCorruptionChecker {
|
|||
boolean quarantine) throws IOException {
|
||||
this.conf = conf;
|
||||
this.fs = FileSystem.get(conf);
|
||||
this.cacheConf = new CacheConfig(conf);
|
||||
this.cacheConf = CacheConfig.DISABLED;
|
||||
this.executor = executor;
|
||||
this.inQuarantineMode = quarantine;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue