1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00
Files
mariadb/sql
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-12-17 15:01:34 -05:00
2009-04-09 14:22:06 +08:00
2009-06-09 18:44:26 +02:00
2009-06-09 18:44:26 +02:00
2008-10-23 21:27:09 +02:00
2009-01-05 18:10:20 +02:00
2009-06-09 18:44:26 +02:00
2007-10-11 13:29:09 -04:00
2007-10-11 13:29:09 -04:00
2008-12-12 15:13:11 +04:00
2007-08-15 17:43:08 +04:00
2009-06-09 18:44:26 +02:00
2009-04-29 07:59:10 +05:00
2009-06-01 16:43:16 +04:00
2009-06-01 16:00:38 +04:00
2009-06-09 18:44:26 +02:00
2009-02-07 16:50:31 +01:00
2008-02-12 10:43:38 +01:00
2009-06-09 18:44:26 +02:00
2009-05-31 17:15:35 +08:00
2008-12-17 15:01:34 -05:00
2007-10-11 13:29:09 -04:00
2008-11-27 12:33:04 +01:00
2009-06-05 13:23:58 +02:00
2008-06-17 17:57:04 +05:30
2007-10-16 16:11:50 -04:00
2008-11-22 01:10:38 +01:00
2008-11-22 01:10:38 +01:00
2009-06-09 18:44:26 +02:00
2008-08-25 21:18:22 +04:00
2009-06-09 18:44:26 +02:00
2009-06-01 16:00:38 +04:00
2007-10-11 14:37:45 -04:00
2009-03-19 09:44:58 -04:00
2008-07-15 21:46:02 +04:00
2009-04-29 07:59:10 +05:00
2009-06-09 18:44:26 +02:00
2008-07-03 23:41:22 +04:00
2008-07-03 23:41:22 +04:00
2009-04-29 07:59:10 +05:00
2009-04-29 07:59:10 +05:00
2009-04-29 07:59:10 +05:00
2008-01-23 13:26:41 -07:00
2009-06-04 10:54:23 +05:00
2008-12-10 18:16:21 +04:00
2007-10-16 16:11:50 -04:00
2009-04-17 13:46:27 +05:00
2009-06-05 01:30:08 +02:00
2009-05-27 18:19:44 +03:00
2009-05-27 18:19:44 +03:00
2009-06-05 13:23:58 +02:00
2009-06-05 13:23:58 +02:00
2009-05-15 16:13:54 +03:00
2009-01-14 18:50:51 +04:00
2009-05-15 12:11:07 +05:00
2009-06-01 16:00:38 +04:00
2009-05-27 18:19:44 +03:00
2009-01-05 18:10:20 +02:00
2009-03-19 11:44:57 +01:00
2009-05-04 22:33:23 +02:00