Bug #39249 | Maria: query cache returns out-of-date results | ||
---|---|---|---|
Submitted: | 4 Sep 2008 15:25 | Modified: | 26 May 2010 17:50 |
Reporter: | Guilhem Bichot | Email Updates: | |
Status: | Unsupported | Impact on me: | |
Category: | MySQL Server: Maria storage engine | Severity: | S3 (Non-critical) |
Version: | 5.1-maria, 6.0-bk | OS: | Linux |
Assigned to: | CPU Architecture: | Any |
[4 Sep 2008 15:25]
Guilhem Bichot
[13 Oct 2008 13:06]
Georgi Kodinov
I've seen this while testing in 6.0-bugteam : main.ps_not_windows [ pass ] 21 main.query_cache [ fail ] --- /home/kgeorge/mysql/bzr/merge-6.0-bugteam/mysql-test/r/query_cache.result 2008-10-13 13:27:43.000000000 +0300 +++ /home/kgeorge/mysql/bzr/merge-6.0-bugteam/mysql-test/r/query_cache.reject 2008-10-13 16:04:57.000000000 +0300 @@ -1585,14 +1585,12 @@ 1 0 2 0 3 0 -4 0 reset query cache; select *, (select count(*) from t2) from t1; a (select count(*) from t2) 1 0 2 0 3 0 -4 0 drop table t1,t2; # # Bug#25132 disabled query cache: Qcache_free_blocks = 1 mysqltest: Result content mismatch Stopping All Servers Restoring snapshot of databases Saving core.18412 Saving core.18440 Saving core.18531 Saving core.18558 Resuming Tests main.query_cache_debug [ skipped ] Test needs 'big-test' opt
[15 Oct 2008 9:24]
Kristofer Pettersson
This is what I think is the situation: Under open_and_lock_tables, in execute_sqlcom_select the query cache is asked to attach a result set writer intercepting the current statement. Before this is allowed a call to ha_myisam::register_query_cache_table is issued to assert that the current statement can be cached. In this test case either a concurrent insert or a regular insert has happened depending on the order locks were acquired on t1, t2. In the case of concurrent insert, 'register_query_cache_table' should return false to indicate that the statement shouldn't be cached. In the second case, insert operation should have been visible to the select operation waiting on the write lock and the result should have been the same. Could you verify that the code in ha_myisam::register_query_cache_table is correct for getting a consistent snap shot on the state of myisam which can be used in this context? If the error on the other hand happens on a regular insert with a select hanging on lock tables, then maybe the qc api has a more serious flaw, but I don't think this is the case. Do you agree?
[21 Nov 2008 18:38]
Guilhem Bichot
In BUG#40179, query_cache.test fails in default configuration (i.e. using MyISAM, not Maria), with exactly the same output (same missing line at line 1641): 8085: @@ -1641,7 +1641,6 @@ 38086: 1 0 38087: 2 0 38088: 3 0 38089: -4 0 38090: reset query cache; 38091: select *, (select count(*) from t2) from t1; 38092: a (select count(*) from t2) as in the Description of the present BUG#39249. So I'm changing category to Server:QueryCache, marking it as duplicate of BUG#40179 and de-assigning it from Sanja.
[1 Apr 2009 9:39]
Guilhem Bichot
http://bugs.mysql.com/bug.php?id=41098 and http://bugs.mysql.com/bug.php?id=40179 have been fixed, but only for MyISAM. The bugfix revision davi.arnaut@sun.com-20090219210935-9vilvcisyyieffxl has been merged into 5.1-maria but not propagated to storage/maria as it was not trivial to do (in Maria there are several ma*get_status() functions unlike MyISAM). So this bug still exists (at least I can repeat the problem of the reduced test case). We should propagate Davi's fix, and see if it fixes all testcases (including row_format=page|dynamic).