List:Commits« Previous MessageNext Message »
From:marko.makela Date:April 23 2012 12:10pm
Subject:bzr push into mysql-trunk-wl5545 branch (marko.makela:3903 to 3905) WL#5545
View as plain text  
 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
 3904 Marko Mäkelä	2012-04-23
      WL#5526/WL#5545 test coverage: Show that a failure
      to create a clustered index will do the lazy drop index.

    modified:
      mysql-test/suite/innodb/r/innodb-index-online.result
      mysql-test/suite/innodb/t/innodb-index-online.test
 3903 Marko Mäkelä	2012-04-23
      WL#5545: Clean up innodb-index-online.test
      according to suggestions from Matthias Leich.

    modified:
      mysql-test/suite/innodb/r/innodb-index-online.result
      mysql-test/suite/innodb/t/innodb-index-online.test
=== modified file 'mysql-test/suite/innodb/r/innodb-index-online.result'
--- a/mysql-test/suite/innodb/r/innodb-index-online.result	revid:marko.makela@stripped
+++ b/mysql-test/suite/innodb/r/innodb-index-online.result	revid:marko.makela@strippedo1ssnaq
@@ -310,13 +310,18 @@ ddl_background_drop_indexes	1
 ddl_background_drop_tables	0
 ddl_online_create_index	0
 ddl_pending_alter_table	0
-ALTER TABLE t1 COMMENT 'testing if c3p5 will be dropped';
+CREATE TABLE `t1#2`(a INT PRIMARY KEY) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX ft ON t1 (c3);
+ERROR 42S01: Table 'test.t1#2' already exists
 SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem='ddl';
 name	count
 ddl_background_drop_indexes	0
 ddl_background_drop_tables	0
 ddl_online_create_index	0
 ddl_pending_alter_table	0
+DROP TABLE `t1#2`;
+call mtr.add_suppression("InnoDB: Error creating.*t1@00231.ibd");
+call mtr.add_suppression("InnoDB: Error number 17 means 'File exists'");
 SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2g_created WAIT_FOR dml4_done';
 SET lock_wait_timeout = 1;
 ALTER TABLE t1 DROP INDEX c2f, ADD INDEX c2g(c22f);
@@ -334,7 +339,7 @@ t1	CREATE TABLE `t1` (
   PRIMARY KEY (`c1`),
   KEY `c2d` (`c22f`),
   KEY `c2f` (`c22f`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='testing if c3p5 will be dropped'
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='testing if c2e will be dropped'
 ALTER TABLE t1 DROP INDEX c2d, DROP INDEX c2f;
 ERROR 42S02: Table 'test.t1' doesn't exist
 ALTER TABLE t1 ADD INDEX c2h(c22f), ALGORITHM = INPLACE;

=== modified file 'mysql-test/suite/innodb/t/innodb-index-online.test'
--- a/mysql-test/suite/innodb/t/innodb-index-online.test	revid:marko.makela@strippedebpy1ce3
+++ b/mysql-test/suite/innodb/t/innodb-index-online.test	revid:marko.makela@strippedy336k0o1ssnaq
@@ -327,9 +327,17 @@ reap;
 # Index c3p5 should still exist in the data dictionary cache.
 eval $innodb_metrics_select;
 
-ALTER TABLE t1 COMMENT 'testing if c3p5 will be dropped';
+CREATE TABLE `t1#2`(a INT PRIMARY KEY) ENGINE = InnoDB;
+--error ER_TABLE_EXISTS_ERROR
+CREATE FULLTEXT INDEX ft ON t1 (c3);
+# The failed CREATE FULLTEXT INDEX should have cleaned up c3p5 from the cache.
 eval $innodb_metrics_select;
 
+DROP TABLE `t1#2`;
+
+call mtr.add_suppression("InnoDB: Error creating.*t1@00231.ibd");
+call mtr.add_suppression("InnoDB: Error number 17 means 'File exists'");
+
 SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2g_created WAIT_FOR dml4_done';
 # The lock upgrade at the end of the ALTER will conflict with the DISCARD.
 SET lock_wait_timeout = 1;

=== modified file 'storage/innobase/handler/handler0alter.cc'
--- a/storage/innobase/handler/handler0alter.cc	revid:marko.makela@oracle.com-20120423104835-9138g3x7ebpy1ce3
+++ b/storage/innobase/handler/handler0alter.cc	revid:marko.makela@oracle.com-20120423120920-iq0y336k0o1ssnaq
@@ -2841,7 +2841,7 @@ ha_innobase::commit_inplace_alter_table(
 			break;
 		case DB_TABLESPACE_ALREADY_EXISTS:
 		case DB_DUPLICATE_KEY:
-			ut_a(ctx->indexed_table->n_ref_count == 0);
+			ut_a(ctx->indexed_table->n_ref_count == 1);
 			innobase_convert_tablename(tmp_name);
 			my_error(ER_TABLE_EXISTS_ERROR, MYF(0), tmp_name);
 			err = HA_ERR_TABLE_EXIST;
@@ -2854,6 +2854,7 @@ ha_innobase::commit_inplace_alter_table(
 		drop_new_clustered:
 			dict_table_close(ctx->indexed_table, TRUE, FALSE);
 			row_merge_drop_table(trx, ctx->indexed_table);
+			ctx->indexed_table = NULL;
 		}
 	} else if (ctx) {
 		dberr_t	error;
@@ -3051,6 +3052,10 @@ processed_field:
 	row_mysql_unlock_data_dictionary(trx);
 	trx_free_for_mysql(trx);
 
+	if (trx == ctx->trx) {
+		ctx->trx = NULL;
+	}
+
 	if (err == 0) {
 		/* Delete corresponding rows from the stats table. We update
 		the statistics in a separate transaction from trx, because
@@ -3117,6 +3122,8 @@ func_exit:
 	}
 
 ret:
-	MONITOR_ATOMIC_DEC(MONITOR_PENDING_ALTER_TABLE);
+	if (err == 0) {
+		MONITOR_ATOMIC_DEC(MONITOR_PENDING_ALTER_TABLE);
+	}
 	DBUG_RETURN(err != 0);
 }

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-wl5545 branch (marko.makela:3903 to 3905) WL#5545marko.makela23 Apr