voonhous commented on code in PR #13724: URL: https://github.com/apache/hudi/pull/13724#discussion_r2335897776
########## hudi-io/src/main/java/org/apache/hudi/io/hfile/CachingHFileReaderImpl.java: ########## @@ -0,0 +1,150 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hudi.io.hfile; + +import org.apache.hudi.io.SeekableDataInputStream; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.concurrent.TimeUnit; + +/** + * HFile reader implementation with integrated caching functionality. This extends BaseHFileReaderImpl and overrides the block instantiation method to add caching capabilities. + * <p> + * Uses a shared static cache across all instances to maximize cache hits when multiple readers access the same file. + */ +public class CachingHFileReaderImpl extends HFileReaderImpl { + + private static final Logger LOG = LoggerFactory.getLogger(CachingHFileReaderImpl.class); + + private static volatile HFileBlockCache GLOBAL_BLOCK_CACHE; + // Store first config to check against cache config + private static volatile HFileReaderConfig INITIAL_CONFIG; + private static final Object CACHE_LOCK = new Object(); + + private final String filePath; + + public CachingHFileReaderImpl(SeekableDataInputStream stream, long fileSize, String filePath) { + this(stream, fileSize, filePath, HFileReaderConfig.DEFAULT_BLOCK_CACHE_SIZE); + } Review Comment: Not used, removed. Have also removed all other unused constructors in this class. -- 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]
