List:Commits« Previous MessageNext Message »
From:marko.makela Date:April 28 2011 7:34am
Subject:bzr commit into mysql-trunk-innodb branch (marko.makela:3611)
View as plain text  
#At file:///home/marko/innobase/dev/mysql2a/5.6-innodb/ based on revid:marko.makela@stripped64atxe7x7wq8

 3611 Marko Mäkelä	2011-04-28
      Remove some debug code that was added in MySQL 3.23.44.
      
      Until MySQL 3.23.44, there was an incorrect optimization in the
      transaction commit. The update_undo log would be discarded at commit
      if it comprised only one page, it did not delete-mark anything, and
      there was only one read view in trx_sys->view_list. (It looks like
      that the read view could have belonged to a different transaction, if
      the committing transaction used consistent reads.) Ever since then,
      update_undo logs can only be discarded by the purge.
      
      trx_purge_sys_print(): Remove.
      
      trx_undo_prev_version_build(): On corruption, never print out anything
      and return DB_ERROR, but let an assertion fail instead. These
      printouts have apparently never been triggered in the 10 years of
      their existence. The only references to them were found in corrupted
      databases or when attempting to rescue a corrupted database. In such
      situations, the assertion failures can be avoided by setting
      innodb_force_recovery=5.
      
      rb:652 approved by Sunny Bains

    modified:
      storage/innobase/include/trx0purge.h
      storage/innobase/include/trx0rec.h
      storage/innobase/trx/trx0purge.c
      storage/innobase/trx/trx0rec.c
=== modified file 'storage/innobase/include/trx0purge.h'
--- a/storage/innobase/include/trx0purge.h	revid:marko.makela@stripped0110428072940-458g64atxe7x7wq8
+++ b/storage/innobase/include/trx0purge.h	revid:marko.makela@stripped3349-hjvdnwldg97dl34a
@@ -100,13 +100,6 @@ trx_purge(
 					submit to task queue. */
 	ulint	limit);			/*!< in: the maximum number of
 					records to purge in one batch */
-/******************************************************************//**
-Prints information of the purge system to stderr. */
-UNIV_INTERN
-void
-trx_purge_sys_print(void);
-/*======================*/
-
 /** This is the purge pointer/iterator. We need both the undo no and the
 transaction no up to which purge has parsed and applied the records. */
 typedef struct purge_iter_struct {

=== modified file 'storage/innobase/include/trx0rec.h'
--- a/storage/innobase/include/trx0rec.h	revid:marko.makela@strippedom-20110428072940-458g64atxe7x7wq8
+++ b/storage/innobase/include/trx0rec.h	revid:marko.makela@stripped073349-hjvdnwldg97dl34a
@@ -245,8 +245,7 @@ that the caller has a latch on the index
 and an s-latch on the purge_view. This guarantees that the stack of versions
 is locked.
 @return DB_SUCCESS, or DB_MISSING_HISTORY if the previous version is
-earlier than purge_view, which means that it may have been removed,
-DB_ERROR if corrupted record */
+earlier than purge_view, which means that it may have been removed */
 UNIV_INTERN
 ulint
 trx_undo_prev_version_build(

=== modified file 'storage/innobase/trx/trx0purge.c'
--- a/storage/innobase/trx/trx0purge.c	revid:marko.makela@stripped
+++ b/storage/innobase/trx/trx0purge.c	revid:marko.makela@oracle.com-20110428073349-hjvdnwldg97dl34a
@@ -1309,28 +1309,3 @@ run_synchronously:
 
 	return(n_pages_handled);
 }
-
-/******************************************************************//**
-Prints information of the purge system to stderr. */
-UNIV_INTERN
-void
-trx_purge_sys_print(void)
-/*=====================*/
-{
-	fprintf(stderr, "InnoDB: Purge system view:\n");
-	read_view_print(purge_sys->view);
-
-	fprintf(stderr, "InnoDB: Purge trx n:o " TRX_ID_FMT
-		", undo n:o " TRX_ID_FMT "\n",
-		(ullint) purge_sys->limit.trx_no,
-		(ullint) purge_sys->limit.undo_no);
-	fprintf(stderr,
-		"InnoDB: Purge next stored %lu, page_no %lu, offset %lu,\n"
-		"InnoDB: Purge hdr_page_no %lu, hdr_offset %lu\n",
-		(ulong) purge_sys->next_stored,
-		(ulong) purge_sys->page_no,
-		(ulong) purge_sys->offset,
-		(ulong) purge_sys->hdr_page_no,
-		(ulong) purge_sys->hdr_offset);
-}
-

=== modified file 'storage/innobase/trx/trx0rec.c'
--- a/storage/innobase/trx/trx0rec.c	revid:marko.makela@strippedq8
+++ b/storage/innobase/trx/trx0rec.c	revid:marko.makela@stripped
@@ -1406,8 +1406,7 @@ that the caller has a latch on the index
 and an s-latch on the purge_view. This guarantees that the stack of versions
 is locked all the way down to the purge_view.
 @return DB_SUCCESS, or DB_MISSING_HISTORY if the previous version is
-earlier than purge_view, which means that it may have been removed,
-DB_ERROR if corrupted record */
+earlier than purge_view, which means that it may have been removed */
 UNIV_INTERN
 ulint
 trx_undo_prev_version_build(
@@ -1451,20 +1450,7 @@ trx_undo_prev_version_build(
 	      || mtr_memo_contains_page(index_mtr, index_rec,
 					MTR_MEMO_PAGE_X_FIX));
 	ut_ad(rec_offs_validate(rec, index, offsets));
-
-	if (!dict_index_is_clust(index)) {
-		fprintf(stderr, "InnoDB: Error: trying to access"
-			" update undo rec for non-clustered index %s\n"
-			"InnoDB: Submit a detailed bug report to"
-			" http://bugs.mysql.com\n"
-			"InnoDB: index record ", index->name);
-		rec_print(stderr, index_rec, index);
-		fputs("\n"
-		      "InnoDB: record version ", stderr);
-		rec_print_new(stderr, rec, offsets);
-		putc('\n', stderr);
-		return(DB_ERROR);
-	}
+	ut_a(dict_index_is_clust(index));
 
 	roll_ptr = row_get_rec_roll_ptr(rec, index, offsets);
 	old_roll_ptr = roll_ptr;
@@ -1484,7 +1470,9 @@ trx_undo_prev_version_build(
 
 	if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
 		/* The undo record may already have been purged.
-		This should never happen in InnoDB. */
+		This should never happen for user transactions, but
+		it can happen in purge. */
+		ut_ad(err == DB_MISSING_HISTORY);
 
 		return(err);
 	}
@@ -1522,54 +1510,8 @@ trx_undo_prev_version_build(
 	ptr = trx_undo_update_rec_get_update(ptr, index, type, trx_id,
 					     roll_ptr, info_bits,
 					     NULL, heap, &update);
-
-	if (UNIV_UNLIKELY(table_id != index->table->id)) {
-		ptr = NULL;
-
-		fprintf(stderr,
-			"InnoDB: Error: trying to access update undo rec"
-			" for table %s\n"
-			"InnoDB: but the table id in the"
-			" undo record is wrong\n"
-			"InnoDB: Submit a detailed bug report"
-			" to http://bugs.mysql.com\n"
-			"InnoDB: Run also CHECK TABLE %s\n",
-			index->table_name, index->table_name);
-	}
-
-	if (ptr == NULL) {
-		/* The record was corrupted, return an error; these printfs
-		should catch an elusive bug in row_vers_old_has_index_entry */
-
-		fprintf(stderr,
-			"InnoDB: table %s, index %s, n_uniq %lu\n"
-			"InnoDB: undo rec address %p, type %lu cmpl_info %lu\n"
-			"InnoDB: undo rec table id %llu,"
-			" index table id %llu\n"
-			"InnoDB: dump of 150 bytes in undo rec: ",
-			index->table_name, index->name,
-			(ulong) dict_index_get_n_unique(index),
-			undo_rec, (ulong) type, (ulong) cmpl_info,
-			(ullint) table_id,
-			(ullint) index->table->id);
-		ut_print_buf(stderr, undo_rec, 150);
-		fputs("\n"
-		      "InnoDB: index record ", stderr);
-		rec_print(stderr, index_rec, index);
-		fputs("\n"
-		      "InnoDB: record version ", stderr);
-		rec_print_new(stderr, rec, offsets);
-		fprintf(stderr, "\n"
-			"InnoDB: Record trx id " TRX_ID_FMT
-			", update rec trx id " TRX_ID_FMT "\n"
-			"InnoDB: Roll ptr in rec " TRX_ID_FMT
-			", in update rec" TRX_ID_FMT "\n",
-			(ullint) rec_trx_id, (ullint) trx_id,
-			(ullint) old_roll_ptr, (ullint) roll_ptr);
-
-		trx_purge_sys_print();
-		return(DB_ERROR);
-	}
+	ut_a(table_id == index->table->id);
+	ut_a(ptr);
 
 	if (row_upd_changes_field_size_or_external(index, offsets, update)) {
 		ulint	n_ext;

Attachment: [text/bzr-bundle] bzr/marko.makela@oracle.com-20110428073349-hjvdnwldg97dl34a.bundle
Thread
bzr commit into mysql-trunk-innodb branch (marko.makela:3611) marko.makela28 Apr