summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-03-24 23:24:45 +0200
committerunknown <monty@narttu.mysql.fi>2003-03-24 23:24:45 +0200
commit3b0438c8dd343da6ff77480ce3a814dbc11a0e42 (patch)
tree9d2f2979e4e950d2f6ca76cad917a2a0dbd6253c
parentcf97cbd1db762c443aa3c1412f3e788559aaa5dd (diff)
downloadmariadb-git-3b0438c8dd343da6ff77480ce3a814dbc11a0e42.tar.gz
Fixed bug that binary log was not locked during a DELETE FROM TABLE_NAME;
-rw-r--r--sql/sql_delete.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 278e98533c9..2372e908152 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -30,6 +30,7 @@ int generate_table(THD *thd, TABLE_LIST *table_list, TABLE *locked_table)
char path[FN_REFLEN];
int error;
TABLE **table_ptr;
+ my_bool lock_open_locked= 0;
DBUG_ENTER("generate_table");
thd->proc_info="generate_table";
@@ -102,7 +103,7 @@ int generate_table(THD *thd, TABLE_LIST *table_list, TABLE *locked_table)
error= ha_create_table(path,&create_info,1) ? -1 : 0;
if (thd->locked_tables && reopen_tables(thd,1,0))
error= -1;
- VOID(pthread_mutex_unlock(&LOCK_open));
+ lock_open_locked= 1; // Unlock mutex before return
}
if (!error)
{
@@ -114,6 +115,8 @@ int generate_table(THD *thd, TABLE_LIST *table_list, TABLE *locked_table)
}
send_ok(&thd->net); // This should return record count
}
+ if (lock_open_locked)
+ VOID(pthread_mutex_unlock(&LOCK_open));
DBUG_RETURN(error ? -1 : 0);
}