You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by dc...@apache.org on 2020/06/18 21:09:44 UTC
[thrift] 01/01: THRIFT-5233: Handle I/O timeouts in go library
(#2181)
This is an automated email from the ASF dual-hosted git repository.
dcelasun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git
commit bcae3bb52f976ce245ad77dfb060e5776d67ce85
Merge: 8b8633e e79f764
Author: Duru Can Celasun <dc...@apache.org>
AuthorDate: Thu Jun 18 22:09:33 2020 +0100
THRIFT-5233: Handle I/O timeouts in go library (#2181)
Client: go
As discussed in the JIRA ticket, this commit changes how we handle I/O
timeouts in the go library.
This is a breaking change that adds context to all Read*, Write*, and
Skip functions to TProtocol, along with the compiler change to support
that, and also adds context to TStandardClient.Recv, TDeserializer,
TStruct, and a few others.
Along with the function signature changes, this commit also implements
context cancellation check in the following TProtocol's ReadMessageBegin
implementations:
- TBinaryProtocol
- TCompactProtocol
- THeaderProtocol
In those ReadMessageBegin implementations, if the passed in context
object has a deadline attached, it will keep retrying the I/O timeout
errors, until the deadline on the context object passed. They won't
retry I/O timeout errors if the passed in context does not have a
deadline attached (still return on the first error).
CHANGES.md | 2 +
compiler/cpp/src/thrift/generate/t_go_generator.cc | 140 ++++-----
lib/go/test/tests/client_error_test.go | 246 +++++++--------
lib/go/test/tests/optional_fields_test.go | 79 ++---
lib/go/test/tests/protocol_mock.go | 336 ++++++++++-----------
lib/go/test/tests/required_fields_test.go | 46 +--
lib/go/thrift/application_exception.go | 48 +--
lib/go/thrift/binary_protocol.go | 185 ++++++------
lib/go/thrift/client.go | 20 +-
lib/go/thrift/compact_protocol.go | 117 +++----
lib/go/thrift/debug_protocol.go | 168 +++++------
lib/go/thrift/deserializer.go | 17 +-
lib/go/thrift/header_protocol.go | 184 +++++------
lib/go/thrift/header_transport.go | 39 ++-
lib/go/thrift/header_transport_test.go | 6 +-
lib/go/thrift/json_protocol.go | 158 +++++-----
lib/go/thrift/json_protocol_test.go | 62 ++--
lib/go/thrift/multiplexed_protocol.go | 10 +-
lib/go/thrift/protocol.go | 134 ++++----
lib/go/thrift/protocol_test.go | 82 ++---
lib/go/thrift/serializer.go | 8 +-
lib/go/thrift/serializer_test.go | 10 +-
lib/go/thrift/serializer_types_test.go | 241 +++++++--------
lib/go/thrift/simple_json_protocol.go | 147 ++++-----
lib/go/thrift/simple_json_protocol_test.go | 66 ++--
lib/go/thrift/simple_server.go | 2 +-
lib/go/thrift/transport_exception.go | 14 +
lib/go/thrift/transport_exception_test.go | 31 +-
28 files changed, 1342 insertions(+), 1256 deletions(-)