List:Internals« Previous MessageNext Message »
From:jan.lindstrom Date:April 8 2005 10:40am
Subject:bk commit into 5.0 tree (jan:1.1843)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jan. When jan 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.1843 05/04/08 13:40:00 jan@stripped +6 -0
  Review fixes. Rename xid as a recovered_xid and copy hole xid whenever
  needed.

  sql/ha_innodb.cc
    1.184 05/04/08 13:39:51 jan@stripped +1 -2
    Pass xid as a parameter to trx_prepare_for_mysql() function.

  innobase/trx/trx0undo.c
    1.24 05/04/08 13:39:51 jan@stripped +10 -12
    Rename xid as a recovered_xid and copy xid whenewer needed.

  innobase/trx/trx0trx.c
    1.58 05/04/08 13:39:51 jan@stripped +17 -15
    Rename xid as a recovered_xid and use that when copying xid
    between undo record and trx.

  innobase/include/trx0undo.h
    1.7 05/04/08 13:39:51 jan@stripped +3 -3
    Add XID to parameters of trx_set_state_at_prepare() function
    and rename xid as a recovered_xid in undo structure.

  innobase/include/trx0trx.ic
    1.5 05/04/08 13:39:51 jan@stripped +0 -31
    Remove trx_copy_xid() function.

  innobase/include/trx0trx.h
    1.48 05/04/08 13:39:51 jan@stripped +4 -11
    Add XID to trx_prepare_for_mysql() function parameters and remove
    unnecessary trx_copy_xid() function. Rename xid as a
    recovered_xid.

# 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:	jan
# Host:	hundin.mysql.fi
# Root:	/home/jan/mysql-5.0

--- 1.47/innobase/include/trx0trx.h	Fri Apr  8 11:19:55 2005
+++ 1.48/innobase/include/trx0trx.h	Fri Apr  8 13:39:51 2005
@@ -164,7 +164,8 @@
 trx_prepare_for_mysql(
 /*=================*/
 			/* out: 0 or error number */
-	trx_t*	trx);	/* in: trx handle */
+	trx_t*	trx,	/* in: trx handle */
+	XID*    xid);	/* in: X/Open XA XID */
 /**************************************************************************
 This function is used to find number of prepared transactions and
 their transaction objects for a recovery. */
@@ -184,14 +185,6 @@
 			/* out: trx or NULL */
 	XID*	xid);	/*  in: X/Open XA transaction identification */
 /***********************************************************************
-Copy X/Open XA transaction identification (XID) */
-UNIV_INLINE
-void
-trx_copy_xid(
-/*=========*/
-	XID*		dest,	/* in: XID to copy to */
-	const XID*	src);	/* in: XID to copy from */
-/***********************************************************************
 If required, flushes the log to disk if we called trx_commit_for_mysql()
 with trx->flush_log_later == TRUE. */
 
@@ -374,9 +367,9 @@
 					if we can use the insert buffer for
 					them, we set this FALSE */
 	dulint		id;		/* transaction id */
-	XID*		xid;		/* X/Open XA transaction 
+	XID		recovered_xid;	/* X/Open XA transaction 
 					identification to identify a 
-					transaction branch */
+					transaction branch in a recovery*/
 	ibool		support_xa;	/* normally we do the XA two-phase
 					commit steps, but by setting this to
 					FALSE, one can save CPU time and about

--- 1.4/innobase/include/trx0trx.ic	Fri Apr  8 11:19:55 2005
+++ 1.5/innobase/include/trx0trx.ic	Fri Apr  8 13:39:51 2005
@@ -38,34 +38,3 @@
 		trx_start_low(trx, ULINT_UNDEFINED);
 	}
 }
-
-/***********************************************************************
-Copy X/Open XA transaction identification (XID) */
-UNIV_INLINE
-void
-trx_copy_xid(
-/*=========*/
-	XID*		dest,	/* in: XID to copy to */
-	const XID*	src)	/* in: XID to copy from */
-{	
-	ut_ad(dest);
-
-	if (src == NULL) {
-		dest->formatID = -1;
-	} else {
- 
-		dest->formatID = src->formatID;
-
-		if (src->formatID != -1) {
-			dest->gtrid_length = src->gtrid_length;
-			dest->bqual_length = src->bqual_length;
-
-			memcpy(dest->data, src->data,
-				(src->gtrid_length+src->bqual_length));
-		} else {
-			dest->gtrid_length = 0;
-			dest->bqual_length = 0;
-		}
-	}
-}
-

--- 1.6/innobase/include/trx0undo.h	Fri Feb 25 22:35:12 2005
+++ 1.7/innobase/include/trx0undo.h	Fri Apr  8 13:39:51 2005
@@ -248,8 +248,8 @@
 /*==========================*/
 				/* out: undo log segment header page,
 				x-latched */
-	trx_t*		trx,	/* in: transaction */
 	trx_undo_t*	undo,	/* in: undo log memory copy */
+	XID*		xid,	/* in: X/Open XA XID */
 	mtr_t*		mtr);	/* in: mtr */
 
 /**************************************************************************
@@ -346,8 +346,8 @@
 					field */
 	dulint		trx_id;		/* id of the trx assigned to the undo
 					log */
-	XID             xid;		/* X/Open XA transaction 
-					identification */
+	XID		recovered_xid;	/* X/Open transaction identification
+					used in a recovery */
 	ibool		dict_operation;	/* TRUE if a dict operation trx */
 	dulint		table_id;	/* if a dict operation, then the table
 					id */

--- 1.57/innobase/trx/trx0trx.c	Fri Apr  8 11:19:55 2005
+++ 1.58/innobase/trx/trx0trx.c	Fri Apr  8 13:39:51 2005
@@ -165,7 +165,7 @@
 	trx->read_view = NULL;
 
 	/* Set X/Open XA transaction identification to NULL */
-	trx->xid = NULL;
+	trx->recovered_xid.formatID = -1;
 
 	return(trx);
 }
@@ -438,7 +438,7 @@
 			trx = trx_create(NULL); 
 
 			trx->id = undo->trx_id;
-			trx->xid = &(undo->xid);
+			trx->recovered_xid = undo->recovered_xid;
 			trx->insert_undo = undo;
 			trx->rseg = rseg;
 
@@ -510,7 +510,7 @@
 				trx = trx_create(NULL); 
 
 				trx->id = undo->trx_id;
-				trx->xid = &(undo->xid);
+				trx->recovered_xid = undo->recovered_xid;
 
 				if (undo->state != TRX_UNDO_ACTIVE) {
 
@@ -1766,7 +1766,8 @@
 void
 trx_prepare_off_kernel(
 /*===================*/
-	trx_t*	trx)	/* in: transaction */
+	trx_t*	trx,	/* in: transaction */
+	XID*	xid)	/* in: X/Open XA XID */
 {
 	page_t*		update_hdr_page;
 	trx_rseg_t*	rseg;
@@ -1801,13 +1802,13 @@
 			because only a single OS thread is allowed to do the
 			transaction prepare for this transaction. */
 
-			trx_undo_set_state_at_prepare(trx, trx->insert_undo,
-							  		&mtr);
+			trx_undo_set_state_at_prepare(trx->insert_undo,
+								xid, &mtr);
 		}
 
 		if (trx->update_undo) {
-			update_hdr_page = trx_undo_set_state_at_prepare(trx,
-						trx->update_undo, &mtr);
+			update_hdr_page = trx_undo_set_state_at_prepare(
+						trx->update_undo, xid, &mtr);
 		}
 
 		mutex_exit(&(rseg->mutex));
@@ -1884,7 +1885,8 @@
 trx_prepare_for_mysql(
 /*====-=============*/
 			/* out: 0 or error number */
-	trx_t*	trx)	/* in: trx handle */
+	trx_t*	trx,	/* in: trx handle */
+	XID*	xid)	/* in: X/Open XA XID */
 {
 	/* Because we do not do the prepare by sending an Innobase
 	sig to the transaction, we must here make sure that trx has been
@@ -1898,7 +1900,7 @@
 
 	mutex_enter(&kernel_mutex);
 
-	trx_prepare_off_kernel(trx);
+	trx_prepare_off_kernel(trx, xid);
 
 	mutex_exit(&kernel_mutex);
 
@@ -1934,7 +1936,7 @@
 
 	while (trx) {
 		if (trx->conc_state == TRX_PREPARED) {
-			trx_copy_xid(&(xid_list[count]), trx->xid);
+			xid_list[count] = trx->recovered_xid;
 
 			/* Print this only to a first transaction in
 			the prepared state */
@@ -2005,10 +2007,10 @@
 		of gtrid_lenght+bqual_length bytes should be
 		the same */
 
-		if (trx->xid &&
-			xid->gtrid_length == trx->xid->gtrid_length &&
-			xid->bqual_length == trx->xid->bqual_length &&
-			memcmp(xid->data, trx->xid->data,
+		if (trx->recovered_xid.formatID != -1 &&
+			xid->gtrid_length == trx->recovered_xid.gtrid_length &&
+			xid->bqual_length == trx->recovered_xid.bqual_length &&
+			memcmp(xid->data, trx->recovered_xid.data,
 					xid->gtrid_length + 
 					xid->bqual_length) == 0) {
 			break;

--- 1.23/innobase/trx/trx0undo.c	Mon Mar 14 15:26:38 2005
+++ 1.24/innobase/trx/trx0undo.c	Fri Apr  8 13:39:51 2005
@@ -581,8 +581,6 @@
 	trx_ulogf_t*	log_hdr,/* in: undo log header */
 	XID*		xid)	/* out: X/Open XA Transaction Identification */
 {
-	ulint i;
-
 	xid->formatID = mach_read_from_4(log_hdr + TRX_UNDO_XA_FORMAT);
 	
 	xid->gtrid_length = mach_read_from_4(log_hdr + TRX_UNDO_XA_TRID_LEN);
@@ -1405,7 +1403,7 @@
 	undo->state = TRX_UNDO_ACTIVE;
 	undo->del_marks = FALSE;
 	undo->trx_id = trx_id;
-	trx_copy_xid(&(undo->xid), xid);
+	undo->recovered_xid = *xid;
 
 	undo->dict_operation = FALSE;
 
@@ -1451,7 +1449,7 @@
 	undo->state = TRX_UNDO_ACTIVE;
 	undo->del_marks = FALSE;
 	undo->trx_id = trx_id;
-	trx_copy_xid(&(undo->xid), xid);
+	undo->recovered_xid = *xid;
 
 	undo->dict_operation = FALSE;
 
@@ -1681,11 +1679,11 @@
 #endif /* UNIV_SYNC_DEBUG */
 	mutex_enter(&(rseg->mutex));
 
-	undo = trx_undo_reuse_cached(trx, rseg, type, trx->id, trx->xid,
-									&mtr);
+	undo = trx_undo_reuse_cached(trx, rseg, type, trx->id, 
+						&trx->recovered_xid, &mtr);
 	if (undo == NULL) {
-		undo = trx_undo_create(trx, rseg, type, trx->id, trx->xid,
-									&mtr);
+		undo = trx_undo_create(trx, rseg, type, trx->id, 
+						&trx->recovered_xid, &mtr);
 		if (undo == NULL) {
 			/* Did not succeed */
 
@@ -1773,8 +1771,8 @@
 /*==========================*/
 				/* out: undo log segment header page,
 				x-latched */
-	trx_t*		trx,	/* in: transaction */
 	trx_undo_t*	undo,	/* in: undo log memory copy */
+	XID*		xid,	/* in: X/Open XA XID */
 	mtr_t*		mtr)	/* in: mtr */
 {
 	trx_usegf_t*	seg_hdr;
@@ -1783,7 +1781,7 @@
 	page_t*		undo_page;
 	ulint		offset;
 	
-	ut_ad(trx && undo && mtr);
+	ut_ad(xid && undo && mtr);
 
 	if (undo->id >= TRX_RSEG_N_SLOTS) {
 		fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
@@ -1799,7 +1797,7 @@
 
 	/*--------------------------------------*/
 	undo->state = TRX_UNDO_PREPARED;
-	trx_copy_xid(&(undo->xid), trx->xid);
+	undo->recovered_xid = *xid;
 	/*--------------------------------------*/
 		   
 	mlog_write_ulint(seg_hdr + TRX_UNDO_STATE, undo->state, 
@@ -1811,7 +1809,7 @@
 	mlog_write_ulint(undo_header + TRX_UNDO_XID_EXISTS,
 					TRUE, MLOG_1BYTE, mtr);
 
-	trx_undo_write_xid(undo_header, &undo->xid, mtr);	
+	trx_undo_write_xid(undo_header, &(undo->recovered_xid), mtr);	
 
 	return(undo_page);
 }

--- 1.183/sql/ha_innodb.cc	Fri Apr  8 11:19:55 2005
+++ 1.184/sql/ha_innodb.cc	Fri Apr  8 13:39:51 2005
@@ -6569,7 +6569,6 @@
 	}
 
 	trx = check_trx_exists(thd);
-	trx->xid = &(thd->transaction.xid);
 
 	/* Release a possible FIFO ticket and search latch. Since we will
 	reserve the kernel mutex, we have to release the search system latch
@@ -6592,7 +6591,7 @@
 
 		ut_ad(trx->active_trans);
 
-		error = trx_prepare_for_mysql(trx);
+		error = trx_prepare_for_mysql(trx, &(thd->transaction.xid));
 	} else {
 		/* We just mark the SQL statement ended and do not do a
 		transaction prepare */
Thread
bk commit into 5.0 tree (jan:1.1843)jan.lindstrom8 Apr