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
f037f230fd
commit
e4c06c120a
@ -87,14 +87,15 @@ public class StoreFileWriter implements CellSink, ShipperListener {
|
|||||||
* @param maxKeys the expected maximum number of keys to be added. Was used
|
* @param maxKeys the expected maximum number of keys to be added. Was used
|
||||||
* for Bloom filter size in {@link HFile} format version 1.
|
* for Bloom filter size in {@link HFile} format version 1.
|
||||||
* @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
|
||||||
*/
|
*/
|
||||||
StoreFileWriter(FileSystem fs, Path path, final Configuration conf, CacheConfig cacheConf,
|
StoreFileWriter(FileSystem fs, Path path, final Configuration conf, CacheConfig cacheConf,
|
||||||
final CellComparator comparator, BloomType bloomType, long maxKeys,
|
final CellComparator 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,7 +109,8 @@ public class StoreFileWriter implements CellSink, ShipperListener {
|
|||||||
* 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 trt Ready-made timetracker to use.
|
* @param shouldDropCacheBehind Drop pages written to page cache after writing the store file.
|
||||||
|
* @param trt Ready-made timetracker to use.
|
||||||
* @throws IOException problem writing to FS
|
* @throws IOException problem writing to FS
|
||||||
*/
|
*/
|
||||||
private StoreFileWriter(FileSystem fs, Path path,
|
private StoreFileWriter(FileSystem fs, Path path,
|
||||||
@ -116,7 +118,7 @@ public class StoreFileWriter implements CellSink, ShipperListener {
|
|||||||
CacheConfig cacheConf,
|
CacheConfig cacheConf,
|
||||||
final CellComparator comparator, BloomType bloomType, long maxKeys,
|
final CellComparator 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
|
||||||
@ -129,6 +131,7 @@ public class StoreFileWriter implements CellSink, ShipperListener {
|
|||||||
.withComparator(comparator)
|
.withComparator(comparator)
|
||||||
.withFavoredNodes(favoredNodes)
|
.withFavoredNodes(favoredNodes)
|
||||||
.withFileContext(fileContext)
|
.withFileContext(fileContext)
|
||||||
|
.withShouldDropCacheBehind(shouldDropCacheBehind)
|
||||||
.create();
|
.create();
|
||||||
|
|
||||||
generalBloomFilterWriter = BloomFilterFactory.createGeneralBloomAtWrite(
|
generalBloomFilterWriter = BloomFilterFactory.createGeneralBloomAtWrite(
|
||||||
@ -371,6 +374,7 @@ public class StoreFileWriter implements CellSink, ShipperListener {
|
|||||||
private InetSocketAddress[] favoredNodes;
|
private InetSocketAddress[] favoredNodes;
|
||||||
private HFileContext fileContext;
|
private HFileContext fileContext;
|
||||||
private TimeRangeTracker trt;
|
private TimeRangeTracker trt;
|
||||||
|
private boolean shouldDropCacheBehind;
|
||||||
|
|
||||||
public Builder(Configuration conf, CacheConfig cacheConf,
|
public Builder(Configuration conf, CacheConfig cacheConf,
|
||||||
FileSystem fs) {
|
FileSystem fs) {
|
||||||
@ -449,10 +453,11 @@ public class StoreFileWriter implements CellSink, ShipperListener {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder withShouldDropCacheBehind(boolean shouldDropCacheBehind/*NOT USED!!*/) {
|
public Builder 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
|
||||||
@ -490,7 +495,8 @@ public class StoreFileWriter implements CellSink, ShipperListener {
|
|||||||
comparator = CellComparator.COMPARATOR;
|
comparator = CellComparator.COMPARATOR;
|
||||||
}
|
}
|
||||||
return new StoreFileWriter(fs, filePath,
|
return new StoreFileWriter(fs, filePath,
|
||||||
conf, cacheConf, comparator, bloomType, maxKeyCount, favoredNodes, fileContext, trt);
|
conf, cacheConf, comparator, bloomType, maxKeyCount, favoredNodes, fileContext,
|
||||||
|
shouldDropCacheBehind, trt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user