Bug #91009 Incorrect usage of std::atomic::compare_exchange_weak
Submitted: 24 May 11:04 Modified: 30 May 12:36
Reporter: Alexey Kopytov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S4 (Feature request)
Version:8.0.11 OS:Any
Assigned to: CPU Architecture:ARM

[24 May 11:04] Alexey Kopytov
Description:
Fil_shard::release_open_slot() contains an incorrect usage of C++11
atomics. That is, std::atomic::compare_exchange_weak() is assumed to
always succeed, which is not necessarily the case. From
http://en.cppreference.com/w/cpp/atomic/atomic/compare_exchange :

"The weak forms (1-2) of the functions are allowed to fail spuriously,
that is, act as if *this != expected even if they are equal. "

I see that effect with MTR tests on an ARM64 machine, which is failing
the "ut_a(success)" assertion. It should use either the strong form of
the atomic (preferable per the reference) , or use a loop. In both cases
the assertion becomes redundant.

While we are at it, may I suggest inlining
Fil_shard::reserve_open_slot() and Fil_shard::release_open_slot()?

How to repeat:
Code inspection.

Suggested fix:
See above.
[25 May 12:49] Sinisa Milivojevic
Hi Kaamas,

Thank you for your report.

At this moment, we do not support any of the processors from the  ARM family. However, these CPUs will increase in importance, so I am filing this report as a valid feature request.

Verified.
[30 May 12:36] Sinisa Milivojevic
Hi,

A fix for this report has been pushed into 8.0.