Bug #87402 Redundant check in ut_rnd_gen_ulint()

Submitted: 11 Aug 2017 15:59 Modified: 14 Aug 2017 9:58
Reporter: Alexey Kopytov Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S5 (Performance)
Version:8.0.2 OS:Any
Assigned to: CPU Architecture:Any

[11 Aug 2017 15:59] Alexey Kopytov
Description:
In 8.0.2 my_thread_local* variables have been replaced with C++11
thread-local storage. One piece of code which is now redundant due to
that change is the following part of ut_rnd_gen_ulint():

	ulint	rnd = ut_rnd_ulint_counter;
	if (rnd == 0) {
		rnd = 65654363;
	}

The check above was only required because the combination of
my_thread_local_key, my_set_thread_local() and my_get_thread_local()
essentially emulated thread-local storage and did not allow automatic
initialization of thread-local variables.

That check on a critical code path can be avoided if
ut_rnd_ulint_counter is initialized to 65654363 rather than zero in
ut0rnd.cc

How to repeat:
Code analysis of ut_rnd_gen_ulint() and ut_rnd_ulint_counter
initialization.

Suggested fix:
See above.
[14 Aug 2017 9:58] MySQL Verification Team
Hello Alexey,

Thank you for your feedback!
Verifying based on my internal discussion with developer.

Thanks,
Umesh

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.