3907 Marko Mäkelä 2012-04-23
WL#5545/WL#5526 code coverage fixes.
row_merge_dict_table_get_index(): Remove. There never can be duplicate
index names. Use plain dict_table_get_index_on_name() instead.
When doing ADD INDEX and DROP INDEX in a single statement, the new index
will carry the TEMP_INDEX_PREFIX and the old one (to be dropped)
will lack it.
Approved by Jimmy Yang.
modified:
mysql-test/suite/innodb/r/innodb-index.result
mysql-test/suite/innodb/t/innodb-index.test
storage/innobase/row/row0merge.cc
3906 Marko Mäkelä 2012-04-23
Fix a bug introduced in
revision-id marko.makela@stripped
modified:
storage/innobase/handler/handler0alter.cc
3905 Marko Mäkelä 2012-04-23
WL#5545 test coverage improvements.
Test if incompletely created indexes will be dropped when there is
a table name#2 clash when creating a clustered index.
ha_innobase::commit_inplace_alter_table(): Fix broken error handling.
Do not decrement MONITOR_PENDING_ALTER_TABLE if an error is being
returned for commit=true. In this case, the method will be re-invoked
with commit=false. This bug was introduced in WL#5526.
modified:
mysql-test/suite/innodb/r/innodb-index-online.result
mysql-test/suite/innodb/t/innodb-index-online.test
storage/innobase/handler/handler0alter.cc
=== modified file 'mysql-test/suite/innodb/r/innodb-index.result'
--- a/mysql-test/suite/innodb/r/innodb-index.result revid:marko.makela@strippedk0o1ssnaq
+++ b/mysql-test/suite/innodb/r/innodb-index.result revid:marko.makela@strippedrznly3g72
@@ -962,4 +962,14 @@ a b
1 e
3 a
3 b
+alter table t2 add index t2a(b);
+ERROR 42000: Duplicate key name 't2a'
+alter table t2 drop index t2a, add index t2a(b);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(1) DEFAULT NULL,
+ KEY `t2a` (`b`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1,t2;
=== modified file 'mysql-test/suite/innodb/t/innodb-index.test'
--- a/mysql-test/suite/innodb/t/innodb-index.test revid:marko.makela@oracle.com-20120423120920-iq0y336k0o1ssnaq
+++ b/mysql-test/suite/innodb/t/innodb-index.test revid:marko.makela@oracle.com-20120423122705-sok8waprznly3g72
@@ -370,4 +370,9 @@ connection default;
disconnect a;
disconnect b;
+--error ER_DUP_KEYNAME
+alter table t2 add index t2a(b);
+alter table t2 drop index t2a, add index t2a(b);
+show create table t2;
+
DROP TABLE t1,t2;
=== modified file 'storage/innobase/handler/handler0alter.cc'
--- a/storage/innobase/handler/handler0alter.cc revid:marko.makela@oracle.com-20120423120920-iq0y336k0o1ssnaq
+++ b/storage/innobase/handler/handler0alter.cc revid:marko.makela@stripped20120423122705-sok8waprznly3g72
@@ -3052,7 +3052,7 @@ processed_field:
row_mysql_unlock_data_dictionary(trx);
trx_free_for_mysql(trx);
- if (trx == ctx->trx) {
+ if (ctx && trx == ctx->trx) {
ctx->trx = NULL;
}
=== modified file 'storage/innobase/row/row0merge.cc'
--- a/storage/innobase/row/row0merge.cc revid:marko.makela@oracle.com-20120423120920-iq0y336k0o1ssnaq
+++ b/storage/innobase/row/row0merge.cc revid:marko.makela@stripped423122705-sok8waprznly3g72
@@ -794,53 +794,6 @@ row_merge_heap_create(
return(heap);
}
-/**********************************************************************//**
-Search an index object by name and column names. If several indexes match,
-return the index with the max id.
-@return matching index, NULL if not found */
-static __attribute__((nonnull, warn_unused_result))
-dict_index_t*
-row_merge_dict_table_get_index(
-/*===========================*/
- dict_table_t* table, /*!< in: table */
- const merge_index_def_t*index_def) /*!< in: index definition */
-{
- dict_index_t* found = NULL;
-
- found = NULL;
- for (dict_index_t* index = dict_table_get_first_index(table);
- index != NULL;
- index = dict_table_get_next_index(index)) {
-
- if (ut_strcmp(index->name, index_def->name) == 0
- && dict_index_get_n_ordering_defined_by_user(index)
- == index_def->n_fields) {
-
- for (ulint i = 0; i < index_def->n_fields; i++) {
- const dict_field_t* field
- = dict_index_get_nth_field(index, i);
-
- if (dict_col_get_no(field->col) !=
- index_def->fields[i].col_no) {
- goto next_index;
- }
- }
-
- /* We found a matching index, select
- the index with the higher id*/
-
- if (!found || index->id > found->id) {
-
- found = index;
- }
- }
-next_index:
- continue;
- }
-
- return(found);
-}
-
/********************************************************************//**
Read a merge block from the file system.
@return TRUE if request was successful, FALSE if fail */
@@ -3122,8 +3075,7 @@ row_merge_create_index(
if (err == DB_SUCCESS) {
- index = row_merge_dict_table_get_index(
- table, index_def);
+ index = dict_table_get_index_on_name(table, index_def->name);
ut_a(index);
No bundle (reason: useless for push emails).| Thread |
|---|
| • bzr push into mysql-trunk-wl5545 branch (marko.makela:3905 to 3907) WL#5526WL#5545 | marko.makela | 23 Apr |