List:Internals« Previous MessageNext Message »
From:sasha Date:June 21 2001 9:59pm
Subject:bk commit into 3.23 tree
View as plain text  
Below is the list of changes that have just been pushed into main
3.23. repository. For information on how to access the repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet@stripped, 2001-06-21 15:59:51-06:00, sasha@stripped
  fixed drop/create database bug when holding global read lock
  preserve originating server id in Intvar events to avoid inifinite loops

  mysql-test/r/drop.result
    1.2 01/06/21 15:59:50 sasha@stripped +7 -0
    updated result

  mysql-test/r/flush.result
    1.3 01/06/21 15:59:50 sasha@stripped +2 -0
    updated result

  mysql-test/t/drop.test
    1.2 01/06/21 15:59:50 sasha@stripped +13 -0
    test for proper handling of drop/create database when holding
    global read lock

  mysql-test/t/flush.test
    1.6 01/06/21 15:59:50 sasha@stripped +15 -0
    test to see if other thread would block on drop database if we
    are holding global read lock

  sql/log.cc
    1.56 01/06/21 15:59:50 sasha@stripped +4 -0
    preserve originating server id in Intvar log event

  sql/share/czech/errmsg.txt
    1.24 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/danish/errmsg.txt
    1.23 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/dutch/errmsg.txt
    1.24 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/english/errmsg.txt
    1.27 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/estonian/errmsg.txt
    1.24 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/french/errmsg.txt
    1.23 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/german/errmsg.txt
    1.25 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/greek/errmsg.txt
    1.24 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/hungarian/errmsg.txt
    1.25 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/italian/errmsg.txt
    1.28 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/japanese/errmsg.txt
    1.23 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/korean/errmsg.txt
    1.23 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/norwegian-ny/errmsg.txt
    1.23 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/norwegian/errmsg.txt
    1.23 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/polish/errmsg.txt
    1.23 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/portuguese/errmsg.txt
    1.25 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/romanian/errmsg.txt
    1.22 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/russian/errmsg.txt
    1.24 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/slovak/errmsg.txt
    1.24 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/spanish/errmsg.txt
    1.24 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/share/swedish/errmsg.txt
    1.24 01/06/21 15:59:50 sasha@stripped +2 -0
    new error messages

  sql/slave.cc
    1.104 01/06/21 15:59:50 sasha@stripped +1 -1
    fixed typo in comment

  sql/sql_db.cc
    1.23 01/06/21 15:59:50 sasha@stripped +46 -0
    global read lock should block drop/create database

  include/mysqld_error.h
    1.24 01/06/21 15:59:49 sasha@stripped +3 -1
    new error messages

# 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:	sasha
# Host:	mysql.sashanet.com
# Root:	/home/sasha/src/bk/mysql

--- 1.23/include/mysqld_error.h	Tue May 29 07:29:01 2001
+++ 1.24/include/mysqld_error.h	Thu Jun 21 15:59:49 2001
@@ -208,4 +208,6 @@
 #define ER_LOCK_WAIT_TIMEOUT 1205
 #define ER_LOCK_TABLE_FULL 1206
 #define ER_READ_ONLY_TRANSACTION 1207
-#define ER_ERROR_MESSAGES 208
+#define ER_DROP_DB_WITH_READ_LOCK 1208
+#define ER_CREATE_DB_WITH_READ_LOCK 1209
+#define ER_ERROR_MESSAGES 210

--- 1.55/sql/log.cc	Wed Apr 25 13:44:56 2001
+++ 1.56/sql/log.cc	Thu Jun 21 15:59:50 2001
@@ -652,12 +652,16 @@
     if (thd->last_insert_id_used)
     {
       Intvar_log_event e((uchar)LAST_INSERT_ID_EVENT, thd->last_insert_id);
+      if(thd->server_id)
+	e.server_id = thd->server_id;
       if (e.write(file))
 	goto err;
     }
     if (thd->insert_id_used)
     {
       Intvar_log_event e((uchar)INSERT_ID_EVENT, thd->last_insert_id);
+      if(thd->server_id)
+	e.server_id = thd->server_id;
       if (e.write(file))
 	goto err;
     }

--- 1.23/sql/share/czech/errmsg.txt	Tue May 29 07:29:01 2001
+++ 1.24/sql/share/czech/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -218,3 +218,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.22/sql/share/danish/errmsg.txt	Tue May 29 07:29:01 2001
+++ 1.23/sql/share/danish/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -212,3 +212,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.23/sql/share/dutch/errmsg.txt	Tue May 29 07:29:01 2001
+++ 1.24/sql/share/dutch/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -209,3 +209,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.26/sql/share/english/errmsg.txt	Tue May 29 07:38:16 2001
+++ 1.27/sql/share/english/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -209,3 +209,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.23/sql/share/estonian/errmsg.txt	Tue May 29 07:29:01 2001
+++ 1.24/sql/share/estonian/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -213,3 +213,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.22/sql/share/french/errmsg.txt	Tue May 29 07:29:01 2001
+++ 1.23/sql/share/french/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -209,3 +209,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.24/sql/share/german/errmsg.txt	Tue Jun 12 08:13:51 2001
+++ 1.25/sql/share/german/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -212,3 +212,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.23/sql/share/greek/errmsg.txt	Tue May 29 07:29:01 2001
+++ 1.24/sql/share/greek/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -209,3 +209,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.24/sql/share/hungarian/errmsg.txt	Tue May 29 07:29:01 2001
+++ 1.25/sql/share/hungarian/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -211,3 +211,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.27/sql/share/italian/errmsg.txt	Tue May 29 07:29:01 2001
+++ 1.28/sql/share/italian/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -209,3 +209,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.22/sql/share/japanese/errmsg.txt	Tue May 29 07:29:01 2001
+++ 1.23/sql/share/japanese/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -211,3 +211,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.22/sql/share/korean/errmsg.txt	Tue May 29 07:29:01 2001
+++ 1.23/sql/share/korean/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -209,3 +209,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.22/sql/share/norwegian-ny/errmsg.txt	Tue May 29 07:29:01 2001
+++ 1.23/sql/share/norwegian-ny/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -211,3 +211,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.22/sql/share/norwegian/errmsg.txt	Tue May 29 07:29:01 2001
+++ 1.23/sql/share/norwegian/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -211,3 +211,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.22/sql/share/polish/errmsg.txt	Tue May 29 07:29:01 2001
+++ 1.23/sql/share/polish/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -213,3 +213,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.24/sql/share/portuguese/errmsg.txt	Fri Jun  1 15:03:15 2001
+++ 1.25/sql/share/portuguese/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -209,3 +209,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.21/sql/share/romanian/errmsg.txt	Tue May 29 07:29:01 2001
+++ 1.22/sql/share/romanian/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -213,3 +213,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.23/sql/share/russian/errmsg.txt	Tue May 29 07:29:01 2001
+++ 1.24/sql/share/russian/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -212,3 +212,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.23/sql/share/slovak/errmsg.txt	Tue May 29 07:29:02 2001
+++ 1.24/sql/share/slovak/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -217,3 +217,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.23/sql/share/spanish/errmsg.txt	Tue May 29 07:29:02 2001
+++ 1.24/sql/share/spanish/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -210,3 +210,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.23/sql/share/swedish/errmsg.txt	Tue May 29 07:29:02 2001
+++ 1.24/sql/share/swedish/errmsg.txt	Thu Jun 21 15:59:50 2001
@@ -209,3 +209,5 @@
 "Lock wait timeout exceeded",
 "The total number of locks exceeds the lock table size",
 "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
+"DROP DATABASE not allowed while thread is holding global read lock",
+"CREATE DATABASE not allowed while thread is holding global read lock",

--- 1.103/sql/slave.cc	Fri Jun  1 15:03:15 2001
+++ 1.104/sql/slave.cc	Thu Jun 21 15:59:50 2001
@@ -1367,7 +1367,7 @@
 	    {
 	      // show a little mercy, allow slave to read one more event
 	      // before cutting him off - otherwise he gets stuck
-	      // on Invar events, since they do not advance the offset
+	      // on Intvar events, since they do not advance the offset
 	      // immediately
 	      if (++stuck_count > 2)
 	        events_till_disconnect++;

--- 1.22/sql/sql_db.cc	Wed Mar 21 09:09:06 2001
+++ 1.23/sql/sql_db.cc	Thu Jun 21 15:59:50 2001
@@ -38,6 +38,32 @@
   DBUG_ENTER("mysql_create_db");
   
   VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
+  VOID(pthread_mutex_lock(&LOCK_open));
+
+  // do not create database if another thread is holding read lock
+  if (global_read_lock)
+  {
+    if (thd->global_read_lock)
+    {
+      net_printf(&thd->net, ER_CREATE_DB_WITH_READ_LOCK);
+      VOID(pthread_mutex_unlock(&LOCK_open));
+      goto exit;
+    }
+    while (global_read_lock && ! thd->killed)
+    {
+      (void) pthread_cond_wait(&COND_refresh,&LOCK_open);
+    }
+    
+    if (thd->killed)
+    {
+      net_printf(&thd->net, ER_SERVER_SHUTDOWN);
+      VOID(pthread_mutex_unlock(&LOCK_open));
+      goto exit;
+    }
+
+  }
+  
+  VOID(pthread_mutex_unlock(&LOCK_open));
 
   /* Check directory */
   (void)sprintf(path,"%s/%s", mysql_data_home, db);
@@ -104,6 +130,26 @@
 
   VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
   VOID(pthread_mutex_lock(&LOCK_open));
+
+  // do not drop database if another thread is holding read lock
+  if (global_read_lock)
+  {
+    if (thd->global_read_lock)
+    {
+      net_printf(&thd->net, ER_DROP_DB_WITH_READ_LOCK);
+      goto exit;
+    }
+    while (global_read_lock && ! thd->killed)
+    {
+      (void) pthread_cond_wait(&COND_refresh,&LOCK_open);
+    }
+
+    if (thd->killed)
+    {
+      net_printf(&thd->net, ER_SERVER_SHUTDOWN);
+      goto exit;
+    }
+  }
 
   (void) sprintf(path,"%s/%s",mysql_data_home,db);
   unpack_dirname(path,path);			// Convert if not unix

--- 1.1/mysql-test/r/drop.result	Tue Mar 27 10:23:04 2001
+++ 1.2/mysql-test/r/drop.result	Thu Jun 21 15:59:50 2001
@@ -1,2 +1,9 @@
 n
 1
+Database
+foo
+mysql
+test
+Database
+mysql
+test

--- 1.2/mysql-test/r/flush.result	Fri Jun  1 17:43:31 2001
+++ 1.3/mysql-test/r/flush.result	Thu Jun 21 15:59:50 2001
@@ -1,4 +1,6 @@
 n
 3
 n
+23
+n
 345

--- 1.1/mysql-test/t/drop.test	Tue Mar 27 10:23:04 2001
+++ 1.2/mysql-test/t/drop.test	Thu Jun 21 15:59:50 2001
@@ -10,3 +10,16 @@
 create table t1(n int);
 drop table t1;
 select * from t1;
+drop database if exists foo;
+flush tables with read lock;
+--error 1209
+create database foo;
+unlock tables;
+create database foo;
+show databases;
+flush tables with read lock;
+--error 1208
+drop database foo;
+unlock tables;
+drop database foo;
+show databases;

--- 1.5/mysql-test/t/flush.test	Fri Jun  1 17:43:31 2001
+++ 1.6/mysql-test/t/flush.test	Thu Jun 21 15:59:50 2001
@@ -33,6 +33,21 @@
 connection con1;
 reap;
 
+#test if drop database will wait until we release the global read lock
+connection con1;
+drop database if exists foo;
+create database foo;
+create table foo.t1(n int);
+insert into foo.t1 values (23);
+flush tables with read lock;
+connection con2;
+send drop database foo;
+connection con1;
+select * from foo.t1;
+unlock tables;
+connection con2;
+reap;
+
 # test if dirty close releases global read lock
 connection con1;
 create table t1 (n int);
Thread
bk commit into 3.23 treesasha21 Jun