Enhance BrokerResourceValidationManager to support logical table partitions in resource validation#17842
Conversation
…itions in resource validation
There was a problem hiding this comment.
Pull request overview
Updates broker-resource validation so it also processes logical-table partitions, ensuring broker assignments for logical tables are periodically repaired when broker membership changes (Issue #15751).
Changes:
- Extend controller periodic-task plumbing to allow subclasses to customize the table/partition list and processing filter.
- Enhance
BrokerResourceValidationManagerto include logical-table broker-resource partitions and rebuild them usingLogicalTableConfig. - Add unit, stateless, and integration tests covering logical-table broker-resource rebuild and periodic repair.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/ControllerPeriodicTasksIntegrationTest.java | Adds an integration test verifying periodic validation repairs logical-table broker partitions after adding a broker. |
| pinot-controller/src/test/java/org/apache/pinot/controller/validation/ValidationManagerStatelessTest.java | Adds stateless test for rebuilding broker resource for a logical table after manual broker addition. |
| pinot-controller/src/test/java/org/apache/pinot/controller/validation/BrokerResourceValidationManagerTest.java | New unit tests validating logical partitions are included in getTablesToProcess behavior. |
| pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManagerStatelessTest.java | Adds stateless tests for rebuild/update paths involving logical-table partitions. |
| pinot-controller/src/main/java/org/apache/pinot/controller/validation/BrokerResourceValidationManager.java | Includes logical-table partitions in periodic validation and resolves broker tenants for logical tables. |
| pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/periodictask/ControllerPeriodicTask.java | Introduces overridable hooks for “tables to process” and “should process” filtering. |
| pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java | Adds logical-partition discovery, supports rebuild-by-tags for logical tables, and updates broker ideal state atomically. |
| pinot-common/src/main/java/org/apache/pinot/common/utils/helix/HelixHelper.java | Includes logical tables when mapping broker tags to tables. |
...er/src/main/java/org/apache/pinot/controller/validation/BrokerResourceValidationManager.java
Outdated
Show resolved
Hide resolved
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Outdated
Show resolved
Hide resolved
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Outdated
Show resolved
Hide resolved
...er/src/main/java/org/apache/pinot/controller/validation/BrokerResourceValidationManager.java
Show resolved
Hide resolved
...rc/test/java/org/apache/pinot/controller/validation/BrokerResourceValidationManagerTest.java
Outdated
Show resolved
Hide resolved
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Outdated
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #17842 +/- ##
============================================
- Coverage 63.27% 63.25% -0.02%
- Complexity 1468 1481 +13
============================================
Files 3190 3190
Lines 192197 192282 +85
Branches 29456 29474 +18
============================================
+ Hits 121612 121628 +16
- Misses 61060 61120 +60
- Partials 9525 9534 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…e validation for logical tables
...er/src/main/java/org/apache/pinot/controller/validation/BrokerResourceValidationManager.java
Show resolved
Hide resolved
...src/test/java/org/apache/pinot/integration/tests/ControllerPeriodicTasksIntegrationTest.java
Outdated
Show resolved
Hide resolved
| return tables; | ||
| } | ||
| List<String> combined = new ArrayList<>(tables); | ||
| combined.addAll(_pinotHelixResourceManager.getBrokerResourceLogicalTablePartitions()); |
There was a problem hiding this comment.
Can / Should this task run on non-leaders for logical tables ?
There was a problem hiding this comment.
Why? Running on the non-leader would get the update from all the controllers.
| _pinotHelixResourceManager.rebuildBrokerResource(tableNameWithType, brokerInstances); | ||
| LogicalTableConfig logicalTableConfig = _pinotHelixResourceManager.getLogicalTableConfig(tableNameWithType); | ||
| if (logicalTableConfig != null) { | ||
| Set<String> brokerInstances = _pinotHelixResourceManager |
There was a problem hiding this comment.
Why does logical table config have a broker tenant? What happens if a physical table's broker tenant is different from a logical table's broker tenant?
There was a problem hiding this comment.
The brokerTenant in the logical table is used to identity the broker node which should be used for the querying. For a logical table, the broker tenant of the physical table can be different and it would not be used, as much I remember.
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Outdated
Show resolved
Hide resolved
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Outdated
Show resolved
Hide resolved
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Outdated
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/common/utils/helix/HelixHelper.java
Show resolved
Hide resolved
...test/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManagerStatelessTest.java
Outdated
Show resolved
Hide resolved
...test/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManagerStatelessTest.java
Outdated
Show resolved
Hide resolved
...src/test/java/org/apache/pinot/integration/tests/ControllerPeriodicTasksIntegrationTest.java
Outdated
Show resolved
Hide resolved
...src/test/java/org/apache/pinot/integration/tests/ControllerPeriodicTasksIntegrationTest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
You can also share your feedback on Copilot code review. Take the survey.
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Outdated
Show resolved
Hide resolved
...ler/src/test/java/org/apache/pinot/controller/validation/ValidationManagerStatelessTest.java
Show resolved
Hide resolved
...rc/test/java/org/apache/pinot/controller/validation/BrokerResourceValidationManagerTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.
You can also share your feedback on Copilot code review. Take the survey.
Summary
This PR updates BrokerResourceValidationManager so that the periodic broker resource validation runs for logical table partitions in the broker resource in addition to physical tables. It closes the gap identified in Issue #15751: after PR #15726, the broker resource includes logical tables, but the validation/repair logic only considered physical tables, so logical table broker assignments were never corrected when brokers were added or removed.
Problem
tableName_OFFLINE/tableName_REALTIME) and logical table partition names.getAllTables()(physical tables), so logical table partitions were never validated or repaired.Solution
getTablesToProcessIn addition to physical tables from the base implementation, the task now includes partition names for logical tables by calling
PinotHelixResourceManager.getBrokerResourceLogicalTablePartitions(), so both physical and logical broker-resource partitions are processed.processTableFor each partition name, type is determined by config presence (not by name): look up table config first; if present, treat as physical and resolve broker instances from the table config's broker tenant; otherwise look up logical table config and, if present, resolve from
LogicalTableConfig.getBrokerTenant(). ThenrebuildBrokerResourceis invoked. If neither config exists, the partition is skipped with a warning.Tests
getTablesToProcessreturns both physical tables and logical table partitions, and that the table-name property still restricts to a single table.testUpdateBrokerResourceWithLogicalTable(broker add + rebuild for logical table),testRebuildBrokerResourceFromHelixTagsForLogicalTable(rebuild API for logical table name).testRebuildBrokerResourceWhenBrokerAddedForLogicalTable(rebuild for logical table after broker add).testBrokerResourceValidationManagerRepairsLogicalTable(periodic task repairs logical table partition when a new broker is added).Result
PROPERTY_KEY_TABLE_NAMEis set, only that table/partition is processed; otherwise physical tables plus logical table partitions are processed.Related