Uh oh!
There was an error while loading. Please reload this page.
HBASE-27794: Tooling for parsing/reading the prefetch files list file - #5468
Conversation
Apache-HBase
commented
Oct 18, 2023
🎊 +1 overall
This message was automatically generated. |
wchevreuil
left a comment
There was a problem hiding this comment.
Thanks for adding this @Kota-SH ! I had a few nits.
Also, can we add a tool to parse the persistent cache map file and read the list of cached files from there? I think it would be good for troubleshooting if we could analyse the persistent cache file contents.
| server.getBlockCache().ifPresent(blockCache -> { | ||
| if (blockCache instanceof CombinedBlockCache) { | ||
| BlockCache l2 = ((CombinedBlockCache) blockCache).getSecondLevelCache(); | ||
| if (l2 instanceof BucketCache) { | ||
| if (((BucketCache) l2).isCachePersistenceEnabled()) { |
There was a problem hiding this comment.
Use the static method BucketCache.getBucketCacheFromCacheConfig for finding the bucket cache instance.
There was a problem hiding this comment.
Thanks for the feedback @wchevreuil, However, my idea is that we have RegionServer.getBlockCache(), so I added a getter (getBucketCacheIfPresent()) for the bucket cache as a property of the RS.
WDYT?
There was a problem hiding this comment.
It's fine to add the additional getter, but we should not duplicate code. This whole implementation is identical to BucketCache.getBucketCacheFromCacheConfig, so you should just call it inside your method.
| /** | ||
| * Get the list of prefetched files | ||
| */ | ||
| List<String> getPrefetchedFilesList(ServerName serverName) throws IOException; |
There was a problem hiding this comment.
Nit: let's call it "getCachedFilesList".
Apache-HBase
commented
Oct 18, 2023
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 18, 2023
🎊 +1 overall
This message was automatically generated. |
| Admin admin = TEST_UTIL.getAdmin(); | ||
| List<String> prefetchedFilesList = | ||
| admin.getPrefetchedFilesList(regionServingRS.getServerName()); | ||
| assertEquals(1, ((List<?>) prefetchedFilesList).size()); |
There was a problem hiding this comment.
Nit: (List<?>) Redundant cast can be removed as prefetchedFilesList type is List
Apache-HBase
commented
Oct 24, 2023
💔 -1 overall
This message was automatically generated. |
70e8c80 to
6e07f26CompareApache-HBase
commented
Oct 24, 2023
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 24, 2023
💔 -1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 24, 2023
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 25, 2023
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 25, 2023
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 25, 2023
💔 -1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 25, 2023
💔 -1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 25, 2023
💔 -1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 25, 2023
💔 -1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 26, 2023
💔 -1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 26, 2023
💔 -1 overall
This message was automatically generated. |
| CacheConfig cacheConfig = server.getRegions().get(0).getStores().get(0).getCacheConfig(); | ||
| BucketCache.getBucketCacheFromCacheConfig(cacheConfig).ifPresent(bucketCache -> { | ||
| if (bucketCache.isCachePersistenceEnabled()) { |
There was a problem hiding this comment.
Maybe we should encapsulate this in the BlockCache.
| public List<String> getCachedFilesList() throws IOException { | ||
| List<String> tmp = new ArrayList<>(); | ||
| File persistedFile = new File(persistencePath); | ||
| try (FileInputStream fis = new FileInputStream(persistedFile)) { | ||
| if (fis.skip(ProtobufMagic.lengthOfPBMagic()) != ProtobufMagic.lengthOfPBMagic()) { | ||
| throw new IOException( | ||
| "Incorrect number of bytes read while checking for protobuf magic number"); | ||
| } | ||
| BucketCacheProtos.BucketCacheEntry proto = | ||
| BucketCacheProtos.BucketCacheEntry.parseDelimitedFrom(fis); | ||
| tmp.addAll(proto.getPrefetchedFilesMap().keySet()); | ||
| } | ||
| return tmp; | ||
| } |
There was a problem hiding this comment.
So this would make sense for a standalone tool, but since we are implementing this whole thing as part of the RS RPC API, why don't we simply return the in-memory contents?
Apache-HBase
commented
Oct 30, 2023
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 30, 2023
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 30, 2023
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 31, 2023
💔 -1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 31, 2023
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 31, 2023
💔 -1 overall
This message was automatically generated. |
| public Map<String, Boolean> getFullyCachedFiles() { | ||
| return fullyCachedFiles; | ||
| public Optional<Map<String, Boolean>> getFullyCachedFiles() { |
There was a problem hiding this comment.
nit: mark with Override annotation.
Apache-HBase
commented
Oct 31, 2023
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 31, 2023
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 31, 2023
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Oct 31, 2023
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Nov 1, 2023
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Nov 1, 2023
🎊 +1 overall
This message was automatically generated. |
…#5468) Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org>
…#5468) Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org>
…apache#5468) Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org> (cherry picked from commit fa4c896)
…apache#5468) Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org> (cherry picked from commit fa4c896)
…apache#5468) Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org> (cherry picked from commit fa4c896)
…apache#5468) Signed-off-by: Wellingt
…ist file (apache#5468)" This reverts commit c37fba6.
…apache#5468) Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org>
…es list file (apache#5468) (apache#5491) Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org> (cherry picked from commit fa4c896) Change-Id: I2e96f4b8bccef4ca9ae518dfca2283e63ec07102
Jira: https://issues.apache.org/jira/browse/HBASE-27794