diff options
author | Michael Widenius <monty@askmonty.org> | 2011-05-03 19:10:10 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-05-03 19:10:10 +0300 |
commit | 1be5462d59fa5fbd1ca92286c3a0a049c00f4bb9 (patch) | |
tree | 17ba1ed90233efa64bc83364ed1ffb74dd637ead /storage/xtradb/trx/trx0trx.c | |
parent | ce55d37929fc91b476541d3a77336a44b20317ac (diff) | |
parent | 90e058e0c623f770ee602ebab86e91303f08c90a (diff) | |
download | mariadb-git-1be5462d59fa5fbd1ca92286c3a0a049c00f4bb9.tar.gz |
Merge with MariaDB 5.1
Diffstat (limited to 'storage/xtradb/trx/trx0trx.c')
-rw-r--r-- | storage/xtradb/trx/trx0trx.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/storage/xtradb/trx/trx0trx.c b/storage/xtradb/trx/trx0trx.c index 75bbe1b342a..98bd9e4ac58 100644 --- a/storage/xtradb/trx/trx0trx.c +++ b/storage/xtradb/trx/trx0trx.c @@ -2106,18 +2106,18 @@ trx_recover_for_mysql( /*******************************************************************//** This function is used to find one X/Open XA distributed transaction which is in the prepared state -@return trx or NULL */ +@return trx or NULL; on match, the trx->xid will be invalidated */ UNIV_INTERN trx_t* trx_get_trx_by_xid( /*===============*/ - XID* xid) /*!< in: X/Open XA transaction identification */ + const XID* xid) /*!< in: X/Open XA transaction identifier */ { trx_t* trx; if (xid == NULL) { - return (NULL); + return(NULL); } mutex_enter(&kernel_mutex); @@ -2130,10 +2130,16 @@ trx_get_trx_by_xid( of gtrid_lenght+bqual_length bytes should be the same */ - if (xid->gtrid_length == trx->xid.gtrid_length + if (trx->conc_state == TRX_PREPARED + && 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) { + + /* Invalidate the XID, so that subsequent calls + will not find it. */ + memset(&trx->xid, 0, sizeof(trx->xid)); + trx->xid.formatID = -1; break; } @@ -2142,14 +2148,5 @@ trx_get_trx_by_xid( mutex_exit(&kernel_mutex); - if (trx) { - if (trx->conc_state != TRX_PREPARED) { - - return(NULL); - } - - return(trx); - } else { - return(NULL); - } + return(trx); } |