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.1814 05/03/14 15:27:54 jan@stripped +5 -0
Enhance XID processing in InnoDB. Do not initialize XID and copy
only those bytes which are present. Store only a pointer of a
XID whenever possible.
sql/ha_innodb.cc
1.175 05/03/14 15:26:38 jan@stripped +9 -9
In prepare set trx->xid to a pointer to thd->transaction.xid. Some
style corrections.
innobase/trx/trx0undo.c
1.23 05/03/14 15:26:38 jan@stripped +11 -15
Write only those bytes from X/Open XA XID which are present.
Remove unnecessary memesets and use a new function to copy XID.
innobase/trx/trx0trx.c
1.53 05/03/14 15:26:38 jan@stripped +10 -10
Removed unnecessary memsets from XID. Initially trx->xid points to
NULL XID trx->tmp.xid. In recovery trx->xid is set to be the same
as undo->xid. Use a new function to copy XID.
innobase/include/trx0trx.ic
1.3 05/03/14 15:26:38 jan@stripped +24 -0
Added function to copy X/Open XA transaction identification XID.
innobase/include/trx0trx.h
1.44 05/03/14 15:26:38 jan@stripped +13 -2
Added function to copy X/Open XA transaction identification and
modified XID in trx structure to be a pointer and added a new
temporal field for 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.43/innobase/include/trx0trx.h Sun Mar 13 12:47:34 2005
+++ 1.44/innobase/include/trx0trx.h Mon Mar 14 15:26:38 2005
@@ -183,7 +183,15 @@
/*===============*/
/* 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. */
@@ -366,9 +374,12 @@
if we can use the insert buffer for
them, we set this FALSE */
dulint id; /* transaction id */
- XID xid; /* X/Open XA transaction
+ XID* xid; /* X/Open XA transaction
identification to identify a
transaction branch */
+ XID tmp_xid; /* Temporary XID allways empty,
+ above will point here when transaction
+ is created */
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.2/innobase/include/trx0trx.ic Fri Sep 20 05:18:37 2002
+++ 1.3/innobase/include/trx0trx.ic Mon Mar 14 15:26:38 2005
@@ -39,4 +39,28 @@
}
}
+/***********************************************************************
+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 && src);
+
+ 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.52/innobase/trx/trx0trx.c Sun Mar 13 12:47:21 2005
+++ 1.53/innobase/trx/trx0trx.c Mon Mar 14 15:26:38 2005
@@ -164,8 +164,8 @@
trx->read_view = NULL;
/* Set X/Open XA transaction identification to NULL */
- memset(&trx->xid, 0, sizeof(trx->xid));
- trx->xid.formatID = -1;
+ trx->tmp_xid.formatID = -1;
+ trx->xid = &(trx->tmp_xid);
return(trx);
}
@@ -438,7 +438,7 @@
trx = trx_create(NULL);
trx->id = undo->trx_id;
- trx->xid = undo->xid;
+ trx->xid = &(undo->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->xid = &(undo->xid);
if (undo->state != TRX_UNDO_ACTIVE) {
@@ -1931,7 +1931,7 @@
while (trx) {
if (trx->conc_state == TRX_PREPARED) {
- xid_list[count] = trx->xid;
+ trx_copy_xid(&(xid_list[count]), trx->xid);
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -1991,11 +1991,11 @@
of gtrid_lenght+bqual_length bytes should be
the same */
- if (xid->gtrid_length == trx->xid.gtrid_length &&
- xid->bqual_length == trx->xid.bqual_length &&
- memcmp(xid->data, trx->xid.data,
- xid->gtrid_length +
- xid->bqual_length) == 0) {
+ if (xid->gtrid_length == trx->xid->gtrid_length &&
+ xid->bqual_length == trx->xid->bqual_length &&
+ memcmp(xid->data, trx->xid->data,
+ xid->gtrid_length +
+ xid->bqual_length) == 0) {
break;
}
--- 1.22/innobase/trx/trx0undo.c Sun Mar 13 12:47:21 2005
+++ 1.23/innobase/trx/trx0undo.c Mon Mar 14 15:26:38 2005
@@ -569,7 +569,7 @@
MLOG_4BYTES, mtr);
mlog_write_string(log_hdr + TRX_UNDO_XA_XID, xid->data,
- XIDDATASIZE, mtr);
+ xid->gtrid_length+xid->bqual_length, mtr);
}
/************************************************************************
@@ -589,10 +589,8 @@
xid->bqual_length = mach_read_from_4(log_hdr + TRX_UNDO_XA_BQUAL_LEN);
- for (i = 0; i < XIDDATASIZE; i++) {
- xid->data[i] = (char)mach_read_from_1(log_hdr +
- TRX_UNDO_XA_XID + i);
- }
+ memcpy(xid->data, log_hdr + TRX_UNDO_XA_XID,
+ xid->gtrid_length + xid->bqual_length);
}
/*******************************************************************
@@ -608,7 +606,7 @@
trx_upagef_t* page_hdr;
ulint free;
ulint new_free;
-
+
page_hdr = undo_page + TRX_UNDO_PAGE_HDR;
free = mach_read_from_2(page_hdr + TRX_UNDO_PAGE_FREE);
@@ -1249,8 +1247,6 @@
/* Read X/Open XA transaction identification if it exists, or
set it to NULL. */
-
- memset(&xid, 0, sizeof(xid));
xid.formatID = -1;
if (xid_exists == TRUE) {
@@ -1409,7 +1405,7 @@
undo->state = TRX_UNDO_ACTIVE;
undo->del_marks = FALSE;
undo->trx_id = trx_id;
- undo->xid = *xid;
+ trx_copy_xid(&(undo->xid), xid);
undo->dict_operation = FALSE;
@@ -1455,7 +1451,7 @@
undo->state = TRX_UNDO_ACTIVE;
undo->del_marks = FALSE;
undo->trx_id = trx_id;
- undo->xid = *xid;
+ trx_copy_xid(&(undo->xid), xid);
undo->dict_operation = FALSE;
@@ -1685,10 +1681,10 @@
#endif /* UNIV_SYNC_DEBUG */
mutex_enter(&(rseg->mutex));
- undo = trx_undo_reuse_cached(trx, rseg, type, trx->id, &trx->xid,
+ undo = trx_undo_reuse_cached(trx, rseg, type, trx->id, trx->xid,
&mtr);
if (undo == NULL) {
- undo = trx_undo_create(trx, rseg, type, trx->id, &trx->xid,
+ undo = trx_undo_create(trx, rseg, type, trx->id, trx->xid,
&mtr);
if (undo == NULL) {
/* Did not succeed */
@@ -1801,10 +1797,10 @@
seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
page_hdr = undo_page + TRX_UNDO_PAGE_HDR;
- /*------------------------------*/
+ /*--------------------------------------*/
undo->state = TRX_UNDO_PREPARED;
- undo->xid = trx->xid;
- /*------------------------------*/
+ trx_copy_xid(&(undo->xid), trx->xid);
+ /*--------------------------------------*/
mlog_write_ulint(seg_hdr + TRX_UNDO_STATE, undo->state,
MLOG_2BYTES, mtr);
--- 1.174/sql/ha_innodb.cc Sun Mar 13 12:48:40 2005
+++ 1.175/sql/ha_innodb.cc Mon Mar 14 15:26:38 2005
@@ -6316,16 +6316,16 @@
FALSE - the current SQL statement ended */
{
int error = 0;
- trx_t* trx;
+ trx_t* trx;
+ static int q = 0;
if (!thd->variables.innodb_support_xa) {
return(0);
}
- trx = check_trx_exists(thd);
-
- trx->xid=thd->transaction.xid;
+ 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
@@ -6343,14 +6343,14 @@
if (all
|| (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) {
- /* We were instructed to prepare the whole transaction, or
- this is an SQL statement end and autocommit is on */
+ /* We were instructed to prepare the whole transaction, or
+ this is an SQL statement end and autocommit is on */
- ut_ad(trx->active_trans);
+ ut_ad(trx->active_trans);
error = trx_prepare_for_mysql(trx);
} else {
- /* We just mark the SQL statement ended and do not do a
+ /* We just mark the SQL statement ended and do not do a
transaction prepare */
if (trx->auto_inc_lock) {
@@ -6371,7 +6371,7 @@
srv_active_wake_master_thread();
- return error;
+ return error;
}
/***********************************************************************
| Thread |
|---|
| • bk commit into 5.0 tree (jan:1.1814) | jan.lindstrom | 14 Mar |