List:Commits« Previous MessageNext Message »
From:marko.makela Date:August 18 2010 11:40am
Subject:bzr commit into mysql-5.5-innodb branch (marko.makela:3166) Bug#55626
View as plain text  
#At file:///home/marko/innobase/dev/mysql2a/5.5-innodb/ based on revid:vasil.dimov@stripped96ts3919o4v

 3166 Marko Mäkelä	2010-08-18
      Merge Bug#55626 fix from mysql-5.1-innodb:
      
      revno: 3545
      revision-id: marko.makela@stripped10110-zfs0i1vfrccfb4yw
      parent: vasil.dimov@strippedom-20100817193934-1yl7zz2odikxauf8
      committer: Marko Mäkelä <marko.makela@stripped>
      branch nick: 5.1-innodb
      timestamp: Wed 2010-08-18 14:01:10 +0300
      message:
        Bug#55626: MIN and MAX reading a delete-marked record from secondary index
      
        Remove a bogus debug assertion that triggered the bug.
        Add assertions precisely where records must not be delete-marked.
        And a comment to clarify when the record is allowed to be delete-marked.

    modified:
      storage/innobase/row/row0sel.c
=== modified file 'storage/innobase/row/row0sel.c'
--- a/storage/innobase/row/row0sel.c	revid:vasil.dimov@strippedts3919o4v
+++ b/storage/innobase/row/row0sel.c	revid:marko.makela@stripped
@@ -2682,7 +2682,6 @@ row_sel_store_mysql_rec(
 	ut_ad(prebuilt->mysql_template);
 	ut_ad(prebuilt->default_rec);
 	ut_ad(rec_offs_validate(rec, NULL, offsets));
-	ut_ad(!rec_get_deleted_flag(rec, rec_offs_comp(offsets)));
 
 	if (UNIV_LIKELY_NULL(prebuilt->blob_heap)) {
 		mem_heap_free(prebuilt->blob_heap);
@@ -3603,6 +3602,7 @@ row_search_for_mysql(
 				row_sel_try_search_shortcut_for_mysql().
 				The latch will not be released until
 				mtr_commit(&mtr). */
+				ut_ad(!rec_get_deleted_flag(rec, comp));
 
 				if (!row_sel_store_mysql_rec(buf, prebuilt,
 							     rec, offsets)) {
@@ -4230,7 +4230,7 @@ no_gap_lock:
 
 				rec = old_vers;
 			}
-		} else if (!lock_sec_rec_cons_read_sees(rec, trx->read_view)) {
+		} else {
 			/* We are looking into a non-clustered index,
 			and to get the right version of the record we
 			have to look also into the clustered index: this
@@ -4238,8 +4238,12 @@ no_gap_lock:
 			information via the clustered index record. */
 
 			ut_ad(index != clust_index);
+			ut_ad(!dict_index_is_clust(index));
 
-			goto requires_clust_rec;
+			if (!lock_sec_rec_cons_read_sees(
+				    rec, trx->read_view)) {
+				goto requires_clust_rec;
+			}
 		}
 	}
 
@@ -4362,8 +4366,13 @@ requires_clust_rec:
 						  ULINT_UNDEFINED, &heap);
 			result_rec = rec;
 		}
+
+		/* result_rec can legitimately be delete-marked
+		now that it has been established that it points to a
+		clustered index record that exists in the read view. */
 	} else {
 		result_rec = rec;
+		ut_ad(!rec_get_deleted_flag(rec, comp));
 	}
 
 	/* We found a qualifying record 'result_rec'. At this point,

Attachment: [text/bzr-bundle] bzr/marko.makela@oracle.com-20100818114002-6iftfqr4n5h13xb6.bundle
Thread
bzr commit into mysql-5.5-innodb branch (marko.makela:3166) Bug#55626marko.makela18 Aug