diff options
author | danilalexeev <danilalexeev@yandex-team.com> | 2024-12-07 23:39:51 +0300 |
---|---|---|
committer | danilalexeev <danilalexeev@yandex-team.com> | 2024-12-07 23:54:13 +0300 |
commit | fbb77d816aca85abe7cdf16e73f1c28e83cbf8b7 (patch) | |
tree | 11177560d4d641969789c12e12574384eea9d161 | |
parent | 9a84f81be34ee0fa230bb58cb29b63e03bb38f5b (diff) | |
download | ydb-fbb77d816aca85abe7cdf16e73f1c28e83cbf8b7.tar.gz |
YT-20603: Change EnableLegacyRpcCodecs' default to false at rpc layer
commit_hash:cf3eee744626a3b686f2c9e535e01ab9ee93b376
-rw-r--r-- | yt/yt/core/rpc/client.h | 4 | ||||
-rw-r--r-- | yt/yt/core/rpc/grpc/channel.cpp | 3 | ||||
-rw-r--r-- | yt/yt/core/rpc/http/channel.cpp | 9 | ||||
-rw-r--r-- | yt/yt/core/test_framework/test_proxy_service.cpp | 4 |
4 files changed, 16 insertions, 4 deletions
diff --git a/yt/yt/core/rpc/client.h b/yt/yt/core/rpc/client.h index 0dbbe3c67e..2d2dc4ae09 100644 --- a/yt/yt/core/rpc/client.h +++ b/yt/yt/core/rpc/client.h @@ -143,7 +143,7 @@ public: DEFINE_BYVAL_RW_PROPERTY(bool, ResponseHeavy); DEFINE_BYVAL_RW_PROPERTY(NCompression::ECodec, RequestCodec, NCompression::ECodec::None); DEFINE_BYVAL_RW_PROPERTY(NCompression::ECodec, ResponseCodec, NCompression::ECodec::None); - DEFINE_BYVAL_RW_PROPERTY(bool, EnableLegacyRpcCodecs, true); + DEFINE_BYVAL_RW_PROPERTY(bool, EnableLegacyRpcCodecs, false); DEFINE_BYVAL_RW_PROPERTY(bool, GenerateAttachmentChecksums, true); DEFINE_BYVAL_RW_PROPERTY(IMemoryUsageTrackerPtr, MemoryUsageTracker); // Field is used on client side only. So it is never serialized. @@ -481,7 +481,7 @@ public: DEFINE_BYVAL_RW_PROPERTY(NCompression::ECodec, DefaultRequestCodec, NCompression::ECodec::None); DEFINE_BYVAL_RW_PROPERTY(NCompression::ECodec, DefaultResponseCodec, NCompression::ECodec::None); DEFINE_BYVAL_RW_PROPERTY(IMemoryUsageTrackerPtr, DefaultMemoryUsageTracker); - DEFINE_BYVAL_RW_PROPERTY(bool, DefaultEnableLegacyRpcCodecs, true); + DEFINE_BYVAL_RW_PROPERTY(bool, DefaultEnableLegacyRpcCodecs, false); DEFINE_BYREF_RW_PROPERTY(TStreamingParameters, DefaultClientAttachmentsStreamingParameters); DEFINE_BYREF_RW_PROPERTY(TStreamingParameters, DefaultServerAttachmentsStreamingParameters); diff --git a/yt/yt/core/rpc/grpc/channel.cpp b/yt/yt/core/rpc/grpc/channel.cpp index ed6ed3b034..06eb21947e 100644 --- a/yt/yt/core/rpc/grpc/channel.cpp +++ b/yt/yt/core/rpc/grpc/channel.cpp @@ -343,6 +343,9 @@ private: } try { + THROW_ERROR_EXCEPTION_IF( + Request_->IsAttachmentCompressionEnabled(), + "Compression codecs are not supported in RPC over GRPC"); RequestBody_ = Request_->Serialize(); } catch (const std::exception& ex) { auto responseHandler = TryAcquireResponseHandler(); diff --git a/yt/yt/core/rpc/http/channel.cpp b/yt/yt/core/rpc/http/channel.cpp index b656f00c2c..7a8373bab5 100644 --- a/yt/yt/core/rpc/http/channel.cpp +++ b/yt/yt/core/rpc/http/channel.cpp @@ -182,9 +182,16 @@ private: TSharedRef httpRequestBody; try { + THROW_ERROR_EXCEPTION_IF( + request->IsAttachmentCompressionEnabled(), + "Compression codecs are not supported in HTTP"); auto requestBody = request->Serialize(); THROW_ERROR_EXCEPTION_UNLESS(requestBody.Size() == 2, "Attachments are not supported in HTTP"); - httpRequestBody = NGrpc::ExtractMessageFromEnvelopedMessage(requestBody[1]); + if (request->IsLegacyRpcCodecsEnabled()) { + httpRequestBody = NGrpc::ExtractMessageFromEnvelopedMessage(requestBody[1]); + } else { + httpRequestBody = requestBody[1]; + } } catch (const std::exception& ex) { responseHandler->HandleError(TError(NRpc::EErrorCode::TransportError, "Request serialization failed") << ex); diff --git a/yt/yt/core/test_framework/test_proxy_service.cpp b/yt/yt/core/test_framework/test_proxy_service.cpp index 1795281c8e..05c880451f 100644 --- a/yt/yt/core/test_framework/test_proxy_service.cpp +++ b/yt/yt/core/test_framework/test_proxy_service.cpp @@ -123,9 +123,11 @@ IClientRequestControlPtr TTestChannel::Send( EmplaceOrCrash(RequestToBus_, std::make_pair(Address_, requestId), bus); try { + // Serialization modifies the request header and should be called prior to header copying. + auto serializedMessage = request->Serialize(); service->HandleRequest( std::make_unique<NProto::TRequestHeader>(request->Header()), - request->Serialize(), + std::move(serializedMessage), bus); bus->GetReadyResponseFuture() .Subscribe(BIND(&TTestChannel::HandleRequestResult, MakeStrong(this), Address_, requestId, responseHandler)); |