List:Commits« Previous MessageNext Message »
From:marko.makela Date:March 26 2013 1:08pm
Subject:bzr push into mysql-5.6 branch (marko.makela:4959 to 4960) Bug#15959474
View as plain text  
 4960 Marko Mäkelä	2013-03-26
      Track down Bug#15959474 CHECK TABLE FAILURE, PERMANENT, INDEX RECORD MISCOUNT
      
      lock_trx_has_rec_x_lock(): New predicate: Assert that the transaction
      is holding an exclusive lock on the record that it is about to update.
      
      row_upd_clust_step(): Assert lock_trx_has_rec_x_lock().
      
      This is based on the patch uploaded by Yasufumi Kinoshita.
      
      rb#2187 approved by Jimmy Yang

    modified:
      storage/innobase/include/lock0lock.h
      storage/innobase/lock/lock0lock.cc
      storage/innobase/row/row0upd.cc
=== modified file 'storage/innobase/include/lock0lock.h'
--- a/storage/innobase/include/lock0lock.h	revid:olav.sandstaa@stripped18-zvdjqxbh6f3owc95
+++ b/storage/innobase/include/lock0lock.h	revid:marko.makela@strippedyvzp3innr8
@@ -824,6 +824,19 @@ lock_trx_has_sys_table_locks(
 /*=========================*/
 	const trx_t*	trx)	/*!< in: transaction to check */
 	__attribute__((warn_unused_result));
+
+/*******************************************************************//**
+Check if the transaction holds an exclusive lock on a record.
+@return	whether the locks are held */
+UNIV_INTERN
+bool
+lock_trx_has_rec_x_lock(
+/*====================*/
+	const trx_t*		trx,	/*!< in: transaction to check */
+	const dict_table_t*	table,	/*!< in: table to check */
+	const buf_block_t*	block,	/*!< in: buffer block of the record */
+	ulint			heap_no)/*!< in: record heap number */
+	__attribute__((nonnull, warn_unused_result));
 #endif /* UNIV_DEBUG */
 
 /*******************************************************************//**

=== modified file 'storage/innobase/lock/lock0lock.cc'
--- a/storage/innobase/lock/lock0lock.cc	revid:olav.sandstaa@stripped
+++ b/storage/innobase/lock/lock0lock.cc	revid:marko.makela@stripped
@@ -1499,6 +1499,7 @@ lock_rec_has_expl(
 	     lock = lock_rec_get_next(heap_no, lock)) {
 
 		if (lock->trx == trx
+		    && !lock_rec_get_insert_intention(lock)
 		    && !lock_is_wait_not_by_other(lock->type_mode)
 		    && lock_mode_stronger_or_eq(
 			    lock_get_mode(lock),
@@ -1509,8 +1510,7 @@ lock_rec_has_expl(
 			|| heap_no == PAGE_HEAP_NO_SUPREMUM)
 		    && (!lock_rec_get_gap(lock)
 			|| (precise_mode & LOCK_GAP)
-			|| heap_no == PAGE_HEAP_NO_SUPREMUM)
-		    && (!lock_rec_get_insert_intention(lock))) {
+			|| heap_no == PAGE_HEAP_NO_SUPREMUM)) {
 
 			return(lock);
 		}
@@ -7028,6 +7028,28 @@ lock_trx_has_sys_table_locks(
 
 	return(strongest_lock);
 }
+
+/*******************************************************************//**
+Check if the transaction holds an exclusive lock on a record.
+@return	whether the locks are held */
+UNIV_INTERN
+bool
+lock_trx_has_rec_x_lock(
+/*====================*/
+	const trx_t*		trx,	/*!< in: transaction to check */
+	const dict_table_t*	table,	/*!< in: table to check */
+	const buf_block_t*	block,	/*!< in: buffer block of the record */
+	ulint			heap_no)/*!< in: record heap number */
+{
+	ut_ad(heap_no > PAGE_HEAP_NO_SUPREMUM);
+
+	lock_mutex_enter();
+	ut_a(lock_table_has(trx, table, LOCK_IX));
+	ut_a(lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP,
+			       block, heap_no, trx));
+	lock_mutex_exit();
+	return(true);
+}
 #endif /* UNIV_DEBUG */
 
 /*******************************************************************//**

=== modified file 'storage/innobase/row/row0upd.cc'
--- a/storage/innobase/row/row0upd.cc	revid:olav.sandstaa@oracle.com-20130326073318-zvdjqxbh6f3owc95
+++ b/storage/innobase/row/row0upd.cc	revid:marko.makela@stripped0326125541-q0i3k4yvzp3innr8
@@ -2437,6 +2437,10 @@ row_upd_clust_step(
 		}
 	}
 
+	ut_ad(lock_trx_has_rec_x_lock(thr_get_trx(thr), index->table,
+				      btr_pcur_get_block(pcur),
+				      page_rec_get_heap_no(rec)));
+
 	/* NOTE: the following function calls will also commit mtr */
 
 	if (node->is_delete) {

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.6 branch (marko.makela:4959 to 4960) Bug#15959474marko.makela20 May