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-20770-70b7a10c0d1e5f0a84cb678e925e7566b8e6b298
in repository https://gitbox.apache.org/repos/asf/hudi.git

commit 559a36f541aa5f273c1753b4bc7106ba77963747
Author: voonhous <[email protected]>
AuthorDate: Fri Nov 20 09:09:24 2026 +0000

    refactor(sync): use Lombok @Slf4j for loggers (#20770)
    
    Replace the hand-declared private static final SLF4J loggers in
    hudi-hive-sync with Lombok @Slf4j: add the annotation, drop the field
    and the org.slf4j imports, and rename LOG to log. Migrated (2 files):
    HiveDriverPool, HiveMetaStoreClientPool.
    
    No topic-preserved files, no category changes, no cross-module
    touches, no skipped files.
---
 .../org/apache/hudi/hive/util/HiveDriverPool.java    | 20 +++++++++-----------
 .../hudi/hive/util/HiveMetaStoreClientPool.java      | 16 +++++++---------
 2 files changed, 16 insertions(+), 20 deletions(-)

diff --git 
a/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/util/HiveDriverPool.java
 
b/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/util/HiveDriverPool.java
index 303af59e699c..7845b23229a5 100644
--- 
a/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/util/HiveDriverPool.java
+++ 
b/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/util/HiveDriverPool.java
@@ -22,12 +22,11 @@ import org.apache.hudi.exception.HoodieException;
 import org.apache.hudi.hive.HiveSyncConfig;
 import org.apache.hudi.hive.HoodieHiveSyncException;
 
+import lombok.extern.slf4j.Slf4j;
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.ql.Driver;
 import org.apache.hadoop.hive.ql.session.SessionState;
 import org.apache.hadoop.security.UserGroupInformation;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -56,10 +55,9 @@ import static 
org.apache.hudi.sync.common.HoodieSyncConfig.META_SYNC_DATABASE_NA
  * thread. The pool is gated behind {@code 
hoodie.datasource.hive_sync.batching.enabled}
  * and is constructed only for HiveQL sync mode.
  */
+@Slf4j
 public class HiveDriverPool implements AutoCloseable {
 
-  private static final Logger LOG = 
LoggerFactory.getLogger(HiveDriverPool.class);
-
   // Per-worker Driver construction has to be fast in practice (a few hundred 
ms
   // for the SessionState + Driver init). A 60s ceiling per worker leaves 
plenty of
   // headroom for a slow JVM warm-up but bounds the failure mode if the 
metastore
@@ -102,7 +100,7 @@ public class HiveDriverPool implements AutoCloseable {
       tearDown();
       throw new HoodieException("Failed to construct HiveDriverPool of size " 
+ size, e);
     }
-    LOG.info("Initialized HiveDriverPool with {} workers", size);
+    log.info("Initialized HiveDriverPool with {} workers", size);
   }
 
   /**
@@ -174,12 +172,12 @@ public class HiveDriverPool implements AutoCloseable {
     long start = System.currentTimeMillis();
     ParallelDispatch.Outcome outcome = dispatch.awaitOutcome();
     outcome.suppressed().forEach(e ->
-        LOG.warn("Additional SQL batch failed (suppressed in favor of first 
error)", e));
+        log.warn("Additional SQL batch failed (suppressed in favor of first 
error)", e));
 
     if (outcome.failed()) {
       throw new HoodieHiveSyncException("Failed in executing SQL", 
outcome.firstError());
     }
-    LOG.info("Completed {} SQL statements ({} cancelled) in {} ms across {} 
workers",
+    log.info("Completed {} SQL statements ({} cancelled) in {} ms across {} 
workers",
         outcome.completed(), outcome.cancelled(), System.currentTimeMillis() - 
start, size);
   }
 
@@ -208,7 +206,7 @@ public class HiveDriverPool implements AutoCloseable {
             try {
               worker.driver.close();
             } catch (Exception e) {
-              LOG.warn("Error closing pooled Driver", e);
+              log.warn("Error closing pooled Driver", e);
             }
             // close() releases the current query's resources but leaves the 
shutdown hook
             // Driver.compile() registered; only destroy() removes it. Without 
this the
@@ -218,20 +216,20 @@ public class HiveDriverPool implements AutoCloseable {
             try {
               worker.driver.destroy();
             } catch (Exception e) {
-              LOG.warn("Error destroying pooled Driver", e);
+              log.warn("Error destroying pooled Driver", e);
             }
           }
           if (worker.sessionState != null) {
             try {
               worker.sessionState.close();
             } catch (Exception e) {
-              LOG.warn("Error closing pooled SessionState", e);
+              log.warn("Error closing pooled SessionState", e);
             }
           }
           return null;
         }).get(30, TimeUnit.SECONDS);
       } catch (Exception e) {
-        LOG.warn("Error during pool worker shutdown", e);
+        log.warn("Error during pool worker shutdown", e);
       }
       worker.executor.shutdown();
       try {
diff --git 
a/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/util/HiveMetaStoreClientPool.java
 
b/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/util/HiveMetaStoreClientPool.java
index 7b2e04b348a0..65589571ca6a 100644
--- 
a/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/util/HiveMetaStoreClientPool.java
+++ 
b/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/util/HiveMetaStoreClientPool.java
@@ -21,11 +21,10 @@ package org.apache.hudi.hive.util;
 import org.apache.hudi.exception.HoodieException;
 import org.apache.hudi.hive.HiveSyncConfig;
 
+import lombok.extern.slf4j.Slf4j;
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.metastore.IMetaStoreClient;
 import org.apache.hadoop.hive.metastore.RetryingMetaStoreClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -59,10 +58,9 @@ import java.util.concurrent.atomic.AtomicInteger;
  * through {@code IMetaStoreClient.dropPartition} (Thrift), whereas 
ADD/UPDATE/TOUCH go
  * through the thread-bound Hive {@code Driver} and use {@code HiveDriverPool} 
instead.
  */
+@Slf4j
 public class HiveMetaStoreClientPool implements AutoCloseable {
 
-  private static final Logger LOG = 
LoggerFactory.getLogger(HiveMetaStoreClientPool.class);
-
   private final ArrayBlockingQueue<IMetaStoreClient> available;
   private final List<IMetaStoreClient> all;
   private final ExecutorService executor;
@@ -87,7 +85,7 @@ public class HiveMetaStoreClientPool implements AutoCloseable 
{
     this.all = new ArrayList<>(clients);
     this.available.addAll(clients);
     this.executor = Executors.newFixedThreadPool(size, new 
PoolThreadFactory());
-    LOG.info("Initialized IMetaStoreClient pool with {} clients", size);
+    log.info("Initialized IMetaStoreClient pool with {} clients", size);
   }
 
   private static List<IMetaStoreClient> buildClients(HiveSyncConfig config, 
int size) {
@@ -186,14 +184,14 @@ public class HiveMetaStoreClientPool implements 
AutoCloseable {
     long start = System.currentTimeMillis();
     ParallelDispatch.Outcome outcome = dispatch.awaitOutcome();
     outcome.suppressed().forEach(e ->
-        LOG.warn("Additional {} batch failed (suppressed in favor of first 
error)", description, e));
+        log.warn("Additional {} batch failed (suppressed in favor of first 
error)", description, e));
 
     if (outcome.failed()) {
-      LOG.error("{} dispatch aborted after first failure ({} batches 
cancelled)",
+      log.error("{} dispatch aborted after first failure ({} batches 
cancelled)",
           description, outcome.cancelled());
       throw outcome.firstError();
     }
-    LOG.info("Completed {} {} batches ({} cancelled) in {} ms across {} 
clients",
+    log.info("Completed {} {} batches ({} cancelled) in {} ms across {} 
clients",
         outcome.completed(), description, outcome.cancelled(),
         System.currentTimeMillis() - start, size);
   }
@@ -225,7 +223,7 @@ public class HiveMetaStoreClientPool implements 
AutoCloseable {
       try {
         client.close();
       } catch (Exception e) {
-        LOG.warn("Error closing pooled IMetaStoreClient", e);
+        log.warn("Error closing pooled IMetaStoreClient", e);
       }
     }
     available.clear();

Reply via email to