Bug #44164 TL_WRITE has no description in lock_descriptions[]
Submitted: 8 Apr 2009 18:21 Modified: 16 May 2009 0:12
Reporter: Andrew Hutchings Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.1.32 OS:Any
Assigned to: Davi Arnaut CPU Architecture:Any

[8 Apr 2009 18:21] Andrew Hutchings
Description:
TL_WRITE does not have a corresponding message in lock_descriptions[] so when this lock is in use "mysqladmin debug" gives garbage:

Thread database.table_name          Locked/Waiting        Lock_type

2       test.testing                Locked - write        �I�|�

In gdb:
409	in sql_test.cc
(gdb) print dl_ptr
$3 = (TABLE_LOCK_INFO *) 0x12f3e30
(gdb) print dl_ptr->type
$4 = TL_WRITE

How to repeat:
Basic table:
CREATE TABLE `testing` (
  `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1

I have inserted 10 rows into this.

mysql1> set autocommit=0;
mysql1> start transaction;
mysql1> select * from testing for update;

mysql2> update testing set a=10;

shell> mysqladmin debug

Suggested fix:
1. Add a lock description for TL_WRITE.
2. Possibly add an "UNKNOWN" when descriptions are not found.
[9 Apr 2009 14:11] Andrew Hutchings
Actually, I think the core problem is a message is missing from the middle of lock_descriptions, either for TL_READ_DEFAULT or TL_READ.
[14 Apr 2009 12: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/commits/71999

2874 Davi Arnaut	2009-04-14
      Bug#44164: TL_WRITE has no description in lock_descriptions[]
      
      The problem was that new lock types were being added without a
      corresponding description. Since the lock types (enum values)
      are used as indices to the description array, the descriptions
      could be shifted depending on the lock type. The solution is to
      ensure that every lock type has a correspondent description.
     @ include/thr_lock.h
        Add warning.
     @ sql/sql_test.cc
        Update lock descriptions.
[14 Apr 2009 16:26] 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/commits/72032

2857 Davi Arnaut	2009-04-14
      Bug#44164: TL_WRITE has no description in lock_descriptions[]
      
      The problem was that new lock types were being added without a
      corresponding description. Since the lock types (enum values)
      are used as indices to the description array, the descriptions
      could be shifted depending on the lock type. The solution is to
      ensure that every lock type has a correspondent description.
     @ include/thr_lock.h
        Add warning.
     @ sql/sql_test.cc
        Update lock descriptions.
[5 May 2009 19:43] Bugs System
Pushed into 5.1.35 (revid:davi.arnaut@sun.com-20090505190206-9xmh7dlc6kom8exp) (version source revid:davi.arnaut@sun.com-20090505190206-9xmh7dlc6kom8exp) (merge vers: 5.1.35) (pib:6)
[6 May 2009 14:08] Bugs System
Pushed into 6.0.12-alpha (revid:svoj@sun.com-20090506125450-yokcmvqf2g7jhujq) (version source revid:davi.arnaut@sun.com-20090414215844-r7d1osonzuk61tjz) (merge vers: 6.0.11-alpha) (pib:6)
[16 May 2009 0:12] Paul DuBois
Noted in 5.1.35, 6.0.12 changelogs.

Not all lock types had proper descriptive strings, resulting in
garbage output from mysqladmin debug.
[9 Jun 2009 23:11] Davi Arnaut
Bug#34502 has been closed as a duplicate of this one.
[15 Jun 2009 8:29] Bugs System
Pushed into 5.1.35-ndb-6.3.26 (revid:jonas@mysql.com-20090615074202-0r5r2jmi83tww6sf) (version source revid:jonas@mysql.com-20090615070837-9pccutgc7repvb4d) (merge vers: 5.1.35-ndb-6.3.26) (pib:6)
[15 Jun 2009 9:09] Bugs System
Pushed into 5.1.35-ndb-7.0.7 (revid:jonas@mysql.com-20090615074335-9hcltksp5cu5fucn) (version source revid:jonas@mysql.com-20090615072714-rmfkvrbbipd9r32c) (merge vers: 5.1.35-ndb-7.0.7) (pib:6)
[15 Jun 2009 9:50] Bugs System
Pushed into 5.1.35-ndb-6.2.19 (revid:jonas@mysql.com-20090615061520-sq7ds4yw299ggugm) (version source revid:jonas@mysql.com-20090615054654-ebgpz7elwu1xj36j) (merge vers: 5.1.35-ndb-6.2.19) (pib:6)