1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-09 11:41:36 +03:00
Files
mariadb/mysql-test/r
Kristofer Pettersson b22d02ad42 Bug#43758 Query cache can lock up threads in 'freeing items' state
Early patch submitted for discussion.

It is possible for more than one thread to enter the condition
in query_cache_insert(), but the condition predicate is to
signal one thread each time the cache status changes between
the following states: {NO_FLUSH_IN_PROGRESS,FLUSH_IN_PROGRESS,
TABLE_FLUSH_IN_PROGRESS}

Consider three threads THD1, THD2, THD3

   THD2: select ... => Got a writer in ::store_query
   THD3: select ... => Got a writer in ::store_query
   THD1: flush tables => qc status= FLUSH_IN_PROGRESS;
                      new writers are blocked.
   THD2: select ... => Still got a writer and enters cond in
                       query_cache_insert
   THD3: select ... => Still got a writer and enters cond in
                       query_cache_insert
   THD1: flush tables => finished and signal status change.
   THD2: select ... => Wakes up and completes the insert.
   THD3: select ... => Happily waiting for better times. Why hurry?

This patch is a refactoring of this lock system. It introduces four new methods:
   Query_cache::try_lock()
   Query_cache::lock()
   Query_cache::lock_and_suspend()
   Query_cache::unlock()

This change also deprecates wait_while_table_flush_is_in_progress(). All threads are
queued and put on a conditional wait. On each unlock the queue is signalled. This resolve
the issues with left over threads. To assure that no threads are spending unnecessary
time waiting a signal broadcast is issued every time a lock is taken before a full
cache flush.
2009-06-16 10:34:47 +02:00
..
2008-04-02 10:06:36 +02:00
2009-02-10 16:27:35 +03:00
2009-01-23 13:22:05 +01:00
2008-03-08 01:14:56 +04:00
2008-11-21 17:32:45 +04:00
2008-09-03 13:06:03 +05:00
2009-05-10 21:20:35 +05:00
2009-03-11 14:29:59 +02:00
2009-05-21 21:51:48 +04:00
2009-06-01 16:00:38 +04:00
2009-03-27 10:18:06 +08:00
2008-09-05 13:36:02 +05:00
2009-02-07 16:50:31 +01:00
2009-05-13 23:39:35 +05:00
2009-01-23 13:22:05 +01:00
2009-04-29 07:59:10 +05:00
2009-04-29 07:59:10 +05:00
2009-02-26 18:17:06 +01:00
2009-02-03 14:45:17 +01:00
2009-05-06 15:00:14 +05:30
2009-02-10 16:27:35 +03:00
2009-04-09 14:38:50 +05:00
2009-03-16 20:54:50 +01:00
2008-10-23 21:27:09 +02:00
2009-01-26 15:20:33 +01:00
2009-05-28 16:21:41 +05:00
2009-02-10 22:26:37 +01:00
2009-05-08 21:24:15 +04:00
2009-02-27 17:06:23 +02:00
2009-02-19 18:22:28 +01:00
2009-02-03 14:45:17 +01:00
2009-02-09 22:00:15 +01:00
2008-07-03 23:41:22 +04:00
2009-02-19 17:59:00 +04:00
2008-04-02 10:06:36 +02:00
2008-03-25 17:48:05 -06:00
2009-06-04 13:53:15 +02:00
2009-06-04 13:53:15 +02:00
2009-06-10 11:58:36 +03:00
2008-07-07 11:43:56 +03:00
2008-12-13 19:42:12 +00:00
2009-02-09 22:00:15 +01:00
2008-12-13 19:42:12 +00:00
2009-02-19 18:24:25 -05:00
2009-03-27 13:55:14 +01:00
2008-12-09 17:31:22 +04:00
2009-01-13 15:04:28 +01:00
2009-02-14 20:14:10 +03:00
2008-11-18 13:52:03 +04:00
2009-05-15 12:42:57 +04:00
2008-08-26 15:22:09 +05:00
2009-05-15 12:11:07 +05:00
2009-05-10 21:20:35 +05:00
2009-06-02 13:44:41 +05:30
2009-02-12 11:52:01 +02:00