Skip to content

THRIFT-6280: Pass the current TConfiguration on from THeaderTransportFactory - #3872

Merged
Jens-G merged 1 commit into
apache:masterfrom
Jens-G:THRIFT-6280
Sep 16, 2026
Merged

Jens-G merged 1 commit into
apache:masterfrom
Jens-G:THRIFT-6280

Conversation

@Jens-G

@Jens-G Jens-G commented Sep 16, 2026

Copy link
Copy Markdown
Member

JIRA: THRIFT-6280
Client: go

THeaderTransportFactory in lib/go/thrift/header_transport.go did not pass its TConfiguration on the way the framed transport factory does:

  • SetTConfiguration propagated f.cfg, the configuration the factory held before, instead of cfg, the one it was given. The wrapped factory therefore always lagged one update behind.
  • NewTHeaderTransportFactoryConf did not propagate the configuration to the wrapped factory at all.

Change

  • NewTHeaderTransportFactoryConf and SetTConfiguration both propagate the given configuration to the wrapped factory, as NewTFramedTransportFactoryConf and tFramedTransportFactory.SetTConfiguration do.
  • GetTransport also passes the configuration to the transport it is handed before the wrapped factory builds on it, as the framed factory does. The transport the wrapped factory returns already received it through NewTHeaderTransportConf.
  • The deprecated NewTHeaderTransportFactory uses a configuration marked noPropagation, so it still passes nothing on.

Tests

New cases in header_transport_test.go, using a recording factory and transport:

  • TestTHeaderTransportFactoryConfPropagation checks the configuration:
    • after construction, on the wrapped factory;
    • after GetTransport, on the transport handed in, on the wrapped transport and on the header transport;
    • after PropagateTConfiguration(factory, updated), on the wrapped factory and on the next transport.
  • TestTHeaderTransportFactoryWithoutConf checks that the deprecated constructor passes nothing on.

Results:

  • Unmodified library: three assertions fail. Nothing reached the wrapped factory at construction or the transport handed in, and the wrapped factory held the old configuration after the update.
  • Mutations: removing each of the three changes in turn fails one assertion.
  • Checks: go vet -stdmethods=false and go test -race ./thrift pass with Go 1.26 and 1.27, and GOARCH=386 vet and tests pass as well.

The test helpers have names of their own, so this PR does not collide with the ones #3861 adds to the same package.

🤖 Generated with Claude Code

@Jens-G
Jens-G requested a review from fishy as a code owner September 16, 2026 21:49
@mergeable mergeable Bot added the golang Pull requests that update Go code label Sep 16, 2026
…Factory

Client: go

THeaderTransportFactory.SetTConfiguration handed the factory it wraps the
configuration it held before, not the one it was given, and
NewTHeaderTransportFactoryConf did not pass the configuration to the wrapped
factory at all. Both now do what the framed transport factory does: the
constructor and SetTConfiguration propagate the given configuration, and
GetTransport also passes it to the transport it is handed before the wrapped
factory builds on it. The deprecated NewTHeaderTransportFactory still keeps
its configuration to itself.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Jens-G
Jens-G merged commit 7938d30 into apache:master Sep 16, 2026
101 of 102 checks passed
@Jens-G
Jens-G deleted the THRIFT-6280 branch September 16, 2026 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

golang Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants