aboutsummaryrefslogtreecommitdiffstats
path: root/yt
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-06-20 00:01:05 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-06-20 00:10:06 +0300
commit4ccb78569fa336d5a57cb2d8f880013cfc2ba6fa (patch)
tree2b24132084c22fd8bcd388c04bfa6ac33556f47c /yt
parent93108b981df25d1adbac948754f5955075eedcc8 (diff)
downloadydb-4ccb78569fa336d5a57cb2d8f880013cfc2ba6fa.tar.gz
Intermediate changes
Diffstat (limited to 'yt')
-rw-r--r--yt/yt/core/misc/unittests/consistent_hashing_ut.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/yt/yt/core/misc/unittests/consistent_hashing_ut.cpp b/yt/yt/core/misc/unittests/consistent_hashing_ut.cpp
index e870aeed1a..8c95d6e961 100644
--- a/yt/yt/core/misc/unittests/consistent_hashing_ut.cpp
+++ b/yt/yt/core/misc/unittests/consistent_hashing_ut.cpp
@@ -25,9 +25,10 @@ struct TStringComparer
struct TStringHasher
{
- ui64 operator()(const TString& node, int index) const
+ ui64 operator()(const TString& node, ui64 index) const
{
- return ::THash<TStringBuf>()(node + std::to_string(index));
+ auto hashNode = ::THash<TStringBuf>()(node);
+ return (hashNode ^ (index << 3)) + hashNode << (index & 7);
}
};
@@ -563,7 +564,7 @@ TEST(TConsistentHashingRing, ManyNodesSimultaneouslyStress)
TEST(TConsistentHashingRing, SmallTokenCount)
{
- const size_t testCases = 10;
+ const size_t testCases = 4;
auto singleReplicaLargeResult = 0.0;
auto manyReplicasLargeResult = 0.0;
@@ -612,8 +613,8 @@ TEST(TConsistentHashingRing, SmallTokenCount)
/*batchSize*/ 200) / testCases;
}
- EXPECT_LE(std::fabs(singleReplicaLargeResult - singleReplicaSmallResult), 0.1);
- EXPECT_LE(std::fabs(manyReplicasLargeResult - manyReplicasSmallResult), 0.1);
+ EXPECT_LE(std::fabs(singleReplicaLargeResult - singleReplicaSmallResult), 0.12);
+ EXPECT_LE(std::fabs(manyReplicasLargeResult - manyReplicasSmallResult), 0.12);
}
////////////////////////////////////////////////////////////////////////////////