Address review feedback from the deprecation-removal PRs - #19148
Conversation
Follow-ups to the review comments on apache#19139 and apache#19142. No API is removed here; this is cleanup of loose ends left by those PRs plus one bug fix. - Drop the now-redundant (List<IndexType>) null casts at FieldConfig call sites. Those casts existed only to disambiguate the singular-IndexType 5-arg constructor from the List one; apache#19139 removes the former, so bare null now resolves unambiguously. Also drops the java.util.List import in AvgAggregationFunctionTest, which is unused once the casts are gone. - GET /tables/livebrokers mapped every exception to 404 NOT_FOUND while declaring only 200 and 500. getTableToLiveBrokersMapping filters unknown tables rather than reporting them, so nothing it throws is a lookup miss: a missing broker ExternalView surfaces as IllegalStateException and was being reported to clients as "not found", and the documented 500 was unreachable. Map to INTERNAL_SERVER_ERROR and keep the cause. - MaterializedViewTaskExecutorFactory fell back to an empty PinotConfiguration when _minionConf was null. Once apache#19139 removes the deprecated 1-arg init, _minionConf is always set, so the branch is dead; if it were ever reached it would silently build a plaintext gRPC client with default limits instead of the configured TLS one. Replaced with a Preconditions check.
646e007 to
0866c37
Compare
There was a problem hiding this comment.
Pull request overview
This PR follows up on review feedback from earlier deprecation-removal PRs by (1) cleaning up now-redundant FieldConfig null-casts in tests, (2) fixing an incorrect HTTP status mapping in the controller’s surviving /tables/livebrokers endpoint, and (3) removing a silently-insecure fallback in MaterializedViewTaskExecutorFactory by failing fast if the factory is used before initialization.
Changes:
- Remove redundant
(List<IndexType>) nullcasts atFieldConfigcall sites in multiple test classes (and drop the now-unusedjava.util.Listimport inAvgAggregationFunctionTest). - Update
GET /tables/livebrokersto surface server-side failures as500 INTERNAL_SERVER_ERROR(and log the original cause) instead of incorrectly reporting404 NOT_FOUND. - Replace an unreachable/unsafe “default empty gRPC config” fallback in
MaterializedViewTaskExecutorFactorywith a precondition check to ensureinit(...)was called beforecreate().
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
pinot-spi/src/test/java/org/apache/pinot/spi/config/table/OpenStructIndexConfigTest.java |
Drops redundant null casts in FieldConfig construction within open-struct index config tests. |
pinot-segment-local/src/test/java/org/apache/pinot/segment/local/utils/IndexCombinationValidationTest.java |
Drops redundant null casts in FieldConfig construction across index-combination validation tests. |
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/materializedview/MaterializedViewTaskExecutorFactory.java |
Fails fast (instead of silently defaulting) when minion config isn’t initialized before building the gRPC client config. |
pinot-core/src/test/java/org/apache/pinot/core/query/aggregation/function/AvgAggregationFunctionTest.java |
Removes now-unnecessary List import and redundant null casts in FieldConfig construction. |
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableInstances.java |
Corrects exception-to-HTTP-status mapping for /tables/livebrokers to return 500 with cause logging. |
…message - MaterializedViewTaskExecutorFactory: also validate _zkMetadataManager, which create() passes straight into MaterializedViewTaskExecutor and which is null if the factory is used before init(). Both checks moved to the top of create() so they run on every call; inside the lazy-init block they were skipped once _queryExecutor had been built. - PinotTableInstances: e.getMessage() is null for many exceptions, which would produce an empty message in both the log line and the 500 response body. Use a stable contextual message and let the attached cause carry the detail.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #19148 +/- ##
============================================
+ Coverage 65.62% 65.67% +0.05%
Complexity 1423 1423
============================================
Files 3439 3439
Lines 218236 218063 -173
Branches 34679 34678 -1
============================================
+ Hits 143207 143216 +9
+ Misses 63479 63295 -184
- Partials 11550 11552 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…gone Removing the (List<IndexType>) null casts shortened these statements enough to fit within the 120-char limit, so the line wrapping they needed is now just noise. Applies to IndexCombinationValidationTest, OpenStructIndexConfigTest and AvgAggregationFunctionTest.
Part of #19147. Addresses the review comments left on #19139 and #19142, kept out of those PRs so their approvals weren't churned.
Originally stacked on #19139; now that it has merged, this is rebased onto master and the diff stands alone — 5 files, +22/−20. No API is removed, so it does not trip the Binary Compatibility Check.
1. Redundant
FieldConfigcasts — addresses IndexCombinationValidationTest and AvgAggregationFunctionTestCopilot flagged the
(List<IndexType>) nullcasts as noise. Correct: they existed only to disambiguateWith the singular overload gone, the 5-arg form is unique (the remaining constructors are 7- and 9-arg), so bare
nullresolves unambiguously. Dropped at 12 call sites across three test files — includingOpenStructIndexConfigTest, which has the same pattern but wasn't touched by #19139.AvgAggregationFunctionTestalso loses itsjava.util.Listimport, which #19139 had added purely for those casts and which is now unused.2.
GET /tables/livebrokersreports 404 for server-side failures — addresses this commentThe endpoint declares
200and500, but caughtExceptionand mapped everything to404 NOT_FOUND.Checking
getTableToLiveBrokersMapping, unknown tables are silently filtered out rather than reported — so nothing it throws is a lookup miss. What it does throw isIllegalStateExceptionwhen the brokerExternalViewis missing, plus whatever Helix/ZK raises. So a cluster-level misconfiguration was being reported to clients as "not found", and the documented500was unreachable.Now maps to
INTERNAL_SERVER_ERROR, matching the declared responses, and passes the cause through so it is logged.This targets the surviving plural endpoint, not the singular one removed in #19142.
3. Dead
_minionConfnull-branch inMaterializedViewTaskExecutorFactoryRaised in review of #19139. The factory did:
_minionConfis assigned only byinit(zkMetadataManager, minionConf). With the deprecated 1-arginitremoved in #19139, that is the only initialization path, so the fallback is unreachable. It is also the wrong thing to fall back to — an empty configuration builds a plaintext gRPC client with default message limits rather than the operator's configured TLS client, and does so silently.Replaced with a
Preconditions.checkState, so a factory used beforeinitfails loudly instead of quietly downgrading the connection.Verification
Rebased onto master after #19139/#19141/#19142/#19143 merged, then re-verified: full
test-compilepluscheckstyle:checkandlicense:checkacross all five touched modules, and the three affected test classes pass —AvgAggregationFunctionTest(54),IndexCombinationValidationTest(47),OpenStructIndexConfigTest(14).