Skip to content

Commit bf6f654

Browse files
author
Yasufumi Kinoshita
committed
Merge branch 'mysql-8.0' into mysql-8.4
Change-Id: Id85855546b8198d3f903203f25f328265d42b5ca
2 parents a35517a + 0bdd58b commit bf6f654

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)