summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorunknown <gluh@gluh.mysql.r18.ru>2003-08-27 18:03:39 +0500
committerunknown <gluh@gluh.mysql.r18.ru>2003-08-27 18:03:39 +0500
commit5f8cc0998f6366c46cc20e42e4989f8f3f468f03 (patch)
treef67788457623bbbf382374756ab4f3f6833bc25e /sql/sql_table.cc
parent91dc31d38334cddc0b47c9ac0c0be338fc8cfd20 (diff)
downloadmariadb-git-5f8cc0998f6366c46cc20e42e4989f8f3f468f03.tar.gz
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.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 37f8d0d7f4f..f33cc8fde14 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -900,6 +900,23 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
DBUG_RETURN(-1);
}
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))