summaryrefslogtreecommitdiff
path: root/sql/ha_partition.cc
diff options
context:
space:
mode:
authorsvoj@mysql.com/april.(none) <>2007-07-25 19:56:17 +0500
committersvoj@mysql.com/april.(none) <>2007-07-25 19:56:17 +0500
commit3b18aae71c49f1e85e00b82184a992b70fa8b597 (patch)
tree3d9b4b3023946a2cde552f86f3b6f13275eb21d6 /sql/ha_partition.cc
parent2edad3d4ba27cc930d2628d0772e82d3b1c3ae9a (diff)
downloadmariadb-git-3b18aae71c49f1e85e00b82184a992b70fa8b597.tar.gz
BUG#29806 - binlog_innodb.test creates a server log
Stopping mysql server could result in an entry in mysql error file: "InnoDB: Error: MySQL is freeing a thd". This happened because InnoDB assumes that the server will never call external_lock(F_UNLCK) in case external_lock(READ/WRITE) failed. Prior to this patch we haven't had strict definition whether external_lock(F_UNLCK) must be called in case external_lock(READ/WRITE) fails. This patch states that we never call external_lock(F_UNLCK) in case external_lock(READ/WRITE) fails.
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r--sql/ha_partition.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index e4924e8e8f2..d46b3a3bb08 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -1142,6 +1142,12 @@ int ha_partition::prepare_new_partition(TABLE *table,
create_flag= TRUE;
if ((error= file->ha_open(table, part_name, m_mode, m_open_test_lock)))
goto error;
+ /*
+ Note: if you plan to add another call that may return failure,
+ better to do it before external_lock() as cleanup_new_partition()
+ assumes that external_lock() is last call that may fail here.
+ Otherwise see description for cleanup_new_partition().
+ */
if ((error= file->external_lock(current_thd, m_lock_type)))
goto error;
@@ -1164,6 +1170,14 @@ error:
NONE
DESCRIPTION
+ This function is called immediately after prepare_new_partition() in
+ case the latter fails.
+
+ In prepare_new_partition() last call that may return failure is
+ external_lock(). That means if prepare_new_partition() fails,
+ partition does not have external lock. Thus no need to call
+ external_lock(F_UNLCK) here.
+
TODO:
We must ensure that in the case that we get an error during the process
that we call external_lock with F_UNLCK, close the table and delete the
@@ -1182,7 +1196,6 @@ void ha_partition::cleanup_new_partition(uint part_count)
m_file= m_added_file;
m_added_file= NULL;
- external_lock(current_thd, F_UNLCK);
/* delete_table also needed, a bit more complex */
close();