[improve][client]PIP-425:Support connecting with next available endpoint for multi-endpoint serviceUrls
Fixes https://github.com/apache/pulsar/issues/22934#issuecomment-2943690398
Main Issue: https://github.com/apache/pulsar/issues/22934#issuecomment-2943690398
PIP: https://github.com/apache/pulsar/pull/24394
Motivation
As https://github.com/apache/pulsar/issues/22934 and https://github.com/apache/pulsar/discussions/22933 mentioned, when most of the nodes in serviceurl are down (but there is at least one available node), creating consumers and producers through PulsarClient will most likely fail. I think this is not as expected. If the code is robust enough, as long as there is one available node, it should be accessible normally. Therefore, this PR is going to optimize the code logic, remove unavailable nodes through the feedback mechanism, and improve the success rate of PulsarClient requests.
By the way, https://github.com/apache/pulsar/pull/22935 removes faulty nodes through a regular health check mechanism, but this brings new problems (frequent creation of connections and increased system load), so this solution is abandoned. See https://github.com/apache/pulsar/issues/22934#issuecomment-2943690398 for more details!
Modifications
Verifying this change
- [x] Make sure that the change passes the CI checks.
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
- Added integration tests for end-to-end deployment with large payloads (10MB)
- Extended integration test for recovery after broker failure
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
- [ ] Dependencies (add or upgrade a dependency)
- [x] 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
- [ ]
doc - [ ]
doc-required - [x]
doc-not-needed - [ ]
doc-complete
Matching PR in forked repository
PR in forked repository: https://github.com/AuroraTwinkle/pulsar/pull/8