List:Commits« Previous MessageNext Message »
From:ingo Date:April 5 2006 12:39pm
Subject:bk commit into 5.0 tree (ingo:1.2138) BUG#5390
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of mydev. When mydev does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2138 06/04/05 14:39:20 ingo@stripped +2 -0
  BUG#5390 - problems with merge tables
  Additional fix for INSERT DELAYED with subselect.
  Originally detected in 5.1, but 5.0 could also be affected.
  The user thread creates a dummy table object,
  which is not included in the lock. The 'real' table is
  opened and locked by the 'delayed' system thread.
  The dummy object is now marked as not locked and this is
  tested in mysql_lock_have_duplicate().

  sql/sql_insert.cc
    1.186 06/04/05 14:39:15 ingo@stripped +4 -1
    BUG#5390 - problems with merge tables
    Marked the dummy table object as not being
    included in the lock.

  sql/lock.cc
    1.86 06/04/05 14:39:15 ingo@stripped +9 -4
    BUG#5390 - problems with merge tables
    Additional fix for INSERT DELAYED with subselect.
    The user thread creates a dummy table object,
    which is not included in the lock.
    Changed to safer asserts.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	ingo
# Host:	chilla.local
# Root:	/home/mydev/mysql-5.0-bug5390

--- 1.85/sql/lock.cc	2006-02-20 18:04:45 +01:00
+++ 1.86/sql/lock.cc	2006-04-05 14:39:15 +02:00
@@ -530,8 +530,11 @@
   THR_LOCK_DATA         **end_data2;
   DBUG_ENTER("mysql_lock_have_duplicate");
 
-  /* Table may not be defined for derived or view tables. */
-  if (! (table= needle->table))
+  /*
+    Table may not be defined for derived or view tables.
+    Table may not be part of a lock for delayed operations.
+  */
+  if (! (table= needle->table) || ! table->lock_count)
     goto end;
 
   /* A temporary table does not have locks. */
@@ -550,7 +553,8 @@
   lock_tables= mylock->table;
 
   /* Prepare table related variables that don't change in loop. */
-  DBUG_ASSERT(table == lock_tables[table->lock_position]);
+  DBUG_ASSERT((table->lock_position < mylock->table_count) &&
+              (table == lock_tables[table->lock_position]));
   table_lock_data= lock_locks + table->lock_data_start;
   end_data= table_lock_data + table->lock_count;
 
@@ -563,7 +567,8 @@
       continue;
 
     /* All tables in list must be in lock. */
-    DBUG_ASSERT(table2 == lock_tables[table2->lock_position]);
+    DBUG_ASSERT((table2->lock_position < mylock->table_count) &&
+                (table2 == lock_tables[table2->lock_position]));
 
     for (lock_data2=  lock_locks + table2->lock_data_start,
            end_data2= lock_data2 + table2->lock_count;

--- 1.185/sql/sql_insert.cc	2006-03-29 12:54:59 +02:00
+++ 1.186/sql/sql_insert.cc	2006-04-05 14:39:15 +02:00
@@ -1536,7 +1536,10 @@
 
   /* Adjust in_use for pointing to client thread */
   copy->in_use= client_thd;
-  
+
+  /* Adjust lock_count. This table object is not part of a lock. */
+  copy->lock_count= 0;
+
   return copy;
 
   /* Got fatal error */
Thread
bk commit into 5.0 tree (ingo:1.2138) BUG#5390ingo5 Apr