List:Commits« Previous MessageNext Message »
From:Kristofer Pettersson Date:March 13 2009 2:37pm
Subject:bzr commit into mysql-6.0-bugteam branch (kristofer.pettersson:3111)
Bug#43568
View as plain text  
#At file:///home/thek/Development/cpp/mysqlbzr/mysql-6.0-bugteam/ based on revid:kristofer.pettersson@stripped

 3111 Kristofer Pettersson	2009-03-13
      Bug#43568 set_handler_table_locks uses parser tokens instead 
                of correct lock_options
      
      set_handler_table_locks uses parser tokens instead of correct
      lock options to determine the correct lock to set.
      After open_tables, the correct lock option is stored in
      TABLE::reginfo.lock_type.
      Failing to use the correct lock option might create issues with
      binlog and replication.
     @ include/thr_lock.h
        * Added comment.
     @ sql/lock.cc
        * set transactional lock type based on TABLE::reginfo.locktype
          instead of TABLE_LIST::lock_type.

    modified:
      include/thr_lock.h
      sql/lock.cc
=== modified file 'include/thr_lock.h'
--- a/include/thr_lock.h	2009-02-16 21:18:45 +0000
+++ b/include/thr_lock.h	2009-03-13 14:37:14 +0000
@@ -27,6 +27,12 @@ extern "C" {
 struct st_thr_lock;
 extern ulong locks_immediate,locks_waited ;
 
+/**
+  Lock types are used to request a lock on a table. Changes in this enumeration
+  might affect transactional locks as well.
+  @see set_handler_table_locks
+  @see read_lock_type_for_table
+*/
 enum thr_lock_type { TL_IGNORE=-1,
 		     TL_UNLOCK,			/* UNLOCK ANY LOCK */
                      /*

=== modified file 'sql/lock.cc'
--- a/sql/lock.cc	2009-03-04 13:31:31 +0000
+++ b/sql/lock.cc	2009-03-13 14:37:14 +0000
@@ -1574,30 +1574,30 @@ int set_handler_table_locks(THD *thd, TA
 {
   TABLE_LIST    *tlist;
   int           error= 0;
+  int           trans_lock_type;
+  thr_lock_type lock_type;
   DBUG_ENTER("set_handler_table_locks");
   DBUG_PRINT("lock_info", ("transactional: %d", transactional));
 
   for (tlist= table_list; tlist; tlist= tlist->next_global)
   {
-    int lock_type;
-    int lock_timeout= -1; /* Use default for non-transactional locks. */
-
     if (tlist->placeholder())
       continue;
+    /*
+      All tlist objects have an opened TABLE objects attached and
+      it should contain a proper lock types set even if it
+      came in as a base table from a view only.
+    */
+    lock_type= tlist->table->reginfo.lock_type;
+    int lock_timeout= -1; /* Use default for non-transactional locks. */
 
-    DBUG_ASSERT((tlist->lock_type == TL_READ) ||
-                (tlist->lock_type == TL_READ_NO_INSERT) ||
-                (tlist->lock_type == TL_WRITE_DEFAULT) ||
-                (tlist->lock_type == TL_WRITE) ||
-                (tlist->lock_type == TL_WRITE_CONCURRENT_INSERT) ||
-                (tlist->lock_type == TL_WRITE_LOW_PRIORITY));
+    DBUG_ASSERT(lock_type != TL_WRITE_DEFAULT && lock_type != TL_READ_DEFAULT);
 
     /*
-      Every tlist object has a proper lock_type set. Even if it came in
-      the list as a base table from a view only.
+      Translate the lock_type into a transactional lock type.
     */
-    lock_type= ((tlist->lock_type <= TL_READ_NO_INSERT) ?
-                HA_LOCK_IN_SHARE_MODE : HA_LOCK_IN_EXCLUSIVE_MODE);
+    trans_lock_type= ((lock_type <= TL_READ_NO_INSERT) ?
+                      HA_LOCK_IN_SHARE_MODE : HA_LOCK_IN_EXCLUSIVE_MODE);
 
     if (transactional)
     {


Attachment: [text/bzr-bundle] bzr/kristofer.pettersson@sun.com-20090313143714-c7o39ppq4x1e2wpx.bundle
Thread
bzr commit into mysql-6.0-bugteam branch (kristofer.pettersson:3111)Bug#43568Kristofer Pettersson13 Mar
  • Re: bzr commit into mysql-6.0-bugteam branch(kristofer.pettersson:3111) Bug#43568Ingo Strüwing13 Mar