Add API to update segment ZK metadata without uploading - #19180
Add API to update segment ZK metadata without uploading#19180goutamadwant wants to merge 3 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #19180 +/- ##
============================================
+ Coverage 66.62% 66.95% +0.33%
- Complexity 1423 1426 +3
============================================
Files 3443 3452 +9
Lines 218577 218610 +33
Branches 34792 34752 -40
============================================
+ Hits 145624 146374 +750
+ Misses 61218 60536 -682
+ Partials 11735 11700 -35
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:
|
| String.format("Segment CRC does not match for segment: %s in table: %s", segmentName, tableNameWithType), | ||
| Status.PRECONDITION_FAILED); | ||
| } | ||
| segmentZKMetadata.setCustomMap(customMapModifier.modifyMap(segmentZKMetadata.getCustomMap())); |
There was a problem hiding this comment.
the refreshTime should also be updated, similar to how segment refresh is handled:
There was a problem hiding this comment.
Pull request overview
Adds a metadata-only segment update path to avoid recompressing and uploading unchanged segments.
Changes:
- Adds a CRC-checked, CAS-protected controller API for updating segment custom metadata.
- Routes unchanged minion conversions through the new API.
- Adds mixed-version fallback behavior and tests.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
FileUploadDownloadClient.java |
Adds metadata-update URI and PUT support. |
PinotSegmentRestletResource.java |
Implements the metadata update endpoint. |
PinotSegmentRestletResourceTest.java |
Tests endpoint success and error cases. |
BaseSingleSegmentConversionExecutor.java |
Skips uploads for unchanged segments. |
SegmentConversionUtils.java |
Adds the minion-side API client. |
BaseSingleSegmentConversionExecutorTest.java |
Tests metadata-only and fallback paths. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| } catch (HttpErrorStatusException e) { | ||
| if (e.getStatusCode() != HttpStatus.SC_NOT_FOUND) { |
| mocked.when(() -> SegmentConversionUtils.updateSegmentZKMetadata(Mockito.anyString(), Mockito.anyString(), | ||
| Mockito.anyString(), Mockito.anyString(), Mockito.any(), Mockito.any())) | ||
| .thenThrow(new HttpErrorStatusException("metadata API not found", HttpStatus.SC_NOT_FOUND)); |
|
|
||
| @PUT | ||
| @Path("segments/{tableNameWithType}/{segmentName}/metadata") | ||
| @Authorize(targetType = TargetType.TABLE, paramName = "tableNameWithType", action = Actions.Table.UPLOAD_SEGMENT) |
| SegmentZKMetadataCustomMapModifier customMapModifier; | ||
| try { | ||
| customMapModifier = new SegmentZKMetadataCustomMapModifier(customMapModifierJson); | ||
| } catch (Exception e) { | ||
| throw new ControllerApplicationException(LOGGER, "Invalid segment ZK metadata custom map modifier", |
Closes #10458
What this PR does
PUT /segments/{tableNameWithType}/{segmentName}/metadataAPI for updating the segment ZK metadata custom map.If-Matchand uses the ZK record version for compare-and-set protection.Backward compatibility
The endpoint is additive. Existing upload behavior is unchanged for modified segments, and older controllers continue to work through the fallback path.
Tests
PinotSegmentRestletResourceTestBaseSingleSegmentConversionExecutorTestpinot-common,pinot-controller, andpinot-minion-builtin-tasks