List:Commits« Previous MessageNext Message »
From:marko.makela Date:June 29 2011 7:34am
Subject:bzr push into mysql-trunk branch (marko.makela:3239 to 3240)
View as plain text  
 3240 Marko Mäkelä	2011-06-29 [merge]
      Merge mysql-5.5 to mysql-trunk.

    modified:
      storage/innobase/include/row0row.h
      storage/innobase/include/row0row.ic
      storage/innobase/include/row0upd.ic
      storage/innobase/include/trx0sys.h
      storage/innobase/include/trx0sys.ic
      storage/innobase/row/row0row.c
 3239 Marko Mäkelä	2011-06-28 [merge]
      Merge mysql-5.5 to mysql-trunk.

    modified:
      mysql-test/suite/innodb/r/innodb-use-sys-malloc.result
      mysql-test/suite/innodb/t/innodb-use-sys-malloc-master.opt
      mysql-test/suite/innodb/t/innodb-use-sys-malloc.test
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/include/db0err.h
      storage/innobase/row/row0mysql.c
      storage/innobase/ut/ut0ut.c
=== modified file 'storage/innobase/include/row0row.h'
--- a/storage/innobase/include/row0row.h	revid:marko.makela@stripped4-di9ixvbj3jrnzycj
+++ b/storage/innobase/include/row0row.h	revid:marko.makela@stripped44u9fgo
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
 
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free Software
@@ -38,27 +38,16 @@ Created 4/20/1996 Heikki Tuuri
 #include "btr0types.h"
 
 /*********************************************************************//**
-Gets the offset of the trx id field, in bytes relative to the origin of
+Gets the offset of the DB_TRX_ID field, in bytes relative to the origin of
 a clustered index record.
 @return	offset of DATA_TRX_ID */
 UNIV_INLINE
 ulint
-row_get_trx_id_offset_func(
-/*=======================*/
-#ifdef UNIV_DEBUG
-	const rec_t*		rec,	/*!< in: record */
-#endif /* UNIV_DEBUG */
+row_get_trx_id_offset(
+/*==================*/
 	const dict_index_t*	index,	/*!< in: clustered index */
-	const ulint*		offsets)/*!< in: rec_get_offsets(rec, index) */
+	const ulint*		offsets)/*!< in: record offsets */
 	__attribute__((nonnull, warn_unused_result));
-#ifdef UNIV_DEBUG
-# define row_get_trx_id_offset(rec, index, offsets)	\
-	row_get_trx_id_offset_func(rec, index, offsets)
-#else /* UNIV_DEBUG */
-# define row_get_trx_id_offset(rec, index, offsets)	\
-	row_get_trx_id_offset_func(index, offsets)
-#endif /* UNIV_DEBUG */
-
 /*********************************************************************//**
 Reads the trx id field from a clustered index record.
 @return	value of the field */
@@ -77,9 +66,10 @@ UNIV_INLINE
 roll_ptr_t
 row_get_rec_roll_ptr(
 /*=================*/
-	const rec_t*	rec,	/*!< in: record */
-	dict_index_t*	index,	/*!< in: clustered index */
-	const ulint*	offsets);/*!< in: rec_get_offsets(rec, index) */
+	const rec_t*		rec,	/*!< in: record */
+	const dict_index_t*	index,	/*!< in: clustered index */
+	const ulint*		offsets)/*!< in: rec_get_offsets(rec, index) */
+	__attribute__((nonnull, warn_unused_result));
 /*****************************************************************//**
 When an insert or purge to a table is performed, this function builds
 the entry to be inserted into or purged from an index on the table.

=== modified file 'storage/innobase/include/row0row.ic'
--- a/storage/innobase/include/row0row.ic	revid:marko.makela@stripped3jrnzycj
+++ b/storage/innobase/include/row0row.ic	revid:marko.makela@stripped
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
 
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free Software
@@ -28,25 +28,22 @@ Created 4/20/1996 Heikki Tuuri
 #include "trx0undo.h"
 
 /*********************************************************************//**
-Gets the offset of trx id field, in bytes relative to the origin of
+Gets the offset of the DB_TRX_ID field, in bytes relative to the origin of
 a clustered index record.
 @return	offset of DATA_TRX_ID */
 UNIV_INLINE
 ulint
-row_get_trx_id_offset_func(
-/*=======================*/
-#ifdef UNIV_DEBUG
-	const rec_t*		rec,	/*!< in: record */
-#endif /* UNIV_DEBUG */
+row_get_trx_id_offset(
+/*==================*/
 	const dict_index_t*	index,	/*!< in: clustered index */
-	const ulint*		offsets)/*!< in: rec_get_offsets(rec, index) */
+	const ulint*		offsets)/*!< in: record offsets */
 {
 	ulint	pos;
 	ulint	offset;
 	ulint	len;
 
 	ut_ad(dict_index_is_clust(index));
-	ut_ad(rec_offs_validate(rec, index, offsets));
+	ut_ad(rec_offs_validate(NULL, index, offsets));
 
 	pos = dict_index_get_sys_col_pos(index, DATA_TRX_ID);
 
@@ -76,7 +73,7 @@ row_get_rec_trx_id(
 	offset = index->trx_id_offset;
 
 	if (!offset) {
-		offset = row_get_trx_id_offset(rec, index, offsets);
+		offset = row_get_trx_id_offset(index, offsets);
 	}
 
 	return(trx_read_trx_id(rec + offset));
@@ -89,9 +86,9 @@ UNIV_INLINE
 roll_ptr_t
 row_get_rec_roll_ptr(
 /*=================*/
-	const rec_t*	rec,	/*!< in: record */
-	dict_index_t*	index,	/*!< in: clustered index */
-	const ulint*	offsets)/*!< in: rec_get_offsets(rec, index) */
+	const rec_t*		rec,	/*!< in: record */
+	const dict_index_t*	index,	/*!< in: clustered index */
+	const ulint*		offsets)/*!< in: rec_get_offsets(rec, index) */
 {
 	ulint	offset;
 
@@ -101,7 +98,7 @@ row_get_rec_roll_ptr(
 	offset = index->trx_id_offset;
 
 	if (!offset) {
-		offset = row_get_trx_id_offset(rec, index, offsets);
+		offset = row_get_trx_id_offset(index, offsets);
 	}
 
 	return(trx_read_roll_ptr(rec + offset + DATA_TRX_ID_LEN));

=== modified file 'storage/innobase/include/row0upd.ic'
--- a/storage/innobase/include/row0upd.ic	revid:marko.makela@stripped23614-di9ixvbj3jrnzycj
+++ b/storage/innobase/include/row0upd.ic	revid:marko.makela@strippedmjywa44u9fgo
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
 
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free Software
@@ -171,7 +171,7 @@ row_upd_rec_sys_fields(
 		ulint	offset = index->trx_id_offset;
 
 		if (!offset) {
-			offset = row_get_trx_id_offset(rec, index, offsets);
+			offset = row_get_trx_id_offset(index, offsets);
 		}
 
 #if DATA_TRX_ID + 1 != DATA_ROLL_PTR

=== modified file 'storage/innobase/include/trx0sys.h'
--- a/storage/innobase/include/trx0sys.h	revid:marko.makela@stripped10628123614-di9ixvbj3jrnzycj
+++ b/storage/innobase/include/trx0sys.h	revid:marko.makela@stripped-a3sbmjywa44u9fgo
@@ -328,7 +328,17 @@ UNIV_INTERN
 ibool
 trx_in_trx_list(
 /*============*/
-	const trx_t*	in_trx);/*!< in: transaction */
+	const trx_t*	in_trx)		/*!< in: transaction */
+	__attribute__((nonnull, warn_unused_result));
+/***********************************************************//**
+Assert that a transaction has been recovered.
+@return TRUE */
+UNIV_INLINE
+ibool
+trx_assert_recovered(
+/*=================*/
+	trx_id_t	trx_id)		/*!< in: transaction identifier */
+	__attribute__((warn_unused_result));
 #endif /* UNIV_DEBUG */
 /*****************************************************************//**
 Updates the offset information about the end of the MySQL binlog entry

=== modified file 'storage/innobase/include/trx0sys.ic'
--- a/storage/innobase/include/trx0sys.ic	revid:marko.makela@strippedj
+++ b/storage/innobase/include/trx0sys.ic	revid:marko.makela@stripped
@@ -324,7 +324,7 @@ trx_list_get_min_trx_id_low(void)
 /*=============================*/
 {
 	trx_id_t	id;
-	trx_t*		trx;
+	const trx_t*	trx;
 
 #ifdef UNIV_SYNC_DEBUG
 	ut_ad(rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
@@ -338,6 +338,28 @@ trx_list_get_min_trx_id_low(void)
 	return(id);
 }
 
+#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+/***********************************************************//**
+Assert that a transaction has been recovered.
+@return TRUE */
+UNIV_INLINE
+ibool
+trx_assert_recovered(
+/*=================*/
+	trx_id_t	trx_id)		/*!< in: transaction identifier */
+{
+	const trx_t*	trx;
+
+	rw_lock_s_lock(&trx_sys->lock);
+	trx = trx_get_on_id(trx_id);
+	ut_a(trx);
+	ut_a(trx->is_recovered);
+	rw_lock_s_unlock(&trx_sys->lock);
+
+	return(TRUE);
+}
+#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
+
 /****************************************************************//**
 Returns the minimum trx id in trx list. This is the smallest id for which
 the trx can possibly be active. (But, you must look at the trx->state

=== modified file 'storage/innobase/row/row0row.c'
--- a/storage/innobase/row/row0row.c	revid:marko.makela@strippednzycj
+++ b/storage/innobase/row/row0row.c	revid:marko.makela@stripped
@@ -205,33 +205,19 @@ row_build(
 	}
 
 #if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
-	if (UNIV_LIKELY_NULL(rec_offs_any_null_extern(rec, offsets))) {
-		/* This condition can occur during crash recovery before
-		trx_rollback_active() has completed execution.
+	/* This condition can occur during crash recovery before
+	trx_rollback_active() has completed execution.
 
-		This condition is possible if the server crashed
-		during an insert or update before
-		btr_store_big_rec_extern_fields() did mtr_commit() all
-		BLOB pointers to the clustered index record.
-
-		Look up the transaction that holds the implicit lock
-		on this record, and assert that it was recovered (and
-		will soon be rolled back). */
-
-		ulint		trx_id_pos	= dict_index_get_sys_col_pos(
-				index, DATA_TRX_ID);
-		ulint		len;
-		trx_id_t	trx_id		= trx_read_trx_id(
-			rec_get_nth_field(rec, offsets, trx_id_pos, &len));
-		const trx_t*	trx;
-		ut_a(len == 6);
-
-		rw_lock_s_lock(&trx_sys->lock);
-		trx = trx_get_on_id(trx_id);
-		ut_a(trx);
-		ut_a(trx->is_recovered);
-		rw_lock_s_unlock(&trx_sys->lock);
-	}
+	This condition is possible if the server crashed
+	during an insert or update before
+	btr_store_big_rec_extern_fields() did mtr_commit() all
+	BLOB pointers to the clustered index record.
+
+	If the record contains a null BLOB pointer, look up the
+	transaction that holds the implicit lock on this record, and
+	assert that it was recovered (and will soon be rolled back). */
+	ut_a(!rec_offs_any_null_extern(rec, offsets)
+	     || trx_assert_recovered(row_get_rec_trx_id(rec, index, offsets)));
 #endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
 
 	if (type != ROW_COPY_POINTERS) {

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (marko.makela:3239 to 3240) marko.makela29 Jun