You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/09/21 05:24:04 UTC

[GitHub] [pulsar] mattisonchao opened a new pull request, #17758: [fix][metadata] Fix allow updating the released resource lock value.

mattisonchao opened a new pull request, #17758:
URL: https://github.com/apache/pulsar/pull/17758

   ### Motivation
   
   In the current implementation, If the lock was expired by `release` or `revalidate`, the `expireFuture` will invoke to notify the user to clean up.
   However, we can still update the lock value, even if the lock is already expired.
   
   ### Modifications
   
   - Disallow update lock value if the resource lock is already released.
   - Introduce `Revalidating` state to avoid invoking `revalidate` and `updateValue` concurrently.
    
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If the box was checked, please highlight the changes*
   
   - [ ] Dependencies (add or upgrade a dependency)
   - [ ] The public API
   - [ ] The schema
   - [ ] The default values of configurations
   - [ ] The binary protocol
   - [ ] The REST endpoints
   - [ ] The admin CLI options
   - [ ] Anything that affects deployment
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc-required` 
   (Your PR needs to update docs and you will update later)
   
   - [x] `doc-not-needed` 
   (Please explain why)
   
   - [ ] `doc` 
   (Your PR contains doc changes)
   
   - [ ] `doc-complete`
   (Docs have been already added)
   
   ### Matching PR in forked repository
   
   PR in forked repository: <!-- ENTER URL HERE 
   
   After opening this PR, the build in apache/pulsar will fail and instructions will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments have
   been handled, the tests pass and the PR is approved by a reviewer.
   
   -->
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] mattisonchao closed pull request #17758: [fix][metadata] Fix allow updating the released resource lock value.

Posted by GitBox <gi...@apache.org>.
mattisonchao closed pull request #17758: [fix][metadata] Fix allow updating the released resource lock value.
URL: https://github.com/apache/pulsar/pull/17758


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] codelipenghui commented on a diff in pull request #17758: [fix][metadata] Fix allow updating the released resource lock value.

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on code in PR #17758:
URL: https://github.com/apache/pulsar/pull/17758#discussion_r981170659


##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/coordination/impl/ResourceLockImpl.java:
##########
@@ -71,7 +73,14 @@ public synchronized T getValue() {
 
     @Override
     public synchronized CompletableFuture<Void> updateValue(T newValue) {
-       return acquire(newValue);
+        if (state == State.Revalidating) {
+            return revalidateFuture
+                    // ignore revalidate result
+                    .exceptionally(ignore -> null)
+                    .thenCompose(__ -> acquire(newValue));

Review Comment:
   Is it possible to add a test to cover this case?



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] michaeljmarshall commented on pull request #17758: [fix][metadata] Fix allow updating the released resource lock value.

Posted by GitBox <gi...@apache.org>.
michaeljmarshall commented on PR #17758:
URL: https://github.com/apache/pulsar/pull/17758#issuecomment-1253239531

   @mattisonchao - thank you for your work on the lock implementation. I have been having issues related to locks recently. Here is an issue describing my observations and some potential solutions. https://github.com/apache/pulsar/issues/17759


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] mattisonchao commented on a diff in pull request #17758: [fix][metadata] Fix allow updating the released resource lock value.

Posted by GitBox <gi...@apache.org>.
mattisonchao commented on code in PR #17758:
URL: https://github.com/apache/pulsar/pull/17758#discussion_r981216974


##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/coordination/impl/ResourceLockImpl.java:
##########
@@ -71,7 +73,14 @@ public synchronized T getValue() {
 
     @Override
     public synchronized CompletableFuture<Void> updateValue(T newValue) {
-       return acquire(newValue);
+        if (state == State.Revalidating) {
+            return revalidateFuture
+                    // ignore revalidate result
+                    .exceptionally(ignore -> null)
+                    .thenCompose(__ -> acquire(newValue));

Review Comment:
   I can try on it.



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] github-actions[bot] commented on pull request #17758: [fix][metadata] Fix allow updating the released resource lock value.

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #17758:
URL: https://github.com/apache/pulsar/pull/17758#issuecomment-1294358149

   The pr had no activity for 30 days, mark with Stale label.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org