List:Commits« Previous MessageNext Message »
From:marko.makela Date:June 20 2012 10:04am
Subject:bzr push into mysql-trunk-wl6255 branch (marko.makela:4002 to 4008) WL#6255
View as plain text  
 4008 Marko Mäkelä	2012-06-20
      WL#6255: Add a test case suggested by Jimmy Yang.

    modified:
      mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result
      mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test
 4007 Marko Mäkelä	2012-06-20
      WL#6255 review fix: Clarify a comment.

    modified:
      storage/innobase/row/row0merge.cc
 4006 Marko Mäkelä	2012-06-20
      Fix typos in comments.

    modified:
      storage/innobase/include/rem0rec.h
 4005 Marko Mäkelä	2012-06-20
      WL#6255 review fix.
      
      innobase_table_flags(): Rename a local variable.

    modified:
      storage/innobase/handler/ha_innodb.cc
 4004 Marko Mäkelä	2012-06-20
      WL#6255 review fixes.
      
      btr_cur_pessimistic_delete(): Remove UNIV_LIKELY.

    modified:
      storage/innobase/btr/btr0cur.cc
 4003 Marko Mäkelä	2012-06-20
      WL#6255 rb:1105 Problem 26 fix.
      
      trx_undo_prev_version_build(): Replace the assertion on table_id
      mismatch with a check. On table_id mismatch, assert that the table has
      been rebuilt by a transaction that started after the record version
      was written.
      
      This should be repeateable by a single connection thread, with enough
      purge lag:
      
      create table;
      lots_of_updates;
      alter table;
      begin;
      do_something;
      rollback; -- crashes
      
      Before WL#6255, we rebuilt the table using a DB_ROLL_PTR that looks
      like an insert. Those result in a DB_SUCCESS return from
      trx_undo_prev_version_build().
      
      WL#6255 is copying the DB_TRX_ID,DB_ROLL_PTR from the old table as is,
      so that it can detect which changes were already applied from the
      online rebuild log.
      
      The problem occurs when DB_ROLL_PTR is an update_undo record, and when
      the purge view has not yet advanced to the DB_TRX_ID that is stamped
      on the record. The undo log record is still valid, but it is pointing
      to the old table. Because the rebuild did not copy any history, and
      because the rolling-back transaction started after the rebuild, it is
      safe to pretend that the history was already purged. The purge will
      eventually happen. It will read the undo log records, figure out that
      the table_id has been dropped, and remove the undo log records without
      touching any tables.
      
      Approved by Jimmy Yang on IM.

    modified:
      storage/innobase/trx/trx0rec.cc
 4002 Marko Mäkelä	2012-06-19
      WL#6255: Adjust innodb-multiple-tablespaces.test.
      
      In WL#6255, we do not attempt to remove a tablespace file if it is
      known to be missing. Adjust the test accordingly.
      
      Patch provided by Kevin Lewis.

    modified:
      mysql-test/suite/innodb/r/innodb-multiple-tablespaces.result
      mysql-test/suite/innodb/t/innodb-multiple-tablespaces.test
=== 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@stripped
+++ b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result	revid:marko.makela@stripped
@@ -201,3 +201,29 @@ create table articles(`FTS_DOC_ID` seria
 create fulltext index `idx5` on articles(`col115`)  ;
 alter ignore table articles add primary key  (`col32`)  ;
 drop table articles;
+CREATE TABLE articles (
+id INT UNSIGNED NOT NULL,
+title VARCHAR(200),
+body TEXT
+) ENGINE=InnoDB;
+INSERT INTO articles VALUES
+(1, 'MySQL Tutorial','DBMS stands for DataBase ...')  ,
+(2, 'How To Use MySQL Well','After you went through a ...'),
+(3, 'Optimizing MySQL','In this tutorial we will show ...'),
+(4, '1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+(5, 'MySQL vs. YourSQL','In the following database comparison ...'),
+(6, 'MySQL Security','When configured properly, MySQL ...');
+CREATE FULLTEXT INDEX idx on articles (title, body);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+DROP INDEX idx ON articles;
+CREATE UNIQUE INDEX idx2 ON articles(id);
+CREATE FULLTEXT INDEX idx on articles (title, body);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+SELECT * FROM articles WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id	title	body
+1	MySQL Tutorial	DBMS stands for DataBase ...
+3	Optimizing MySQL	In this tutorial we will show ...
+DROP TABLE articles;

=== 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@strippedm-20120619193426-6ywbpsmz2ymv545b
+++ b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test	revid:marko.makela@oracle.com-20120620100221-79tsm8xrvfp79kmd
@@ -237,3 +237,36 @@ alter ignore table articles add primary
 
 drop table articles;
 
+# Create a table with FTS index, this will create hidden column FTS_DOC_ID
+CREATE TABLE articles (
+	id INT UNSIGNED NOT NULL,
+	title VARCHAR(200),
+	body TEXT
+	) ENGINE=InnoDB;
+
+INSERT INTO articles VALUES
+	(1, 'MySQL Tutorial','DBMS stands for DataBase ...')  ,
+	(2, 'How To Use MySQL Well','After you went through a ...'),
+	(3, 'Optimizing MySQL','In this tutorial we will show ...'),
+	(4, '1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+	(5, 'MySQL vs. YourSQL','In the following database comparison ...'),
+	(6, 'MySQL Security','When configured properly, MySQL ...');
+
+CREATE FULLTEXT INDEX idx on articles (title, body);
+
+# Drop the FTS index, however, this will keep the FTS_DOC_ID hidden
+# column (to avoid a table rebuild)
+DROP INDEX idx ON articles;
+
+# Now create cluster index on id online; The rebuild should still
+# have the FTS_DOC_ID
+CREATE UNIQUE INDEX idx2 ON articles(id);
+
+# Recreate FTS index, this should not require a rebuild,
+# since the FTS_DOC_ID is still there
+CREATE FULLTEXT INDEX idx on articles (title, body);
+
+SELECT * FROM articles WHERE MATCH (title, body)
+	AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+DROP TABLE articles;

=== modified file 'storage/innobase/btr/btr0cur.cc'
--- a/storage/innobase/btr/btr0cur.cc	revid:marko.makela@stripped
+++ b/storage/innobase/btr/btr0cur.cc	revid:marko.makela@oracle.com-20120620100221-79tsm8xrvfp79kmd
@@ -3167,7 +3167,7 @@ btr_cur_pessimistic_delete(
 		goto return_after_reservations;
 	}
 
-	if (UNIV_LIKELY(flags == 0)) {
+	if (flags == 0) {
 		lock_update_delete(block, rec);
 	}
 

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	revid:marko.makela@stripped
+++ b/storage/innobase/handler/ha_innodb.cc	revid:marko.makela@oracle.com-20120620100221-79tsm8xrvfp79kmd
@@ -9070,7 +9070,7 @@ innobase_table_flags(
 {
 	DBUG_ENTER("innobase_table_flags");
 
-	const char*	fts_index_bad = NULL;
+	const char*	fts_doc_id_index_bad = NULL;
 	bool		zip_allowed = true;
 	ulint		zip_ssize = 0;
 	enum row_type	row_format;
@@ -9099,7 +9099,7 @@ innobase_table_flags(
 				DBUG_RETURN(false);
 			}
 
-			if (fts_index_bad) {
+			if (fts_doc_id_index_bad) {
 				goto index_bad;
 			}
 		}
@@ -9113,13 +9113,13 @@ innobase_table_flags(
 		    || strcmp(key->name, FTS_DOC_ID_INDEX_NAME)
 		    || strcmp(key->key_part[0].field->field_name,
 			      FTS_DOC_ID_COL_NAME)) {
-			fts_index_bad = key->name;
+			fts_doc_id_index_bad = key->name;
 		}
 
-		if (fts_index_bad && (*flags2 & DICT_TF2_FTS)) {
+		if (fts_doc_id_index_bad && (*flags2 & DICT_TF2_FTS)) {
 index_bad:
 			my_error(ER_INNODB_FT_WRONG_DOCID_INDEX, MYF(0),
-				 fts_index_bad);
+				 fts_doc_id_index_bad);
 			DBUG_RETURN(false);
 		}
 	}

=== modified file 'storage/innobase/include/rem0rec.h'
--- a/storage/innobase/include/rem0rec.h	revid:marko.makela@stripped
+++ b/storage/innobase/include/rem0rec.h	revid:marko.makela@oracle.com-20120620100221-79tsm8xrvfp79kmd
@@ -66,9 +66,9 @@ The status is stored in the low-order bi
 /* Length of a B-tree node pointer, in bytes */
 #define REC_NODE_PTR_SIZE	4
 
-/** SQL null flag in a 1-byte offset of ROW_FORMAT=REDUNDANT record s*/
+/** SQL null flag in a 1-byte offset of ROW_FORMAT=REDUNDANT records */
 #define REC_1BYTE_SQL_NULL_MASK	0x80UL
-/** SQL null flag in a 2-byte offset of ROW_FORMAT=REDUNDANT record s*/
+/** SQL null flag in a 2-byte offset of ROW_FORMAT=REDUNDANT records */
 #define REC_2BYTE_SQL_NULL_MASK	0x8000UL
 
 /** In a 2-byte offset of ROW_FORMAT=REDUNDANT records, the second most

=== modified file 'storage/innobase/row/row0merge.cc'
--- a/storage/innobase/row/row0merge.cc	revid:marko.makela@oracle.com-20120619193426-6ywbpsmz2ymv545b
+++ b/storage/innobase/row/row0merge.cc	revid:marko.makela@stripped0120620100221-79tsm8xrvfp79kmd
@@ -3503,9 +3503,8 @@ wait_again:
 					}
 				}
 			} else {
-				// TODO: if this can report duplicates
-				// or other erroneous rows, pass
-				// col_map[] as well.
+				/* This cannot report duplicates; an
+				assertion would fail in that case. */
 				error = row_fts_merge_insert(
 					sort_idx, new_table,
 					psort_info, 0);

=== modified file 'storage/innobase/trx/trx0rec.cc'
--- a/storage/innobase/trx/trx0rec.cc	revid:marko.makela@strippedmz2ymv545b
+++ b/storage/innobase/trx/trx0rec.cc	revid:marko.makela@stripped
@@ -1557,7 +1557,14 @@ trx_undo_prev_version_build(
 
 	ptr = trx_undo_rec_get_pars(undo_rec, &type, &cmpl_info,
 				    &dummy_extern, &undo_no, &table_id);
-	ut_a(table_id == index->table->id);
+
+	if (table_id != index->table->id) {
+		/* The table should have been rebuilt, but purge has
+		not yet removed the undo log records for the
+		now-dropped old table (table_id). */
+		ut_a(!index->trx_id || index->trx_id > rec_trx_id);
+		return(DB_SUCCESS);
+	}
 
 	ptr = trx_undo_update_rec_get_sys_cols(ptr, &trx_id, &roll_ptr,
 					       &info_bits);

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