-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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 coordinator API for unused segments #14846
Changes from 2 commits
d23ae3a
037ba93
e590e32
989e83d
dfc143a
99cf3c6
352bd6d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -71,30 +71,13 @@ public ListenableFuture<Boolean> isHandoffComplete(String dataSource, SegmentDes | |||||||
} | ||||||||
|
||||||||
@Override | ||||||||
public ListenableFuture<DataSegment> fetchUsedSegment(String dataSource, String segmentId) | ||||||||
public ListenableFuture<DataSegment> fetchSegment(String dataSource, String segmentId, boolean includeUnused) | ||||||||
{ | ||||||||
final String path = StringUtils.format( | ||||||||
"/druid/coordinator/v1/metadata/datasources/%s/segments/%s", | ||||||||
"/druid/coordinator/v1/metadata/datasources/%s/segments/%s%s", | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks better to read. We can adjust %s to true/false based on the flag passed. Wdyt?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added it this way for consistency with the other APIs. The current pattern is to add a flag without value and check if it has been passed or not. ("includeOvershadowedStatus", "full", etc). Do we want to start moving away from this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something like druid/server/src/main/java/org/apache/druid/client/coordinator/CoordinatorClientImpl.java Line 57 in 82a8529
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with that. Changing to this pattern. |
||||||||
StringUtils.urlEncode(dataSource), | ||||||||
StringUtils.urlEncode(segmentId) | ||||||||
); | ||||||||
|
||||||||
return FutureUtils.transform( | ||||||||
client.asyncRequest( | ||||||||
new RequestBuilder(HttpMethod.GET, path), | ||||||||
new BytesFullResponseHandler() | ||||||||
), | ||||||||
holder -> JacksonUtils.readValue(jsonMapper, holder.getContent(), DataSegment.class) | ||||||||
); | ||||||||
} | ||||||||
|
||||||||
@Override | ||||||||
public ListenableFuture<DataSegment> fetchSegment(String dataSource, String segmentId) | ||||||||
{ | ||||||||
final String path = StringUtils.format( | ||||||||
"/druid/coordinator/v1/metadata/datasources/%s/segments/%s?includeUnused", | ||||||||
StringUtils.urlEncode(dataSource), | ||||||||
StringUtils.urlEncode(segmentId) | ||||||||
StringUtils.urlEncode(segmentId), | ||||||||
includeUnused ? "?includeUnused" : "" | ||||||||
); | ||||||||
|
||||||||
return FutureUtils.transform( | ||||||||
|
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.
Lets rename this to isReplaceTask ?
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.
It's only for a replace task which reads from the datasource it is replacing, so wouldn't reindex be better?
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.
replaceInputDataSourceTask? How does that sound ?