MDEV-26516: WSREP: Record locking is disabled in this thread, but the table being modified

We periodically observe assertion failures in the mtr tests,
specifically in the /storage/innobase/row/row0ins.cc file,
following a WSREP error. The error message is: 'WSREP: record
locking is disabled in this thread, but the table being modified
is not mysql/wsrep_streaming_log: mysql/innodb_table_stats.'"
This issue seems to occur because, upon opening the table,
innodb_stats_auto_recalc may trigger, which Galera does not
anticipate. This commit should fix this bug.
This commit is contained in:
Julius Goryavsky 2024-11-20 17:47:24 +01:00
parent 0ea19c12fd
commit 8bc254dd62
2 changed files with 10 additions and 2 deletions

View file

@ -34,6 +34,9 @@ Created Jan 06, 2010 Vasil Dimov
#include <mysql_com.h>
#include "btr0btr.h"
#include "sync0sync.h"
#ifdef WITH_WSREP
#include <mysql/service_wsrep.h>
#endif
#include <algorithm>
#include <map>
@ -3355,7 +3358,11 @@ dict_stats_update(
if (srv_read_only_mode) {
goto transient;
}
#ifdef WITH_WSREP
if (wsrep_thd_skip_locking(current_thd)) {
goto transient;
}
#endif
if (dict_stats_auto_recalc_is_enabled(table)) {
return(dict_stats_update(
table,

View file

@ -3238,7 +3238,8 @@ row_ins_clust_index_entry(
#ifdef WITH_WSREP
const bool skip_locking
= wsrep_thd_skip_locking(thr_get_trx(thr)->mysql_thd);
= thr_get_trx(thr)->is_wsrep() &&
wsrep_thd_skip_locking(thr_get_trx(thr)->mysql_thd);
ulint flags = index->table->no_rollback() ? BTR_NO_ROLLBACK
: (index->table->is_temporary() || skip_locking)
? BTR_NO_LOCKING_FLAG : 0;