Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
10.0.2, 5.5.30, 5.1.67, 5.2.14, 5.3.12
-
None
-
None
-
None
Description
make sure the query cache is enable
a xa transaction is prepared and the server crashed, after restarted, if do a select between 'xa recover' and 'xa commit', and do the select again after 'xa commit', the second select will hit the query cache and return the wrong value.
how to reappear:
mysql> create table t(id int auto_increment primary key, a int)engine=innodb;
|
Query OK, 0 rows affected (0.00 sec)
|
|
mysql> xa start '111';
|
Query OK, 0 rows affected (0.00 sec)
|
|
mysql> insert into t(a) values(1);
|
Query OK, 1 row affected (0.00 sec)
|
|
mysql> xa end '111';
|
Query OK, 0 rows affected (0.00 sec)
|
|
mysql> xa prepare '111';
|
Query OK, 0 rows affected (0.00 sec)
|
|
mysql> xa recover;
|
ERROR 2006 (HY000): MySQL server has gone away
|
No connection. Trying to reconnect...
|
Connection id: 2
|
Current database: mydb
|
|
+----------+--------------+--------------+------+
|
| formatID | gtrid_length | bqual_length | data |
|
+----------+--------------+--------------+------+
|
| 1 | 3 | 0 | 111 |
|
+----------+--------------+--------------+------+
|
1 row in set (0.00 sec)
|
|
mysql> select * from t;
|
Empty set (0.00 sec)
|
|
mysql> xa commit '111';
|
Query OK, 0 rows affected (0.00 sec)
|
|
mysql> select * from t;
|
Empty set (0.00 sec)
|
|
mysql> show status like 'Qcache_hits';
|
+---------------+-------+
|
| Variable_name | Value |
|
+---------------+-------+
|
| Qcache_hits | 1 |
|
+---------------+-------+
|
the last select hit the query cache and return no rows, but it may return the value (1,1)