PIP-121: Implement AutoClusterFailover#547
PIP-121: Implement AutoClusterFailover#547BewareMyPower wants to merge 13 commits intoapache:mainfrom
Conversation
1a1efd8 to
7b1ba7d
Compare
7b1ba7d to
5df139c
Compare
There was a problem hiding this comment.
Pull request overview
Adds an AutoClusterFailover implementation of ServiceInfoProvider to automatically switch the client’s service URL between a primary cluster and fallback clusters based on periodic TCP reachability probes, plus unit tests for basic failover/switchback behavior.
Changes:
- Introduces new public
pulsar::AutoClusterFailoverAPI (builder/config) and implementation with periodic probing and delayed failover/switchback. - Adds new tests exercising failover to an available secondary and switching back to primary after recovery.
- Makes
ServiceInfodefault-constructible to support the new builder/config construction pattern.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
lib/AutoClusterFailover.cc |
Implements the async probing + state machine for primary/secondary switching. |
include/pulsar/AutoClusterFailover.h |
Adds the public API (Config + Builder) for wiring AutoClusterFailover into Client::create(...). |
include/pulsar/ServiceInfo.h |
Adds a default constructor to ServiceInfo to enable default construction in the new builder/config. |
tests/ServiceInfoProviderTest.cc |
Adds probe-based tests for failover and switchback timing behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Introduces a new AutoClusterFailover ServiceInfoProvider implementation that periodically probes configured Pulsar service URLs and automatically switches between a primary and one (or more) secondary clusters based on availability.
Changes:
- Added public
pulsar::AutoClusterFailoverAPI (builder/config) ininclude/pulsar/AutoClusterFailover.h. - Implemented probing + failover/switchback logic using Asio in
lib/AutoClusterFailover.cc. - Added new gtest coverage for failover and switchback timing behavior in
tests/ServiceInfoProviderTest.cc.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
include/pulsar/AutoClusterFailover.h |
New public header/API for configuring and constructing the failover provider. |
lib/AutoClusterFailover.cc |
Core implementation: periodic async TCP probing and cluster switching logic. |
tests/ServiceInfoProviderTest.cc |
Adds tests exercising failover to secondary and switchback to primary after recovery. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Compared to the Java implementation, this PR changes the delay-based failover and switch-back configs to counter-based configs. See apache/pulsar#25326 for the reason.