1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Fix for MDEV-4009: main.delayed sporadically fails with "query 'REPLACE DELAYED t1 VALUES (5)' failed: 1317: Query execution was interrupted"

- Fixed broadcast without a proper mutex
- Don't break existing locks if we are just testing if we can get the lock

mysql-test/r/create_delayed.result:
  Added test case for failures with INSERT DELAYED with CREATE and DROP TABLE
mysql-test/t/create_delayed.test:
  Added test case for failures with INSERT DELAYED with CREATE and DROP TABLE
sql/mdl.cc:
  Don't break existing locks for timeout=0 (ie, just check if there are conflicting locks).
  This fixed the bug that INSERT DELAYED didn't work properly with CREATE TABLE
sql/sql_base.cc:
  One neads to hold the mutex before doing a mysql_cond_broadcast()
  This fixed the bug that INSERT DELAYED didn't work properly with DROP TABLE
sql/sql_insert.cc:
  Protect setting of mysys_var->current_mutex.
This commit is contained in:
Michael Widenius
2013-01-10 23:40:18 +02:00
parent f6d22b3915
commit 396f4d62c6
5 changed files with 50 additions and 1 deletions

View File

@@ -2823,8 +2823,12 @@ pthread_handler_t handle_delayed_insert(void *arg)
set_timespec(abstime, delayed_insert_timeout);
/* Information for pthread_kill */
mysql_mutex_unlock(&di->mutex);
mysql_mutex_lock(&di->thd.mysys_var->mutex);
di->thd.mysys_var->current_mutex= &di->mutex;
di->thd.mysys_var->current_cond= &di->cond;
mysql_mutex_unlock(&di->thd.mysys_var->mutex);
mysql_mutex_lock(&di->mutex);
thd_proc_info(&(di->thd), "Waiting for INSERT");
DBUG_PRINT("info",("Waiting for someone to insert rows"));