List:Commits« Previous MessageNext Message »
From:marko.makela Date:June 19 2012 1:57pm
Subject:bzr push into mysql-trunk-wl6255 branch (marko.makela:3996 to 3999) WL#6255
View as plain text  
 3999 Marko Mäkelä	2012-06-19
      WL#6255 memory leak fix.
      
      Free the indexed_table if a column is of incorrect name or type.

    modified:
      storage/innobase/handler/handler0alter.cc
 3998 Marko Mäkelä	2012-06-19
      WL#6255: Re-enable online secondary index creation.
      
      If a table contained fulltext indexes, we did not allow online operation.
      We should only deny online rebuild in the presence of fulltext indexes.
      In secondary B-tree index creation, the fulltext indexes are not affected.

    modified:
      mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result
      mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test
      storage/innobase/handler/handler0alter.cc
 3997 Marko Mäkelä	2012-06-19
      WL#6255 rb:1105 Problem 30.
      
      When rebuilding a table that has a generated clustered index (DB_ROW_ID),
      treat the DB_ROW_ID as a unique column when applying merged rows.
      
      row_ins_clust_index_entry_low(): Add the parameter n_uniq.

    modified:
      storage/innobase/include/row0ins.h
      storage/innobase/row/row0ins.cc
      storage/innobase/row/row0log.cc
 3996 Marko Mäkelä	2012-06-19
      WL#6255 rb:1105 Problem 32.
      
      row_log_table_apply_update(): Do not pass col_map[] and friends to
      row_build(), because the record is already in the rebuilt table.

    modified:
      storage/innobase/row/row0log.cc
=== modified file 'mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result'
--- a/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result	revid:marko.makela@strippedfk634qsac90
+++ b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result	revid:marko.makela@stripped-ficvu1gr0uelpvxd
@@ -167,6 +167,8 @@ ADD FULLTEXT INDEX idx5 (title);
 ERROR HY000: InnoDB presently supports one FULLTEXT index creation at a time
 CREATE FULLTEXT INDEX idx on articles (title);
 ALTER TABLE articles ADD FULLTEXT INDEX idx3 (title);
+ALTER TABLE articles ADD INDEX t20 (title(20)), LOCK=NONE;
+ALTER TABLE articles DROP INDEX t20;
 INSERT INTO articles (FTS_DOC_ID, title, body) VALUES
 (29, 'MySQL Tutorial','DBMS stands for DataBase ...'),
 (30, 'How To Use MySQL Well','After you went through a ...'),

=== modified file 'mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test'
--- a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test	revid:marko.makela@stripped20619105628-5l5epfk634qsac90
+++ b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test	revid:marko.makela@stripped-20120619135505-ficvu1gr0uelpvxd
@@ -202,6 +202,9 @@ ALTER TABLE articles ADD FULLTEXT INDEX
 CREATE FULLTEXT INDEX idx on articles (title);
 ALTER TABLE articles ADD FULLTEXT INDEX idx3 (title);
 
+ALTER TABLE articles ADD INDEX t20 (title(20)), LOCK=NONE;
+ALTER TABLE articles DROP INDEX t20;
+
 INSERT INTO articles (FTS_DOC_ID, title, body) VALUES
         (29, 'MySQL Tutorial','DBMS stands for DataBase ...'),
         (30, 'How To Use MySQL Well','After you went through a ...'),

=== modified file 'storage/innobase/handler/handler0alter.cc'
--- a/storage/innobase/handler/handler0alter.cc	revid:marko.makela@strippedm-20120619105628-5l5epfk634qsac90
+++ b/storage/innobase/handler/handler0alter.cc	revid:marko.makela@stripped120619135505-ficvu1gr0uelpvxd
@@ -2348,7 +2348,9 @@ prepare_inplace_alter_table_dict(
 	ulong			autoinc_inc	= 0;
 
 	const bool locked =
-		innobase_fulltext_exist(altered_table->s)
+		num_fts_index > 0
+		|| (innobase_need_rebuild(ha_alter_info)
+		    && innobase_fulltext_exist(altered_table->s))
 		|| (add_autoinc_col != ULINT_UNDEFINED)
 		|| ha_alter_info->alter_info->requested_lock
 		== Alter_info::ALTER_TABLE_LOCK_EXCLUSIVE
@@ -2512,6 +2514,7 @@ prepare_inplace_alter_table_dict(
 
 			if (!col_type) {
 col_fail:
+				dict_mem_table_free(indexed_table);
 				my_error(ER_WRONG_KEY_COLUMN, MYF(0),
 					 field->field_name);
 				goto new_clustered_failed;
@@ -2564,6 +2567,7 @@ col_fail:
 			}
 
 			if (dict_col_name_is_reserved(field->field_name)) {
+				dict_mem_table_free(indexed_table);
 				my_error(ER_WRONG_COLUMN_NAME, MYF(0),
 					 field->field_name);
 				goto new_clustered_failed;

=== modified file 'storage/innobase/include/row0ins.h'
--- a/storage/innobase/include/row0ins.h	revid:marko.makela@oracle.com-20120619105628-5l5epfk634qsac90
+++ b/storage/innobase/include/row0ins.h	revid:marko.makela@stripped0120619135505-ficvu1gr0uelpvxd
@@ -94,6 +94,7 @@ row_ins_clust_index_entry_low(
 				depending on whether we wish optimistic or
 				pessimistic descent down the index tree */
 	dict_index_t*	index,	/*!< in: clustered index */
+	ulint		n_uniq,	/*!< in: 0 or index->n_uniq */
 	dtuple_t*	entry,	/*!< in/out: index entry to insert */
 	ulint		n_ext,	/*!< in: number of externally stored columns */
 	que_thr_t*	thr)	/*!< in: query thread or NULL */

=== modified file 'storage/innobase/row/row0ins.cc'
--- a/storage/innobase/row/row0ins.cc	revid:marko.makela@stripped120619105628-5l5epfk634qsac90
+++ b/storage/innobase/row/row0ins.cc	revid:marko.makela@strippedicvu1gr0uelpvxd
@@ -2186,6 +2186,7 @@ row_ins_clust_index_entry_low(
 				depending on whether we wish optimistic or
 				pessimistic descent down the index tree */
 	dict_index_t*	index,	/*!< in: clustered index */
+	ulint		n_uniq,	/*!< in: 0 or index->n_uniq */
 	dtuple_t*	entry,	/*!< in/out: index entry to insert */
 	ulint		n_ext,	/*!< in: number of externally stored columns */
 	que_thr_t*	thr)	/*!< in: query thread */
@@ -2193,12 +2194,14 @@ row_ins_clust_index_entry_low(
 	btr_cur_t	cursor;
 	ulint*		offsets		= NULL;
 	dberr_t		err;
-	ulint		n_unique;
 	big_rec_t*	big_rec		= NULL;
 	mtr_t		mtr;
 	mem_heap_t*	offsets_heap	= NULL;
 
 	ut_ad(dict_index_is_clust(index));
+	ut_ad(!dict_index_is_unique(index)
+	      || n_uniq == dict_index_get_n_unique(index));
+	ut_ad(!n_uniq || n_uniq == dict_index_get_n_unique(index));
 
 	mtr_start(&mtr);
 
@@ -2228,10 +2231,8 @@ row_ins_clust_index_entry_low(
 	}
 #endif
 
-	n_unique = dict_index_get_n_unique(index);
-
-	if (dict_index_is_unique(index) && (cursor.up_match >= n_unique
-					    || cursor.low_match >= n_unique)) {
+	if (n_uniq && (cursor.up_match >= n_uniq
+		       || cursor.low_match >= n_uniq)) {
 
 		/* Note that the following may return also
 		DB_LOCK_WAIT */
@@ -2585,6 +2586,7 @@ row_ins_clust_index_entry(
 	ulint		n_ext)	/*!< in: number of externally stored columns */
 {
 	dberr_t	err;
+	ulint	n_uniq;
 
 	if (UT_LIST_GET_FIRST(index->table->foreign_list)) {
 		err = row_ins_check_foreign_constraints(
@@ -2595,12 +2597,14 @@ row_ins_clust_index_entry(
 		}
 	}
 
+	n_uniq = dict_index_is_unique(index) ? index->n_uniq : 0;
+
 	/* Try first optimistic descent to the B-tree */
 
 	log_free_check();
 
-	err = row_ins_clust_index_entry_low(0, BTR_MODIFY_LEAF, index, entry,
-					    n_ext, thr);
+	err = row_ins_clust_index_entry_low(
+		0, BTR_MODIFY_LEAF, index, n_uniq, entry, n_ext, thr);
 	if (err != DB_FAIL) {
 
 		return(err);
@@ -2610,8 +2614,8 @@ row_ins_clust_index_entry(
 
 	log_free_check();
 
-	return(row_ins_clust_index_entry_low(0, BTR_MODIFY_TREE, index, entry,
-					     n_ext, thr));
+	return(row_ins_clust_index_entry_low(
+		       0, BTR_MODIFY_TREE, index, n_uniq, entry, n_ext, thr));
 }
 
 /***************************************************************//**

=== modified file 'storage/innobase/row/row0log.cc'
--- a/storage/innobase/row/row0log.cc	revid:marko.makela@stripped20120619105628-5l5epfk634qsac90
+++ b/storage/innobase/row/row0log.cc	revid:marko.makela@stripped-ficvu1gr0uelpvxd
@@ -1186,7 +1186,7 @@ row_log_table_apply_insert_low(
 	entry = row_build_index_entry(row, NULL, index, heap);
 
 	error = row_ins_clust_index_entry_low(
-		flags, BTR_MODIFY_TREE, index, entry, 0, thr);
+		flags, BTR_MODIFY_TREE, index, index->n_uniq, entry, 0, thr);
 
 	switch (error) {
 	case DB_SUCCESS:

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-wl6255 branch (marko.makela:3996 to 3999) WL#6255marko.makela19 Jun