Bug #8480 REPAIR TABLE does not invalidate query cache
Submitted: 12 Feb 2005 20:04 Modified: 12 Mar 2005 4:34
Reporter: Dean Ellis Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.24 forward OS:
Assigned to: Jim Winstead CPU Architecture:Any

[12 Feb 2005 20:04] Dean Ellis
Description:
REPAIR TABLE does not invalidate the query cache for an affected table.  As REPAIR TABLE can alter the results of a query this is potentially dangerous.

How to repeat:
SET GLOBAL query_cache_size=1024*1024;
CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1);
SELECT a FROM t1;
SELECT a FROM t1;
SHOW STATUS LIKE 'qcache_queries_in_cache';
REPAIR TABLE t1;
SHOW STATUS LIKE 'qcache_queries_in_cache';
ALTER TABLE t1;
SHOW STATUS LIKE 'qcache_queries_in_cache';

Suggested fix:
REPAIR TABLE should flush results for affected table, as ALTER TABLE does.
[8 Mar 2005 2:12] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/22761
[12 Mar 2005 0:03] Jim Winstead
Pushed, will be in 4.1.11 and 5.0.3.
[12 Mar 2005 4:34] Paul DuBois
Noted in 4.0.25, 4.1.11, 5.0.3 changelogs.