mirror of
https://github.com/MariaDB/server.git
synced 2025-06-23 19:21:55 +03:00
made some optimization of last patch for
Bug #2385 "CREATE TABLE LIKE lacks locking on source and destination table" (in sql_table.cc and mysql-test/t/synchronization.test) mysql-test/t/synchronization.test: added sleep to more reliable work sql/sql_table.cc: made some optimization of last patch for Bug #2385 "CREATE TABLE LIKE lacks locking on source and destination table" in mysql_create_like_table
This commit is contained in:
@ -13,6 +13,7 @@ CREATE TABLE t1 (a int);
|
|||||||
send CREATE TABLE t2 LIKE t1;
|
send CREATE TABLE t2 LIKE t1;
|
||||||
|
|
||||||
connection con_to_harm_sleeper;
|
connection con_to_harm_sleeper;
|
||||||
|
sleep 1;
|
||||||
ALTER TABLE t1 add key(a);
|
ALTER TABLE t1 add key(a);
|
||||||
|
|
||||||
connection con_to_sleep;
|
connection con_to_sleep;
|
||||||
|
@ -1986,27 +1986,25 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
|
|||||||
mysql_bin_log.write(&qinfo);
|
mysql_bin_log.write(&qinfo);
|
||||||
}
|
}
|
||||||
res= 0;
|
res= 0;
|
||||||
|
goto err;
|
||||||
err:
|
|
||||||
pthread_mutex_lock(&LOCK_open);
|
|
||||||
unlock_table_name(thd, &src_tables_list);
|
|
||||||
pthread_mutex_unlock(&LOCK_open);
|
|
||||||
DBUG_RETURN(res);
|
|
||||||
|
|
||||||
table_exists:
|
table_exists:
|
||||||
pthread_mutex_lock(&LOCK_open);
|
|
||||||
unlock_table_name(thd, &src_tables_list);
|
|
||||||
pthread_mutex_unlock(&LOCK_open);
|
|
||||||
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
|
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
|
||||||
{
|
{
|
||||||
char warn_buff[MYSQL_ERRMSG_SIZE];
|
char warn_buff[MYSQL_ERRMSG_SIZE];
|
||||||
sprintf(warn_buff,ER(ER_TABLE_EXISTS_ERROR),table_name);
|
sprintf(warn_buff,ER(ER_TABLE_EXISTS_ERROR),table_name);
|
||||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_TABLE_EXISTS_ERROR,warn_buff);
|
ER_TABLE_EXISTS_ERROR,warn_buff);
|
||||||
DBUG_RETURN(0);
|
res= 0;
|
||||||
}
|
}
|
||||||
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
|
else
|
||||||
DBUG_RETURN(-1);
|
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
|
||||||
|
|
||||||
|
err:
|
||||||
|
pthread_mutex_lock(&LOCK_open);
|
||||||
|
unlock_table_name(thd, &src_tables_list);
|
||||||
|
pthread_mutex_unlock(&LOCK_open);
|
||||||
|
DBUG_RETURN(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user