1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

merge from mysql-5.1

This commit is contained in:
Mattias Jonsson
2012-02-29 21:18:50 +01:00
7 changed files with 306 additions and 54 deletions

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -6792,8 +6792,8 @@ int ha_partition::final_add_index(handler_add_index *add, bool commit)
DBUG_RETURN(ret);
err:
uint j;
uint *key_numbers= NULL;
KEY *old_key_info= NULL;
uint *key_numbers= NULL;
KEY *old_key_info= NULL;
uint num_of_keys= 0;
int error;
@ -6803,27 +6803,27 @@ err:
if (i > 0)
{
num_of_keys= part_add_index->num_of_keys;
key_numbers= (uint*) ha_thd()->alloc(sizeof(uint) * num_of_keys);
if (!key_numbers)
{
sql_print_error("Failed with error handling of adding index:\n"
"committing index failed, and when trying to revert "
"already committed partitions we failed allocating\n"
"memory for the index for table '%s'",
table_share->table_name.str);
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
old_key_info= table->key_info;
/*
Use the newly added key_info as table->key_info to remove them.
Note that this requires the subhandlers to use name lookup of the
index. They must use given table->key_info[key_number], they cannot
use their local view of the keys, since table->key_info only include
the indexes to be removed here.
*/
for (j= 0; j < num_of_keys; j++)
key_numbers[j]= j;
table->key_info= part_add_index->key_info;
key_numbers= (uint*) ha_thd()->alloc(sizeof(uint) * num_of_keys);
if (!key_numbers)
{
sql_print_error("Failed with error handling of adding index:\n"
"committing index failed, and when trying to revert "
"already committed partitions we failed allocating\n"
"memory for the index for table '%s'",
table_share->table_name.str);
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
old_key_info= table->key_info;
/*
Use the newly added key_info as table->key_info to remove them.
Note that this requires the subhandlers to use name lookup of the
index. They must use given table->key_info[key_number], they cannot
use their local view of the keys, since table->key_info only include
the indexes to be removed here.
*/
for (j= 0; j < num_of_keys; j++)
key_numbers[j]= j;
table->key_info= part_add_index->key_info;
}
for (j= 0; j < m_tot_parts; j++)
@ -6831,15 +6831,15 @@ err:
if (j < i)
{
/* Remove the newly added index */
error= m_file[j]->prepare_drop_index(table, key_numbers, num_of_keys);
if (error || m_file[j]->final_drop_index(table))
{
sql_print_error("Failed with error handling of adding index:\n"
"committing index failed, and when trying to revert "
"already committed partitions we failed removing\n"
"the index for table '%s' partition nr %d",
table_share->table_name.str, j);
}
error= m_file[j]->prepare_drop_index(table, key_numbers, num_of_keys);
if (error || m_file[j]->final_drop_index(table))
{
sql_print_error("Failed with error handling of adding index:\n"
"committing index failed, and when trying to revert "
"already committed partitions we failed removing\n"
"the index for table '%s' partition nr %d",
table_share->table_name.str, j);
}
}
else if (j > i)
{