List:Internals« Previous MessageNext Message »
From:ingo Date:April 27 2005 8:58pm
Subject:bk commit into 5.0 tree (ingo:1.1905) BUG#7823
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.1905 05/04/27 22:58:11 ingo@stripped +3 -0
  Bug#7823 - FLUSH TABLES WITH READ LOCK + INSERT DELAYED = deadlock
  After merge fix.

  sql/sql_insert.cc
    1.145 05/04/27 22:58:05 ingo@stripped +1 -1
    Bug#7823 - FLUSH TABLES WITH READ LOCK + INSERT DELAYED = deadlock
    After merge fix.

  sql/mysql_priv.h
    1.292 05/04/27 22:58:05 ingo@stripped +4 -1
    Bug#7823 - FLUSH TABLES WITH READ LOCK + INSERT DELAYED = deadlock
    After merge fix.

  sql/lock.cc
    1.66 05/04/27 22:58:05 ingo@stripped +49 -2
    Bug#7823 - FLUSH TABLES WITH READ LOCK + INSERT DELAYED = deadlock
    After merge fix.

# 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-5000

--- 1.65/sql/lock.cc	Wed Apr 27 21:02:34 2005
+++ 1.66/sql/lock.cc	Wed Apr 27 22:58:05 2005
@@ -82,7 +82,8 @@
 static void print_lock_error(int error, const char *);
 
 
-MYSQL_LOCK *mysql_lock_tables(THD *thd,TABLE **tables,uint count)
+MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
+                              bool ignore_global_read_lock)
 {
   MYSQL_LOCK *sql_lock;
   TABLE *write_lock_used;
@@ -93,7 +94,7 @@
     if (!(sql_lock = get_lock_data(thd,tables,count, 0,&write_lock_used)))
       break;
 
-    if (global_read_lock && write_lock_used)
+    if (global_read_lock && write_lock_used && ! ignore_global_read_lock)
     {
       /*
 	Someone has issued LOCK ALL TABLES FOR READ and we want a write lock
@@ -948,4 +949,50 @@
   thd->exit_cond(old_message); // this unlocks LOCK_global_read_lock
   DBUG_RETURN(error);
 }
+
+
+
+/*
+  Set protection against global read lock.
+
+  SYNOPSIS
+    set_protect_against_global_read_lock()
+    void
+
+  RETURN
+    FALSE       OK, no global read lock exists.
+    TRUE        Error, global read lock exists already.
+*/
+
+bool set_protect_against_global_read_lock(void)
+{
+  bool       global_read_lock_exists;
+
+  pthread_mutex_lock(&LOCK_open);
+  if (! (global_read_lock_exists= test(global_read_lock)))
+    protect_against_global_read_lock++;
+  pthread_mutex_unlock(&LOCK_open);
+  return global_read_lock_exists;
+}
+
+
+/*
+  Unset protection against global read lock.
+
+  SYNOPSIS
+    unset_protect_against_global_read_lock()
+    void
+
+  RETURN
+    void
+*/
+
+void unset_protect_against_global_read_lock(void)
+{
+  pthread_mutex_lock(&LOCK_open);
+  protect_against_global_read_lock--;
+  pthread_mutex_unlock(&LOCK_open);
+  pthread_cond_broadcast(&COND_refresh);
+}
+
 

--- 1.291/sql/mysql_priv.h	Wed Apr 27 21:02:34 2005
+++ 1.292/sql/mysql_priv.h	Wed Apr 27 22:58:05 2005
@@ -1151,7 +1151,8 @@
 extern struct st_VioSSLAcceptorFd * ssl_acceptor_fd;
 #endif /* HAVE_OPENSSL */
 
-MYSQL_LOCK *mysql_lock_tables(THD *thd,TABLE **table,uint count);
+MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count,
+                              bool ignore_global_read_lock= FALSE);
 void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock);
 void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock);
 void mysql_unlock_some_tables(THD *thd, TABLE **table,uint count);
@@ -1165,6 +1166,8 @@
                               bool is_not_commit);
 void start_waiting_global_read_lock(THD *thd);
 bool make_global_read_lock_block_commit(THD *thd);
+bool set_protect_against_global_read_lock(void);
+void unset_protect_against_global_read_lock(void);
 
 /* Lock based on name */
 int lock_and_wait_for_table_name(THD *thd, TABLE_LIST *table_list);

--- 1.144/sql/sql_insert.cc	Wed Apr 27 20:58:27 2005
+++ 1.145/sql/sql_insert.cc	Wed Apr 27 22:58:05 2005
@@ -1213,7 +1213,7 @@
   }
 
   pthread_mutex_lock(&tmp->mutex);
-  table=tmp->get_local_table(thd);
+  table= tmp->get_local_table(thd);
   pthread_mutex_unlock(&tmp->mutex);
   if (table)
     thd->di=tmp;
Thread
bk commit into 5.0 tree (ingo:1.1905) BUG#7823ingo27 Apr