MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:Heikki Tuuri Date:September 2 2005 10:38pm
Subject:bk commit into 5.0 tree (heikki:1.1946) BUG#12947
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of heikki. When heikki does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1946 05/09/03 01:38:37 heikki@stripped +1 -0
  row0sel.c:
    Fix bug #12947 : a consistent read could return inconsistent results; this bug was introduced in 5.0.5

  innobase/row/row0sel.c
    1.102 05/09/03 01:38:08 heikki@stripped +12 -6
    Fix bug #12947 : a consistent read could return inconsistent results; this bug was introduced in 5.0.5

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	heikki
# Host:	hundin.mysql.fi
# Root:	/home/heikki/mysql-5.0

--- 1.101/innobase/row/row0sel.c	2005-08-19 11:32:52 +03:00
+++ 1.102/innobase/row/row0sel.c	2005-09-03 01:38:08 +03:00
@@ -3055,6 +3055,7 @@
 					cursor 'direction' should be 0. */
 {
 	dict_index_t*	index		= prebuilt->index;
+	ibool		comp 		= index->table->comp;
 	dtuple_t*	search_tuple	= prebuilt->search_tuple;
 	btr_pcur_t*	pcur		= prebuilt->pcur;
 	trx_t*		trx		= prebuilt->trx;
@@ -3491,7 +3492,7 @@
 	/* PHASE 4: Look for matching records in a loop */
 	
 	rec = btr_pcur_get_rec(pcur);
-	ut_ad(!!page_rec_is_comp(rec) == index->table->comp);
+	ut_ad(!!page_rec_is_comp(rec) == comp);
 #ifdef UNIV_SEARCH_DEBUG
 /*
 	fputs("Using ", stderr);
@@ -3544,7 +3545,7 @@
 	/* Do sanity checks in case our cursor has bumped into page
 	corruption */
 	
-	if (page_rec_is_comp(rec)) {
+	if (comp) {
 		next_offs = rec_get_next_offs(rec, TRUE);
 		if (UNIV_UNLIKELY(next_offs < PAGE_NEW_SUPREMUM)) {
 			goto wrong_offs;
@@ -3711,7 +3712,7 @@
 		if (!set_also_gap_locks
 		    || srv_locks_unsafe_for_binlog
 		    || (unique_search && !UNIV_UNLIKELY(rec_get_deleted_flag(
-					rec, page_rec_is_comp(rec))))) {
+								rec, comp)))) {
 
 			goto no_gap_lock;
 		} else {
@@ -3803,7 +3804,12 @@
 		}
 	}
 
-	if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, page_rec_is_comp(rec)))) {
+	/* NOTE that at this point rec can be an old version of a clustered
+	index record built for a consistent read. We cannot assume after this
+	point that rec is on a buffer pool page. Functions like
+	page_rec_is_comp() cannot be used then! */
+
+	if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, comp))) {
 
 		/* The record is delete-marked: we can skip it if this is
 		not a consistent read which might see an earlier version
@@ -3836,6 +3842,7 @@
 		the clustered index ("clust_index").  However, after this
 		"if" block, "rec" may be pointing to
 		"clust_rec" of "clust_index". */
+
 		ut_ad(rec_offs_validate(rec, index, offsets));
 
 		/* It was a non-clustered index and we must fetch also the
@@ -3858,8 +3865,7 @@
 			goto next_rec;
 		}
 
-		if (UNIV_UNLIKELY(rec_get_deleted_flag(clust_rec,
-					page_rec_is_comp(clust_rec)))) {
+		if (UNIV_UNLIKELY(rec_get_deleted_flag(clust_rec, comp))) {
 
 			/* The record is delete marked: we can skip it */
 
Thread
bk commit into 5.0 tree (heikki:1.1946) BUG#12947Heikki Tuuri3 Sep