Skip to content

feat: configurable transport compression strategy#19454

Open
jtuglu1 wants to merge 1 commit into
apache:masterfrom
jtuglu1:compression-strategy
Open

feat: configurable transport compression strategy#19454
jtuglu1 wants to merge 1 commit into
apache:masterfrom
jtuglu1:compression-strategy

Conversation

@jtuglu1
Copy link
Copy Markdown
Contributor

@jtuglu1 jtuglu1 commented May 12, 2026

Fixes #XXXX.

Description

Fixed the bug ...

Renamed the class ...

Added a forbidden-apis entry ...

Release note


Key changed/added classes in this PR
  • MyFoo
  • OurBar
  • TheirBaz

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.


private static InputStream newLz4InputStream(InputStream in)
{
return new LZ4BlockInputStream(in);
Copy link
Copy Markdown
Member

@FrankChen021 FrankChen021 left a comment

Choose a reason for hiding this comment

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

Severity Findings
P0 0
P1 1
P2 1
P3 0
Total 2

Reviewed 3 of 3 changed files.


This is an automated review by Codex GPT-5.5

return new JsonParserIterator<>(
queryResultType,
future,
wrapFutureWithDecompressor(future, responseContentEncoding.get()),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[P1] Decompressor choice races the response headers

The decompressor is selected from responseContentEncoding.get() when the Sequence iterator is created, which can happen immediately after run() returns and before the async HTTP handler has seen the response headers. In that common path this passes an empty encoding and returns the original future, so a later zstd/x-lz4 response is handed to JsonParserIterator still compressed and parsing fails. Defer the encoding lookup until the future completes, e.g. always transform with a function that reads the AtomicReference after handleResponse has set it.

if (acceptEncoding == null) {
return null;
}
if (acceptEncoding.contains("zstd")) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[P2] Honor q=0 when negotiating encodings

This substring check treats headers like gzip, zstd;q=0 or x-lz4;q=0 as accepting the encoding, then sends a compressed response that the client explicitly marked unacceptable. QueryResultPusher handles user-facing query responses too, so this can break standards-compliant clients. Parse Accept-Encoding as tokens with q-values and only select zstd/x-lz4 when q is absent or greater than zero.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants