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/08/09 10:50:05 UTC

[GitHub] [pulsar] mattisonchao opened a new pull request, #17018: [Cleanup][broker] Fix typo & Revert irrelevant code.

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

   ### Motivation
   
   From comment https://github.com/apache/pulsar/pull/16968#discussion_r940533777, We have to revert some irrelevant code.
   
   ### Modifications
   
   - Fix typo.
   - Revert irrelevant code.
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   ### 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] `doc-not-needed` 
   (Please explain why)
     
   - [ ] `doc` 
   (Your PR contains doc changes)
   
   - [ ] `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] mattisonchao commented on a diff in pull request #17018: [cleanup][broker] Fix typo & Revert irrelevant code.

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -550,14 +550,15 @@ public final synchronized void readEntriesComplete(List<Entry> entries, Object c
         if (serviceConfig.isDispatcherDispatchMessagesInSubscriptionThread()) {
             // setting sendInProgress here, because sendMessagesToConsumers will be executed
             // in a separate thread, and we want to prevent more reads
+            havePendingRead = true;

Review Comment:
   Just mark here, we set `sendInProgress` here has a risk if the task in `dispatchMessagesThread` executor got some problem. the `sendInProgress` will never be set to false.
   
   But I'm not quite sure if the problem exists because this executor is an unbounded queue.



-- 
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] tisonkun commented on a diff in pull request #17018: [cleanup][broker] Follow up on #16968 to restore some behavior in PersistentDispatcherMultipleConsumers class

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -93,7 +93,7 @@ public class PersistentDispatcherMultipleConsumers extends AbstractDispatcherMul
     protected volatile PositionImpl minReplayedPosition = null;
     protected boolean shouldRewindBeforeReadingOrReplaying = false;
     protected final String name;
-    protected volatile boolean sendInProgress;
+    protected boolean sendInProgress;

Review Comment:
   I think if `protected boolean` works, `protected volatile boolean` doesn't cause regression?



-- 
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 a diff in pull request #17018: [cleanup][broker] Fix typo & Revert irrelevant code.

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -550,14 +550,15 @@ public final synchronized void readEntriesComplete(List<Entry> entries, Object c
         if (serviceConfig.isDispatcherDispatchMessagesInSubscriptionThread()) {
             // setting sendInProgress here, because sendMessagesToConsumers will be executed
             // in a separate thread, and we want to prevent more reads
+            havePendingRead = true;

Review Comment:
   That is a good point. We could handle the `RejectedExecutionException` if we think it will happen. As you said though, the queue is unbounded, so I don't think it is a case we _have_ to handle.



-- 
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 #17018: [Cleanup][broker] Fix typo & Revert irrelevant code.

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -550,14 +550,15 @@ public final synchronized void readEntriesComplete(List<Entry> entries, Object c
         if (serviceConfig.isDispatcherDispatchMessagesInSubscriptionThread()) {
             // setting sendInProgress here, because sendMessagesToConsumers will be executed
             // in a separate thread, and we want to prevent more reads
+            havePendingRead = true;

Review Comment:
   Just mark here, we set `havePendingRead` here has a risk if the task in `dispatchMessagesThread` executor got some problem. the `havePendingRead` will never be set to false.
   
   But I'm not quite sure if the problem exists because this executor is an unbounded queue.



-- 
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 #17018: [cleanup][broker] Fix typo & Revert irrelevant code.

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -550,14 +550,15 @@ public final synchronized void readEntriesComplete(List<Entry> entries, Object c
         if (serviceConfig.isDispatcherDispatchMessagesInSubscriptionThread()) {
             // setting sendInProgress here, because sendMessagesToConsumers will be executed
             // in a separate thread, and we want to prevent more reads
+            havePendingRead = true;

Review Comment:
   Yes @michaeljmarshall , It has to be `sendInProgress`.
   @lhotari  Thanks a lot! 



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -550,14 +550,15 @@ public final synchronized void readEntriesComplete(List<Entry> entries, Object c
         if (serviceConfig.isDispatcherDispatchMessagesInSubscriptionThread()) {
             // setting sendInProgress here, because sendMessagesToConsumers will be executed
             // in a separate thread, and we want to prevent more reads
+            havePendingRead = true;

Review Comment:
   Sure, thanks



-- 
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 #17018: [Cleanup][broker] Fix typo & Revert irrelevant code.

Posted by GitBox <gi...@apache.org>.
mattisonchao closed pull request #17018: [Cleanup][broker] Fix typo & Revert irrelevant code.
URL: https://github.com/apache/pulsar/pull/17018


-- 
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- merged pull request #17018: [cleanup][broker] Follow up on #16968 to restore some behavior in PersistentDispatcherMultipleConsumers class

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


-- 
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] lhotari commented on a diff in pull request #17018: [cleanup][broker] Fix typo & Revert irrelevant code.

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -550,14 +550,15 @@ public final synchronized void readEntriesComplete(List<Entry> entries, Object c
         if (serviceConfig.isDispatcherDispatchMessagesInSubscriptionThread()) {
             // setting sendInProgress here, because sendMessagesToConsumers will be executed
             // in a separate thread, and we want to prevent more reads
+            havePendingRead = true;

Review Comment:
   the comment `setting sendInProgress here` is no more true. I'm just wondering why `havePendingRead` is set to true instead of `sendInProgress`?



-- 
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 a diff in pull request #17018: [cleanup][broker] Follow up on #16968 to restore some behavior in PersistentDispatcherMultipleConsumers class

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -93,7 +93,7 @@ public class PersistentDispatcherMultipleConsumers extends AbstractDispatcherMul
     protected volatile PositionImpl minReplayedPosition = null;
     protected boolean shouldRewindBeforeReadingOrReplaying = false;
     protected final String name;
-    protected volatile boolean sendInProgress;
+    protected boolean sendInProgress;

Review Comment:
   The usage of `volatile` did not cause a regression. It simply was unnecessary because `sendInProgress` is only ever updated within the `synchronized (this)` block.



-- 
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] lhotari commented on a diff in pull request #17018: [cleanup][broker] Fix typo & Revert irrelevant code.

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -550,14 +550,15 @@ public final synchronized void readEntriesComplete(List<Entry> entries, Object c
         if (serviceConfig.isDispatcherDispatchMessagesInSubscriptionThread()) {
             // setting sendInProgress here, because sendMessagesToConsumers will be executed
             // in a separate thread, and we want to prevent more reads
+            havePendingRead = true;

Review Comment:
   the comment `setting sendInProgress here` is outdated after the recent changes. I'm just wondering why `havePendingRead` is set to true instead of `sendInProgress`?



-- 
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 a diff in pull request #17018: [cleanup][broker] Fix typo & Revert irrelevant code.

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -550,14 +550,15 @@ public final synchronized void readEntriesComplete(List<Entry> entries, Object c
         if (serviceConfig.isDispatcherDispatchMessagesInSubscriptionThread()) {
             // setting sendInProgress here, because sendMessagesToConsumers will be executed
             // in a separate thread, and we want to prevent more reads
+            havePendingRead = true;

Review Comment:
   Great catch @lhotari. It is supposed to be `sendInProgress`.



-- 
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 #17018: [cleanup][broker] Follow up on #16968 to restore some behavior in PersistentDispatcherMultipleConsumers class

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

   Move label `release/2.10.2``release/2.9.4` and `release/2.8.5` to PR #17053


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