1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Bug#11761296: 53775: QUERY ON PARTITIONED TABLE RETURNS CACHED

RESULT FROM PREVIOUS TRANSACTION

The current Query Cache API is not fully compatible with
the partitioning engine.

There is no good way to implement support for QC due to:
1) a static callback for ha_partition would need to have access
to all partition names and call the underlying callback for each
[sub]partition with the correct name.
2) pruning would be impossible, even if one used the ulonglong
engine_data due to if engine_data is changed, the table is
invalidated by the QC.

So the only viable solution to avoid incorrect data is to not allow
caching of queries using partitioned tables.

(There are some extra changes, due to removal of \r as line break)
This commit is contained in:
Mattias Jonsson
2012-02-20 22:59:11 +01:00
parent 8b0f2c4d7d
commit 7e21bee031
7 changed files with 286 additions and 34 deletions

View File

@ -1,5 +1,7 @@
SET SESSION STORAGE_ENGINE = InnoDB;
drop table if exists t1,t2,t3;
set @save_query_cache_size = @@global.query_cache_size;
set GLOBAL query_cache_size = 1355776;
flush status;
set autocommit=0;
create table t1 (a int not null);
@ -100,7 +102,7 @@ show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 2
drop table t3,t2,t1;
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id));
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id));
select count(*) from t1;
count(*)
0
@ -109,7 +111,6 @@ select count(*) from t1;
count(*)
1
drop table t1;
set GLOBAL query_cache_size=1355776;
CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a));
CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b));
CREATE TABLE t3 ( id int(10) NOT NULL auto_increment, t1_id int(10) NOT NULL default '0', t2_id int(10) NOT NULL default '0', state int(11) default NULL, PRIMARY KEY (id), UNIQUE KEY t1_id (t1_id,t2_id), KEY t2_id (t2_id,t1_id), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`), CONSTRAINT `t3_ibfk_2` FOREIGN KEY (`t2_id`) REFERENCES `t2` (`id`));
@ -218,5 +219,5 @@ Qcache_queries_in_cache 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 1
set GLOBAL query_cache_size=1048576;
set @@global.query_cache_size = @save_query_cache_size;
drop table t2;