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/04/11 07:44:23 UTC

[GitHub] [pulsar] liangyepianzhou opened a new pull request, #15114: [optimize][Transaction] TransactionMetadataService don't connect again if store exist.

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

   ### Motivation && Modification
   We  don't need to openTransactionMetadataStore if store exist.
   
   ### 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.
   
   Need to update docs? 
   
   - [ ] `doc-required` 
   (Your PR needs to update docs and you will update later)
     
   - [x] `no-need-doc` 
   (Please explain why)
     
   - [ ] `doc` 
   (Your PR contains doc changes)
   
   - [ ] `doc-added`
   (Docs have been already added)


-- 
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 diff in pull request #15114: [fix][txn] TransactionMetadataService don't connect again if store exist

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/TransactionMetadataStoreService.java:
##########
@@ -180,6 +180,8 @@ public CompletableFuture<Void> handleTcClientConnect(TransactionCoordinatorID tc
                         // so we should jude the store exist again.
                         if (stores.get(tcId) != null) {
                             completableFuture.complete(null);
+                            tcLoadSemaphore.release();
+                            return;
                         }

Review Comment:
   yes, If the store is already there, we can complete the future, and this means that this time handleTcClientConnect has completed. We should do nothing again. 



-- 
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 diff in pull request #15114: [fix][txn] TransactionMetadataService don't connect again if store exist

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/TransactionMetadataStoreService.java:
##########
@@ -180,6 +180,8 @@ public CompletableFuture<Void> handleTcClientConnect(TransactionCoordinatorID tc
                         // so we should jude the store exist again.
                         if (stores.get(tcId) != null) {
                             completableFuture.complete(null);
+                            tcLoadSemaphore.release();
+                            return;
                         }

Review Comment:
   If the store is already there, we can complete the future, and this means that this time handleTcClientConnect has completed. We should do nothing again. 



-- 
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 #15114: [fix][txn] TransactionMetadataService don't connect again if store exist

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/TransactionMetadataStoreService.java:
##########
@@ -180,6 +180,8 @@ public CompletableFuture<Void> handleTcClientConnect(TransactionCoordinatorID tc
                         // so we should jude the store exist again.
                         if (stores.get(tcId) != null) {
                             completableFuture.complete(null);
+                            tcLoadSemaphore.release();
+                            return;
                         }

Review Comment:
   Can we move here out of the semaphore, if the store is already there, we don't need to use Semaphore again?



-- 
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] RobertIndie merged pull request #15114: [fix][txn] TransactionMetadataService don't connect again if store exist

Posted by GitBox <gi...@apache.org>.
RobertIndie merged PR #15114:
URL: https://github.com/apache/pulsar/pull/15114


-- 
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 #15114: [fix][txn] TransactionMetadataService don't connect again if store exist

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

   > Could you add some tests to verify it?
   There's less need to add tests here, and it's also hard to add tests.
   When the store exists, we can get the correct result regardless of whether execute openTransactionMetadataStore or not.
   This is just an optimization, don't let it do some repetitive operations


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