diff options
author | Mattias Jonsson <mattias.jonsson@oracle.com> | 2012-02-29 21:18:50 +0100 |
---|---|---|
committer | Mattias Jonsson <mattias.jonsson@oracle.com> | 2012-02-29 21:18:50 +0100 |
commit | cef28c88a35c68e372ee688db52bed7bfb821dca (patch) | |
tree | 848ce9ff51a4e0bab7b3e06e4111bfae0672a8df /sql/ha_partition.cc | |
parent | 9b2a3e6352987e071783a6814edaa8ad33783f27 (diff) | |
parent | bd5f062f92ab5a606bda789bd3387dadcfb9cf6e (diff) | |
download | mariadb-git-cef28c88a35c68e372ee688db52bed7bfb821dca.tar.gz |
merge from mysql-5.1
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r-- | sql/ha_partition.cc | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index fdaa1b0cda6..240138e7a6b 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -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) { |