yihua commented on code in PR #18439:
URL: https://github.com/apache/hudi/pull/18439#discussion_r3271386303


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/StorageBasedLockProvider.java:
##########
@@ -346,9 +352,24 @@ public synchronized boolean tryLock() {
         newLockData,
         latestLock.getRight());
     if (lockUpdateStatus.getLeft() != LockUpsertResult.SUCCESS) {
-      // failed to acquire the lock, indicates concurrent contention
       logInfoLockState(FAILED_TO_ACQUIRE);
-      
hoodieLockMetrics.ifPresent(HoodieLockMetrics::updateLockAcquirePreconditionFailureMetric);
+      switch (lockUpdateStatus.getLeft()) {
+        case ACQUIRED_BY_OTHERS:
+          // failed to acquire the lock, indicates concurrent contention
+          
hoodieLockMetrics.ifPresent(HoodieLockMetrics::updateLockAcquirePreconditionFailureMetric);
+          break;
+        case THROTTLED:
+          // The write was rejected; we did not acquire. Transient — caller 
may retry.
+          
hoodieLockMetrics.ifPresent(HoodieLockMetrics::updateLockStateUnknownMetric);

Review Comment:
   Let's add a new metric for "throttled"?



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/StorageBasedLockProvider.java:
##########
@@ -551,6 +625,12 @@ protected synchronized boolean renewLock() {
           
hoodieLockMetrics.ifPresent(HoodieLockMetrics::updateLockStateUnknownMetric);
           // Let heartbeat retry later.
           return true;
+        case THROTTLED:
+          // Throttling is transient, let the heartbeat retry on its next 
cycle.
+          logger.warn("Owner {}: Unable to renew lock due to throttling, will 
retry on next heartbeat.", ownerId);
+          
hoodieLockMetrics.ifPresent(HoodieLockMetrics::updateLockStateUnknownMetric);

Review Comment:
   Update throttled metric



-- 
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]

Reply via email to