summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-01-14 00:09:15 +0200
committerunknown <monty@mysql.com>2005-01-14 00:09:15 +0200
commit177e99f32719b9c20c55c19fbbc9cef09550d9e1 (patch)
tree8e12e0a89204ea53a9bc43cf5f2fcb17819c89d5 /sql/sql_prepare.cc
parentc0af1e3c67c707477f2cdc1dd776fb6d6df8cdb8 (diff)
downloadmariadb-git-177e99f32719b9c20c55c19fbbc9cef09550d9e1.tar.gz
Fix bug in INSERT DELAYED with prepared statements
The bug was that if you have two TL_WRITE_DELAYED at the same time, mi_lock_databases() could be done in the wrong order and we could write the wrong header to the MyISAM index file. sql/mysql_priv.h: Fix bug in insert delayed with prepared statements sql/sql_base.cc: Fix bug in insert delayed with prepared statements sql/sql_prepare.cc: Fix bug in insert delayed with prepared statements The bug was that if you have two TL_WRITE_DELAYED at the same time, mi_lock_databases() could be done in the wrong order and we could write the wrong header to the MyISAM index file.
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index ecf01824755..1dc46aef4da 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -897,8 +897,12 @@ static int mysql_test_insert(Prepared_statement *stmt,
/*
open temporary memory pool for temporary data allocated by derived
tables & preparation procedure
+ Note that this is done without locks (should not be needed as we will not
+ access any data here)
+ If we would use locks, then we have to ensure we are not using
+ TL_WRITE_DELAYED as having two such locks can cause table corruption.
*/
- if (open_and_lock_tables(thd, table_list))
+ if (open_normal_and_derived_tables(thd, table_list))
{
DBUG_RETURN(-1);
}