-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Make use of Chunked Encoding in the REST segments API #90136
Make use of Chunked Encoding in the REST segments API #90136
Conversation
This one returns the largest of all responses in the diagnostics in most cases, making it chunked by index which should be good enough.
Pinging @elastic/es-distributed (Team:Distributed) |
import java.util.List; | ||
import java.util.Locale; | ||
import java.util.Map; | ||
|
||
public class IndicesSegmentResponse extends BroadcastResponse { | ||
public class IndicesSegmentResponse extends BroadcastResponse implements ChunkedToXContent { |
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.
Hmm this is another case of something that implements both chunked and unchunked interfaces, risking accidental de-chunking (and see also that duplicated call to buildBroadcastShardsHeader
).
Could we instead make BroadcastResponse
always use chunked responses and change addCustomXContentFields
to something chunking-compatible? That'd fix this case plus indices stats, searchable snapshot stats, data stream stats, field usage stats, disk usage stats, ...
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.
(btw I'm ok to make this tactical change in 8.5 given its impact as long as we follow up with a better solution in 8.6)
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.
I'd also like to see us not implement ToXContent
, but ok to defer to a follow-up (hoping we can do this soon).
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { | ||
// override the BroadcastResponse behavior that is not compatible with the toXContentChunked implementation | ||
// TODO: make this not a ToXContent to make this unnecessary | ||
return ChunkedToXContent.super.toXContent(builder, params); |
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.
Can we assert false here? May need more test fixing but seems we'd need that anyway.
Thanks both, merging this today as is but will follow-up with removing the |
This one returns the largest of all responses in the diagnostics in most cases, making it chunked by index which should be good enough.
relates #89838