Bug #19206 | Engine hangs trying to read from table that was locked for writing | ||
---|---|---|---|
Submitted: | 19 Apr 2006 22:02 | Modified: | 2 May 2006 21:59 |
Reporter: | Nikolay Grishakin | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Documentation | Severity: | S2 (Serious) |
Version: | 5.1 | OS: | Linux (Linux) |
Assigned to: | Paul DuBois | CPU Architecture: | Any |
[19 Apr 2006 22:02]
Nikolay Grishakin
[19 Apr 2006 22:11]
Jonas Oreland
1) Why category Partitioning 2) Have you tested on myisam/innodb ? 3) I would actually expect the behaviour that you describe, but I havent read manual on "lock table" very closely...have you?
[19 Apr 2006 22:40]
Nikolay Grishakin
This is from manual: http://dev.mysql.com/doc/refman/5.1/en/lock-tables.html "If a thread obtains a READ lock on a table, that thread (and all other threads) can only read from the table. If a thread obtains a WRITE lock on a table, only the thread holding the lock can write to the table. Other threads are blocked from doing so until the lock has been released."
[19 Apr 2006 22:51]
Nikolay Grishakin
The manual says "If a thread obtains a WRITE lock on a table, only the thread holding the lock can write to the table. Other threads are blocked from doing so until the lock has been released." By "doing so" I assume doing writes and reads are permited. I changed the table to InnoDB and it hangs too. Moving bug category to "Server"
[19 Apr 2006 22:56]
Jonas Oreland
I interpret it as the behaviour is correct. I.e while having a write lock on table, no other thread can read/write from it. This is sometimes also called exclusive lock. They "block" until unlocked, I interpret block as hang in this context. But that's my interpretation :-)
[20 Apr 2006 6:23]
Heikki Tuuri
The manual should say that other threads cannot write or read from the table when the table is WRITE-locked.
[20 Apr 2006 7:01]
Nikolay Grishakin
Why no error code is returned when table is locked by another thread? There is no option for wait or no-wait lock available. So why second thread should retry forever?
[20 Apr 2006 7:15]
Nikolay Grishakin
If I use read lock on table I'm getting appropriate error message back when someone else trys to insert into the same table: "query 'INSERT INTO test.t1 VALUES(NULL, "aaaaa1", "bbbbb1")' failed: 1099: Table 't1' was locked with a READ lock and can't be updated"
[2 May 2006 21:59]
Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant product(s). Additional info: Updated the manual as indicated by the final comment.