Skip to content
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 parameter to list segments which can be queried #7878

Merged
merged 1 commit into from
Jan 3, 2022

Conversation

jackjlli
Copy link
Member

@jackjlli jackjlli commented Dec 7, 2021

Description

This PR adds a parameter called excludeReplacedSegments to listSegments API in order to return live only segments which can be queried.
This is useful for us to know which set of segments can be queried.
One example is that if merged segments are generated by merge & roll up feature, the old segments won't be queried any more. In this case, user may not be interested in knowing the old segments.

Upgrade Notes

Does this PR prevent a zero down-time upgrade? (Assume upgrade order: Controller, Broker, Server, Minion)

  • Yes (Please label as backward-incompat, and complete the section below on Release Notes)

Does this PR fix a zero-downtime upgrade introduced earlier?

  • Yes (Please label this as backward-incompat, and complete the section below on Release Notes)

Does this PR otherwise need attention when creating release notes? Things to consider:

  • New configuration options
  • Deprecation of configurations
  • Signature changes to public methods/interfaces
  • New plugins added or old plugins removed
  • Yes (Please label this PR as release-notes and complete the section on Release Notes)

Release Notes

Documentation

@jackjlli jackjlli requested review from mcvsubbu and snleee December 7, 2021 22:30
@jackjlli jackjlli force-pushed the return-live-segments branch from 413c9df to f42eac8 Compare December 7, 2021 22:51
@jtao15
Copy link
Contributor

jtao15 commented Dec 8, 2021

Thanks for the pr, LGTM

Copy link
Contributor

@snleee snleee left a comment

Choose a reason for hiding this comment

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

LGTM

public List<Map<TableType, List<String>>> getSegments(
@ApiParam(value = "Name of the table", required = true) @PathParam("tableName") String tableName,
@ApiParam(value = "OFFLINE|REALTIME") @QueryParam("type") String tableTypeStr) {
@ApiParam(value = "OFFLINE|REALTIME") @QueryParam("type") String tableTypeStr,
@ApiParam(value = "Whether to return live only segments, which is a set of segments that can be queried"
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 a little bit vague to me. Here essentially we are excluding the segments already replaced using the lineage info, and not excluding the segments that are either in ERROR state or not served by the servers. Suggest updating the description/method name to make that clear

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good point! I'll polish the description to make it clear in the next push. In the future, if we really want to exclude the segment in ERROR state, we can also bring up another param like excludeErrorSegments and the like.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you change the description so that this can be in sync with the new parameter name (excludeReplacedSegments)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Description updated.

@@ -163,17 +163,21 @@
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/segments/{tableName}")
@ApiOperation(value = "List all segments", notes = "List all segments")
@ApiOperation(value = "List all segments. The 'liveOnly' parameter is used to get the list of segments"
Copy link
Contributor

Choose a reason for hiding this comment

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

All the internal implementation can be fixed, let us make sure we get the parameter name right. Just suggesting here: How about "includeIgnoredSegments"? You can write an explanation that segments are ignored when the lineage information indicates that they are superseded by newer segments.

Copy link
Member Author

Choose a reason for hiding this comment

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

There can be multiple kinds of segments that should be ignored. E.g. like Jackie mentioned, segments in ERROR state or not served by servers can also be ignored. Plus, the existing behavior should the default behavior, which means that even if we introduce this includeIgnoredSegments, the value should be false by default.

How about renaming it to queryableSegments and make it false by default?

Copy link
Member Author

Choose a reason for hiding this comment

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

Discussed it offline. The existing listSegments returns all the segments regardless of their states. Thus, the optional parameter should be called sth like excludeReplacedSegments to indicate that replaced segments are filtered out in the response payload. Later on, we can add more and more parameters like excludeErrorSegments, excludeConsumingSegments to filter more segments.

@jackjlli jackjlli force-pushed the return-live-segments branch 3 times, most recently from b8795b4 to d9054f2 Compare December 14, 2021 18:32
@jackjlli jackjlli force-pushed the return-live-segments branch from d9054f2 to 6765116 Compare December 14, 2021 19:59
@jackjlli jackjlli merged commit a1f3c30 into master Jan 3, 2022
@jackjlli jackjlli deleted the return-live-segments branch January 3, 2022 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants