yihua commented on code in PR #11935:
URL: https://github.com/apache/hudi/pull/11935#discussion_r1757581531
##########
hudi-common/src/main/java/org/apache/hudi/io/storage/HoodieNativeAvroHFileReader.java:
##########
@@ -244,14 +248,32 @@ private static GenericRecord
getRecordFromKeyValue(KeyValue keyValue,
readerSchema);
}
- private synchronized HFileReader getSharedHFileReader() {
- try {
- if (!sharedHFileReader.isPresent()) {
- sharedHFileReader = Option.of(newHFileReader());
+ private byte[] getHFileMetaInfoFromCache(String key) throws IOException {
Review Comment:
The new logic always checks the `isMetaInfoLoaded` before getting the value.
##########
hudi-common/src/main/java/org/apache/hudi/io/storage/HoodieNativeAvroHFileReader.java:
##########
@@ -244,14 +248,32 @@ private static GenericRecord
getRecordFromKeyValue(KeyValue keyValue,
readerSchema);
}
- private synchronized HFileReader getSharedHFileReader() {
- try {
- if (!sharedHFileReader.isPresent()) {
- sharedHFileReader = Option.of(newHFileReader());
+ private byte[] getHFileMetaInfoFromCache(String key) throws IOException {
+ if (!PRELOADED_META_INFO_KEYS.contains(key)) {
+ throw new
IllegalStateException("HoodieNativeAvroHFileReader#getHFileMetaInfoFromCache"
+ + " should only be called on supported meta info keys; this key is
not supported: "
+ + key);
+ }
+ byte[] bytes = metaInfoMap.get(key);
+ if (bytes != null) {
+ return bytes;
+ }
+ loadAllMetaInfoIntoCache();
+ return metaInfoMap.get(key);
+ }
+
+ private synchronized void loadAllMetaInfoIntoCache() throws IOException {
+ // Load all meta info that are small into cache
Review Comment:
Addressed.
--
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]