Skip to content

Commit 0bdd58b

Browse files
author
Yasufumi Kinoshita
committed
Merge branch 'mysql-8.0-bug37212019' into mysql-8.0
Change-Id: Iddd15a2aab2b4f4dbb6742fa1f9d4c61b65cd79e
2 parents 7b81cc3 + b7b770f commit 0bdd58b

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

storage/innobase/include/ut0rnd.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,17 @@ static inline uint64_t random_from_interval(uint64_t low, uint64_t high) {
183183
}
184184

185185
static inline uint64_t random_from_interval_fast(uint64_t low, uint64_t high) {
186-
return random_from_interval_gen<random_64_fast>(low, high);
186+
/* FIXME: To keep backward compatibility with the previous ut_rnd_interval(),
187+
high value is not to be returned to keep same behavior for performance tuning
188+
parameter.
189+
(Bug#37212019: behavior related to innodb_spin_wait_delay changed in 8.0.30)
190+
This function is not required accurate randomness, no real problems. */
191+
192+
if (low == high) {
193+
return (low);
194+
}
195+
196+
return random_from_interval_gen<random_64_fast>(low, high - 1);
187197
}
188198

189199
static inline uint64_t hash_uint64(uint64_t value) {

unittest/gunit/innodb/ut0rnd-t.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ static void test_interval_fast_distribution(uint64_t n) {
369369
const uint64_t max_score = 17000;
370370

371371
for (uint64_t i = 0; i < max_count; i++) {
372-
const auto value = ut::random_from_interval_fast(0, n - 1);
372+
const auto value = ut::random_from_interval_fast(0, n);
373373
for (auto target : target_score) {
374374
if (value == target[0]) {
375375
target[1]++;

0 commit comments

Comments
 (0)