Chunked encoding for _cat APIs#92022
Conversation
Some of these APIs scale as O(#indices) or O(#shards) so it seems worthwhile to use chunked encoding throughout. Relates elastic#89838
|
Pinging @elastic/es-distributed (Team:Distributed) |
| import java.io.OutputStream; | ||
| import java.io.Writer; | ||
|
|
||
| public final class UTF8StreamWriter extends Writer { |
There was a problem hiding this comment.
This claims performance benefits over the JDK's Writer. It's possible those claims are true, but I don't think this is on a hot enough path to warrant having yet another custom (and wholly untested) implementation of UTF-8 encoding, so I've replaced it with a regular Writer instead.
| currentOutput = null; | ||
| return new ReleasableBytesReference(chunkOutput.bytes(), () -> Releasables.closeExpectNoException(chunkOutput)); | ||
| } finally { | ||
| if (currentOutput != null) { |
There was a problem hiding this comment.
Although I don't see any obvious ways to throw exceptions in this area, I'm somewhat dubious about how such an exception would be handled in the networking code (edit: I get it now, but for the sake of safety we have to close currentOutput if we're not returning)
|
@elasticmachine update branch |
original-brownbear
left a comment
There was a problem hiding this comment.
Looks great thanks! Just one question on a test.
Some of these APIs scale as O(#indices) or O(#shards) so it seems worthwhile to use chunked encoding throughout.
Relates #89838