This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/master/pr-20769-d97f98013b5adc56a3b23cf985e194b7a71b7319 in repository https://gitbox.apache.org/repos/asf/hudi.git
commit 40ea87502e765acc7a30b6052659f5244ff35c7d Author: voonhous <[email protected]> AuthorDate: Fri Nov 20 02:37:08 2026 +0000 refactor(io): use Lombok @Slf4j for loggers (#20769) Replace hand-declared SLF4J loggers in hudi-io (main and test) with Lombok @Slf4j: add the annotation, delete the field and the slf4j imports, and rename LOG to log. Covers FileIOUtils and TestHFileWriter. No behavior change. FileIOUtils.LOG was public; no class in the repo (Java or Scala, any module) referenced it, so no other file needed changes. Skipped (left hand-declared): - Registry: interface. - HoodieStorage: @PublicAPIClass; its public LOG field is inherited by out-of-tree storage implementations, so removing it is an API change. --- .../src/main/java/org/apache/hudi/io/util/FileIOUtils.java | 13 ++++++------- .../test/java/org/apache/hudi/io/hfile/TestHFileWriter.java | 11 +++++------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/hudi-io/src/main/java/org/apache/hudi/io/util/FileIOUtils.java b/hudi-io/src/main/java/org/apache/hudi/io/util/FileIOUtils.java index 2700ede0a4fa..8f04df0845d7 100644 --- a/hudi-io/src/main/java/org/apache/hudi/io/util/FileIOUtils.java +++ b/hudi-io/src/main/java/org/apache/hudi/io/util/FileIOUtils.java @@ -26,8 +26,7 @@ import org.apache.hudi.storage.HoodieStorage; import org.apache.hudi.storage.StoragePath; import org.apache.hudi.storage.StoragePathInfo; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import lombok.extern.slf4j.Slf4j; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; @@ -52,8 +51,8 @@ import java.util.stream.Collectors; /** * Bunch of utility methods for working with files and byte streams. */ +@Slf4j public class FileIOUtils { - public static final Logger LOG = LoggerFactory.getLogger(FileIOUtils.class); public static final long KB = 1024; public static void deleteDirectory(File directory) throws IOException { @@ -164,7 +163,7 @@ public class FileIOUtils { try { closeable.close(); } catch (IOException e) { - LOG.warn("Failed to close the closeable", e); + log.warn("Failed to close the closeable", e); } } @@ -183,7 +182,7 @@ public class FileIOUtils { if (!ignoreIOE) { throw new HoodieIOException("Failed to create file " + fullPath, e); } else { - LOG.warn("Failed to create file {}", fullPath, e); + log.warn("Failed to create file {}", fullPath, e); } } } @@ -241,13 +240,13 @@ public class FileIOUtils { try (InputStream is = storage.open(detailPath)) { return Option.of(FileIOUtils.readAsByteArray(is)); } catch (FileNotFoundException fnfe) { - LOG.debug("No file found at path {}", detailPath); + log.debug("No file found at path {}", detailPath); return Option.empty(); } catch (IOException e) { if (!ignoreIOE) { throw new HoodieIOException("Could not read commit details from " + detailPath, e); } else { - LOG.warn("Could not read commit details from {}", detailPath, e); + log.warn("Could not read commit details from {}", detailPath, e); } return Option.empty(); } diff --git a/hudi-io/src/test/java/org/apache/hudi/io/hfile/TestHFileWriter.java b/hudi-io/src/test/java/org/apache/hudi/io/hfile/TestHFileWriter.java index a206a76943b4..224ee7726d29 100644 --- a/hudi-io/src/test/java/org/apache/hudi/io/hfile/TestHFileWriter.java +++ b/hudi-io/src/test/java/org/apache/hudi/io/hfile/TestHFileWriter.java @@ -25,6 +25,7 @@ import org.apache.hudi.io.hfile.protobuf.generated.HFileProtos; import org.apache.hudi.io.util.IOUtils; import com.google.protobuf.CodedOutputStream; +import lombok.extern.slf4j.Slf4j; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.hbase.CellComparatorImpl; @@ -36,8 +37,6 @@ import org.apache.hadoop.hbase.io.hfile.HFileContextBuilder; import org.apache.hadoop.io.DataOutputBuffer; import org.apache.hadoop.io.WritableUtils; import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -69,8 +68,8 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +@Slf4j class TestHFileWriter { - private static final Logger LOG = LoggerFactory.getLogger(TestHFileWriter.class); private static final HFileContext CONTEXT = HFileContext.builder().build(); private static final String[] THREE_KEYS = {"key1", "key2", "key3"}; private static final byte[][] THREE_VALUES = {bytes("value1"), bytes("value2"), bytes("value3")}; @@ -142,7 +141,7 @@ class TestHFileWriter { validateHFileStructure(hfile); // 4. Validate consistency with HFileReader. validateConsistencyWithHFileReader(hfile); - LOG.info("All validations passed!"); + log.info("All validations passed!"); } @Test @@ -342,8 +341,8 @@ class TestHFileWriter { assertEquals(hbaseBlocks[0], nativeBlocks[0], "native vs HBase data block bytes"); assertEquals(hbaseBlocks[1], nativeBlocks[1], "native vs HBase root index bytes"); if (dataGolden != null) { - LOG.info("DATA_REGION_HEX={}", nativeBlocks[0]); - LOG.info("ROOT_INDEX_BLOCK_HEX={}", nativeBlocks[1]); + log.info("DATA_REGION_HEX={}", nativeBlocks[0]); + log.info("ROOT_INDEX_BLOCK_HEX={}", nativeBlocks[1]); assertEquals(dataGolden, nativeBlocks[0], "data block bytes changed (storage-format change)"); assertEquals(rootGolden, nativeBlocks[1], "root index bytes changed (storage-format change)"); }
