Below is the list of changes that have just been committed into a local
5.1 repository of cps. When cps 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, 2006-10-25 12:54:59+04:00, petr@stripped +2 -0
fix test failures in the runtime tree
sql/log.cc@stripped, 2006-10-25 12:54:54+04:00, petr@stripped +2 -0
NULL table pointer during initilization
sql/sql_table.cc@stripped, 2006-10-25 12:54:54+04:00, petr@stripped +27 -9
don't lock the destination table with table lock, but use name lock instead
# 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: petr
# Host: owlet.local
# Root: /home/cps/mysql/devel/5.1-rename-bug
--- 1.240/sql/log.cc 2006-10-25 12:55:09 +04:00
+++ 1.241/sql/log.cc 2006-10-25 12:55:09 +04:00
@@ -317,11 +317,13 @@ Log_to_csv_event_handler::Log_to_csv_eve
/* logger thread always works with mysql database */
general_log_thd->db= my_strdup("mysql", MYF(0));
general_log_thd->db_length= 5;
+ general_log.table= 0;
slow_log_thd= new THD;
/* logger thread always works with mysql database */
slow_log_thd->db= my_strdup("mysql", MYF(0));;
slow_log_thd->db_length= 5;
+ slow_log.table= 0;
/* no privileged thread exists at the moment */
privileged_thread= 0;
}
--- 1.369/sql/sql_table.cc 2006-10-25 12:55:09 +04:00
+++ 1.370/sql/sql_table.cc 2006-10-25 12:55:09 +04:00
@@ -4607,11 +4607,11 @@ bool mysql_create_like_table(THD* thd, T
char *src_db;
char *src_table= table_ident->table.str;
int err;
- bool res= TRUE;
+ bool res= TRUE, unlock_dst_table= FALSE;
enum legacy_db_type not_used;
HA_CREATE_INFO *create_info;
- TABLE_LIST src_tables_list;
+ TABLE_LIST src_tables_list, dst_tables_list;
DBUG_ENTER("mysql_create_like_table");
if (!(create_info= copy_create_info(lex_create_info)))
@@ -4794,17 +4794,29 @@ bool mysql_create_like_table(THD* thd, T
char buf[2048];
String query(buf, sizeof(buf), system_charset_info);
query.length(0); // Have to zero it since constructor doesn't
- TABLE *table_ptr;
- int error;
+ uint counter;
/*
- Let's open and lock the table: it will be closed (and
- unlocked) by close_thread_tables() at the end of the
- statement anyway.
- */
- if (!(table_ptr= open_ltable(thd, table, TL_READ_NO_INSERT)))
+ Here we open the destination table. This is needed for
+ store_create_info() to work. The table will be closed
+ by close_thread_tables() at the end of the statement.
+ */
+ if (open_tables(thd, &table, &counter, 0))
goto err;
+ bzero((gptr)&dst_tables_list, sizeof(dst_tables_list));
+ dst_tables_list.db= table->db;
+ dst_tables_list.table_name= table->table_name;
+
+ /*
+ lock destination table name, to make sure that nobody
+ can drop/alter the table while we execute store_create_info()
+ */
+ if (lock_and_wait_for_table_name(thd, &dst_tables_list))
+ goto err;
+ else
+ unlock_dst_table= TRUE;
+
int result= store_create_info(thd, table, &query, create_info);
DBUG_ASSERT(result == 0); // store_create_info() always return 0
@@ -4837,6 +4849,12 @@ table_exists:
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
err:
+ if (unlock_dst_table)
+ {
+ pthread_mutex_lock(&LOCK_open);
+ unlock_table_name(thd, &dst_tables_list);
+ pthread_mutex_unlock(&LOCK_open);
+ }
DBUG_RETURN(res);
}
| Thread |
|---|
| • bk commit into 5.1 tree (petr:1.2325) | Petr Chardin | 25 Oct |