aboutsummaryrefslogtreecommitdiffstats
path: root/yt/yt
diff options
context:
space:
mode:
authorkvk1920 <kvk1920@yandex-team.com>2024-10-09 11:19:24 +0300
committerkvk1920 <kvk1920@yandex-team.com>2024-10-09 11:31:07 +0300
commit21ff5e09b3fd29ac99bb50ea7c4368f9eea7d3e7 (patch)
treedec7d01a4c822de0cae1cbed9e0e9c7a51e0ee56 /yt/yt
parentf77f95225df990636722a97078583a1b8a6727c5 (diff)
downloadydb-21ff5e09b3fd29ac99bb50ea7c4368f9eea7d3e7.tar.gz
Fix non-deterministic hash set traverse in YSON struct
* Changelog entry Type: fix Component: master Non-deterministic order of YSON struct field loading leads leads to non-deterministic error in case of absence of two or more required fields. Since error message is a part of response for master mutation this could lead to "state hashes differ" alert on master. commit_hash:140c56096212d5df8f9f1b1c2dbd63b3d2e61498
Diffstat (limited to 'yt/yt')
-rw-r--r--yt/yt/core/ytree/yson_struct_detail.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/yt/yt/core/ytree/yson_struct_detail.cpp b/yt/yt/core/ytree/yson_struct_detail.cpp
index 3bcd69aa40..1665385717 100644
--- a/yt/yt/core/ytree/yson_struct_detail.cpp
+++ b/yt/yt/core/ytree/yson_struct_detail.cpp
@@ -273,7 +273,11 @@ void TYsonStructMeta::LoadStruct(
pendingParameters.erase(parameter);
});
- for (const auto parameter : pendingParameters) {
+ auto sortedPendingParameters = std::vector(pendingParameters.begin(), pendingParameters.end());
+ Sort(sortedPendingParameters, [] (const auto* lhs, const auto* rhs) {
+ return lhs->GetKey() < rhs->GetKey();
+ });
+ for (const auto parameter : sortedPendingParameters) {
parameter->Load(target, /*cursor*/ nullptr, createLoadOptions(parameter->GetKey()));
}