-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HBASE-28596 Optimise BucketCache usage upon regions splits/merges. #5906
Conversation
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
Change-Id: I510be0cb8041fead191f965178fd7336b6274352
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
Change-Id: Ib4454ed5de44ce35271e53a88caf7fce3b2d05ad
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, lack of comments and javadoc makes it a bit hard to review the changes...
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java
Show resolved
Hide resolved
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
Show resolved
Hide resolved
Change-Id: I970b6179aa4ccfe89dcd8eb7bb8eedbfc77037d5
🎊 +1 overall
This message was automatically generated. |
Change-Id: I6dd46a801a44d9da8a824d10d57b88fb3c8cf0da
Change-Id: Ie893a0ef25bedc252a475b0f80f13beb28861e62
Change-Id: I8c88c9dd0eeefbb276c6d5f29b7c485df5482f3c
Thanks for the initial review, I have added extra comments and javadocs to help with reviewing. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Change-Id: I94f27b3e5f6787a1bc159693805c0c8929a8fcea
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
Just checked on these latest failures, I believe those are unrelated flakeys. |
@Override | ||
public void close(boolean evictOnClose) throws IOException { | ||
if (closed.compareAndSet(false, true)) { | ||
if (evictOnClose && StoreFileInfo.isReference(this.reader.getPath())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need to check isReference here? We will only use HalfStoreFileReader when the store file is a reference file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think there's no need for this extra check, as we'll always have a reference with HalfStoreFileReader. Let me remove this.
@@ -244,6 +248,45 @@ public static int getMaxCachedBlocksByFile(Configuration conf) { | |||
return conf == null ? DEFAULT_MAX : conf.getInt("hbase.ui.blockcache.by.file.max", DEFAULT_MAX); | |||
} | |||
|
|||
/** | |||
* Similarly to HFileBlock.Writer.getBlockForCaching(), creates a HFileBlock instance without |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we share some common code between these two methods? Otherwise how can we align these two methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, let me work on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the most I could reuse here is the new HFIleContext part. The block builder portion is hard to reuse because in HFileBlock.Writer the parameters are calculated on the go, so any sort of reuse would require an awful lot of parameters.
@@ -45,7 +45,7 @@ public HFilePreadReader(ReaderContext context, HFileInfo fileInfo, CacheConfig c | |||
}); | |||
|
|||
// Prefetch file blocks upon open if requested | |||
if (cacheConf.shouldPrefetchOnOpen() && cacheIfCompactionsOff() && shouldCache.booleanValue()) { | |||
if (cacheConf.shouldPrefetchOnOpen() && shouldCache.booleanValue()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why removing cacheIfCompactionsOff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same reason as explained here: https://github.com/apache/hbase/pull/5906/files#r1606971440. We want the prefetch to run even for refs or links, the cache implementation should decide what to do with refs/links.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better add some comments to explain the history here?
public void close(boolean evictOnClose) throws IOException { | ||
if (closed.compareAndSet(false, true)) { | ||
if (evictOnClose && StoreFileInfo.isReference(this.reader.getPath())) { | ||
final HFileReaderImpl.HFileScannerImpl s = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually it is not a good idea to the implementation class directly at upper layer. Why we need to use HFileScannerImpl here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to seek to the split cell, in order to calculate offsets for the cache keys of referred file to evict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But there is a seekTo method in HFileScanner interface? I just mean why we need the cast here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need the HFileScannerImpl.getCurBlock for figuring out the offset.
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CombinedBlockCache.java
Show resolved
Hide resolved
Change-Id: If712a4310a8f651b2395dd233fec7f8430362da5
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
Change-Id: I480a6a4f062d1d57d8a432d93d9f9c4e62c9c826
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
Any further concerns, @Apache9 ? |
…5906) Signed-off-by: Tak Lon (Stephen) Wu <taklwu@apache.org> Reviewed-by: Duo Zhang <zhangduo@apache.org>
…5906) Signed-off-by: Tak Lon (Stephen) Wu <taklwu@apache.org> Reviewed-by: Duo Zhang <zhangduo@apache.org>
…pache#5906) Signed-off-by: Tak Lon (Stephen) Wu <taklwu@apache.org> Reviewed-by: Duo Zhang <zhangduo@apache.org> Change-Id: I6d6fc84c0e526cc1ed1c14072791b0bd5b9b92fa
No description provided.