List:Commits« Previous MessageNext Message »
From:marko.makela Date:August 9 2012 8:05am
Subject:bzr push into mysql-5.1 branch (marko.makela:3791)
View as plain text  
 3791 Marko Mäkelä	2012-08-09 [merge]
      Merge from mysql-5.1 to working copy.

    modified:
      libmysqld/lib_sql.cc
      sql/sql_class.h
=== modified file 'storage/innobase/btr/btr0pcur.c'
--- a/storage/innobase/btr/btr0pcur.c	revid:sunanda.menon@stripped013ak60re62lus4
+++ b/storage/innobase/btr/btr0pcur.c	revid:marko.makela@stripped1
@@ -312,45 +312,40 @@ btr_pcur_restore_position(
 	/* Restore the old search mode */
 	cursor->search_mode = old_mode;
 
-	if (btr_pcur_is_on_user_rec(cursor, mtr)) {
-		switch (cursor->rel_pos) {
-		case BTR_PCUR_ON:
-			if (!cmp_dtuple_rec(
-				    tuple, btr_pcur_get_rec(cursor),
-				    rec_get_offsets(btr_pcur_get_rec(cursor),
-						    index, NULL,
-						    ULINT_UNDEFINED, &heap))) {
-
-				/* We have to store the NEW value for
-				the modify clock, since the cursor can
-				now be on a different page! But we can
-				retain the value of old_rec */
-
-				cursor->block_when_stored =
-					buf_block_align(
-						btr_pcur_get_page(cursor));
-				cursor->modify_clock =
-					buf_block_get_modify_clock(
-						cursor->block_when_stored);
-				cursor->old_stored = BTR_PCUR_OLD_STORED;
-
-				mem_heap_free(heap);
-
-				return(TRUE);
-			}
-
-			break;
-		case BTR_PCUR_BEFORE:
-			page_cur_move_to_next(btr_pcur_get_page_cur(cursor));
-			break;
-		case BTR_PCUR_AFTER:
-			page_cur_move_to_prev(btr_pcur_get_page_cur(cursor));
-			break;
+	switch (cursor->rel_pos) {
+	case BTR_PCUR_ON:
+		if (btr_pcur_is_on_user_rec(cursor, mtr)
+		    && !cmp_dtuple_rec(
+			    tuple, btr_pcur_get_rec(cursor),
+			    rec_get_offsets(btr_pcur_get_rec(cursor),
+					    index, NULL,
+					    ULINT_UNDEFINED, &heap))) {
+
+			/* We have to store the NEW value for
+			the modify clock, since the cursor can
+			now be on a different page! But we can
+			retain the value of old_rec */
+
+			cursor->block_when_stored =
+				buf_block_align(
+					btr_pcur_get_page(cursor));
+			cursor->modify_clock =
+				buf_block_get_modify_clock(
+					cursor->block_when_stored);
+			cursor->old_stored = BTR_PCUR_OLD_STORED;
+
+			mem_heap_free(heap);
+
+			return(TRUE);
+		}
 #ifdef UNIV_DEBUG
-		default:
-			ut_error;
+		/* fall through */
+	case BTR_PCUR_BEFORE:
+	case BTR_PCUR_AFTER:
+		break;
+	default:
+		ut_error;
 #endif /* UNIV_DEBUG */
-		}
 	}
 
 	mem_heap_free(heap);

=== modified file 'storage/innodb_plugin/ChangeLog'
--- a/storage/innodb_plugin/ChangeLog	revid:sunanda.menon@stripped-20120809065043-o013ak60re62lus4
+++ b/storage/innodb_plugin/ChangeLog	revid:marko.makela@stripped5-mci2a9xym2lpi431
@@ -1,3 +1,9 @@
+2012-08-07	The InnoDB Team
+
+	* btr/btr0pcur.c, row/row0merge.c:
+	Fix Bug#14399148 INNODB TABLES UNDER LOAD PRODUCE DUPLICATE COPIES
+	OF ROWS IN QUERIES
+
 2012-03-15	The InnoDB Team
 
 	* fil/fil0fil.c, ibuf/ibuf0ibuf.c, include/fil0fil.h,

=== modified file 'storage/innodb_plugin/btr/btr0pcur.c'
--- a/storage/innodb_plugin/btr/btr0pcur.c	revid:sunanda.menon@stripped
+++ b/storage/innodb_plugin/btr/btr0pcur.c	revid:marko.makela@oracle.com-20120809074825-mci2a9xym2lpi431
@@ -336,44 +336,39 @@ btr_pcur_restore_position_func(
 	/* Restore the old search mode */
 	cursor->search_mode = old_mode;
 
-	if (btr_pcur_is_on_user_rec(cursor)) {
-		switch (cursor->rel_pos) {
-		case BTR_PCUR_ON:
-			if (!cmp_dtuple_rec(
-				    tuple, btr_pcur_get_rec(cursor),
-				    rec_get_offsets(btr_pcur_get_rec(cursor),
-						    index, NULL,
-						    ULINT_UNDEFINED, &heap))) {
-
-				/* We have to store the NEW value for
-				the modify clock, since the cursor can
-				now be on a different page! But we can
-				retain the value of old_rec */
-
-				cursor->block_when_stored =
-					btr_pcur_get_block(cursor);
-				cursor->modify_clock =
-					buf_block_get_modify_clock(
-						cursor->block_when_stored);
-				cursor->old_stored = BTR_PCUR_OLD_STORED;
-
-				mem_heap_free(heap);
-
-				return(TRUE);
-			}
-
-			break;
-		case BTR_PCUR_BEFORE:
-			page_cur_move_to_next(btr_pcur_get_page_cur(cursor));
-			break;
-		case BTR_PCUR_AFTER:
-			page_cur_move_to_prev(btr_pcur_get_page_cur(cursor));
-			break;
+	switch (cursor->rel_pos) {
+	case BTR_PCUR_ON:
+		if (btr_pcur_is_on_user_rec(cursor)
+		    && !cmp_dtuple_rec(
+			    tuple, btr_pcur_get_rec(cursor),
+			    rec_get_offsets(btr_pcur_get_rec(cursor),
+					    index, NULL,
+					    ULINT_UNDEFINED, &heap))) {
+
+			/* We have to store the NEW value for
+			the modify clock, since the cursor can
+			now be on a different page! But we can
+			retain the value of old_rec */
+
+			cursor->block_when_stored =
+				btr_pcur_get_block(cursor);
+			cursor->modify_clock =
+				buf_block_get_modify_clock(
+					cursor->block_when_stored);
+			cursor->old_stored = BTR_PCUR_OLD_STORED;
+
+			mem_heap_free(heap);
+
+			return(TRUE);
+		}
 #ifdef UNIV_DEBUG
-		default:
-			ut_error;
+		/* fall through */
+	case BTR_PCUR_BEFORE:
+	case BTR_PCUR_AFTER:
+		break;
+	default:
+		ut_error;
 #endif /* UNIV_DEBUG */
-		}
 	}
 
 	mem_heap_free(heap);

=== modified file 'storage/innodb_plugin/row/row0merge.c'
--- a/storage/innodb_plugin/row/row0merge.c	revid:sunanda.menon@stripped809065043-o013ak60re62lus4
+++ b/storage/innodb_plugin/row/row0merge.c	revid:marko.makela@stripped5-mci2a9xym2lpi431
@@ -1214,11 +1214,25 @@ row_merge_read_clustered_index(
 				goto err_exit;
 			}
 
+			/* Store the cursor position on the last user
+			record on the page. */
+			btr_pcur_move_to_prev_on_page(&pcur);
+			/* Leaf pages must never be empty, unless
+			this is the only page in the index tree. */
+			ut_ad(btr_pcur_is_on_user_rec(&pcur)
+			      || buf_block_get_page_no(
+				      btr_pcur_get_block(&pcur))
+			      == clust_index->page);
+
 			btr_pcur_store_position(&pcur, &mtr);
 			mtr_commit(&mtr);
 			mtr_start(&mtr);
+			/* Restore position on the record, or its
+			predecessor if the record was purged
+			meanwhile. */
 			btr_pcur_restore_position(BTR_SEARCH_LEAF,
 						  &pcur, &mtr);
+			/* Move to the successor of the original record. */
 			has_next = btr_pcur_move_to_next_user_rec(&pcur, &mtr);
 		}
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1 branch (marko.makela:3791) marko.makela9 Aug