Details
-
Bug
-
Status: Stalled (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.3
-
None
Description
This patch fixes problems with "memory write order inversion" and
other problems that lead to the inoperability of the MW-328A test
from the Galera test suite. The MariaDB code contains many places
where the values​of the variables "mysys_var->current_cond" and
"mysys_var->current_mutex" are synchronously changed. Usually,
the zeroing of these variables is protected by the capture of
"mysys_var->mutex" mutex, but their initialization with non-zero
values usually is not protected with this mutex. To avoid the
problems caused by memory write order inversion, one of the code
fragments (in the sql/sql_class.cc file) uses mysql_cond_broadcast
for "mysys_var->current_cond" with additional checks and loop with
sleep(). However, there are several other places in the MariaDB
code where the similar broadcast is performed without additional
checks. In addition, there are many code fragments where broadcast
can be ignored because the enter_cond() is called after the
"thd->killed" flag is set, but (possibly) before checking the
"mysys_var->current_cond" variable by another thread (before
broadcast). So I added additional checks for "thd->killed" to
the code.