summaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/client/operation_helpers.cpp
diff options
context:
space:
mode:
authormax42 <[email protected]>2023-06-30 11:13:34 +0300
committermax42 <[email protected]>2023-06-30 11:13:34 +0300
commit3e1899838408bbad47622007aa382bc8a2b01f87 (patch)
tree0f21c1e6add187ddb6c3ccc048a7d640ce03fb87 /yt/cpp/mapreduce/client/operation_helpers.cpp
parent5463eb3f5e72a86f858a3d27c886470a724ede34 (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/operation_helpers.cpp')
-rw-r--r--yt/cpp/mapreduce/client/operation_helpers.cpp91
1 files changed, 0 insertions, 91 deletions
diff --git a/yt/cpp/mapreduce/client/operation_helpers.cpp b/yt/cpp/mapreduce/client/operation_helpers.cpp
deleted file mode 100644
index abb21856622..00000000000
--- a/yt/cpp/mapreduce/client/operation_helpers.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-#include "operation_helpers.h"
-
-#include <yt/cpp/mapreduce/common/retry_lib.h>
-
-#include <yt/cpp/mapreduce/interface/config.h>
-
-#include <yt/cpp/mapreduce/interface/logging/yt_log.h>
-
-#include <yt/cpp/mapreduce/raw_client/raw_requests.h>
-
-#include <yt/cpp/mapreduce/http/context.h>
-#include <yt/cpp/mapreduce/http/requests.h>
-
-#include <util/string/builder.h>
-
-#include <util/system/mutex.h>
-#include <util/system/rwlock.h>
-
-namespace NYT::NDetail {
-
-////////////////////////////////////////////////////////////////////////////////
-
-ui64 RoundUpFileSize(ui64 size)
-{
- constexpr ui64 roundUpTo = 4ull << 10;
- return (size + roundUpTo - 1) & ~(roundUpTo - 1);
-}
-
-bool UseLocalModeOptimization(const TClientContext& context, const IClientRetryPolicyPtr& clientRetryPolicy)
-{
- if (!context.Config->EnableLocalModeOptimization) {
- return false;
- }
-
- static THashMap<TString, bool> localModeMap;
- static TRWMutex mutex;
-
- {
- TReadGuard guard(mutex);
- auto it = localModeMap.find(context.ServerName);
- if (it != localModeMap.end()) {
- return it->second;
- }
- }
-
- bool isLocalMode = false;
- TString localModeAttr("//sys/@local_mode_fqdn");
- // We don't want to pollute logs with errors about failed request,
- // so we check if path exists before getting it.
- if (NRawClient::Exists(clientRetryPolicy->CreatePolicyForGenericRequest(),
- context,
- TTransactionId(),
- localModeAttr,
- TExistsOptions().ReadFrom(EMasterReadKind::Cache)))
- {
- auto fqdnNode = NRawClient::TryGet(
- clientRetryPolicy->CreatePolicyForGenericRequest(),
- context,
- TTransactionId(),
- localModeAttr,
- TGetOptions().ReadFrom(EMasterReadKind::Cache));
- if (!fqdnNode.IsUndefined()) {
- auto fqdn = fqdnNode.AsString();
- isLocalMode = (fqdn == TProcessState::Get()->FqdnHostName);
- YT_LOG_DEBUG("Checking local mode; LocalModeFqdn: %v FqdnHostName: %v IsLocalMode: %v",
- fqdn,
- TProcessState::Get()->FqdnHostName,
- isLocalMode ? "true" : "false");
- }
- }
-
- {
- TWriteGuard guard(mutex);
- localModeMap[context.ServerName] = isLocalMode;
- }
-
- return isLocalMode;
-}
-
-TString GetOperationWebInterfaceUrl(TStringBuf serverName, TOperationId operationId)
-{
- serverName.ChopSuffix(":80");
- serverName.ChopSuffix(".yt.yandex-team.ru");
- serverName.ChopSuffix(".yt.yandex.net");
- return ::TStringBuilder() << "https://yt.yandex-team.ru/" << serverName <<
- "/operations/" << GetGuidAsString(operationId);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-} // namespace NYT::NDetail