-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Segment Lineage List API #9005 #9006
Conversation
Looks like it only returns the lineage entry Ids, can we return the actual entries as well? You can probably refer the get schema api "/schema/{schemaName}" to convert the object to json string. |
...ava/org/apache/pinot/controller/api/resources/PinotSegmentUploadDownloadRestletResource.java
Outdated
Show resolved
Hide resolved
@Authenticate(AccessType.READ) | ||
@Produces(MediaType.APPLICATION_JSON) | ||
@ApiOperation(value = "List segment lineage", notes = "List segment lineage") | ||
public Response listSegmentLineage( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we add some test for this endpoint. you can checkout how other endpoints are tested under PinotSegmentUploadDownloadRestletResourceTest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raised some concerns in the #Testing done
section of the PR description. Namely, PinotSegmentUploadDownloadRestletResourceTest
does not seem to cover any segment operations integration tests (as it requires table creation and segment upload) and such operations are tested in PinotHelixResourceManagerTest
though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh. actually my mistake. I think the first thing I suggest is to move the API from PinotSegmentUploadDownloadRestletResource
to PinotSegmentRestletResource
where all the other segment metadata APIs are located.
then it should be easy to add a test in PinotSegmentRestletResourceTest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CC ^ @snleee what do you think? this IMO should be in SegmentRestletResource rather than the UploadDownload one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that @yuanbenson probably put the new API to PinotSegmentUploadDownloadRestletResource
because the segment lineage-related code is being written in the segment replacement-related APIs.
Another way to put this is e.g. GET /tables/{tableName}/segments/lineage
under PinotSegmentRestletResource
as @walterddr suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@walterddr Moved the newly added API to PinotSegmentRestletResource
.
...ntroller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #9006 +/- ##
============================================
- Coverage 68.55% 68.47% -0.09%
- Complexity 4839 4961 +122
============================================
Files 1808 1831 +23
Lines 94274 96293 +2019
Branches 14056 14392 +336
============================================
+ Hits 64633 65935 +1302
- Misses 25122 25774 +652
- Partials 4519 4584 +65
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Thanks, addressed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you for working on this!
@yuanbenson Linter test fails. Can you try to set up https://docs.pinot.apache.org/developers/developers-and-contributors/code-setup#intellij and apply the style to the classes that you added? |
pinot-spi/src/main/java/org/apache/pinot/spi/utils/builder/ControllerRequestURLBuilder.java
Outdated
Show resolved
Hide resolved
@Authenticate(AccessType.READ) | ||
@Produces(MediaType.APPLICATION_JSON) | ||
@ApiOperation(value = "List segment lineage", notes = "List segment lineage") | ||
public Response listSegmentLineage( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that @yuanbenson probably put the new API to PinotSegmentUploadDownloadRestletResource
because the segment lineage-related code is being written in the segment replacement-related APIs.
Another way to put this is e.g. GET /tables/{tableName}/segments/lineage
under PinotSegmentRestletResource
as @walterddr suggested.
LGTM, thanks for working on this! |
LinkedHashMap<String, LineageEntry> sortedLineageEntries = new LinkedHashMap<>(); | ||
_lineageEntries.entrySet().stream() | ||
.sorted(Map.Entry.comparingByValue(Comparator.comparingLong(LineageEntry::getTimestamp))) | ||
.forEachOrdered(x -> sortedLineageEntries.put(x.getKey(), x.getValue())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@snleee fyi ensures resulting entries of listing segment lineage REST API are in chronological order here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO sorting is not necessary. at least we shouldn't do this in the toJsonObject path. what do you think we add the timestamp processing later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussed offline. We agreed to file the issue and address it from the separate PR.
@yuanbenson Can you change the description |
Yes, indeed that has been done! I just updated the description to reflect that. |
@yuanbenson Please create an issue regarding optimizing the JSON conversion for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me. thank you for the contribution!
Description
This PR adds support for listing segment lineage entries. The following endpoint on the controller can be used to retrieve such entries in chronological order of timestamp for a particular table.
Testing Done
Added new Junit test in
PinotSegmentRestletResourceTest.java
Manual verification
type
parameter.
3. Invalid tableLabels
feature