summaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/client/client.cpp
diff options
context:
space:
mode:
authorhiddenpath <[email protected]>2025-03-01 17:24:09 +0300
committerhiddenpath <[email protected]>2025-03-01 17:42:01 +0300
commit513eec13663e999f0e8537c42e804e5e8684f19a (patch)
tree38a93cbb29a62558436ff498bcdfdee39b28afae /yt/cpp/mapreduce/client/client.cpp
parent8b739d2ab4331d499f54de87def577f77db0680a (diff)
YT-24173: Fix error resolving path in remote clusters operations
commit_hash:9facb0640518c75b7a745dad2ddbd649cb91a83f
Diffstat (limited to 'yt/cpp/mapreduce/client/client.cpp')
-rw-r--r--yt/cpp/mapreduce/client/client.cpp37
1 files changed, 23 insertions, 14 deletions
diff --git a/yt/cpp/mapreduce/client/client.cpp b/yt/cpp/mapreduce/client/client.cpp
index 6e589033085..bf9936a64a9 100644
--- a/yt/cpp/mapreduce/client/client.cpp
+++ b/yt/cpp/mapreduce/client/client.cpp
@@ -1496,8 +1496,7 @@ IClientPtr TClient::GetParentClient(bool ignoreGlobalTx)
RawClient_,
Context_,
TTransactionId(),
- ClientRetryPolicy_
- );
+ ClientRetryPolicy_);
} else {
return this;
}
@@ -1510,15 +1509,10 @@ void TClient::CheckShutdown() const
}
}
-TClientContext CreateClientContext(
- const TString& serverName,
- const TCreateClientOptions& options)
+void SetupClusterContext(
+ TClientContext& context,
+ const TString& serverName)
{
- TClientContext context;
- context.Config = options.Config_ ? options.Config_ : TConfig::Get();
- context.TvmOnly = options.TvmOnly_;
- context.ProxyAddress = options.ProxyAddress_;
-
context.ServerName = serverName;
ApplyProxyUrlAliasingRules(context.ServerName);
@@ -1531,9 +1525,8 @@ TClientContext CreateClientContext(
static constexpr char httpUrlSchema[] = "http://";
static constexpr char httpsUrlSchema[] = "https://";
- if (options.UseTLS_) {
- context.UseTLS = *options.UseTLS_;
- } else {
+
+ if (!context.UseTLS) {
context.UseTLS = context.ServerName.StartsWith(httpsUrlSchema);
}
@@ -1555,9 +1548,25 @@ TClientContext CreateClientContext(
if (context.ServerName.find(':') == TString::npos) {
context.ServerName = CreateHostNameWithPort(context.ServerName, context);
}
- if (options.TvmOnly_) {
+ if (context.TvmOnly) {
context.ServerName = Format("tvm.%v", context.ServerName);
}
+}
+
+TClientContext CreateClientContext(
+ const TString& serverName,
+ const TCreateClientOptions& options)
+{
+ TClientContext context;
+ context.Config = options.Config_ ? options.Config_ : TConfig::Get();
+ context.TvmOnly = options.TvmOnly_;
+ context.ProxyAddress = options.ProxyAddress_;
+
+ if (options.UseTLS_) {
+ context.UseTLS = *options.UseTLS_;
+ }
+
+ SetupClusterContext(context, serverName);
if (options.ProxyRole_) {
context.Config->Hosts = "hosts?role=" + *options.ProxyRole_;