Bug #9510 | LOCKING table doesn't prevent reading not locked tables in SQL_CACHE queries | ||
---|---|---|---|
Submitted: | 31 Mar 2005 2:27 | Modified: | 31 Mar 2005 10:00 |
Reporter: | Gleb Paharenko | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 4.1.10a | OS: | Linux (Linux) |
Assigned to: | Oleksandr Byelkin | CPU Architecture: | Any |
[31 Mar 2005 2:27]
Gleb Paharenko
[31 Mar 2005 2:46]
Jorge del Conde
I was unable to repeat this with 4.1.11 from bk: mysql> LOCK TABLES a READ; Query OK, 0 rows affected (0.00 sec) mysql> SELECT SQL_CACHE COUNT(*) FROM b; ERROR 1100 (HY000): Table 'b' was not locked with LOCK TABLES mysql>
[31 Mar 2005 9:43]
Sergei Golubchik
Of course, reading from query cache is not affected by LOCK TABLES: mysql> create table t1 select 1; mysql> create table t2 select 2; mysql> select * from t1; +---+ | 1 | +---+ | 1 | +---+ 1 row in set (0.00 sec) mysql> lock table t2 read; Query OK, 0 rows affected (0.00 sec) mysql> select * from t1; +---+ | 1 | +---+ | 1 | +---+ 1 row in set (0.00 sec) Similary, you can lock the table and do SELECT from another connection. See also http://bugs.mysql.com/bug.php?id=2693
[31 Mar 2005 10:00]
Oleksandr Byelkin
Access to other tables during lock in force is prohibited because MySQL can't lock them too (to avoid deadlock all tables should be locked at once). During QC answer non-locked tables are not touched, so it can answer.