List:Commits« Previous MessageNext Message »
From:dlenev Date:May 14 2008 5:46am
Subject:bk commit into 6.0 tree (dlenev:1.2638) WL#3726
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of dlenev.  When dlenev 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@stripped, 2008-05-14 09:46:41+04:00, dlenev@stripped +11 -0
  Post-merge fixes after merging patches for WL#3726 "DDL locking for all
  metadata objects" with latest mysql-6.0-runtime tree.

  mysql-test/r/information_schema.result@stripped, 2008-05-14 09:46:36+04:00, dlenev@stripped +1 -0
    Fixed test case after bad merge.

  mysql-test/r/view_multi.result@stripped, 2008-05-14 09:46:36+04:00, dlenev@stripped +1 -1
    Adjusted test case to change in size of binary log event.

  mysql-test/t/information_schema.test@stripped, 2008-05-14 09:46:36+04:00, dlenev@stripped +1 -0
    Fixed test case after bad merge.

  mysql-test/t/view_multi.test@stripped, 2008-05-14 09:46:36+04:00, dlenev@stripped +1 -1
    Adjusted test case to change in size of binary log event.

  sql/backup/backup_progress.cc@stripped, 2008-05-14 09:46:37+04:00, dlenev@stripped +8 -0
    Allocate metadata lock requests objects (MDL_EL) on execution memory
    root in cases when we use stack TABLE_LIST objects to open tables.

  sql/backup/kernel.cc@stripped, 2008-05-14 09:46:37+04:00, dlenev@stripped +10 -1
    Allocate metadata lock requests objects (MDL_EL) on execution memory
    root in cases when we use stack TABLE_LIST objects to open tables.
    Use heap for MDL_EL objects in case when TABLE_LIST is allocated on
    heap.

  sql/si_objects.cc@stripped, 2008-05-14 09:46:37+04:00, dlenev@stripped +2 -0
    Allocate metadata lock requests objects (MDL_EL) on execution memory
    root in cases when TABLE_LIST objects is also allocated there.

  sql/sql_base.cc@stripped, 2008-05-14 09:46:37+04:00, dlenev@stripped +1 -1
    Fixed incorrect error message.

  sql/sql_partition.cc@stripped, 2008-05-14 09:46:37+04:00, dlenev@stripped +1 -1
    Adjusted code to the fact that reopen_tables() no longer has
    "mark_share_as_old" argument.

  sql/sql_servers.cc@stripped, 2008-05-14 09:46:37+04:00, dlenev@stripped +3 -0
    Allocate metadata lock requests objects (MDL_EL) on execution memory
    root in cases when we use stack TABLE_LIST objects to open tables.

  sql/sql_table.cc@stripped, 2008-05-14 09:46:37+04:00, dlenev@stripped +8 -6
    mysql_rm_table_part2():
      Changed code to mimic old behavior. Don't leave LOCK TABLES mode when
      dropping temporary table.
    mysql_discard_or_import_tablespace():
      Fixed results of bad manual merge.

diff -Nrup a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
--- a/mysql-test/r/information_schema.result	2008-05-12 13:47:39 +04:00
+++ b/mysql-test/r/information_schema.result	2008-05-14 09:46:36 +04:00
@@ -1715,6 +1715,7 @@ ERROR 42000: SELECT command denied to us
 DROP TABLE t1,t2;
 DROP DATABASE testdb1;
 DROP USER mysqluser_35955@localhost;
+USE test;
 drop tables if exists t1, t2, t3;
 create table t1 (i int);
 create table t2 (j int primary key auto_increment);
diff -Nrup a/mysql-test/r/view_multi.result b/mysql-test/r/view_multi.result
--- a/mysql-test/r/view_multi.result	2007-09-04 13:31:59 +04:00
+++ b/mysql-test/r/view_multi.result	2008-05-14 09:46:36 +04:00
@@ -34,7 +34,7 @@ i
 1
 select * from t2;
 i
-show binlog events in 'master-bin.000001' from 106;
+show binlog events in 'master-bin.000001' from 107;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	1	#	use `test`; create table t1 (i int)
 master-bin.000001	#	Query	1	#	use `test`; create table t2 (i int)
diff -Nrup a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
--- a/mysql-test/t/information_schema.test	2008-05-12 13:47:40 +04:00
+++ b/mysql-test/t/information_schema.test	2008-05-14 09:46:36 +04:00
@@ -1389,6 +1389,7 @@ SELECT * FROM INFORMATION_SCHEMA.tables,
 DROP TABLE t1,t2;
 DROP DATABASE testdb1;
 DROP USER mysqluser_35955@localhost;
+USE test;
 
 #
 # Additional test for WL#3726 "DDL locking for all metadata objects"
diff -Nrup a/mysql-test/t/view_multi.test b/mysql-test/t/view_multi.test
--- a/mysql-test/t/view_multi.test	2008-03-04 18:21:05 +03:00
+++ b/mysql-test/t/view_multi.test	2008-05-14 09:46:36 +04:00
@@ -104,7 +104,7 @@ select * from t2;
 
 # Now let us check that statements were logged in proper order
 --replace_column 2 # 5 #
-show binlog events in 'master-bin.000001' from 106;
+show binlog events in 'master-bin.000001' from 107;
 
 drop table t1, t2;
 drop view v1;
diff -Nrup a/sql/backup/backup_progress.cc b/sql/backup/backup_progress.cc
--- a/sql/backup/backup_progress.cc	2008-03-21 18:13:01 +03:00
+++ b/sql/backup/backup_progress.cc	2008-05-14 09:46:37 +04:00
@@ -55,6 +55,7 @@ my_bool check_ob_progress_tables(THD *th
 
   /* Check mysql.online_backup */
   tables.init_one_table("mysql", "online_backup", TL_READ);
+  mdl_alloc_locks(&tables, thd->mem_root);
   if (simple_open_n_lock_tables(thd, &tables))
   {
     ret= TRUE;
@@ -65,6 +66,7 @@ my_bool check_ob_progress_tables(THD *th
 
   /* Check mysql.online_backup_progress */
   tables.init_one_table("mysql", "online_backup_progress", TL_READ);
+  mdl_alloc_locks(&tables, thd->mem_root);
   if (simple_open_n_lock_tables(thd, &tables))
   {
     ret= TRUE;
@@ -165,6 +167,8 @@ bool backup_history_log_write(THD *thd, 
   table_list.db= MYSQL_SCHEMA_NAME.str;
   table_list.db_length= MYSQL_SCHEMA_NAME.length;
 
+  mdl_alloc_locks(&table_list, thd->mem_root);
+
   if (!(table= open_performance_schema_table(thd, & table_list,
                                              & open_tables_backup)))
     goto err;
@@ -317,6 +321,8 @@ bool backup_history_log_update(THD *thd,
   table_list.db= MYSQL_SCHEMA_NAME.str;
   table_list.db_length= MYSQL_SCHEMA_NAME.length;
 
+  mdl_alloc_locks(&table_list, thd->mem_root);
+
   if (!(table= open_performance_schema_table(thd, & table_list,
                                              & open_tables_backup)))
     goto err;
@@ -465,6 +471,8 @@ bool backup_progress_log_write(THD *thd,
 
   table_list.db= MYSQL_SCHEMA_NAME.str;
   table_list.db_length= MYSQL_SCHEMA_NAME.length;
+
+  mdl_alloc_locks(&table_list, thd->mem_root);
 
   if (!(table= open_performance_schema_table(thd, & table_list,
                                              & open_tables_backup)))
diff -Nrup a/sql/backup/kernel.cc b/sql/backup/kernel.cc
--- a/sql/backup/kernel.cc	2008-04-20 00:45:03 +04:00
+++ b/sql/backup/kernel.cc	2008-05-14 09:46:37 +04:00
@@ -1108,6 +1108,7 @@ Backup_info::add_table(Db_item &dbi, con
   // FIXME: table/db name mangling
   entry.db= const_cast<char*>(t.db().name().ptr());
   entry.alias= entry.table_name= const_cast<char*>(t.name().ptr());
+  mdl_alloc_locks(&entry, m_thd->mem_root);
 
   uint cnt;
   int res= ::open_tables(m_thd,&tl,&cnt,0);
@@ -2106,7 +2107,13 @@ TABLE_LIST *build_table_list(const Table
 
   for( uint tno=0; tno < tables.count() ; tno++ )
   {
-    TABLE_LIST *ptr= (TABLE_LIST*)my_malloc(sizeof(TABLE_LIST), MYF(MY_WME));
+    TABLE_LIST *ptr;
+    MDL_EL *mdl;
+    char *keybuff;
+
+    my_multi_malloc(MYF(MY_WME), &ptr, sizeof(TABLE_LIST),
+                    &mdl, sizeof(MDL_EL), &keybuff, MAX_DBKEY_LENGTH,
+                    NULL, 0);
     DBUG_ASSERT(ptr);  // FIXME: report error instead
     bzero(ptr,sizeof(TABLE_LIST));
 
@@ -2115,6 +2122,8 @@ TABLE_LIST *build_table_list(const Table
     ptr->alias= ptr->table_name= const_cast<char*>(tbl.name().ptr());
     ptr->db= const_cast<char*>(tbl.db().name().ptr());
     ptr->lock_type= lock;
+    mdl_init_lock(mdl, keybuff, 0, ptr->db, ptr->table_name);
+    ptr->mdl= mdl;
 
     // and add it to the list
 
diff -Nrup a/sql/si_objects.cc b/sql/si_objects.cc
--- a/sql/si_objects.cc	2008-04-16 11:53:13 +04:00
+++ b/sql/si_objects.cc	2008-05-14 09:46:37 +04:00
@@ -1906,6 +1906,8 @@ bool TriggerObj::serialize(THD *thd, Str
   if (!lst)
     DBUG_RETURN(FALSE);
 
+  mdl_alloc_locks(lst, thd->mem_root);
+
   if (open_tables(thd, &lst, &num_tables, 0))
     DBUG_RETURN(FALSE);
 
diff -Nrup a/sql/sql_base.cc b/sql/sql_base.cc
--- a/sql/sql_base.cc	2008-05-12 13:47:40 +04:00
+++ b/sql/sql_base.cc	2008-05-14 09:46:37 +04:00
@@ -3731,7 +3731,7 @@ bool open_view_entry(THD *thd, TABLE_LIS
     return FALSE;
   }
 
-  my_error(ER_WRONG_OBJECT, MYF(0), share->db.str, share->table_name.str, "BASE TABLE");
+  my_error(ER_WRONG_OBJECT, MYF(0), share->db.str, share->table_name.str, "VIEW");
   release_table_share(share, RELEASE_NORMAL);
 err:
   VOID(pthread_mutex_unlock(&LOCK_open));
diff -Nrup a/sql/sql_partition.cc b/sql/sql_partition.cc
--- a/sql/sql_partition.cc	2008-05-12 13:47:41 +04:00
+++ b/sql/sql_partition.cc	2008-05-14 09:46:37 +04:00
@@ -5791,7 +5791,7 @@ static void alter_partition_lock_handlin
     */
     pthread_mutex_lock(&LOCK_open);
     lpt->thd->in_lock_tables= 1;
-    err= reopen_tables(lpt->thd, 1, 1);
+    err= reopen_tables(lpt->thd, 1);
     lpt->thd->in_lock_tables= 0;
     if (err)
     {
diff -Nrup a/sql/sql_servers.cc b/sql/sql_servers.cc
--- a/sql/sql_servers.cc	2008-05-12 13:02:28 +04:00
+++ b/sql/sql_servers.cc	2008-05-14 09:46:37 +04:00
@@ -363,6 +363,7 @@ insert_server(THD *thd, FOREIGN_SERVER *
   bzero((char*) &tables, sizeof(tables));
   tables.db= (char*) "mysql";
   tables.alias= tables.table_name= (char*) "servers";
+  mdl_alloc_locks(&tables, thd->mem_root);
 
   /* need to open before acquiring THR_LOCK_plugin or it will deadlock */
   if (! (table= open_ltable(thd, &tables, TL_WRITE, 0)))
@@ -581,6 +582,7 @@ int drop_server(THD *thd, LEX_SERVER_OPT
   bzero((char*) &tables, sizeof(tables));
   tables.db= (char*) "mysql";
   tables.alias= tables.table_name= (char*) "servers";
+  mdl_alloc_locks(&tables, thd->mem_root);
 
   rw_wrlock(&THR_LOCK_servers);
 
@@ -704,6 +706,7 @@ int update_server(THD *thd, FOREIGN_SERV
   bzero((char*) &tables, sizeof(tables));
   tables.db= (char*)"mysql";
   tables.alias= tables.table_name= (char*)"servers";
+  mdl_alloc_locks(&tables, thd->mem_root);
 
   if (!(table= open_ltable(thd, &tables, TL_WRITE, 0)))
   {
diff -Nrup a/sql/sql_table.cc b/sql/sql_table.cc
--- a/sql/sql_table.cc	2008-05-12 13:47:41 +04:00
+++ b/sql/sql_table.cc	2008-05-14 09:46:37 +04:00
@@ -1665,6 +1665,12 @@ int mysql_rm_table_part2(THD *thd, TABLE
           error= -1;
           goto err_with_placeholders;
         }
+        /*
+          Leave LOCK TABLES mode if we managed to drop all tables
+          which were locked.
+        */
+        if (thd->locked_tables->table_count == 0)
+          unlock_locked_tables(thd);
       }
 
       if (thd->killed)
@@ -1815,12 +1821,6 @@ err_with_placeholders:
       it makes sense to remove exclusive meta-data locks in all cases.
     */
     mdl_release_exclusive_locks(&thd->mdl_context);
-    /*
-      Leave LOCK TABLES mode if we managed to drop all tables
-      which were locked.
-    */
-    if (thd->locked_tables && thd->locked_tables->table_count == 0)
-      unlock_locked_tables(thd);
   }
 
   thd->no_warnings_for_error= 0;
@@ -5052,6 +5052,8 @@ err:
     my_ok(thd);
     DBUG_RETURN(0);
   }
+
+  table->file->print_error(error, MYF(0));
 
   DBUG_RETURN(-1);
 }
Thread
bk commit into 6.0 tree (dlenev:1.2638) WL#3726dlenev14 May