diff options
| author | rp-1 <[email protected]> | 2025-10-11 14:59:44 +0300 |
|---|---|---|
| committer | rp-1 <[email protected]> | 2025-10-11 15:16:12 +0300 |
| commit | 384d7a82d5838408972b6df01c48dccdc25f08d5 (patch) | |
| tree | 30fcdc7831f4d5ecc20eb3c4e4bc75ff27ddd178 /yt/cpp/mapreduce/client/client.cpp | |
| parent | 31c19b13025472f6ce0023b390930e292a670181 (diff) | |
YT-26065: Add TPatchableField to C++ config
Initial commit
commit_hash:d8d8a160ba64cc1e63e174430aec262d2359cf4e
Diffstat (limited to 'yt/cpp/mapreduce/client/client.cpp')
| -rw-r--r-- | yt/cpp/mapreduce/client/client.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/yt/cpp/mapreduce/client/client.cpp b/yt/cpp/mapreduce/client/client.cpp index 26e5f00f336..ab616c3aace 100644 --- a/yt/cpp/mapreduce/client/client.cpp +++ b/yt/cpp/mapreduce/client/client.cpp @@ -1560,6 +1560,52 @@ void TClient::CheckShutdown() const } } +const TNode::TMapType& TClient::GetDynamicConfiguration(const TString& configProfile) +{ + auto g = Guard(ClusterConfigLock_); + + if (!ClusterConfig_) { + TNode clusterConfigNode; + + TYPath clusterConfigPath = Context_.Config->ConfigRemotePatchPath + "/" + configProfile; + YT_LOG_DEBUG( + "Fetching cluster config (ConfigPath: %v, ConfigProfile: %v)", + Context_.Config->ConfigRemotePatchPath, + configProfile); + + try { + clusterConfigNode = Get(clusterConfigPath, TGetOptions()); + } catch (const TErrorResponse& error) { + if (!error.IsResolveError()) { + throw; + } + + ClusterConfig_.emplace(); + YT_LOG_WARNING( + "Could not resolve, saved empty cluster config (ConfigPath: %v, ConfigProfile: %v)", + Context_.Config->ConfigRemotePatchPath, + configProfile); + } + + if (clusterConfigNode.IsMap()) { + ClusterConfig_ = clusterConfigNode.UncheckedAsMap(); + YT_LOG_DEBUG( + "Saved cluster config (ConfigPath: %v, ConfigProfile: %v)", + Context_.Config->ConfigRemotePatchPath, + configProfile); + } else if (!ClusterConfig_.has_value()) { + ClusterConfig_.emplace(); + YT_LOG_WARNING( + "Config node has incorrect type, saved empty cluster config (NodeType: %v, ConfigPath: %v, ConfigProfile: %v)", + clusterConfigNode.GetType(), + Context_.Config->ConfigRemotePatchPath, + configProfile); + } + } + + return *ClusterConfig_; +} + void SetupClusterContext( TClientContext& context, const TString& serverName) |
