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/28 06:39:10 UTC

[GitHub] [pulsar] HQebupt opened a new pull request, #17314: [improve][broker]prevent new connection and partitioned metadata request when broker is closing

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

   ### Motivation
   Inspired by #17085 
   When the leader broker is closing, and the client will reconnect and redo lookup, resulting in unexpected results. 
   
   > @codelipenghui 
   > Looks like we also need to check other cases (e.g. handleConnect)
   > If the broker is shutting down, we should also prevent new connections.
   
   Therefore, it is necessary to check the status of the broker when handling requests, including connect\lookup\partitioned metadata.
   
   The following is the interaction workflow between consumer and broker.
   ```
   Consumer -> Broker: CONNECT
   Broker -> Consumer: CONNECTED
   Consumer -> Broker: PARTITIONED_METADATA
   Broker -> Consumer: PARTITIONED_METADATA_RESPONSE
   Consumer -> Broker: LOOKUP
   Broker -> Consumer: LOOKUP_RESPONSE
   Consumer -> Broker: SUBSCIBE
   Broker -> Consumer: SUCCESS
   Consumer -> Broker: FLOW
   Broker -> Consumer: MESSAGE
   Consumer - Broker: ACK
   ```
   
   ### Modifications
   - Check Pulsar Service state when handle connection and partitioned metadata request.
   
   ### Verifying this change
   
   - [x]  Make sure that the change passes the CI checks.
   
   This change is a trivial rework / code cleanup without any test coverage.
   ### 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): (no)
   - The public API: (no)
   - The schema: (no)
   - The default values of configurations: (no)
   - The wire protocol: (no)
   - The rest endpoints: (no)
   - The admin cli options: (no)
   - Anything that affects deployment: (no)
   
   ### Documentation
   Check the box below and label this PR (if you have committer privilege).
   
   Need to update docs? 
   - [x] `doc-not-needed` 
   


-- 
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 #17314: [improve][broker]prevent new connection request when broker is closing

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -817,6 +817,17 @@ protected void handleConnect(CommandConnect connect) {
             return;
         }
 
+        if (!this.service.getPulsar().isRunning()) {

Review Comment:
   If `!service.isAuthenticationEnabled()`(Line815) return true, the connect will complete without checking pulsar service  is running or not.
   
    My suggestion is that moving this code block just to Line807,  which is just below the debug log @HQebupt 



-- 
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 merged pull request #17314: [improve][broker]prevent new connection request when broker is closing

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


-- 
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 #17314: [improve][broker]prevent new connection request when broker is closing

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -817,6 +817,17 @@ protected void handleConnect(CommandConnect connect) {
             return;
         }
 
+        if (!this.service.getPulsar().isRunning()) {

Review Comment:
   If `!service.isAuthenticationEnabled()` return true, the connect will complete without checking pulsar service  is running or not.
   
    My suggestion is that move this code block just to Line807,  which is just below the debug log @HQebupt 



-- 
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] HQebupt commented on pull request #17314: [improve][broker]prevent new connection request when broker is closing

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

   /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] codelipenghui commented on pull request #17314: [improve][broker]prevent new connection request when broker is closing

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

   Please add a unit test to cover the new change


-- 
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 #17314: [improve][broker]prevent new connection request when broker is closing

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -817,6 +817,17 @@ protected void handleConnect(CommandConnect connect) {
             return;
         }
 
+        if (!this.service.getPulsar().isRunning()) {

Review Comment:
   If `!service.isAuthenticationEnabled()`(Line815) return true, the connect will complete without checking pulsar service  is running or not.
   
    My suggestion is that moving this code block to Line807,  which is just below the debug log. And it's better to add a UT to prevent regression, as well as other patchs solving the similar problem, e.g., https://github.com/apache/pulsar/pull/17315 @HQebupt 



-- 
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] HQebupt commented on pull request #17314: [improve][broker]prevent new connection request when broker is closing

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

   /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] AnonHxy commented on a diff in pull request #17314: [improve][broker]prevent new connection request when broker is closing

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -817,6 +817,17 @@ protected void handleConnect(CommandConnect connect) {
             return;
         }
 
+        if (!this.service.getPulsar().isRunning()) {

Review Comment:
   LGTM 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


[GitHub] [pulsar] HQebupt commented on pull request #17314: [improve][broker]prevent new connection request when broker is closing

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

   /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] HQebupt commented on pull request #17314: [improve][broker]prevent new connection request when broker is closing

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

   /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] HQebupt commented on pull request #17314: [improve][broker]prevent new connection request when broker is closing

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

   > Please add a unit test to cover the new change
   
   done


-- 
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 #17314: [improve][broker]prevent new connection request when broker is closing

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -817,6 +817,17 @@ protected void handleConnect(CommandConnect connect) {
             return;
         }
 
+        if (!this.service.getPulsar().isRunning()) {

Review Comment:
   If `!service.isAuthenticationEnabled()`(Line815) return true, the connect will complete without checking pulsar service  is running or not.
   
    My suggestion is that move this code block just to Line807,  which is just below the debug log @HQebupt 



-- 
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] HQebupt commented on a diff in pull request #17314: [improve][broker]prevent new connection request when broker is closing

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -817,6 +817,17 @@ protected void handleConnect(CommandConnect connect) {
             return;
         }
 
+        if (!this.service.getPulsar().isRunning()) {

Review Comment:
   Resolved, thank you. PTAL @AnonHxy @congbobo184 



-- 
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] HQebupt commented on pull request #17314: [improve][broker]prevent new connection request when broker is closing

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

   /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