Skip to content

Chunked encoding for _cat APIs#92022

Merged
elasticsearchmachine merged 9 commits intoelastic:mainfrom
DaveCTurner:2022-11-30-chunked-encoding-cat-apis
Dec 6, 2022
Merged

Chunked encoding for _cat APIs#92022
elasticsearchmachine merged 9 commits intoelastic:mainfrom
DaveCTurner:2022-11-30-chunked-encoding-cat-apis

Conversation

@DaveCTurner
Copy link
Copy Markdown
Member

Some of these APIs scale as O(#indices) or O(#shards) so it seems worthwhile to use chunked encoding throughout.

Relates #89838

Some of these APIs scale as O(#indices) or O(#shards) so it seems
worthwhile to use chunked encoding throughout.

Relates elastic#89838
@DaveCTurner DaveCTurner added >non-issue :Distributed/Network Http and internode communication implementations v8.7.0 labels Nov 30, 2022
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Meta label for distributed team. label Nov 30, 2022
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

import java.io.OutputStream;
import java.io.Writer;

public final class UTF8StreamWriter extends Writer {
Copy link
Copy Markdown
Member Author

@DaveCTurner DaveCTurner Nov 30, 2022

Choose a reason for hiding this comment

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

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) {
Copy link
Copy Markdown
Member Author

@DaveCTurner DaveCTurner Nov 30, 2022

Choose a reason for hiding this comment

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

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)

@DaveCTurner
Copy link
Copy Markdown
Member Author

@elasticmachine update branch

Copy link
Copy Markdown
Contributor

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

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

Looks great thanks! Just one question on a test.

Copy link
Copy Markdown
Contributor

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

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

LGTM!

@DaveCTurner DaveCTurner added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Dec 6, 2022
@elasticsearchmachine elasticsearchmachine merged commit b3a272e into elastic:main Dec 6, 2022
@DaveCTurner DaveCTurner deleted the 2022-11-30-chunked-encoding-cat-apis branch December 6, 2022 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Distributed/Network Http and internode communication implementations >non-issue Team:Distributed Meta label for distributed team. v8.7.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants