Commit c894ebd6 authored by jan@hundin.mysql.fi's avatar jan@hundin.mysql.fi

Required changes to support recovery of X/Open XA in InnoDB.

parent 2c0d5bb4
......@@ -4417,8 +4417,9 @@ lock_table_queue_validate(
lock = UT_LIST_GET_FIRST(table->locks);
while (lock) {
ut_a(((lock->trx)->conc_state == TRX_ACTIVE)
|| ((lock->trx)->conc_state == TRX_COMMITTED_IN_MEMORY));
ut_a((lock->trx)->conc_state == TRX_ACTIVE ||
(lock->trx)->conc_state == TRX_PREPARED ||
(lock->trx)->conc_state == TRX_COMMITTED_IN_MEMORY);
if (!lock_get_wait(lock)) {
......@@ -4464,9 +4465,9 @@ lock_rec_queue_validate(
lock = lock_rec_get_first(rec);
while (lock) {
ut_a(lock->trx->conc_state == TRX_ACTIVE
|| lock->trx->conc_state
== TRX_COMMITTED_IN_MEMORY);
ut_a(lock->trx->conc_state == TRX_ACTIVE ||
lock->trx->conc_state == TRX_PREPARED ||
lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY);
ut_a(trx_in_trx_list(lock->trx));
......@@ -4518,8 +4519,10 @@ lock_rec_queue_validate(
lock = lock_rec_get_first(rec);
while (lock) {
ut_a(lock->trx->conc_state == TRX_ACTIVE
|| lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY);
ut_a(lock->trx->conc_state == TRX_ACTIVE ||
lock->trx->conc_state == TRX_PREPARED ||
lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY);
ut_a(trx_in_trx_list(lock->trx));
if (index) {
......@@ -4600,8 +4603,9 @@ lock_rec_validate_page(
}
ut_a(trx_in_trx_list(lock->trx));
ut_a(lock->trx->conc_state == TRX_ACTIVE
|| lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY);
ut_a(lock->trx->conc_state == TRX_ACTIVE ||
lock->trx->conc_state == TRX_PREPARED ||
lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY);
for (i = nth_bit; i < lock_rec_get_n_bits(lock); i++) {
......
......@@ -1612,12 +1612,10 @@ trx_print(
fputs(", not started", f);
break;
case TRX_ACTIVE:
case TRX_PREPARED:
fprintf(f, ", ACTIVE %lu sec",
(ulong)difftime(time(NULL), trx->start_time));
break;
case TRX_PREPARED:
fputs(", PREPARED", f);
break;
case TRX_COMMITTED_IN_MEMORY:
fputs(", COMMITTED IN MEMORY", f);
break;
......
......@@ -156,18 +156,18 @@ static int innobase_rollback_to_savepoint(THD* thd, void *savepoint);
static int innobase_savepoint(THD* thd, void *savepoint);
static handlerton innobase_hton = {
0, /* slot */
sizeof(trx_named_savept_t), /* savepoint size. TODO: use it */
0, /* slot */
sizeof(trx_named_savept_t), /* savepoint size. TODO: use it */
innobase_close_connection,
innobase_savepoint,
innobase_rollback_to_savepoint,
NULL, /* savepoint_release */
innobase_commit,
innobase_rollback,
innobase_xa_prepare, //makes flush_block_commit test to fail
NULL, /* recover */
NULL, /* commit_by_xid */
NULL, /* rollback_by_xid */
NULL, /* savepoint_release */
innobase_commit, /* commit */
innobase_rollback, /* rollback */
innobase_xa_prepare, /* prepare */
innobase_xa_recover, /* recover */
innobase_commit_by_xid, /* commit_by_xid */
innobase_rollback_by_xid, /* rollback_by_xid */
};
/*********************************************************************
......@@ -6019,36 +6019,4 @@ int innobase_rollback_by_xid(
}
}
/***********************************************************************
This function is used to test commit/rollback of XA transactions */
int innobase_xa_end(
/*================*/
THD* thd) /* in: MySQL thread handle of the user for whom
transactions should be recovered */
{
DBUG_ENTER("innobase_xa_end");
XID trx_list[100];
int trx_num, trx_num_max = 100;
int i;
XID xid;
while((trx_num = innobase_xa_recover(trx_list, trx_num_max))) {
for(i=0;i < trx_num; i++) {
xid = trx_list[i];
if ( i % 2) {
innobase_commit_by_xid(&xid);
} else {
innobase_rollback_by_xid(&xid);
}
}
}
free(trx_list);
DBUG_RETURN(0);
}
#endif /* HAVE_INNOBASE_DB */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment