From 1bb10ccfb1344ae00f3874e4a725d876e03463b7 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Mar 2008 15:56:53 +0100 Subject: [PATCH] Valgrind warnings found after bug#32943 and after merge from -main into -engines tree. hander::table_share was not updated after changing table->s. sql/ha_partition.cc: Valgrind warning after merge -main -> -engines, after bug#32943 change_table_ptr can happen in a middle of alter table rename/drop/... partition the newly created partitions must get the updated table_share too. sql/sql_base.cc: Bug#32943 was missing a call to change_table_ptr, this was found by valgrind after a merge from -main to -engines. --- sql/ha_partition.cc | 9 +++++++++ sql/sql_base.cc | 1 + 2 files changed, 10 insertions(+) diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 64bee07aa1c..ae7e2215517 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1646,6 +1646,15 @@ void ha_partition::change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) { (*file_array)->change_table_ptr(table_arg, share); } while (*(++file_array)); + if (m_added_file && m_added_file[0]) + { + /* if in middle of a drop/rename etc */ + file_array= m_added_file; + do + { + (*file_array)->change_table_ptr(table_arg, share); + } while (*(++file_array)); + } } /* diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 01e0009ad0d..ba4f695dcb8 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -747,6 +747,7 @@ void close_handle_and_leave_table_as_lock(TABLE *table) table->db_stat= 0; // Mark file closed release_table_share(table->s, RELEASE_NORMAL); table->s= share; + table->file->change_table_ptr(table, table->s); DBUG_VOID_RETURN; }