diff options
author | kvk1920 <kvk1920@yandex-team.com> | 2024-10-09 11:19:24 +0300 |
---|---|---|
committer | kvk1920 <kvk1920@yandex-team.com> | 2024-10-09 11:31:07 +0300 |
commit | 21ff5e09b3fd29ac99bb50ea7c4368f9eea7d3e7 (patch) | |
tree | dec7d01a4c822de0cae1cbed9e0e9c7a51e0ee56 /yt/yt | |
parent | f77f95225df990636722a97078583a1b8a6727c5 (diff) | |
download | ydb-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.cpp | 6 |
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())); } |