Skip to content

Compress large prepared statements headers#11098

Merged
findepi merged 3 commits intotrinodb:masterfrom
findepi:findepi/precompress
Feb 23, 2022
Merged

Compress large prepared statements headers#11098
findepi merged 3 commits intotrinodb:masterfrom
findepi:findepi/precompress

Conversation

@findepi
Copy link
Copy Markdown
Member

@findepi findepi commented Feb 18, 2022

This allows working with larger prepared statements before hitting
header size limits (on either server, or intermediate proxy).

Since the client should not make assumption on any specific format of
prepared statements in the headers, the compression is applied
unconditionally.

It's name suggested it's specifically for `X-Trino-Set-Session` only.
@findepi findepi added enhancement New feature or request jdbc Relates to Trino JDBC driver labels Feb 18, 2022
@findepi findepi requested review from electrum and hashhar February 18, 2022 10:36
@cla-bot cla-bot bot added the cla-signed label Feb 18, 2022
@findepi
Copy link
Copy Markdown
Member Author

findepi commented Feb 18, 2022

@findepi findepi requested a review from dain February 18, 2022 16:14
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.

Make these configurable in ProtocolConfig. This will also allow disabling if necessary, in case someone has a compatibility issue. You can inject this class into both of the calling classes.

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.

You can use java.util.Base64#getUrlEncoder

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

encodeToString requires copying the input data into new byte[]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: maybe rename to COMPRESSION_THRESHOLD_LENGTH, I assumed this was bytes initially.

@findepi findepi force-pushed the findepi/precompress branch 2 times, most recently from fc819b6 to 5105225 Compare February 21, 2022 09:16
@findepi
Copy link
Copy Markdown
Member Author

findepi commented Feb 21, 2022

AC

@findepi findepi force-pushed the findepi/precompress branch from 5105225 to 24acb43 Compare February 22, 2022 12:38
This allows working with larger prepared statements before hitting
header size limits (on either server, or intermediate proxy).

Since the client should not make assumption on any specific format of
prepared statements in the headers, the compression is applied
unconditionally.
@findepi findepi force-pushed the findepi/precompress branch from 24acb43 to 2c6a169 Compare February 23, 2022 09:17
@findepi findepi merged commit 92731e2 into trinodb:master Feb 23, 2022
@findepi findepi deleted the findepi/precompress branch February 23, 2022 09:17
@findepi findepi mentioned this pull request Feb 23, 2022
@github-actions github-actions bot added this to the 372 milestone Feb 23, 2022
@mosabua
Copy link
Copy Markdown
Member

mosabua commented Feb 23, 2022

Filed #11169 to follow up with needed docs.

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

Labels

cla-signed enhancement New feature or request jdbc Relates to Trino JDBC driver

Development

Successfully merging this pull request may close these issues.

5 participants