diff options
author | Michael Widenius <monty@askmonty.org> | 2011-11-23 19:32:14 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-11-23 19:32:14 +0200 |
commit | 7b368e3810feda53fc0dbdf5bfe8863f82f0bbcc (patch) | |
tree | bab573449ec11585c1b5149c7cbf477178caa469 /sql/ha_partition.cc | |
parent | c8768a091ac2d876216582813aaab7d9663008f7 (diff) | |
parent | f28e7bd0645d478d33d7ae3b974931c7991cd0bd (diff) | |
download | mariadb-git-7b368e3810feda53fc0dbdf5bfe8863f82f0bbcc.tar.gz |
Merge with MySQL 5.1.60
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r-- | sql/ha_partition.cc | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 10892ca6e0c..e70eacfab5d 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -6562,7 +6562,25 @@ int ha_partition::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys) */ for (file= m_file; *file; file++) if ((ret= (*file)->add_index(table_arg, key_info, num_of_keys))) - break; + goto err; + return ret; +err: + if (file > m_file) + {
+ uint *key_numbers= (uint*) ha_thd()->alloc(sizeof(uint) * num_of_keys);
+ KEY *old_key_info= table_arg->key_info;
+ uint i;
+ /* Use the newly added key_info as table->key_info to remove them. */
+ for (i= 0; i < num_of_keys; i++)
+ key_numbers[i]= i;
+ table_arg->key_info= key_info;
+ while (--file >= m_file)
+ {
+ (void) (*file)->prepare_drop_index(table_arg, key_numbers, num_of_keys);
+ (void) (*file)->final_drop_index(table_arg);
+ }
+ table_arg->key_info= old_key_info;
+ } return ret; } |