diff options
| author | max42 <[email protected]> | 2023-06-30 11:13:34 +0300 |
|---|---|---|
| committer | max42 <[email protected]> | 2023-06-30 11:13:34 +0300 |
| commit | 3e1899838408bbad47622007aa382bc8a2b01f87 (patch) | |
| tree | 0f21c1e6add187ddb6c3ccc048a7d640ce03fb87 /yt/cpp/mapreduce/client/retry_heavy_write_request.cpp | |
| parent | 5463eb3f5e72a86f858a3d27c886470a724ede34 (diff) | |
Revert "YT-19324: move YT provider to ydb/library/yql"
This reverts commit ca272f12fdd0e8d5c3e957fc87939148f1caaf72, reversing
changes made to 49f8acfc8b0b5c0071b804423bcf53fda26c7c12.
Diffstat (limited to 'yt/cpp/mapreduce/client/retry_heavy_write_request.cpp')
| -rw-r--r-- | yt/cpp/mapreduce/client/retry_heavy_write_request.cpp | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/yt/cpp/mapreduce/client/retry_heavy_write_request.cpp b/yt/cpp/mapreduce/client/retry_heavy_write_request.cpp deleted file mode 100644 index b4e4975d7f3..00000000000 --- a/yt/cpp/mapreduce/client/retry_heavy_write_request.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include "retry_heavy_write_request.h" - -#include "transaction.h" -#include "transaction_pinger.h" - -#include <yt/cpp/mapreduce/common/retry_lib.h> -#include <yt/cpp/mapreduce/common/wait_proxy.h> - -#include <yt/cpp/mapreduce/interface/config.h> -#include <yt/cpp/mapreduce/interface/tvm.h> - -#include <yt/cpp/mapreduce/interface/logging/yt_log.h> - -#include <yt/cpp/mapreduce/http/helpers.h> -#include <yt/cpp/mapreduce/http/http_client.h> -#include <yt/cpp/mapreduce/http/requests.h> -#include <yt/cpp/mapreduce/http/retry_request.h> - -namespace NYT { - -using ::ToString; - -//////////////////////////////////////////////////////////////////////////////// - -void RetryHeavyWriteRequest( - const IClientRetryPolicyPtr& clientRetryPolicy, - const ITransactionPingerPtr& transactionPinger, - const TClientContext& context, - const TTransactionId& parentId, - THttpHeader& header, - std::function<THolder<IInputStream>()> streamMaker) -{ - int retryCount = context.Config->RetryCount; - if (context.ServiceTicketAuth) { - header.SetServiceTicket(context.ServiceTicketAuth->Ptr->IssueServiceTicket()); - } else { - header.SetToken(context.Token); - } - - for (int attempt = 0; attempt < retryCount; ++attempt) { - TPingableTransaction attemptTx(clientRetryPolicy, context, parentId, transactionPinger->GetChildTxPinger(), TStartTransactionOptions()); - - auto input = streamMaker(); - TString requestId; - - try { - auto hostName = GetProxyForHeavyRequest(context); - requestId = CreateGuidAsString(); - - header.AddTransactionId(attemptTx.GetId(), /* overwrite = */ true); - header.SetRequestCompression(ToString(context.Config->ContentEncoding)); - - auto request = context.HttpClient->StartRequest(GetFullUrl(hostName, context, header), requestId, header); - TransferData(input.Get(), request->GetStream()); - request->Finish()->GetResponse(); - } catch (TErrorResponse& e) { - YT_LOG_ERROR("RSP %v - attempt %v failed", - requestId, - attempt); - - if (!IsRetriable(e) || attempt + 1 == retryCount) { - throw; - } - NDetail::TWaitProxy::Get()->Sleep(GetBackoffDuration(e, context.Config)); - continue; - - } catch (std::exception& e) { - YT_LOG_ERROR("RSP %v - %v - attempt %v failed", - requestId, - e.what(), - attempt); - - if (attempt + 1 == retryCount) { - throw; - } - NDetail::TWaitProxy::Get()->Sleep(GetBackoffDuration(e, context.Config)); - continue; - } - - attemptTx.Commit(); - return; - } -} - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace NYT |
