summaryrefslogtreecommitdiff
path: root/sql/sql_partition.cc
diff options
context:
space:
mode:
authorunknown <mikael@dator6.(none)>2008-02-13 11:26:24 +0100
committerunknown <mikael@dator6.(none)>2008-02-13 11:26:24 +0100
commit911a85d54844ad75f407359bd86a44c76c7e6dc4 (patch)
treeb253281ea94dfc16148e7a32b7b1cbf5e05f419d /sql/sql_partition.cc
parent516f95acea961ed8e7c550ba49acdd884678058c (diff)
downloadmariadb-git-911a85d54844ad75f407359bd86a44c76c7e6dc4.tar.gz
Added comments on why we do reopen
Handle error case of not being able to reopen which requires us to remove table from thread's open list and table_cache.
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r--sql/sql_partition.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 677d45dc33d..3f65baa71ff 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -5846,21 +5846,31 @@ static void release_log_entries(partition_info *part_info)
RETURN VALUES
NONE
*/
-void alter_partition_lock_handling(ALTER_PARTITION_PARAM_TYPE *lpt)
+static void alter_partition_lock_handling(ALTER_PARTITION_PARAM_TYPE *lpt)
{
int err;
if (lpt->thd->locked_tables)
{
+ /*
+ When we have the table locked, it is necessary to reopen the table
+ since all table objects were closed and removed as part of the
+ ALTER TABLE of partitioning structure.
+ */
pthread_mutex_lock(&LOCK_open);
lpt->thd->in_lock_tables= 1;
err= reopen_tables(lpt->thd, 1, 1);
lpt->thd->in_lock_tables= 0;
- pthread_mutex_unlock(&LOCK_open);
if (err)
{
- /* Issue a warning since we weren't able to regain the lock again. */
+ /*
+ Issue a warning since we weren't able to regain the lock again.
+ We also need to unlink table from thread's open list and from
+ table_cache
+ */
+ unlink_open_table(lpt->thd, lpt->table, FALSE);
sql_print_warning("We failed to reacquire LOCKs in ALTER TABLE");
}
+ pthread_mutex_unlock(&LOCK_open);
}
}