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/02/08 15:24:01 UTC

[GitHub] [pulsar] liangyepianzhou opened a new pull request #14172: [Transaction] Optimize transaction timeout

liangyepianzhou opened a new pull request #14172:
URL: https://github.com/apache/pulsar/pull/14172


   ### Motivation
   A timeout is create every time a transaction is opened.
   When there are a large number of tasks with long timeout and there is no cancel mechanism, there is a risk of OOM.
   ### Modification
   Cancel the timeout of the completed transaction.
   
   ### Verifying this change
   
   - [ ] 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 `yes` was chosen, please highlight the changes*
   
     - Dependencies (does it add or upgrade a dependency): (yes / no)
     - The public API: (yes / no)
     - The schema: (yes / no / don't know)
     - The default values of configurations: (yes / no)
     - The wire protocol: (yes / no)
     - The rest endpoints: (yes / no)
     - The admin cli options: (yes / no)
     - Anything that affects deployment: (yes / no / don't know)
   
   ### Documentation
   
   Check the box below or label this PR directly (if you have committer privilege).
   
   Need to update docs? 
   
   - [ ] `doc-required` 
     
     (If you need help on updating docs, create a doc issue)
     
   - [x] `no-need-doc` 
     
     (Please explain why)
     
   - [ ] `doc` 
     
     (If this PR contains doc changes)
   
   
   


-- 
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] liangyepianzhou commented on a change in pull request #14172: [Transaction] Optimize transaction timeout

Posted by GitBox <gi...@apache.org>.
liangyepianzhou commented on a change in pull request #14172:
URL: https://github.com/apache/pulsar/pull/14172#discussion_r802253768



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/transaction/TransactionImpl.java
##########
@@ -164,6 +168,7 @@ public synchronized void registerCumulativeAckConsumer(ConsumerImpl<?> consumer)
         return checkIfOpenOrCommitting().thenCompose((value) -> {
             CompletableFuture<Void> commitFuture = new CompletableFuture<>();
             this.state = State.COMMITTING;
+            timeout.cancel();

Review comment:
       The function of timeout is to set the status of the transaction to timeout when the transaction times out.
   If the state of the transaction has become committing or aborting, the timeout will have no effect. At this point, the resources of this timetask can be released




-- 
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 merged pull request #14172: [Transaction] Optimize transaction timeout

Posted by GitBox <gi...@apache.org>.
codelipenghui merged pull request #14172:
URL: https://github.com/apache/pulsar/pull/14172


   


-- 
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] liangyepianzhou commented on pull request #14172: [Transaction] Optimize transaction timeout

Posted by GitBox <gi...@apache.org>.
liangyepianzhou commented on pull request #14172:
URL: https://github.com/apache/pulsar/pull/14172#issuecomment-1033281265


   /pulsarbot run-failure-checks


-- 
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] Jason918 commented on a change in pull request #14172: [Transaction] Optimize transaction timeout

Posted by GitBox <gi...@apache.org>.
Jason918 commented on a change in pull request #14172:
URL: https://github.com/apache/pulsar/pull/14172#discussion_r802252207



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/transaction/TransactionImpl.java
##########
@@ -164,6 +168,7 @@ public synchronized void registerCumulativeAckConsumer(ConsumerImpl<?> consumer)
         return checkIfOpenOrCommitting().thenCompose((value) -> {
             CompletableFuture<Void> commitFuture = new CompletableFuture<>();
             this.state = State.COMMITTING;
+            timeout.cancel();

Review comment:
       Why cancel timeout task here, not after state is in `COMMITTED, ABORTED, ERROR` which this transaction is actually completed.
   




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