In 5.5 we are changing the type of thr_lock.c lock taken for
ALTER TABLE from TL_WRITE_ALLOW_READ to TL_READ_NO_INSERT.
This step is necessary to fix bug #51263 "Deadlock between
transactional SELECT and ALTER TABLE ... REBUILD PARTITION".
It became possible to do this thanks to the fact that in 5.5
ALTER TABLE takes a fairly strong metadata lock (name lock).
We call these locks operation-type-aware locks. The lock
taken for ALTER TABLE is called SNW (Shared No Write) and
provides stronger isolation guarantees than TL_WRITE_ALLOW_READ
thr_lock.c lock while still allowing concurrent transactions
which only read data from the table.
Are there any storage engines out there that interpret the fact
that table is locked using TL_WRITE_ALLOW_READ lock in any
special way, for example, as an indication that ALTER TABLE
is being performed? Is there any good reason to rely on the lock
type for this check and not on the value of thd_sql_command()?
The plan is to remove TL_WRITE_ALLOW_READ in 5.5 codebase.
Dmitry Lenev, Software Developer
Sun Microsystems DBG/MySQL, www.mysql.com
Are you MySQL certified? http://www.mysql.com/certification
|• ALTER TABLE and TL_WRITE_ALLOW_READ lock.||Dmitry Lenev||27 May|