diff options
author | unknown <gluh@gluh.mysql.r18.ru> | 2003-08-28 18:09:00 +0500 |
---|---|---|
committer | unknown <gluh@gluh.mysql.r18.ru> | 2003-08-28 18:09:00 +0500 |
commit | 241ed6b81caf0248200aacbd7e945a24ce835baa (patch) | |
tree | d0c13f66f3fb6662f823e9eff89889816d5b1925 /sql/sql_table.cc | |
parent | 5f8cc0998f6366c46cc20e42e4989f8f3f468f03 (diff) | |
download | mariadb-git-241ed6b81caf0248200aacbd7e945a24ce835baa.tar.gz |
Fix for bug #799 FLUSH TABLES WITH READ LOCK does not block CREATE TABLE
This commit is related to my previos one(ChangeSet 1.1583 03/08/27 18:03:39).
Note about COMMIT&ROLLBACK:
Only 'COMMIT' statement updates the binary log.
'ROLLBACK' statement doesn't update the binlog.
mysql-test/r/drop.result:
Fix for bug #799 FLUSH TABLES WITH READ LOCK does not block CREATE TABLE
mysql-test/r/innodb.result:
Fix for bug #799 FLUSH TABLES WITH READ LOCK does not block CREATE TABLE
mysql-test/t/drop.test:
Fix for bug #799 FLUSH TABLES WITH READ LOCK does not block CREATE TABLE
mysql-test/t/innodb.test:
Fix for bug #799 FLUSH TABLES WITH READ LOCK does not block CREATE TABLE
sql/handler.cc:
Fix for bug #799 FLUSH TABLES WITH READ LOCK does not block CREATE TABLE
sql/sql_table.cc:
Fix for bug #799 FLUSH TABLES WITH READ LOCK does not block CREATE TABLE
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index f33cc8fde14..006cec7000f 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -899,33 +899,18 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name); DBUG_RETURN(-1); } + if (wait_if_global_read_lock(thd, 0)) + DBUG_RETURN(error); VOID(pthread_mutex_lock(&LOCK_open)); - if (global_read_lock) - { - thd->mysys_var->current_mutex= &LOCK_open; - thd->mysys_var->current_cond= &COND_refresh; - if (thd->global_read_lock) - my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE,MYF(0), - table_name); - else - while (global_read_lock && ! thd->killed) - (void) pthread_cond_wait(&COND_refresh,&LOCK_open); - pthread_mutex_lock(&thd->mysys_var->mutex); - thd->mysys_var->current_mutex= 0; - thd->mysys_var->current_cond= 0; - pthread_mutex_unlock(&thd->mysys_var->mutex); - if (error) - goto end; - } if (!tmp_table && !(create_info->options & HA_LEX_CREATE_TMP_TABLE)) { if (!access(path,F_OK)) { - VOID(pthread_mutex_unlock(&LOCK_open)); if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS) - DBUG_RETURN(0); - my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name); - DBUG_RETURN(-1); + error= 0; + else + my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name); + goto end; } } @@ -963,6 +948,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, error=0; end: VOID(pthread_mutex_unlock(&LOCK_open)); + start_waiting_global_read_lock(thd); thd->proc_info="After create"; DBUG_RETURN(error); } |