diff options
author | Andrei <andrei.elkin@mariadb.com> | 2023-03-23 18:45:34 +0200 |
---|---|---|
committer | Andrei <andrei.elkin@mariadb.com> | 2023-03-23 18:45:34 +0200 |
commit | 7e63f3b2e21a8ac07565b8aa60186ffc950ed0bf (patch) | |
tree | 1176c49d9b1bdb24960656f483d1f5ce5466f655 | |
parent | 7c91082e393f1817401b334b3d3584b401d909d7 (diff) | |
download | mariadb-git-bb-10.4-MDEV-30620.tar.gz |
MDEV-30620 Trying to lock uninitialized LOCK_parallel_entrybb-10.4-MDEV-30620
The error was seen by a number of mtr tests being caused
by overdue initialization of rpl_parallel::LOCK_parallel_entry.
Specifically, SHOW-SLAVE-STATUS might find in
rpl_parallel::workers_idle() a gtid domain hash entry
already inserted whose mutex had not done
mysql_mutex_init().
Fixed with swapping the mutex init and the its entry's stack insertion.
Tested with a generous number of `mtr --repeat` of a few of the reported
to fail tests, incl rpl.parallel_backup.
-rw-r--r-- | sql/rpl_parallel.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index 7e70e04b857..746c923ba44 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -2312,14 +2312,16 @@ rpl_parallel::find(uint32 domain_id) e->domain_id= domain_id; e->stop_on_error_sub_id= (uint64)ULONGLONG_MAX; e->pause_sub_id= (uint64)ULONGLONG_MAX; + mysql_mutex_init(key_LOCK_parallel_entry, &e->LOCK_parallel_entry, + MY_MUTEX_INIT_FAST); + mysql_cond_init(key_COND_parallel_entry, &e->COND_parallel_entry, NULL); if (my_hash_insert(&domain_hash, (uchar *)e)) { + mysql_cond_destroy(&e->COND_parallel_entry); + mysql_mutex_destroy(&e->LOCK_parallel_entry); my_free(e); return NULL; } - mysql_mutex_init(key_LOCK_parallel_entry, &e->LOCK_parallel_entry, - MY_MUTEX_INIT_FAST); - mysql_cond_init(key_COND_parallel_entry, &e->COND_parallel_entry, NULL); } else e->force_abort= false; |