Browse Source

branches/zip:

rb://53

Improve innodb_supports_xa system variable handling and 
reduces the number of retrievals of the value from MySQL.

Approved by: Marko, over IM
pull/73/head
michael 17 years ago
parent
commit
c6227f3766
  1. 27
      handler/ha_innodb.cc
  2. 10
      include/ha_prototypes.h
  3. 9
      trx/trx0trx.c

27
handler/ha_innodb.cc

@ -607,6 +607,19 @@ thd_is_select(
return(thd_sql_command((const THD*) thd) == SQLCOM_SELECT);
}
/**********************************************************************
Returns true if the thread has XA support. */
extern "C" UNIV_INTERN
ibool
thd_supports_xa(
/*============*/
/* out: true if thd has XA support */
void* thd) /* in: thread handle (THD*), or NULL to query
the global innodb_supports_xa */
{
return(THDVAR((THD*) thd, support_xa));
}
/**********************************************************************
Returns true if the thread is executing in innodb_strict_mode. */
extern "C" UNIV_INTERN
@ -1238,9 +1251,6 @@ check_trx_exists(
trx->mysql_thd = thd;
trx->mysql_query_str = thd_query(thd);
/* Update the info whether we should skip XA steps that eat
CPU time */
trx->support_xa = THDVAR(thd, support_xa);
} else {
if (trx->magic_n != TRX_MAGIC_N) {
mem_analyze_corruption(trx);
@ -2299,9 +2309,6 @@ innobase_commit(
trx = check_trx_exists(thd);
/* Update the info whether we should skip XA steps that eat CPU time */
trx->support_xa = THDVAR(thd, support_xa);
/* Since we will reserve the kernel mutex, we have to release
the search system latch first to obey the latching order. */
@ -2428,9 +2435,6 @@ innobase_rollback(
trx = check_trx_exists(thd);
/* Update the info whether we should skip XA steps that eat CPU time */
trx->support_xa = THDVAR(thd, support_xa);
/* Release a possible FIFO ticket and search latch. Since we will
reserve the kernel mutex, we have to release the search system latch
first to obey the latching order. */
@ -8843,7 +8847,10 @@ innobase_xa_prepare(
trx->active_trans = 2;
}
if (!THDVAR(thd, support_xa)) {
/* we use support_xa value as it was seen at transaction start
time, not the current session variable value. Any possible changes
to the session variable take effect only in the next transaction */
if (!trx->support_xa) {
return(0);
}

10
include/ha_prototypes.h

@ -206,6 +206,16 @@ innobase_get_charset(
/* out: connection character set */
void* mysql_thd); /* in: MySQL thread handle */
/**********************************************************************
Returns true if the thread supports XA,
global value of innodb_supports_xa if thd is NULL. */
ibool
thd_supports_xa(
/*============*/
/* out: true if thd supports XA */
void* thd); /* in: thread handle (THD*) */
/**********************************************************************
Returns true if the thread is executing in innodb_strict_mode. */

9
trx/trx0trx.c

@ -694,6 +694,15 @@ trx_start(
{
ibool ret;
/* Update the info whether we should skip XA steps that eat CPU time
For the duration of the transaction trx->support_xa is not reread
from thd so any changes in the value take effect in the next
transaction. This is to avoid a scenario where some undo
generated by a transaction, has XA stuff, and other undo,
generated by the same transaction, doesn't
*/
trx->support_xa = thd_supports_xa(trx->mysql_thd);
mutex_enter(&kernel_mutex);
ret = trx_start_low(trx, rseg_id);

Loading…
Cancel
Save