Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

THRIFT-5784: Add THeaderTransforms to TConfiguration #2973

Merged
merged 1 commit into from May 10, 2024

Conversation

fishy
Copy link
Member

@fishy fishy commented May 2, 2024

Client: go

While I'm here, also auto add compression transforms read (currently only zlib is supported) to writeTransforms so that a server will auto use the same compression on the responses as the client chose to use in the requests.

Comment on lines +458 to +461
// Reset writeTransforms to the ones from cfg, as we are going to add
// compression transforms from what we read, we don't want to accumulate
// different transforms read from different requests
t.writeTransforms = t.cfg.GetTHeaderTransforms()
Copy link
Member Author

Choose a reason for hiding this comment

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

a few notes here:

  1. in TSimpleServer we use the same THeaderProtocol instance for incoming and outgoing, while in TStandardClient we use different THeaderProtocol instances, so this behavior should only affect servers (clients would not use the THeaderProtocol read for writing)
  2. the consideration here (and the NOTE added in AddTransform) is for a hypothetical scenario: if a server have a long client connection, but the long client connection is actually multiple clients (e.g. it's a proxy), and those multiple clients use different compression transforms (we currently only support zlib, but the spec also defined snappy so we might support that some day in the future), we don't want to add different compression transforms cumulatively and doing both, but just use the same compression used by the request in the response. Maybe we should mark AddTransform as deprecated instead? the new feature in TConfiguration should be enough to replace that.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should mark AddTransform as deprecated instead?

Agreed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Also added a real test for req and resp compression.

@fishy fishy requested a review from dcelasun May 3, 2024 00:04
@Jens-G Jens-G added the golang patches related to go language label May 3, 2024
@fishy fishy force-pushed the go-header-transform-configuration branch from 08c068f to bfe7d9a Compare May 4, 2024 01:16
@fishy
Copy link
Member Author

fishy commented May 10, 2024

@dcelasun mind taking another look?

Copy link
Member

@dcelasun dcelasun left a comment

Choose a reason for hiding this comment

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

Looks good!

@fishy fishy force-pushed the go-header-transform-configuration branch from bfe7d9a to 12db087 Compare May 10, 2024 14:49
Client: go

While I'm here, also auto add compression transforms read (currently
only zlib is supported) to writeTransforms so that a server will auto
use the same compression on the responses as the client chose to use in
the requests.
@fishy fishy force-pushed the go-header-transform-configuration branch from 12db087 to 0b5c575 Compare May 10, 2024 14:52
@fishy fishy merged commit b20f675 into apache:master May 10, 2024
25 of 34 checks passed
@fishy fishy deleted the go-header-transform-configuration branch May 10, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
golang patches related to go language
Projects
None yet
3 participants