List:Commits« Previous MessageNext Message »
From:marko.makela Date:April 13 2011 8:22am
Subject:bzr commit into mysql-trunk-innodb branch (marko.makela:3579) Bug#58815
Bug#11765812
View as plain text  
#At file:///home/marko/innobase/dev/mysql2a/5.6-innodb/ based on revid:marko.makela@strippedmc37ye1nt7d9

 3579 Marko Mäkelä	2011-04-13
      Suppress the Bug #58815 (Bug #11765812) assertion failure.
      
      buf_page_get_gen(): Introduce BUF_GET_POSSIBLY_FREED for suppressing the
      check that the file page must not have been freed.
      
      btr_estimate_n_rows_in_range_on_level(): Pass BUF_GET_POSSIBLY_FREED and
      explain in the comments why this is needed and why it should be mostly
      harmless to ignore the problem. If InnoDB had always initialized all
      unused fields in data files, no problem would exist.
      
      This change does not fix the bug, it just "shoots the messenger".
      
      rb:647 approved by Jimmy Yang

    modified:
      storage/innobase/btr/btr0cur.c
      storage/innobase/buf/buf0buf.c
      storage/innobase/include/buf0buf.h
=== modified file 'storage/innobase/btr/btr0cur.c'
--- a/storage/innobase/btr/btr0cur.c	revid:marko.makela@oracle.com-20110413075948-kvytmc37ye1nt7d9
+++ b/storage/innobase/btr/btr0cur.c	revid:marko.makela@stripped13082211-e6ouhjz5rmqxcqap
@@ -3264,9 +3264,14 @@ btr_estimate_n_rows_in_range_on_level(
 
 		mtr_start(&mtr);
 
-		/* fetch the page */
-		block = buf_page_get(space, zip_size, page_no, RW_S_LATCH,
-				     &mtr);
+		/* Fetch the page. Because we are not holding the
+		index->lock, the tree may have changed and we may be
+		attempting to read a page that is no longer part of
+		the B-tree. We pass BUF_GET_POSSIBLY_FREED in order to
+		silence a debug assertion about this. */
+		block = buf_page_get_gen(space, zip_size, page_no, RW_S_LATCH,
+					 NULL, BUF_GET_POSSIBLY_FREED,
+					 __FILE__, __LINE__, &mtr);
 
 		page = buf_block_get_frame(block);
 
@@ -3285,6 +3290,13 @@ btr_estimate_n_rows_in_range_on_level(
 			goto inexact;
 		}
 
+		/* It is possible but highly unlikely that the page was
+		originally written by an old version of InnoDB that did
+		not initialize FIL_PAGE_TYPE on other than B-tree pages.
+		For example, this could be an almost-empty BLOB page
+		that happens to contain the magic values in the fields
+		that we checked above. */
+
 		n_pages_read++;
 
 		if (page_no != slot1->page_no) {

=== modified file 'storage/innobase/buf/buf0buf.c'
--- a/storage/innobase/buf/buf0buf.c	revid:marko.makela@stripped075948-kvytmc37ye1nt7d9
+++ b/storage/innobase/buf/buf0buf.c	revid:marko.makela@strippedrmqxcqap
@@ -2902,6 +2902,7 @@ buf_page_get_gen(
 	case BUF_GET_IF_IN_POOL:
 	case BUF_PEEK_IF_IN_POOL:
 	case BUF_GET_IF_IN_POOL_OR_WATCH:
+	case BUF_GET_POSSIBLY_FREED:
 		break;
 	default:
 		ut_error;
@@ -3285,7 +3286,8 @@ wait_until_unfixed:
 
 	buf_block_buf_fix_inc(block, file, line);
 #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
-	ut_a(!block->page.file_page_was_freed);
+	ut_a(mode == BUF_GET_POSSIBLY_FREED
+	     || !block->page.file_page_was_freed);
 #endif
 	mutex_exit(&block->mutex);
 

=== modified file 'storage/innobase/include/buf0buf.h'
--- a/storage/innobase/include/buf0buf.h	revid:marko.makela@stripped
+++ b/storage/innobase/include/buf0buf.h	revid:marko.makela@oracle.com-20110413082211-e6ouhjz5rmqxcqap
@@ -54,6 +54,9 @@ Created 11/5/1995 Heikki Tuuri
 					/*!< Get the page only if it's in the
 					buffer pool, if not then set a watch
 					on the page. */
+#define BUF_GET_POSSIBLY_FREED		16
+					/*!< Like BUF_GET, but do not mind
+					if the file page has been freed. */
 /* @} */
 /** @name Modes for buf_page_get_known_nowait */
 /* @{ */

Attachment: [text/bzr-bundle] bzr/marko.makela@oracle.com-20110413082211-e6ouhjz5rmqxcqap.bundle
Thread
bzr commit into mysql-trunk-innodb branch (marko.makela:3579) Bug#58815Bug#11765812marko.makela13 Apr