HBASE-17590 Drop cache hint should work on store file write path (Ashu Pachauri)
Signed-off-by: Gary Helmling <garyh@apache.org>
This commit is contained in:
parent
a404bfa0c2
commit
a373445730
|
@ -620,6 +620,7 @@ public class StoreFile {
|
||||||
private InetSocketAddress[] favoredNodes;
|
private InetSocketAddress[] favoredNodes;
|
||||||
private HFileContext fileContext;
|
private HFileContext fileContext;
|
||||||
private TimeRangeTracker trt;
|
private TimeRangeTracker trt;
|
||||||
|
private boolean shouldDropCacheBehind;
|
||||||
|
|
||||||
public WriterBuilder(Configuration conf, CacheConfig cacheConf,
|
public WriterBuilder(Configuration conf, CacheConfig cacheConf,
|
||||||
FileSystem fs) {
|
FileSystem fs) {
|
||||||
|
@ -698,10 +699,11 @@ public class StoreFile {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WriterBuilder withShouldDropCacheBehind(boolean shouldDropCacheBehind/*NOT USED!!*/) {
|
public WriterBuilder withShouldDropCacheBehind(boolean shouldDropCacheBehind) {
|
||||||
// TODO: HAS NO EFFECT!!! FIX!!
|
this.shouldDropCacheBehind = shouldDropCacheBehind;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a store file writer. Client is responsible for closing file when
|
* Create a store file writer. Client is responsible for closing file when
|
||||||
* done. If metadata, add BEFORE closing using
|
* done. If metadata, add BEFORE closing using
|
||||||
|
@ -732,7 +734,8 @@ public class StoreFile {
|
||||||
comparator = KeyValue.COMPARATOR;
|
comparator = KeyValue.COMPARATOR;
|
||||||
}
|
}
|
||||||
return new Writer(fs, filePath,
|
return new Writer(fs, filePath,
|
||||||
conf, cacheConf, comparator, bloomType, maxKeyCount, favoredNodes, fileContext, trt);
|
conf, cacheConf, comparator, bloomType, maxKeyCount, favoredNodes, fileContext,
|
||||||
|
shouldDropCacheBehind, trt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -831,16 +834,17 @@ public class StoreFile {
|
||||||
* for Bloom filter size in {@link HFile} format version 1.
|
* for Bloom filter size in {@link HFile} format version 1.
|
||||||
* @param favoredNodes
|
* @param favoredNodes
|
||||||
* @param fileContext - The HFile context
|
* @param fileContext - The HFile context
|
||||||
|
* @param shouldDropCacheBehind Drop pages written to page cache after writing the store file.
|
||||||
* @throws IOException problem writing to FS
|
* @throws IOException problem writing to FS
|
||||||
*/
|
*/
|
||||||
private Writer(FileSystem fs, Path path,
|
private Writer(FileSystem fs, Path path,
|
||||||
final Configuration conf,
|
final Configuration conf,
|
||||||
CacheConfig cacheConf,
|
CacheConfig cacheConf,
|
||||||
final KVComparator comparator, BloomType bloomType, long maxKeys,
|
final KVComparator comparator, BloomType bloomType, long maxKeys,
|
||||||
InetSocketAddress[] favoredNodes, HFileContext fileContext)
|
InetSocketAddress[] favoredNodes, HFileContext fileContext, boolean shouldDropCacheBehind)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
this(fs, path, conf, cacheConf, comparator, bloomType, maxKeys, favoredNodes, fileContext,
|
this(fs, path, conf, cacheConf, comparator, bloomType, maxKeys, favoredNodes, fileContext,
|
||||||
null);
|
shouldDropCacheBehind, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -854,6 +858,7 @@ public class StoreFile {
|
||||||
* for Bloom filter size in {@link HFile} format version 1.
|
* for Bloom filter size in {@link HFile} format version 1.
|
||||||
* @param favoredNodes
|
* @param favoredNodes
|
||||||
* @param fileContext - The HFile context
|
* @param fileContext - The HFile context
|
||||||
|
* @param shouldDropCacheBehind Drop pages written to page cache after writing the store file.
|
||||||
* @param trt Ready-made timetracker to use.
|
* @param trt Ready-made timetracker to use.
|
||||||
* @throws IOException problem writing to FS
|
* @throws IOException problem writing to FS
|
||||||
*/
|
*/
|
||||||
|
@ -862,7 +867,7 @@ public class StoreFile {
|
||||||
CacheConfig cacheConf,
|
CacheConfig cacheConf,
|
||||||
final KVComparator comparator, BloomType bloomType, long maxKeys,
|
final KVComparator comparator, BloomType bloomType, long maxKeys,
|
||||||
InetSocketAddress[] favoredNodes, HFileContext fileContext,
|
InetSocketAddress[] favoredNodes, HFileContext fileContext,
|
||||||
final TimeRangeTracker trt)
|
boolean shouldDropCacheBehind, final TimeRangeTracker trt)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
// If passed a TimeRangeTracker, use it. Set timeRangeTrackerSet so we don't destroy it.
|
// If passed a TimeRangeTracker, use it. Set timeRangeTrackerSet so we don't destroy it.
|
||||||
// TODO: put the state of the TRT on the TRT; i.e. make a read-only version (TimeRange) when
|
// TODO: put the state of the TRT on the TRT; i.e. make a read-only version (TimeRange) when
|
||||||
|
@ -874,6 +879,7 @@ public class StoreFile {
|
||||||
.withComparator(comparator)
|
.withComparator(comparator)
|
||||||
.withFavoredNodes(favoredNodes)
|
.withFavoredNodes(favoredNodes)
|
||||||
.withFileContext(fileContext)
|
.withFileContext(fileContext)
|
||||||
|
.withShouldDropCacheBehind(shouldDropCacheBehind)
|
||||||
.create();
|
.create();
|
||||||
|
|
||||||
this.kvComparator = comparator;
|
this.kvComparator = comparator;
|
||||||
|
|
Loading…
Reference in New Issue