Skip to content

Conversation

@shauryachats
Copy link
Collaborator

@shauryachats shauryachats commented Dec 23, 2025

Summary

This change introduces foundational multi-cluster support to the Pinot broker, enabling a single broker to connect to and route queries across multiple Pinot clusters.

Key highlights

  • Refactors BaseBrokerStarter to improve extensibility by extracting initialization steps (spectator Helix manager, routing manager, cluster change mediator) into overridable hooks.
  • Adds MultiClusterHelixBrokerStarter to:
    • Connect to multiple remote clusters via separate ZooKeeper instances.
    • Maintain remote spectator Helix managers.
    • Initialize remote routing managers and federated routing via MultiClusterRoutingManager.
    • Monitor remote cluster changes (ideal state, external view, instance config, resource config).
  • Introduces MultiClusterRoutingContext, a shared context object that encapsulates table caches and routing managers for local vs. federated routing.
  • Adds configuration support for remote clusters via new SPI constants:
    • pinot.remote.cluster.names
    • pinot.remote.zk.server.<clusterName>

This PR lays the groundwork for cross-cluster query federation while preserving existing single-cluster behavior. Subsequent PRs will add support for SSE and MSE cross-cluster queries.

Testing

Added an end-to-end integration test (MultiClusterIntegrationTest) validating that two isolated clusters can start with multi-cluster brokers, ingest data independently, and remain queryable.

@codecov-commenter
Copy link

codecov-commenter commented Dec 23, 2025

Codecov Report

❌ Patch coverage is 15.78947% with 208 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.19%. Comparing base (e5dba19) to head (5007c4c).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
...r/broker/helix/MultiClusterHelixBrokerStarter.java 0.00% 201 Missing ⚠️
...pinot/core/routing/MultiClusterRoutingContext.java 0.00% 5 Missing ⚠️
...e/pinot/broker/broker/helix/BaseBrokerStarter.java 95.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #17421      +/-   ##
============================================
+ Coverage     55.68%   63.19%   +7.50%     
- Complexity      703     1474     +771     
============================================
  Files          2463     3156     +693     
  Lines        139013   188179   +49166     
  Branches      22166    28796    +6630     
============================================
+ Hits          77407   118912   +41505     
- Misses        55096    60056    +4960     
- Partials       6510     9211    +2701     
Flag Coverage Δ
custom-integration1 100.00% <ø> (?)
integration 100.00% <ø> (?)
integration1 100.00% <ø> (?)
integration2 0.00% <ø> (?)
java-11 63.16% <15.78%> (+7.50%) ⬆️
java-21 63.15% <15.78%> (+7.50%) ⬆️
temurin 63.19% <15.78%> (+7.50%) ⬆️
unittests 63.18% <15.78%> (+7.50%) ⬆️
unittests1 55.68% <16.66%> (+<0.01%) ⬆️
unittests2 33.87% <15.78%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shauryachats shauryachats changed the title [federation] Introduced MultiClusterHelixBrokerStarter to initialize federated broker [federation] Introduced MultiClusterHelixBrokerStarter to start broker in federated mode Dec 23, 2025
* This class is responsible for managing routing managers and providing the appropriate
* routing manager based on query options (e.g., whether federation is enabled).
*/
public class MultiClusterRoutingContext {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is only a sink right now. would you be adding logic to this in a future PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Correct.

_threadAccountant.startWatcherTask();

// TODO: Hook multiClusterRoutingContext into request handlers subsequently.
MultiClusterRoutingContext multiClusterRoutingContext = getMultiClusterRoutingContext();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this initialized in base broker starter?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We need to initialize this in BaseBrokerStarter since it would be passed to all the request handlers subsequently. Alternatively, we could separate out initializing the request handlers in a separate method which can be overriden by MultiClusterHelixBrokerStarter. (The only thing there is we would be passing nulls for multiClusterRoutingContext in BaseBrokerStarter regardless).

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm I thought about this. I think we can leave this be. In the next PR, can you change the local var to an Optional.ofNullable? Just so it is clear for other folks that this will be null in almost all cases (except federated)

@ankitsultana ankitsultana merged commit 5af9015 into apache:master Dec 29, 2025
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants