Make use of Chunked Encoding in the REST segments API#90136
Make use of Chunked Encoding in the REST segments API#90136original-brownbear merged 1 commit intoelastic:mainfrom original-brownbear:chunk-segments-response
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.Map; | ||
|
|
||
| public class IndicesSegmentResponse extends BroadcastResponse { | ||
| public class IndicesSegmentResponse extends BroadcastResponse implements ChunkedToXContent { |
There was a problem hiding this comment.
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.
(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)
henningandersen
left a comment
There was a problem hiding this comment.
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.
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