You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "codelipenghui (via GitHub)" <gi...@apache.org> on 2023/02/20 11:39:17 UTC

[GitHub] [pulsar] codelipenghui opened a new pull request, #19571: [improve][broker] Reduce object creation of EntryBatchIndexesAcks

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

   ### Motivation
   
   Only create EntryBatchIndexesAcks instance while batch index acknowledgment is enabled.
   
   ### Does this pull request potentially affect one of the following parts:
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   *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 threading model
   - [ ] The binary protocol
   - [ ] The REST endpoints
   - [ ] The admin CLI options
   - [ ] The metrics
   - [ ] Anything that affects deployment
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- 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] codelipenghui commented on a diff in pull request #19571: [improve][broker] Reduce object creation of EntryBatchIndexesAcks

Posted by "codelipenghui (via GitHub)" <gi...@apache.org>.
codelipenghui commented on code in PR #19571:
URL: https://github.com/apache/pulsar/pull/19571#discussion_r1112505628


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractBaseDispatcher.java:
##########
@@ -392,6 +392,10 @@ public static void checkAndApplyReachedEndOfTopicOrTopicMigration(PersistentTopi
         }
     }
 
+    protected EntryBatchIndexesAcks getEntryBatchIndexesAcks(int entries) {

Review Comment:
   Without a new interface or a base class, we are not able to do so. I don't want to introduce a new interface here.



-- 
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 #19571: [improve][broker] Reduce object creation of EntryBatchIndexesAcks

Posted by "mattisonchao (via GitHub)" <gi...@apache.org>.
mattisonchao commented on code in PR #19571:
URL: https://github.com/apache/pulsar/pull/19571#discussion_r1112475077


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractBaseDispatcher.java:
##########
@@ -392,6 +392,10 @@ public static void checkAndApplyReachedEndOfTopicOrTopicMigration(PersistentTopi
         }
     }
 
+    protected EntryBatchIndexesAcks getEntryBatchIndexesAcks(int entries) {

Review Comment:
    Agree. We can make `DisableEntryBatchIndexesAcks ` to be static and override the method to return 0. 



-- 
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 #19571: [improve][broker] Reduce object creation of EntryBatchIndexesAcks

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #19571:
URL: https://github.com/apache/pulsar/pull/19571#issuecomment-1482143199

   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


[GitHub] [pulsar] mattisonchao commented on a diff in pull request #19571: [improve][broker] Reduce object creation of EntryBatchIndexesAcks

Posted by "mattisonchao (via GitHub)" <gi...@apache.org>.
mattisonchao commented on code in PR #19571:
URL: https://github.com/apache/pulsar/pull/19571#discussion_r1112453122


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumers.java:
##########
@@ -275,7 +275,7 @@ protected synchronized boolean trySendMessagesToConsumers(ReadType readType, Lis
 
                 SendMessageInfo sendMessageInfo = SendMessageInfo.getThreadLocal();
                 EntryBatchSizes batchSizes = EntryBatchSizes.get(messagesForC);
-                EntryBatchIndexesAcks batchIndexesAcks = EntryBatchIndexesAcks.get(messagesForC);
+                EntryBatchIndexesAcks batchIndexesAcks = getEntryBatchIndexesAcks(messagesForC);

Review Comment:
   There is an NPE at line 291



-- 
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] cbornet closed pull request #19571: [improve][broker] Reduce object creation of EntryBatchIndexesAcks

Posted by "cbornet (via GitHub)" <gi...@apache.org>.
cbornet closed pull request #19571: [improve][broker] Reduce object creation of EntryBatchIndexesAcks
URL: https://github.com/apache/pulsar/pull/19571


-- 
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 #19571: [improve][broker] Reduce object creation of EntryBatchIndexesAcks

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #19571:
URL: https://github.com/apache/pulsar/pull/19571#issuecomment-1544990699

   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


[GitHub] [pulsar] mattisonchao commented on a diff in pull request #19571: [improve][broker] Reduce object creation of EntryBatchIndexesAcks

Posted by "mattisonchao (via GitHub)" <gi...@apache.org>.
mattisonchao commented on code in PR #19571:
URL: https://github.com/apache/pulsar/pull/19571#discussion_r1112451746


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -781,7 +782,7 @@ private boolean sendChunkedMessagesToConsumers(ReadType readType,
             }
             final SendMessageInfo sendMessageInfo = SendMessageInfo.getThreadLocal();
             final EntryBatchSizes batchSizes = EntryBatchSizes.get(messagesForC);
-            final EntryBatchIndexesAcks batchIndexesAcks = EntryBatchIndexesAcks.get(messagesForC);
+            final EntryBatchIndexesAcks batchIndexesAcks = getEntryBatchIndexesAcks(messagesForC);

Review Comment:
   There is an NPE at line 799



-- 
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 pull request #19571: [improve][broker] Reduce object creation of EntryBatchIndexesAcks

Posted by "mattisonchao (via GitHub)" <gi...@apache.org>.
mattisonchao commented on PR #19571:
URL: https://github.com/apache/pulsar/pull/19571#issuecomment-1437767521

   IMO, we can give the some method parameter `@Nullable` annotation. And use `Optional` to avoid potential NPE. 
   


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


Re: [PR] [improve][broker] Reduce object creation of EntryBatchIndexesAcks [pulsar]

Posted by "codelipenghui (via GitHub)" <gi...@apache.org>.
codelipenghui closed pull request #19571: [improve][broker] Reduce object creation of EntryBatchIndexesAcks
URL: https://github.com/apache/pulsar/pull/19571


-- 
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] cbornet commented on pull request #19571: [improve][broker] Reduce object creation of EntryBatchIndexesAcks

Posted by "cbornet (via GitHub)" <gi...@apache.org>.
cbornet commented on PR #19571:
URL: https://github.com/apache/pulsar/pull/19571#issuecomment-1503574808

   /pulsarbot rerun-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] poorbarcode commented on pull request #19571: [improve][broker] Reduce object creation of EntryBatchIndexesAcks

Posted by "poorbarcode (via GitHub)" <gi...@apache.org>.
poorbarcode commented on PR #19571:
URL: https://github.com/apache/pulsar/pull/19571#issuecomment-1501531407

   /pulsarbot rerun-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] mattisonchao commented on a diff in pull request #19571: [improve][broker] Reduce object creation of EntryBatchIndexesAcks

Posted by "mattisonchao (via GitHub)" <gi...@apache.org>.
mattisonchao commented on code in PR #19571:
URL: https://github.com/apache/pulsar/pull/19571#discussion_r1111896050


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractBaseDispatcher.java:
##########
@@ -392,6 +392,10 @@ public static void checkAndApplyReachedEndOfTopicOrTopicMigration(PersistentTopi
         }
     }
 
+    protected EntryBatchIndexesAcks getEntryBatchIndexesAcks(int entries) {

Review Comment:
   Giving it a `@Nullable` annotation to returned value is better.



-- 
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 #19571: [improve][broker] Reduce object creation of EntryBatchIndexesAcks

Posted by "mattisonchao (via GitHub)" <gi...@apache.org>.
mattisonchao commented on code in PR #19571:
URL: https://github.com/apache/pulsar/pull/19571#discussion_r1112475077


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractBaseDispatcher.java:
##########
@@ -392,6 +392,10 @@ public static void checkAndApplyReachedEndOfTopicOrTopicMigration(PersistentTopi
         }
     }
 
+    protected EntryBatchIndexesAcks getEntryBatchIndexesAcks(int entries) {

Review Comment:
   Agree. We can override the method and return 0.



-- 
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 pull request #19571: [improve][broker] Reduce object creation of EntryBatchIndexesAcks

Posted by "mattisonchao (via GitHub)" <gi...@apache.org>.
mattisonchao commented on PR #19571:
URL: https://github.com/apache/pulsar/pull/19571#issuecomment-1437741321

   :( shamely, I missed a place.
   
   


-- 
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] poorbarcode commented on a diff in pull request #19571: [improve][broker] Reduce object creation of EntryBatchIndexesAcks

Posted by "poorbarcode (via GitHub)" <gi...@apache.org>.
poorbarcode commented on code in PR #19571:
URL: https://github.com/apache/pulsar/pull/19571#discussion_r1112468300


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractBaseDispatcher.java:
##########
@@ -392,6 +392,10 @@ public static void checkAndApplyReachedEndOfTopicOrTopicMigration(PersistentTopi
         }
     }
 
+    protected EntryBatchIndexesAcks getEntryBatchIndexesAcks(int entries) {

Review Comment:
   +1



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -781,7 +782,7 @@ private boolean sendChunkedMessagesToConsumers(ReadType readType,
             }
             final SendMessageInfo sendMessageInfo = SendMessageInfo.getThreadLocal();
             final EntryBatchSizes batchSizes = EntryBatchSizes.get(messagesForC);
-            final EntryBatchIndexesAcks batchIndexesAcks = EntryBatchIndexesAcks.get(messagesForC);
+            final EntryBatchIndexesAcks batchIndexesAcks = getEntryBatchIndexesAcks(messagesForC);

Review Comment:
   +1



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumers.java:
##########
@@ -275,7 +275,7 @@ protected synchronized boolean trySendMessagesToConsumers(ReadType readType, Lis
 
                 SendMessageInfo sendMessageInfo = SendMessageInfo.getThreadLocal();
                 EntryBatchSizes batchSizes = EntryBatchSizes.get(messagesForC);
-                EntryBatchIndexesAcks batchIndexesAcks = EntryBatchIndexesAcks.get(messagesForC);
+                EntryBatchIndexesAcks batchIndexesAcks = getEntryBatchIndexesAcks(messagesForC);

Review Comment:
   +1



-- 
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] AnonHxy commented on a diff in pull request #19571: [improve][broker] Reduce object creation of EntryBatchIndexesAcks

Posted by "AnonHxy (via GitHub)" <gi...@apache.org>.
AnonHxy commented on code in PR #19571:
URL: https://github.com/apache/pulsar/pull/19571#discussion_r1112471330


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractBaseDispatcher.java:
##########
@@ -392,6 +392,10 @@ public static void checkAndApplyReachedEndOfTopicOrTopicMigration(PersistentTopi
         }
     }
 
+    protected EntryBatchIndexesAcks getEntryBatchIndexesAcks(int entries) {

Review Comment:
   Maybe we could create an class `DisableEntryBatchIndexesAcks` and return it if `serviceConfig.isAcknowledgmentAtBatchIndexLevelEnabled()` is false  to avoid NPE



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