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
Easy to reproduce with 10.3.6, for example:
openxs@ao756:~/dbs/maria10.3$ bin/mysql --host=127.0.0.1 --port=3308 -uroot -e"select @@query_cache_type, version()"
+--------------------+----------------+
| @@query_cache_type | version() |
+--------------------+----------------+
| OFF | 10.3.6-MariaDB |
+--------------------+----------------+
openxs@ao756:~/dbs/maria10.3$ bin/mysqltest --host=127.0.0.1 --port=3308 -uroot test < /tmp/MDEV-16087.mysqltest
connect conn1, 127.0.0.1, root, , test, 3308;
connect conn2, 127.0.0.1, root, , test, 3308;
connect conn3, 127.0.0.1, root, , test, 3308;
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;
id
connection conn1;
insert into table3 () values ();
connection conn2;
insert into table1 () values ();
select count(*) from table3;
count(*)
0
connection conn3;
set autocommit=0;
select count(*) from table3;
count(*)
1
select count(*) from table3;
count(*)
1
select sql_no_cache count(*) from table3;
count(*)
1
rollback;
connection conn2;
rollback;
connection conn1;
drop table table1;
drop table table2;
drop table table3;
ok
openxs@ao756:~/dbs/maria10.3$ bin/mysql --host=127.0.0.1 --port=3308 -uroot -e"set global query_cache_type=on;"
openxs@ao756:~/dbs/maria10.3$ bin/mysql --host=127.0.0.1 --port=3308 -uroot -e"select @@query_cache_type, version()"
+--------------------+----------------+
| @@query_cache_type | version() |
+--------------------+----------------+
| ON | 10.3.6-MariaDB |
+--------------------+----------------+
openxs@ao756:~/dbs/maria10.3$ bin/mysqltest --host=127.0.0.1 --port=3308 -uroot test < /tmp/MDEV-16087.mysqltest
connect conn1, 127.0.0.1, root, , test, 3308;
connect conn2, 127.0.0.1, root, , test, 3308;
connect conn3, 127.0.0.1, root, , test, 3308;
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;
id
connection conn1;
insert into table3 () values ();
connection conn2;
insert into table1 () values ();
select count(*) from table3;
count(*)
0
connection conn3;
set autocommit=0;
select count(*) from table3;
count(*)
1
select count(*) from table3;
count(*)
0
select sql_no_cache count(*) from table3;
count(*)
1
rollback;
connection conn2;
rollback;
connection conn1;
drop table table1;
drop table table2;
drop table table3;
ok
openxs@ao756:~/dbs/maria10.3$
I can not reproduce with 10.2.12, fore example. so looks like a recent enough regression.