wchevreuil commented on code in PR #5468:
URL: https://github.com/apache/hbase/pull/5468#discussion_r1373262752
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java:
##########
@@ -1984,4 +1984,19 @@ public static Optional<BucketCache>
getBucketCacheFromCacheConfig(CacheConfig ca
return Optional.empty();
}
+ 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;
+ }
Review 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?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]