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-20772-6ab019e87e977028e1b5a5744d9b7bf66dbd231e
in repository https://gitbox.apache.org/repos/asf/hudi.git

commit 5ec913f8754bfe1f130a74df6a523844cc10ac92
Author: voonhous <[email protected]>
AuthorDate: Fri Nov 20 09:09:51 2026 +0000

    refactor(aws): use Lombok @Slf4j for loggers (#20772)
    
    Replace the hand-declared protected static final SLF4J loggers in the
    DynamoDB lock providers with Lombok @Slf4j: add the annotation, drop
    the field and the org.slf4j imports, and rename LOG to log. Migrated
    (2 files): DynamoDBBasedLockProviderBase,
    DynamoDBBasedImplicitPartitionKeyLockProvider.
    
    Both fields were protected, but no other class referenced them: the
    implicit-partition-key subclass declared its own LOG (hiding the base
    one) and DynamoDBBasedLockProvider does not log. Each class keeps
    logging under its own name.
    
    No topic-preserved files, no category changes, no cross-module
    touches, no skipped files.
---
 ...amoDBBasedImplicitPartitionKeyLockProvider.java | 10 ++++-----
 .../lock/DynamoDBBasedLockProviderBase.java        | 26 ++++++++++------------
 2 files changed, 16 insertions(+), 20 deletions(-)

diff --git 
a/hudi-aws/src/main/java/org/apache/hudi/aws/transaction/lock/DynamoDBBasedImplicitPartitionKeyLockProvider.java
 
b/hudi-aws/src/main/java/org/apache/hudi/aws/transaction/lock/DynamoDBBasedImplicitPartitionKeyLockProvider.java
index 11fd1ba7ec58..a17210758ea4 100644
--- 
a/hudi-aws/src/main/java/org/apache/hudi/aws/transaction/lock/DynamoDBBasedImplicitPartitionKeyLockProvider.java
+++ 
b/hudi-aws/src/main/java/org/apache/hudi/aws/transaction/lock/DynamoDBBasedImplicitPartitionKeyLockProvider.java
@@ -24,8 +24,7 @@ import org.apache.hudi.common.util.StringUtils;
 import org.apache.hudi.common.util.hash.HashID;
 import org.apache.hudi.storage.StorageConfiguration;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
 import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
 
 import javax.annotation.concurrent.NotThreadSafe;
@@ -38,10 +37,9 @@ import static org.apache.hudi.common.fs.FSUtils.s3aToS3;
  * It implicitly derives the partition key from the hudi table name and hudi 
table base path
  * available in the lock configuration.
  */
+@Slf4j
 @NotThreadSafe
 public class DynamoDBBasedImplicitPartitionKeyLockProvider extends 
DynamoDBBasedLockProviderBase {
-  protected static final Logger LOG = 
LoggerFactory.getLogger(DynamoDBBasedImplicitPartitionKeyLockProvider.class);
-
   private final String normalizedHudiTableBasePath;
 
   public DynamoDBBasedImplicitPartitionKeyLockProvider(final LockConfiguration 
lockConfiguration, final StorageConfiguration<?> conf) {
@@ -75,14 +73,14 @@ public class DynamoDBBasedImplicitPartitionKeyLockProvider 
extends DynamoDBBased
   public static String derivePartitionKey(String hudiTableBasePath) {
     String normalized = normalizeBasePathForLocking(hudiTableBasePath);
     String partitionKey = HashID.generateXXHashAsString(normalized, 
HashID.Size.BITS_64);
-    LOG.info("The DynamoDB partition key of the lock provider for the base 
path {} (normalized: {}) is {}",
+    log.info("The DynamoDB partition key of the lock provider for the base 
path {} (normalized: {}) is {}",
         hudiTableBasePath, normalized, partitionKey);
     // Releases before this change hashed s3aToS3(basePath) directly. When the 
canonical form
     // differs, this writer has moved to a new lock row and cannot exclude a 
writer still running
     // the old code, so say so loudly rather than leaving it to be inferred 
from the INFO line.
     String legacyForm = s3aToS3(hudiTableBasePath);
     if (!legacyForm.equals(normalized)) {
-      LOG.warn("DynamoDB partition key for base path {} moved from {} to {}. 
Every writer of this "
+      log.warn("DynamoDB partition key for base path {} moved from {} to {}. 
Every writer of this "
               + "table must be upgraded together; a writer still on the 
previous release locks on "
               + "the old partition key and will NOT be excluded by this one.",
           hudiTableBasePath,
diff --git 
a/hudi-aws/src/main/java/org/apache/hudi/aws/transaction/lock/DynamoDBBasedLockProviderBase.java
 
b/hudi-aws/src/main/java/org/apache/hudi/aws/transaction/lock/DynamoDBBasedLockProviderBase.java
index b99639f24c39..e6542f85b1b8 100644
--- 
a/hudi-aws/src/main/java/org/apache/hudi/aws/transaction/lock/DynamoDBBasedLockProviderBase.java
+++ 
b/hudi-aws/src/main/java/org/apache/hudi/aws/transaction/lock/DynamoDBBasedLockProviderBase.java
@@ -34,8 +34,7 @@ import 
com.amazonaws.services.dynamodbv2.AmazonDynamoDBLockClientOptions;
 import com.amazonaws.services.dynamodbv2.LockItem;
 import com.amazonaws.services.dynamodbv2.model.LockNotGrantedException;
 import lombok.Getter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
 import software.amazon.awssdk.regions.Region;
 import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
 import software.amazon.awssdk.services.dynamodb.model.AttributeDefinition;
@@ -65,11 +64,10 @@ import static 
org.apache.hudi.config.DynamoDbBasedLockConfig.DYNAMODB_LOCK_WRITE
  * A DynamoDB based lock. This {@link LockProvider} implementation allows to 
lock table operations
  * using DynamoDB. Users need to have access to AWS DynamoDB to be able to use 
this lock.
  */
+@Slf4j
 @NotThreadSafe
 public abstract class DynamoDBBasedLockProviderBase implements 
LockProvider<LockItem> {
 
-  protected static final Logger LOG = 
LoggerFactory.getLogger(DynamoDBBasedLockProviderBase.class);
-
   protected static final String DYNAMODB_ATTRIBUTE_NAME = "key";
 
   protected final DynamoDbBasedLockConfig dynamoDbBasedLockConfig;
@@ -109,13 +107,13 @@ public abstract class DynamoDBBasedLockProviderBase 
implements LockProvider<Lock
 
   @Override
   public boolean tryLock(long time, TimeUnit unit) {
-    LOG.info(generateLogStatement(LockState.ACQUIRING, 
generateLogSuffixString()));
+    log.info(generateLogStatement(LockState.ACQUIRING, 
generateLogSuffixString()));
     try {
       lock = 
client.acquireLock(AcquireLockOptions.builder(dynamoDBPartitionKey)
           .withAdditionalTimeToWaitForLock(time)
           .withTimeUnit(TimeUnit.MILLISECONDS)
           .build());
-      LOG.info(generateLogStatement(LockState.ACQUIRED, 
generateLogSuffixString()));
+      log.info(generateLogStatement(LockState.ACQUIRED, 
generateLogSuffixString()));
     } catch (InterruptedException e) {
       throw new 
HoodieLockException(generateLogStatement(LockState.FAILED_TO_ACQUIRE, 
generateLogSuffixString()), e);
     } catch (LockNotGrantedException e) {
@@ -127,15 +125,15 @@ public abstract class DynamoDBBasedLockProviderBase 
implements LockProvider<Lock
   @Override
   public void unlock() {
     try {
-      LOG.info(generateLogStatement(LockState.RELEASING, 
generateLogSuffixString()));
+      log.info(generateLogStatement(LockState.RELEASING, 
generateLogSuffixString()));
       if (lock == null) {
         return;
       }
       if (!client.releaseLock(lock)) {
-        LOG.info("The lock has already been stolen");
+        log.info("The lock has already been stolen");
       }
       lock = null;
-      LOG.info(generateLogStatement(LockState.RELEASED, 
generateLogSuffixString()));
+      log.info(generateLogStatement(LockState.RELEASED, 
generateLogSuffixString()));
     } catch (Exception e) {
       throw new 
HoodieLockException(generateLogStatement(LockState.FAILED_TO_RELEASE, 
generateLogSuffixString()), e);
     }
@@ -146,17 +144,17 @@ public abstract class DynamoDBBasedLockProviderBase 
implements LockProvider<Lock
     try {
       if (lock != null) {
         if (!client.releaseLock(lock)) {
-          LOG.info("The lock has already been stolen");
+          log.info("The lock has already been stolen");
         }
         lock = null;
       }
     } catch (Exception e) {
-      LOG.error(generateLogStatement(LockState.FAILED_TO_RELEASE, 
generateLogSuffixString()));
+      log.error(generateLogStatement(LockState.FAILED_TO_RELEASE, 
generateLogSuffixString()));
     } finally {
       try {
         this.client.close();
       } catch (Exception ex) {
-        LOG.warn("Failed to close AmazonDynamoDBLockClient after failed lock 
release", ex);
+        log.warn("Failed to close AmazonDynamoDBLockClient after failed lock 
release", ex);
       }
     }
   }
@@ -203,7 +201,7 @@ public abstract class DynamoDBBasedLockProviderBase 
implements LockProvider<Lock
         .billingMode(billingMode);
     dynamoDB.createTable(createTableRequestBuilder.build());
 
-    LOG.info("Creating dynamoDB table {}, waiting for table to be active", 
tableName);
+    log.info("Creating dynamoDB table {}, waiting for table to be active", 
tableName);
     try {
 
       DynamoTableUtils.waitUntilActive(dynamoDB, tableName, 
dynamoDbBasedLockConfig.getInt(DYNAMODB_LOCK_TABLE_CREATION_TIMEOUT), 20 * 
1000);
@@ -212,7 +210,7 @@ public abstract class DynamoDBBasedLockProviderBase 
implements LockProvider<Lock
     } catch (InterruptedException e) {
       throw new HoodieLockException("Thread interrupted while waiting for 
dynamoDB table to turn active", e);
     }
-    LOG.info("Created dynamoDB table {}", tableName);
+    log.info("Created dynamoDB table {}", tableName);
   }
 
   protected String generateLogSuffixString() {

Reply via email to