summaryrefslogtreecommitdiff
path: root/sql/sql_partition.cc
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-02-20 18:51:43 +0200
committerMichael Widenius <monty@askmonty.org>2011-02-20 18:51:43 +0200
commit58bb0769bdf13a9747e900aa2f0955137738ce9d (patch)
tree1b46ea0f72dce27532f0c87c60ba8a1baa453fa0 /sql/sql_partition.cc
parent7e497abcfb3e761ba5a368316192ae930fb58f6b (diff)
parentde3c4428b8c759e85631d8d70b5845c872de5400 (diff)
downloadmariadb-git-58bb0769bdf13a9747e900aa2f0955137738ce9d.tar.gz
Merge with MySQL 5.1.55
- Fixed some issues with partitions and connection_string, which also fixed lp:716890 "Pre- and post-recovery crash in Aria" - Fixed wrong assert in Aria Now need to merge with latest xtradb before pushing sql/ha_partition.cc: Ensure that m_ordered_rec_buffer is not freed before close. sql/mysqld.cc: Changed to use opt_stack_trace instead of opt_pstack. Removed references to pstack sql/partition_element.h: Ensure that connect_string is initialized storage/maria/ma_key_recover.c: Fixed wrong assert
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r--sql/sql_partition.cc36
1 files changed, 28 insertions, 8 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 71e5185012c..ffa19ae0431 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -1014,12 +1014,13 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
}
/*
- We don't allow creating partitions with timezone-dependent expressions as
- a (sub)partitioning function, but we want to allow such expressions when
- opening existing tables for easier maintenance. This exception should be
- deprecated at some point in future so that we always throw an error.
+ We don't allow creating partitions with expressions with non matching
+ arguments as a (sub)partitioning function,
+ but we want to allow such expressions when opening existing tables for
+ easier maintenance. This exception should be deprecated at some point
+ in future so that we always throw an error.
*/
- if (func_expr->walk(&Item::is_timezone_dependent_processor,
+ if (func_expr->walk(&Item::check_valid_arguments_processor,
0, NULL))
{
if (is_create_table_ind)
@@ -5935,6 +5936,12 @@ static void alter_partition_lock_handling(ALTER_PARTITION_PARAM_TYPE *lpt)
if (lpt->thd->locked_tables)
{
/*
+ Close the table if open, to remove/destroy the already altered
+ table->part_info object, so that it is not reused.
+ */
+ if (lpt->table->db_stat)
+ abort_and_upgrade_lock_and_close_table(lpt);
+ /*
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.
@@ -6436,7 +6443,20 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
table, table_list, FALSE, NULL,
written_bin_log));
err:
- close_thread_tables(thd);
+ if (thd->locked_tables)
+ {
+ /*
+ table->part_info was altered in prep_alter_part_table and must be
+ destroyed and recreated, since otherwise it will be reused, since
+ we are under LOCK TABLE.
+ */
+ alter_partition_lock_handling(lpt);
+ }
+ else
+ {
+ /* Force the table to be closed to avoid reuse of the table->part_info */
+ close_thread_tables(thd);
+ }
DBUG_RETURN(TRUE);
}
#endif
@@ -6747,8 +6767,8 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
{
DBUG_ASSERT(!is_subpart);
Field *field= part_info->part_field_array[0];
- uint32 max_endpoint_val;
- get_endpoint_func get_endpoint;
+ uint32 UNINIT_VAR(max_endpoint_val);
+ get_endpoint_func UNINIT_VAR(get_endpoint);
bool can_match_multiple_values; /* is not '=' */
uint field_len= field->pack_length_in_rec();
part_iter->ret_null_part= part_iter->ret_null_part_orig= FALSE;