Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.2.15, 10.3.6, 10.2(EOL), 10.3(EOL)
-
Ubuntu 16.04
Description
MariaDB 10.2 and newer returns inconsistent results when query caching is enabled (query_cache_type=ON).
Steps to reproduce
1. Start a MariaDB 10.2+ database with default settings.
For example by running a docker container on port 3500:
shell> docker run --name mariadb-10.2.14 -p 3500:3306 -e MYSQL_ROOT_PASSWORD=test -e MYSQL_USER=test -e MYSQL_PASSWORD=test -e MYSQL_DATABASE=test -d mariadb:10.2.14
|
2. Run the attached mysqltest case MDEV-16087.mysqltest
shell> mysqltest -h 127.0.0.1 --port=3500 --user=test --password=test --result-file=MDEV-16087.record test < MDEV-16087.mysqltest
|
It fails with:
--- MDEV-16087.record 2018-05-15 15:42:11.495372790 +0200
|
+++ MDEV-16087.reject 2018-05-15 15:52:24.547984967 +0200
|
@@ -18,7 +18,7 @@
|
1
|
select count(*) from table3;
|
count(*)
|
-1
|
+0
|
select sql_no_cache count(*) from table3;
|
count(*)
|
1
|
|
mysqltest: Result content mismatch
|
3. Disable query caching and re-run the mysqltest case:
shell> echo "set global query_cache_type = off;" | mysql -h 127.0.0.1 --port=3500 --user=root --password=test
|
shell> mysqltest -h 127.0.0.1 --port=3500 --user=test --password=test --result-file=MDEV-16087.record test < MDEV-16087.mysqltest
|
Mysqltest succeeds.
Environment
- Ubuntu
- MariaDB 10.2.14
- Query cache settings:
MariaDB [(none)]> show variables like '%query_cache%';
+------------------------------+----------+
| Variable_name | Value |
+------------------------------+----------+
| have_query_cache | YES |
| query_cache_limit | 131072 |
| query_cache_min_res_unit | 4096 |
| query_cache_size | 67108864 |
| query_cache_strip_comments | OFF |
| query_cache_type | ON |
| query_cache_wlock_invalidate | OFF |
+------------------------------+----------+
Attachments
Issue Links
- relates to
-
MDEV-16251 Query caching should not be enabled by default in apt packages
-
- Closed
-
- links to
-- source include/have_innodb.inc
-- source include/have_query_cache.inc
-- source include/not_embedded.inc
set GLOBAL query_cache_type=ON;
set LOCAL query_cache_type=ON;
connect (conn1,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connect (conn2,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connect (conn3,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection conn1;
create table table1 (id bigint(20) auto_increment, primary key (id)) ENGINE=InnoDB;
create table table2 (id bigint(20) auto_increment, primary key (id)) ENGINE=InnoDB;
create table table3 (id bigint(20) auto_increment, primary key (id)) ENGINE=InnoDB;
connection conn2;
set autocommit=0;
select * from table2;
connection conn1;
insert into table3 () values ();
connection conn2;
insert into table1 () values ();
select count(*) from table3;
connection conn3;
set autocommit=0;
select count(*) from table3;
select count(*) from table3;
select sql_no_cache count(*) from table3;
rollback;
connection conn2;
rollback;
connection conn1;
drop table table1;
drop table table2;
drop table table3;
set GLOBAL query_cache_type=default;