mattisonchao commented on code in PR #19844:
URL: https://github.com/apache/pulsar/pull/19844#discussion_r1139211831


##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/coordination/impl/ResourceLockImpl.java:
##########
@@ -74,22 +74,16 @@ public synchronized T getValue() {
     public synchronized CompletableFuture<Void> updateValue(T newValue) {
         // If there is an operation in progress, we're going to let it 
complete before attempting to
         // update the value
-        if (pendingOperationFuture.isDone()) {
-            pendingOperationFuture = CompletableFuture.completedFuture(null);
-        }
-
-        pendingOperationFuture = pendingOperationFuture.thenCompose(v -> {
-            synchronized (ResourceLockImpl.this) {
-                if (state != State.Valid) {
-                    return CompletableFuture.failedFuture(
-                            new IllegalStateException("Lock was not in valid 
state: " + state));
-                }
-
-                return acquire(newValue);
-            }
-        });
-
-        return pendingOperationFuture;
+        return pendingOperationFuture = 
pendingOperationFuture.exceptionally(ex -> null) // ignore all the exception

Review Comment:
   >I don't think we should ignore the exception here. If the pending 
revalidation fails, we are not the owner of the lock anymore and we shouldn't 
be updating the lock (which will anyway fail because the version has changed).
   
   Yes, you are right. Although `silentRevalidateOnce` can ensure the state 
will mark as `released` after the previous `revalidate` failed by `LockBusy` or 
`BadVersion`. But it can still have a chance to continue to revalidate by 
`updateValue` failed. Since the update failed doesn't mean the lock has 
expired. Therefore, I revert to original behaviour.



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