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/01 13:23:59 UTC

[GitHub] [pulsar] Technoboy- opened a new pull request, #17403: Using `handle` instead of `handleAsync` to avoid using common pool thread

Technoboy- opened a new pull request, #17403:
URL: https://github.com/apache/pulsar/pull/17403

   ### Motivation
   
   When creating consumer, I find that using common pool thread to create the cursor:
   ```
   2022-09-01T21:12:32,515 - INFO  - [bookkeeper-ml-scheduler-OrderedScheduler-0-0:BrokerService$2@1472] - Created topic persistent://prop/ns-test/topic-1 - dedup is disabled
   2022-09-01T21:12:32,528 - INFO  - [ForkJoinPool.commonPool-worker-1:ManagedLedgerImpl@961] - [prop/ns-test/persistent/topic-1] Creating new cursor: sub-2
   2022-09-01T21:12:32,529 - INFO  - [ForkJoinPool.commonPool-worker-1:ManagedCursorImpl@631] - [prop/ns-test/persistent/topic-1] Cursor sub-2 recovered to position 3:-1
   ```
   
   And then find that the thread switches in  `BookkeeperSchemaStorage`.   It's introduced by https://github.com/apache/pulsar/pull/2148.   I think it's no need to use `handleAsync` there.
   
   
   - [x] `doc-not-needed` 
   (Please explain why)
   


-- 
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] merlimat merged pull request #17403: [improve][broker] Using `handle` instead of `handleAsync` to avoid using common pool thread

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


-- 
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] merlimat commented on a diff in pull request #17403: [improve][broker] Using `handle` instead of `handleAsync` to avoid using common pool thread

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/BookkeeperSchemaStorage.java:
##########
@@ -213,7 +213,7 @@ private CompletableFuture<StoredSchema> getSchema(String schemaId) {
                 return readSchemaEntry(schemaLocator.getInfo().getPosition())
                         .thenApply(entry -> new StoredSchema(entry.getSchemaData().toByteArray(),
                                 new LongSchemaVersion(schemaLocator.getInfo().getVersion())));
-            }).handleAsync((res, ex) -> {
+            }).handle((res, ex) -> {

Review Comment:
   @Technoboy- There were 2 instances of `handleAsync()` in the original commit, should we change both?



-- 
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] Technoboy- commented on a diff in pull request #17403: [improve][broker] Using `handle` instead of `handleAsync` to avoid using common pool thread

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on code in PR #17403:
URL: https://github.com/apache/pulsar/pull/17403#discussion_r961222987


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/BookkeeperSchemaStorage.java:
##########
@@ -213,7 +213,7 @@ private CompletableFuture<StoredSchema> getSchema(String schemaId) {
                 return readSchemaEntry(schemaLocator.getInfo().getPosition())
                         .thenApply(entry -> new StoredSchema(entry.getSchemaData().toByteArray(),
                                 new LongSchemaVersion(schemaLocator.getInfo().getVersion())));
-            }).handleAsync((res, ex) -> {
+            }).handle((res, ex) -> {

Review Comment:
   Ah, `getOrCreateSchemaLocator` not existed in the master, so we only have one instance now.



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