List:Commits« Previous MessageNext Message »
From:marko.makela Date:June 30 2010 9:41am
Subject:bzr push into mysql-5.1-innodb branch (marko.makela:3532 to 3534) Bug#54358
View as plain text  
 3534 Marko Mäkelä	2010-06-30
      Bug#54358 follow-up: Correct some error handling.

    modified:
      storage/innodb_plugin/row/row0sel.c
 3533 Marko Mäkelä	2010-06-30
      Correct some comments that were added in the fix of Bug #54358
      (READ UNCOMMITTED access failure of off-page DYNAMIC or COMPRESSED columns).
      
      Records that lack incompletely written externally stored columns may
      be accessed by READ UNCOMMITTED transaction even without involving a
      crash during an INSERT or UPDATE operation. I verified this as follows.
      
      (1) added a delay after the mini-transaction for writing the clustered
      index 'stub' record was committed (patch attached)
      (2) started mysqld in gdb, setting breakpoints to the where the
      assertions about READ UNCOMMITTED were added in the bug fix
      (3) invoked ibtest3 --create-options=key_block_size=2
      to create BLOBs in a COMPRESSED table
      (4) invoked the following:
      yes 'set transaction isolation level read uncommitted;
      checksum table blobt3;select sleep(1);'|mysql -uroot test
      (5) noted that one of the breakpoints was triggered
      (return(NULL) in btr_rec_copy_externally_stored_field())
      
      === modified file 'storage/innodb_plugin/row/row0ins.c'
      --- storage/innodb_plugin/row/row0ins.c	2010-06-30 08:17:25 +0000
      +++ storage/innodb_plugin/row/row0ins.c	2010-06-30 08:17:25 +0000
      @@ -2120,6 +2120,7 @@ function_exit:
       		rec_t*	rec;
       		ulint*	offsets;
       		mtr_start(&mtr);
      +		os_thread_sleep(5000000);
       
       		btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
       					    BTR_MODIFY_TREE, &cursor, 0,
      
      === modified file 'storage/innodb_plugin/row/row0upd.c'
      --- storage/innodb_plugin/row/row0upd.c	2010-06-30 08:11:55 +0000
      +++ storage/innodb_plugin/row/row0upd.c	2010-06-30 08:11:55 +0000
      @@ -1763,6 +1763,7 @@ row_upd_clust_rec(
       		rec_offs_init(offsets_);
       
       		mtr_start(mtr);
      +		os_thread_sleep(5000000);
       
       		ut_a(btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr));
       		rec = btr_cur_get_rec(btr_cur);

    modified:
      storage/innodb_plugin/btr/btr0cur.c
      storage/innodb_plugin/row/row0sel.c
 3532 Marko Mäkelä	2010-06-29
      ChangeLog entry for Bug #54408

    modified:
      storage/innodb_plugin/ChangeLog
=== modified file 'storage/innodb_plugin/btr/btr0cur.c'
--- a/storage/innodb_plugin/btr/btr0cur.c	revid:marko.makela@strippedw27
+++ b/storage/innodb_plugin/btr/btr0cur.c	revid:marko.makela@stripped
@@ -4849,20 +4849,10 @@ btr_rec_copy_externally_stored_field(
 	if (UNIV_UNLIKELY
 	    (!memcmp(data + local_len - BTR_EXTERN_FIELD_REF_SIZE,
 		     field_ref_zero, BTR_EXTERN_FIELD_REF_SIZE))) {
-		/* The externally stored field was not written
-		yet. This is only a valid condition when the server
-		crashed after the time a record stub was freshly
-		inserted but before all its columns were written. This
-		record should only be seen by
+		/* The externally stored field was not written yet.
+		This record should only be seen by
 		recv_recovery_rollback_active() or any
 		TRX_ISO_READ_UNCOMMITTED transactions. */
-
-		/* TODO: assert that there is an owner_trx with
-		owner_trx->id == DB_TRX_ID and owner_trx->is_recovered */
-
-		/* TODO: assert that for the current transaction trx,
-		either (trx == owner_trx && trx_is_recv(trx)) or
-		trx->isolation_level == TRX_ISO_READ_UNCOMMITTED. */
 		return(NULL);
 	}
 

=== modified file 'storage/innodb_plugin/row/row0sel.c'
--- a/storage/innodb_plugin/row/row0sel.c	revid:marko.makela@stripped7
+++ b/storage/innodb_plugin/row/row0sel.c	revid:marko.makela@stripped
@@ -427,11 +427,7 @@ row_sel_fetch_columns(
 
 				/* data == NULL means that the
 				externally stored field was not
-				written yet. This is only a valid
-				condition when the server crashed
-				after the time a record stub was
-				freshly inserted but before all its
-				columns were written. This record
+				written yet. This record
 				should only be seen by
 				recv_recovery_rollback_active() or any
 				TRX_ISO_READ_UNCOMMITTED
@@ -2744,12 +2740,7 @@ row_sel_store_mysql_rec(
 
 			if (UNIV_UNLIKELY(!data)) {
 				/* The externally stored field
-				was not written yet. This is
-				only a valid condition when
-				the server crashed after the
-				time a record stub was freshly
-				inserted but before all its
-				columns were written. This
+				was not written yet. This
 				record should only be seen by
 				recv_recovery_rollback_active()
 				or any TRX_ISO_READ_UNCOMMITTED
@@ -3623,8 +3614,7 @@ row_search_for_mysql(
 
 				if (!row_sel_store_mysql_rec(buf, prebuilt,
 							     rec, offsets)) {
-					/* Only fresh inserts at
-					server crash time may contain
+					/* Only fresh inserts may contain
 					incomplete externally stored
 					columns. Pretend that such
 					records do not exist. Such
@@ -3636,16 +3626,9 @@ row_search_for_mysql(
 					at a lower level, not here. */
 					ut_a(trx->isolation_level
 					     == TRX_ISO_READ_UNCOMMITTED);
-					/* TODO: assert that there is
-					an owner_trx with
-					owner_trx->id == DB_TRX_ID and
-					owner_trx->is_recovered */
-
-					err = DB_TOO_BIG_RECORD;
-
-					/* We let the main loop to do the
-					error handling */
-					goto shortcut_fails_too_big_rec;
+
+					/* Proceed as in case SEL_RETRY. */
+					break;
 				}
 
 				mtr_commit(&mtr);
@@ -3685,7 +3668,7 @@ release_search_latch_if_needed:
 			default:
 				ut_ad(0);
 			}
-shortcut_fails_too_big_rec:
+
 			mtr_commit(&mtr);
 			mtr_start(&mtr);
 		}
@@ -4422,16 +4405,14 @@ requires_clust_rec:
 
 		if (!row_sel_push_cache_row_for_mysql(prebuilt, result_rec,
 						      offsets)) {
-			/* Only fresh inserts at server crash time may contain
-			incomplete externally stored columns. Pretend that
-			such records do not exist. Such records may only be
-			accessed at the READ UNCOMMITTED isolation level or
-			when rolling back a recovered transaction. Rollback
-			happens at a lower level, not here. */
+			/* Only fresh inserts may contain incomplete
+			externally stored columns. Pretend that such
+			records do not exist. Such records may only be
+			accessed at the READ UNCOMMITTED isolation
+			level or when rolling back a recovered
+			transaction. Rollback happens at a lower
+			level, not here. */
 			ut_a(trx->isolation_level == TRX_ISO_READ_UNCOMMITTED);
-			/* TODO: assert that there is an owner_trx
-			with owner_trx->id == DB_TRX_ID and
-			owner_trx->is_recovered */
 		} else if (prebuilt->n_fetch_cached
 			   == MYSQL_FETCH_CACHE_SIZE) {
 
@@ -4449,19 +4430,16 @@ requires_clust_rec:
 		} else {
 			if (!row_sel_store_mysql_rec(buf, prebuilt,
 						     result_rec, offsets)) {
-				/* Only fresh inserts at server crash
-				time may contain incomplete externally
-				stored columns. Pretend that such
-				records do not exist. Such records may
-				only be accessed at the READ UNCOMMITTED
+				/* Only fresh inserts may contain
+				incomplete externally stored
+				columns. Pretend that such records do
+				not exist. Such records may only be
+				accessed at the READ UNCOMMITTED
 				isolation level or when rolling back a
-				recovered transaction. Rollback happens
-				at a lower level, not here. */
+				recovered transaction. Rollback
+				happens at a lower level, not here. */
 				ut_a(trx->isolation_level
 				     == TRX_ISO_READ_UNCOMMITTED);
-				/* TODO: assert that there is an owner_trx
-				with owner_trx->id == DB_TRX_ID and
-				owner_trx->is_recovered */
 				goto next_rec;
 			}
 		}

Attachment: [text/bzr-bundle] bzr/marko.makela@oracle.com-20100630093847-7gkr1lh3bh2xksy0.bundle
Thread
bzr push into mysql-5.1-innodb branch (marko.makela:3532 to 3534) Bug#54358marko.makela30 Jun