Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve][broker]fix broker irrational behavior when it is closing #17085

Merged
merged 2 commits into from Aug 28, 2022

Conversation

HQebupt
Copy link
Contributor

@HQebupt HQebupt commented Aug 14, 2022

Motivation

When the leader broker is closing, and it will release the ownership of its bundles first. The client will redo topic lookup , and this broker will handle it, resulting in unexpected results. For instance, some unassigned bundles maybe are taken ownership by itself again, but the broker can not server the bundles due to it is closing . see the screenshot log.
Therefore, it is necessary to check the status of the broker when handling lookup requests.

image

Modifications

  • Check Pulsar Service state when handling lookup request.
  • Add 'Init' state as running state in PulsarService since PulsarFunctionWorker have to lookup topic when broker is starting.

// start function worker service if necessary
this.startWorkerService(brokerService.getAuthenticationService(), brokerService.getAuthorizationService());

tryCreateNonPartitionedTopic(workerConfig.getFunctionAssignmentTopic());
tryCreateNonPartitionedTopic(workerConfig.getClusterCoordinationTopic());
tryCreateNonPartitionedTopic(workerConfig.getFunctionMetadataTopic());

Verifying this change

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

  • doc-not-needed

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Aug 14, 2022
@HQebupt
Copy link
Contributor Author

HQebupt commented Aug 15, 2022

/pulsarbot run-failure-checks

@codelipenghui codelipenghui added this to the 2.12.0 milestone Aug 15, 2022
@codelipenghui codelipenghui added type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages area/broker labels Aug 15, 2022
@codelipenghui
Copy link
Contributor

@HQebupt Please check the failed test

@HQebupt
Copy link
Contributor Author

HQebupt commented Aug 27, 2022

@HQebupt Please check the failed test

Thank you Penghui. I found the key point.

@HQebupt
Copy link
Contributor Author

HQebupt commented Aug 27, 2022

/pulsarbot run-failure-checks

Copy link
Contributor

@Jason918 Jason918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@codelipenghui codelipenghui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks good to me.

Looks like we also need to check other cases (e.g. handleConnect)
If the broker is shutting down, we should also prevent new connections.

nicoloboschi pushed a commit that referenced this pull request Sep 27, 2022
dragonls pushed a commit to dragonls/pulsar that referenced this pull request Oct 21, 2022
…2.9-wxg-release' (merge request !53)

[improve][broker] fix broker irrational behavior when it is closing (apache#17085)
1. [[improve][broker]fix broker irrational behavior when it is closing by HQebupt · Pull Request apache#17085 · apache/pulsar](apache#17085)
2. [[improve][broker]prevent new connection request when broker is closing by HQebupt · Pull Request apache#17314 · apache/pulsar](apache#17314)
3. [[improve][broker]prevent partitioned metadata lookup request when broker is closing by HQebupt · Pull Request apache#17315 · apache/pulsar](apache#17315)
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/broker cherry-picked/branch-2.11 doc-not-needed Your PR changes do not impact docs type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants