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:50:45 UTC
[GitHub] [pulsar] HQebupt opened a new pull request, #17315: [improve][broker]prevent partitioned metadata lookup request when broker is closing
HQebupt opened a new pull request, #17315:
URL: https://github.com/apache/pulsar/pull/17315
### 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
```
The following screenshot is the interaction workflow between producer and broker.
<img width="510" alt="image" src="https://user-images.githubusercontent.com/4970972/187061264-36cd2a06-0414-4e5e-a097-05af07eb6c39.png">
### 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] HQebupt commented on pull request #17315: [improve][broker]prevent partitioned metadata lookup request when broker is closing
Posted by GitBox <gi...@apache.org>.
HQebupt commented on PR #17315:
URL: https://github.com/apache/pulsar/pull/17315#issuecomment-1242750911
@codelipenghui PTAL when you are available.
--
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 #17315: [improve][broker]prevent partitioned metadata lookup request when broker is closing
Posted by GitBox <gi...@apache.org>.
HQebupt commented on PR #17315:
URL: https://github.com/apache/pulsar/pull/17315#issuecomment-1229834087
/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 pull request #17315: [improve][broker]prevent partitioned metadata lookup request when broker is closing
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on PR #17315:
URL: https://github.com/apache/pulsar/pull/17315#issuecomment-1244811675
LGTM with minor comment
--
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 #17315: [improve][broker]prevent partitioned metadata lookup request when broker is closing
Posted by GitBox <gi...@apache.org>.
HQebupt commented on code in PR #17315:
URL: https://github.com/apache/pulsar/pull/17315#discussion_r970873551
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ServerCnxTest.java:
##########
@@ -2307,4 +2308,21 @@ public void handleConnectWithServiceNotReady() throws Exception {
assertEquals(error.getError(), ServerError.ServiceNotReady);
channel.finish();
}
+
+ @Test(timeOut = 30000)
+ public void handlePartitionMetadataRequestWithServiceNotReady() throws Exception {
+ resetChannel();
+ setChannelConnected();
+ CompletableFuture<Boolean> successFuture = CompletableFuture.completedFuture(true);
+ doReturn(successFuture).when(namespaceService).checkTopicExists(any(TopicName.class));
Review Comment:
No. It will make the test case more complex. I think it's not worth it .
--
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 merged pull request #17315: [improve][broker]prevent partitioned metadata lookup request when broker is closing
Posted by GitBox <gi...@apache.org>.
AnonHxy merged PR #17315:
URL: https://github.com/apache/pulsar/pull/17315
--
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 #17315: [improve][broker]prevent partitioned metadata lookup request when broker is closing
Posted by GitBox <gi...@apache.org>.
HQebupt commented on code in PR #17315:
URL: https://github.com/apache/pulsar/pull/17315#discussion_r970873551
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ServerCnxTest.java:
##########
@@ -2307,4 +2308,21 @@ public void handleConnectWithServiceNotReady() throws Exception {
assertEquals(error.getError(), ServerError.ServiceNotReady);
channel.finish();
}
+
+ @Test(timeOut = 30000)
+ public void handlePartitionMetadataRequestWithServiceNotReady() throws Exception {
+ resetChannel();
+ setChannelConnected();
+ CompletableFuture<Boolean> successFuture = CompletableFuture.completedFuture(true);
+ doReturn(successFuture).when(namespaceService).checkTopicExists(any(TopicName.class));
Review Comment:
Yes. 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] AnonHxy commented on a diff in pull request #17315: [improve][broker]prevent partitioned metadata lookup request when broker is closing
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on code in PR #17315:
URL: https://github.com/apache/pulsar/pull/17315#discussion_r969077415
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ServerCnxTest.java:
##########
@@ -2307,4 +2308,21 @@ public void handleConnectWithServiceNotReady() throws Exception {
assertEquals(error.getError(), ServerError.ServiceNotReady);
channel.finish();
}
+
+ @Test(timeOut = 30000)
+ public void handlePartitionMetadataRequestWithServiceNotReady() throws Exception {
+ resetChannel();
+ setChannelConnected();
+ CompletableFuture<Boolean> successFuture = CompletableFuture.completedFuture(true);
+ doReturn(successFuture).when(namespaceService).checkTopicExists(any(TopicName.class));
Review Comment:
Is it possible to remove this line2316 to line2317?
--
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