2005-10-27 07:29:40 +00:00
|
|
|
/******************************************************
|
|
|
|
Transaction rollback
|
|
|
|
|
|
|
|
(c) 1996 Innobase Oy
|
|
|
|
|
|
|
|
Created 3/26/1996 Heikki Tuuri
|
|
|
|
*******************************************************/
|
|
|
|
|
|
|
|
#include "trx0roll.h"
|
|
|
|
|
|
|
|
#ifdef UNIV_NONINL
|
|
|
|
#include "trx0roll.ic"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "fsp0fsp.h"
|
|
|
|
#include "mach0data.h"
|
|
|
|
#include "trx0rseg.h"
|
|
|
|
#include "trx0trx.h"
|
|
|
|
#include "trx0undo.h"
|
|
|
|
#include "trx0rec.h"
|
|
|
|
#include "que0que.h"
|
|
|
|
#include "usr0sess.h"
|
|
|
|
#include "srv0que.h"
|
|
|
|
#include "srv0start.h"
|
|
|
|
#include "row0undo.h"
|
|
|
|
#include "row0mysql.h"
|
|
|
|
#include "lock0lock.h"
|
|
|
|
#include "pars0pars.h"
|
|
|
|
|
|
|
|
/* This many pages must be undone before a truncate is tried within rollback */
|
|
|
|
#define TRX_ROLL_TRUNC_THRESHOLD 1
|
|
|
|
|
|
|
|
/* In crash recovery, the current trx to be rolled back */
|
2007-10-29 15:32:19 +00:00
|
|
|
static trx_t* trx_roll_crash_recv_trx = NULL;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* In crash recovery we set this to the undo n:o of the current trx to be
|
|
|
|
rolled back. Then we can print how many % the rollback has progressed. */
|
2008-03-17 14:19:04 +00:00
|
|
|
static ib_int64_t trx_roll_max_undo_no;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* Auxiliary variable which tells the previous progress % we printed */
|
2007-10-29 15:32:19 +00:00
|
|
|
static ulint trx_roll_progress_printed_pct;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Rollback a transaction used in MySQL. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
int
|
|
|
|
trx_general_rollback_for_mysql(
|
|
|
|
/*===========================*/
|
|
|
|
/* out: error code or DB_SUCCESS */
|
|
|
|
trx_t* trx, /* in: transaction handle */
|
|
|
|
ibool partial,/* in: TRUE if partial rollback requested */
|
|
|
|
trx_savept_t* savept) /* in: pointer to savepoint undo number, if
|
|
|
|
partial rollback requested */
|
|
|
|
{
|
|
|
|
#ifndef UNIV_HOTBACKUP
|
|
|
|
mem_heap_t* heap;
|
|
|
|
que_thr_t* thr;
|
|
|
|
roll_node_t* roll_node;
|
|
|
|
|
|
|
|
/* Tell Innobase server that there might be work for
|
|
|
|
utility threads: */
|
|
|
|
|
|
|
|
srv_active_wake_master_thread();
|
|
|
|
|
|
|
|
trx_start_if_not_started(trx);
|
|
|
|
|
|
|
|
heap = mem_heap_create(512);
|
|
|
|
|
|
|
|
roll_node = roll_node_create(heap);
|
|
|
|
|
|
|
|
roll_node->partial = partial;
|
|
|
|
|
|
|
|
if (partial) {
|
|
|
|
roll_node->savept = *savept;
|
|
|
|
}
|
|
|
|
|
|
|
|
trx->error_state = DB_SUCCESS;
|
|
|
|
|
|
|
|
thr = pars_complete_graph_for_exec(roll_node, trx, heap);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_a(thr == que_fork_start_command(que_node_get_parent(thr)));
|
|
|
|
que_run_threads(thr);
|
|
|
|
|
|
|
|
mutex_enter(&kernel_mutex);
|
|
|
|
|
|
|
|
while (trx->que_state != TRX_QUE_RUNNING) {
|
|
|
|
|
|
|
|
mutex_exit(&kernel_mutex);
|
|
|
|
|
|
|
|
os_thread_sleep(100000);
|
|
|
|
|
|
|
|
mutex_enter(&kernel_mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
mutex_exit(&kernel_mutex);
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
mem_heap_free(heap);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
ut_a(trx->error_state == DB_SUCCESS);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* Tell Innobase server that there might be work for
|
|
|
|
utility threads: */
|
|
|
|
|
|
|
|
srv_active_wake_master_thread();
|
|
|
|
|
|
|
|
return((int) trx->error_state);
|
|
|
|
#else /* UNIV_HOTBACKUP */
|
|
|
|
/* This function depends on MySQL code that is not included in
|
|
|
|
InnoDB Hot Backup builds. Besides, this function should never
|
|
|
|
be called in InnoDB Hot Backup. */
|
|
|
|
ut_error;
|
2006-02-23 19:25:29 +00:00
|
|
|
return(DB_FAIL);
|
2005-10-27 07:29:40 +00:00
|
|
|
#endif /* UNIV_HOTBACKUP */
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Rollback a transaction used in MySQL. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
int
|
|
|
|
trx_rollback_for_mysql(
|
|
|
|
/*===================*/
|
|
|
|
/* out: error code or DB_SUCCESS */
|
|
|
|
trx_t* trx) /* in: transaction handle */
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
|
|
|
if (trx->conc_state == TRX_NOT_STARTED) {
|
|
|
|
|
|
|
|
return(DB_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
trx->op_info = "rollback";
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2007-01-02 14:36:59 +00:00
|
|
|
/* If we are doing the XA recovery of prepared transactions, then
|
|
|
|
the transaction object does not have an InnoDB session object, and we
|
|
|
|
set a dummy session that we use for all MySQL transactions. */
|
|
|
|
|
|
|
|
err = trx_general_rollback_for_mysql(trx, FALSE, NULL);
|
2007-06-21 12:02:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
trx->op_info = "";
|
|
|
|
|
|
|
|
return(err);
|
2006-02-23 19:25:29 +00:00
|
|
|
}
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Rollback the latest SQL statement for MySQL. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
int
|
|
|
|
trx_rollback_last_sql_stat_for_mysql(
|
|
|
|
/*=================================*/
|
|
|
|
/* out: error code or DB_SUCCESS */
|
|
|
|
trx_t* trx) /* in: transaction handle */
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
|
|
|
if (trx->conc_state == TRX_NOT_STARTED) {
|
|
|
|
|
|
|
|
return(DB_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
trx->op_info = "rollback of SQL statement";
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
err = trx_general_rollback_for_mysql(trx, TRUE,
|
2006-08-29 09:30:31 +00:00
|
|
|
&(trx->last_sql_stat_start));
|
2005-10-27 07:29:40 +00:00
|
|
|
/* The following call should not be needed, but we play safe: */
|
|
|
|
trx_mark_sql_stat_end(trx);
|
|
|
|
|
|
|
|
trx->op_info = "";
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
return(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Frees savepoint structs. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
trx_roll_savepoints_free(
|
|
|
|
/*=====================*/
|
|
|
|
trx_t* trx, /* in: transaction handle */
|
|
|
|
trx_named_savept_t* savep) /* in: free all savepoints > this one;
|
|
|
|
if this is NULL, free all savepoints
|
|
|
|
of trx */
|
|
|
|
{
|
|
|
|
trx_named_savept_t* next_savep;
|
|
|
|
|
|
|
|
if (savep == NULL) {
|
2006-02-23 19:25:29 +00:00
|
|
|
savep = UT_LIST_GET_FIRST(trx->trx_savepoints);
|
2005-10-27 07:29:40 +00:00
|
|
|
} else {
|
2006-02-23 19:25:29 +00:00
|
|
|
savep = UT_LIST_GET_NEXT(trx_savepoints, savep);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
while (savep != NULL) {
|
2006-02-23 19:25:29 +00:00
|
|
|
next_savep = UT_LIST_GET_NEXT(trx_savepoints, savep);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
UT_LIST_REMOVE(trx_savepoints, trx->trx_savepoints, savep);
|
|
|
|
mem_free(savep->name);
|
|
|
|
mem_free(savep);
|
|
|
|
|
|
|
|
savep = next_savep;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Rolls back a transaction back to a named savepoint. Modifications after the
|
|
|
|
savepoint are undone but InnoDB does NOT release the corresponding locks
|
|
|
|
which are stored in memory. If a lock is 'implicit', that is, a new inserted
|
2006-02-23 19:25:29 +00:00
|
|
|
row holds a lock where the lock information is carried by the trx id stored in
|
2005-10-27 07:29:40 +00:00
|
|
|
the row, these locks are naturally released in the rollback. Savepoints which
|
|
|
|
were set after this savepoint are deleted. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
ulint
|
|
|
|
trx_rollback_to_savepoint_for_mysql(
|
|
|
|
/*================================*/
|
|
|
|
/* out: if no savepoint
|
|
|
|
of the name found then
|
|
|
|
DB_NO_SAVEPOINT,
|
|
|
|
otherwise DB_SUCCESS */
|
|
|
|
trx_t* trx, /* in: transaction handle */
|
|
|
|
const char* savepoint_name, /* in: savepoint name */
|
2008-03-17 14:19:04 +00:00
|
|
|
ib_int64_t* mysql_binlog_cache_pos) /* out: the MySQL binlog cache
|
2005-10-27 07:29:40 +00:00
|
|
|
position corresponding to this
|
|
|
|
savepoint; MySQL needs this
|
|
|
|
information to remove the
|
|
|
|
binlog entries of the queries
|
|
|
|
executed after the savepoint */
|
|
|
|
{
|
|
|
|
trx_named_savept_t* savep;
|
|
|
|
ulint err;
|
|
|
|
|
|
|
|
savep = UT_LIST_GET_FIRST(trx->trx_savepoints);
|
|
|
|
|
|
|
|
while (savep != NULL) {
|
2006-02-23 19:25:29 +00:00
|
|
|
if (0 == ut_strcmp(savep->name, savepoint_name)) {
|
|
|
|
/* Found */
|
2005-10-27 07:29:40 +00:00
|
|
|
break;
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
savep = UT_LIST_GET_NEXT(trx_savepoints, savep);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
if (savep == NULL) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
return(DB_NO_SAVEPOINT);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (trx->conc_state == TRX_NOT_STARTED) {
|
|
|
|
ut_print_timestamp(stderr);
|
2006-02-27 09:33:26 +00:00
|
|
|
fputs(" InnoDB: Error: transaction has a savepoint ", stderr);
|
2006-06-13 20:23:26 +00:00
|
|
|
ut_print_name(stderr, trx, FALSE, savep->name);
|
2005-10-27 07:29:40 +00:00
|
|
|
fputs(" though it is not started\n", stderr);
|
2006-02-23 19:25:29 +00:00
|
|
|
return(DB_ERROR);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* We can now free all savepoints strictly later than this one */
|
|
|
|
|
|
|
|
trx_roll_savepoints_free(trx, savep);
|
|
|
|
|
|
|
|
*mysql_binlog_cache_pos = savep->mysql_binlog_cache_pos;
|
|
|
|
|
|
|
|
trx->op_info = "rollback to a savepoint";
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
err = trx_general_rollback_for_mysql(trx, TRUE, &(savep->savept));
|
|
|
|
|
|
|
|
/* Store the current undo_no of the transaction so that we know where
|
|
|
|
to roll back if we have to roll back the next SQL statement: */
|
|
|
|
|
|
|
|
trx_mark_sql_stat_end(trx);
|
|
|
|
|
|
|
|
trx->op_info = "";
|
|
|
|
|
|
|
|
return(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Creates a named savepoint. If the transaction is not yet started, starts it.
|
|
|
|
If there is already a savepoint of the same name, this call erases that old
|
|
|
|
savepoint and replaces it with a new. Savepoints are deleted in a transaction
|
|
|
|
commit or rollback. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
ulint
|
|
|
|
trx_savepoint_for_mysql(
|
|
|
|
/*====================*/
|
|
|
|
/* out: always DB_SUCCESS */
|
|
|
|
trx_t* trx, /* in: transaction handle */
|
|
|
|
const char* savepoint_name, /* in: savepoint name */
|
2008-03-17 14:19:04 +00:00
|
|
|
ib_int64_t binlog_cache_pos) /* in: MySQL binlog cache
|
2005-10-27 07:29:40 +00:00
|
|
|
position corresponding to this
|
|
|
|
connection at the time of the
|
|
|
|
savepoint */
|
|
|
|
{
|
|
|
|
trx_named_savept_t* savep;
|
|
|
|
|
|
|
|
ut_a(trx);
|
|
|
|
ut_a(savepoint_name);
|
|
|
|
|
|
|
|
trx_start_if_not_started(trx);
|
|
|
|
|
|
|
|
savep = UT_LIST_GET_FIRST(trx->trx_savepoints);
|
|
|
|
|
|
|
|
while (savep != NULL) {
|
2006-02-23 19:25:29 +00:00
|
|
|
if (0 == ut_strcmp(savep->name, savepoint_name)) {
|
|
|
|
/* Found */
|
2005-10-27 07:29:40 +00:00
|
|
|
break;
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
savep = UT_LIST_GET_NEXT(trx_savepoints, savep);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (savep) {
|
2006-02-23 19:25:29 +00:00
|
|
|
/* There is a savepoint with the same name: free that */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
UT_LIST_REMOVE(trx_savepoints, trx->trx_savepoints, savep);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
mem_free(savep->name);
|
|
|
|
mem_free(savep);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create a new savepoint and add it as the last in the list */
|
|
|
|
|
|
|
|
savep = mem_alloc(sizeof(trx_named_savept_t));
|
|
|
|
|
|
|
|
savep->name = mem_strdup(savepoint_name);
|
|
|
|
|
|
|
|
savep->savept = trx_savept_take(trx);
|
|
|
|
|
|
|
|
savep->mysql_binlog_cache_pos = binlog_cache_pos;
|
|
|
|
|
|
|
|
UT_LIST_ADD_LAST(trx_savepoints, trx->trx_savepoints, savep);
|
|
|
|
|
|
|
|
return(DB_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Releases a named savepoint. Savepoints which
|
|
|
|
were set after this savepoint are deleted. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
ulint
|
|
|
|
trx_release_savepoint_for_mysql(
|
|
|
|
/*============================*/
|
|
|
|
/* out: if no savepoint
|
|
|
|
of the name found then
|
|
|
|
DB_NO_SAVEPOINT,
|
|
|
|
otherwise DB_SUCCESS */
|
|
|
|
trx_t* trx, /* in: transaction handle */
|
|
|
|
const char* savepoint_name) /* in: savepoint name */
|
|
|
|
{
|
|
|
|
trx_named_savept_t* savep;
|
|
|
|
|
|
|
|
savep = UT_LIST_GET_FIRST(trx->trx_savepoints);
|
|
|
|
|
|
|
|
while (savep != NULL) {
|
2006-02-23 19:25:29 +00:00
|
|
|
if (0 == ut_strcmp(savep->name, savepoint_name)) {
|
|
|
|
/* Found */
|
2005-10-27 07:29:40 +00:00
|
|
|
break;
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
savep = UT_LIST_GET_NEXT(trx_savepoints, savep);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
if (savep == NULL) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
return(DB_NO_SAVEPOINT);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* We can now free all savepoints strictly later than this one */
|
|
|
|
|
|
|
|
trx_roll_savepoints_free(trx, savep);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/* Now we can free this savepoint too */
|
|
|
|
|
|
|
|
UT_LIST_REMOVE(trx_savepoints, trx->trx_savepoints, savep);
|
|
|
|
|
|
|
|
mem_free(savep->name);
|
|
|
|
mem_free(savep);
|
|
|
|
|
|
|
|
return(DB_SUCCESS);
|
|
|
|
}
|
|
|
|
|
branches/zip: In the rollback of incomplete transactions after crash
recovery, tolerate clustered index records whose externally stored
columns have not been written. This should remove the assertion failures
that were reported as Mantis issue#58, issue#62, issue#64.
trx_is_recv(): New function: TRUE if this transaction is rolling back
an incomplete transaction in crash recovery.
enum trx_rbmode: Rollback modes: no rollback, normal rollback, crash recovery.
btr_cur_pessimistic_delete(), btr_free_externally_stored_field(),
btr_rec_free_externally_stored_fields():
Replace the ibool parameter with enum trx_rbmode.
btr_free_externally_stored_field(): If field_ref is zero, return
but assert ut_a(rbmode == RB_RECOVERY). Unless InnoDB has crashed
while inserting a clustered index record, field_ref should not be zero.
btr_rec_free_updated_extern_fields(): Add the parameter enum trx_rbmode.
btr_cur_pessimistic_update(): Pass the rbmode parameter to
btr_rec_free_updated_extern_fields().
row_undo_ins(), row_undo_mod_upd_del_sec(): If row_build_index_entry()
fails, assert trx_is_recv() and skip this secondary index.
row_undo_mod_upd_del_sec(): Empty the heap at the end of each loop
iteration in order to conserve memory and to reduce the number of
low-level memory allocations.
2008-08-06 08:48:34 +00:00
|
|
|
/***********************************************************************
|
|
|
|
Determines if this transaction is rolling back an incomplete transaction
|
|
|
|
in crash recovery. */
|
|
|
|
UNIV_INTERN
|
|
|
|
ibool
|
|
|
|
trx_is_recv(
|
|
|
|
/*========*/
|
|
|
|
/* out: TRUE if trx is an incomplete
|
|
|
|
transaction that is being rolled back
|
|
|
|
in crash recovery */
|
|
|
|
const trx_t* trx) /* in: transaction */
|
|
|
|
{
|
|
|
|
return(trx == trx_roll_crash_recv_trx);
|
|
|
|
}
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/***********************************************************************
|
|
|
|
Returns a transaction savepoint taken at this point in time. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
trx_savept_t
|
|
|
|
trx_savept_take(
|
|
|
|
/*============*/
|
|
|
|
/* out: savepoint */
|
|
|
|
trx_t* trx) /* in: transaction */
|
|
|
|
{
|
|
|
|
trx_savept_t savept;
|
|
|
|
|
|
|
|
savept.least_undo_no = trx->undo_no;
|
|
|
|
|
|
|
|
return(savept);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2007-06-21 12:02:29 +00:00
|
|
|
Roll back an active transaction. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
trx_rollback_active(
|
|
|
|
/*================*/
|
|
|
|
trx_t* trx) /* in/out: transaction */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
|
|
|
mem_heap_t* heap;
|
|
|
|
que_fork_t* fork;
|
|
|
|
que_thr_t* thr;
|
|
|
|
roll_node_t* roll_node;
|
|
|
|
dict_table_t* table;
|
2008-03-17 14:19:04 +00:00
|
|
|
ib_int64_t rows_to_undo;
|
2005-10-27 07:29:40 +00:00
|
|
|
const char* unit = "";
|
2007-04-04 11:05:33 +00:00
|
|
|
ibool dictionary_locked = FALSE;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
heap = mem_heap_create(512);
|
|
|
|
|
|
|
|
fork = que_fork_create(NULL, NULL, QUE_FORK_RECOVERY, heap);
|
|
|
|
fork->trx = trx;
|
|
|
|
|
|
|
|
thr = que_thr_create(fork, heap);
|
|
|
|
|
|
|
|
roll_node = roll_node_create(heap);
|
|
|
|
|
|
|
|
thr->child = roll_node;
|
|
|
|
roll_node->common.parent = thr;
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
mutex_enter(&kernel_mutex);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
trx->graph = fork;
|
|
|
|
|
|
|
|
ut_a(thr == que_fork_start_command(fork));
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
trx_roll_crash_recv_trx = trx;
|
|
|
|
trx_roll_max_undo_no = ut_conv_dulint_to_longlong(trx->undo_no);
|
|
|
|
trx_roll_progress_printed_pct = 0;
|
|
|
|
rows_to_undo = trx_roll_max_undo_no;
|
|
|
|
|
|
|
|
if (rows_to_undo > 1000000000) {
|
|
|
|
rows_to_undo = rows_to_undo / 1000000;
|
|
|
|
unit = "M";
|
|
|
|
}
|
|
|
|
|
|
|
|
ut_print_timestamp(stderr);
|
|
|
|
fprintf(stderr,
|
2007-12-20 14:08:16 +00:00
|
|
|
" InnoDB: Rolling back trx with id " TRX_ID_FMT ", %lu%s"
|
2006-08-29 09:30:31 +00:00
|
|
|
" rows to undo\n",
|
2007-12-20 14:08:16 +00:00
|
|
|
TRX_ID_PREP_PRINTF(trx->id),
|
2006-08-29 09:30:31 +00:00
|
|
|
(ulong) rows_to_undo, unit);
|
2005-10-27 07:29:40 +00:00
|
|
|
mutex_exit(&kernel_mutex);
|
|
|
|
|
|
|
|
trx->mysql_thread_id = os_thread_get_curr_id();
|
|
|
|
|
|
|
|
trx->mysql_process_no = os_proc_get_number();
|
|
|
|
|
2007-10-19 10:52:25 +00:00
|
|
|
if (trx_get_dict_operation(trx) != TRX_DICT_OP_NONE) {
|
2005-10-27 07:29:40 +00:00
|
|
|
row_mysql_lock_data_dictionary(trx);
|
2007-04-04 11:05:33 +00:00
|
|
|
dictionary_locked = TRUE;
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
que_run_threads(thr);
|
|
|
|
|
|
|
|
mutex_enter(&kernel_mutex);
|
|
|
|
|
|
|
|
while (trx->que_state != TRX_QUE_RUNNING) {
|
|
|
|
|
|
|
|
mutex_exit(&kernel_mutex);
|
|
|
|
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Waiting for rollback of trx id %lu to end\n",
|
|
|
|
(ulong) ut_dulint_get_low(trx->id));
|
2005-10-27 07:29:40 +00:00
|
|
|
os_thread_sleep(100000);
|
|
|
|
|
|
|
|
mutex_enter(&kernel_mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
mutex_exit(&kernel_mutex);
|
|
|
|
|
2007-10-19 10:52:25 +00:00
|
|
|
if (trx_get_dict_operation(trx) != TRX_DICT_OP_NONE
|
|
|
|
&& !ut_dulint_is_zero(trx->table_id)) {
|
2007-04-04 11:05:33 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/* If the transaction was for a dictionary operation, we
|
|
|
|
drop the relevant table, if it still exists */
|
|
|
|
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Dropping table with id %lu %lu"
|
|
|
|
" in recovery if it exists\n",
|
2005-10-27 07:29:40 +00:00
|
|
|
(ulong) ut_dulint_get_high(trx->table_id),
|
|
|
|
(ulong) ut_dulint_get_low(trx->table_id));
|
|
|
|
|
2006-05-08 06:18:59 +00:00
|
|
|
table = dict_table_get_on_id_low(trx->table_id);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
if (table) {
|
2007-06-21 12:02:29 +00:00
|
|
|
ulint err;
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
fputs("InnoDB: Table found: dropping table ", stderr);
|
2006-06-13 20:23:26 +00:00
|
|
|
ut_print_name(stderr, trx, TRUE, table->name);
|
2005-10-27 07:29:40 +00:00
|
|
|
fputs(" in recovery\n", stderr);
|
|
|
|
|
|
|
|
err = row_drop_table_for_mysql(table->name, trx, TRUE);
|
2008-10-08 08:54:16 +00:00
|
|
|
trx_commit_for_mysql(trx);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
ut_a(err == (int) DB_SUCCESS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-04 11:05:33 +00:00
|
|
|
if (dictionary_locked) {
|
2005-10-27 07:29:40 +00:00
|
|
|
row_mysql_unlock_data_dictionary(trx);
|
|
|
|
}
|
|
|
|
|
2007-12-20 14:08:16 +00:00
|
|
|
fprintf(stderr, "\nInnoDB: Rolling back of trx id " TRX_ID_FMT
|
|
|
|
" completed\n",
|
|
|
|
TRX_ID_PREP_PRINTF(trx->id));
|
2005-10-27 07:29:40 +00:00
|
|
|
mem_heap_free(heap);
|
|
|
|
|
|
|
|
trx_roll_crash_recv_trx = NULL;
|
2007-06-21 12:02:29 +00:00
|
|
|
}
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2007-06-21 12:02:29 +00:00
|
|
|
/***********************************************************************
|
2007-10-30 08:25:01 +00:00
|
|
|
Rollback or clean up any incomplete transactions which were
|
|
|
|
encountered in crash recovery. If the transaction already was
|
|
|
|
committed, then we clean up a possible insert undo log. If the
|
|
|
|
transaction was not yet committed, then we roll it back.
|
2007-06-21 12:02:29 +00:00
|
|
|
Note: this is done in a background thread. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2007-06-21 12:02:29 +00:00
|
|
|
os_thread_ret_t
|
2007-10-30 08:25:01 +00:00
|
|
|
trx_rollback_or_clean_all_recovered(
|
|
|
|
/*================================*/
|
2007-06-21 12:02:29 +00:00
|
|
|
/* out: a dummy parameter */
|
|
|
|
void* arg __attribute__((unused)))
|
|
|
|
/* in: a dummy parameter required by
|
|
|
|
os_thread_create */
|
|
|
|
{
|
|
|
|
trx_t* trx;
|
|
|
|
|
2007-10-29 15:32:19 +00:00
|
|
|
mutex_enter(&kernel_mutex);
|
|
|
|
|
2007-06-21 12:02:29 +00:00
|
|
|
if (UT_LIST_GET_FIRST(trx_sys->trx_list)) {
|
|
|
|
|
|
|
|
fprintf(stderr,
|
|
|
|
"InnoDB: Starting in background the rollback"
|
|
|
|
" of uncommitted transactions\n");
|
|
|
|
} else {
|
|
|
|
goto leave_function;
|
|
|
|
}
|
2007-11-02 12:53:06 +00:00
|
|
|
|
|
|
|
mutex_exit(&kernel_mutex);
|
|
|
|
|
2007-06-21 12:02:29 +00:00
|
|
|
loop:
|
2007-11-02 12:53:06 +00:00
|
|
|
mutex_enter(&kernel_mutex);
|
|
|
|
|
2007-06-21 12:02:29 +00:00
|
|
|
for (trx = UT_LIST_GET_FIRST(trx_sys->trx_list); trx;
|
|
|
|
trx = UT_LIST_GET_NEXT(trx_list, trx)) {
|
2007-10-29 15:32:19 +00:00
|
|
|
if (!trx->is_recovered) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2007-06-21 12:02:29 +00:00
|
|
|
switch (trx->conc_state) {
|
|
|
|
case TRX_NOT_STARTED:
|
|
|
|
case TRX_PREPARED:
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case TRX_COMMITTED_IN_MEMORY:
|
|
|
|
mutex_exit(&kernel_mutex);
|
|
|
|
fprintf(stderr,
|
2007-12-20 14:08:16 +00:00
|
|
|
"InnoDB: Cleaning up trx with id "
|
|
|
|
TRX_ID_FMT "\n",
|
|
|
|
TRX_ID_PREP_PRINTF(trx->id));
|
2007-06-21 12:02:29 +00:00
|
|
|
trx_cleanup_at_db_startup(trx);
|
|
|
|
goto loop;
|
|
|
|
|
|
|
|
case TRX_ACTIVE:
|
|
|
|
mutex_exit(&kernel_mutex);
|
|
|
|
trx_rollback_active(trx);
|
|
|
|
goto loop;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ut_print_timestamp(stderr);
|
|
|
|
fprintf(stderr,
|
|
|
|
" InnoDB: Rollback of non-prepared transactions completed\n");
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
leave_function:
|
2007-10-29 15:32:19 +00:00
|
|
|
mutex_exit(&kernel_mutex);
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/* We count the number of threads in os_thread_exit(). A created
|
|
|
|
thread should always use that to exit and not use return() to exit. */
|
|
|
|
|
|
|
|
os_thread_exit(NULL);
|
|
|
|
|
2006-05-08 06:18:59 +00:00
|
|
|
OS_THREAD_DUMMY_RETURN;
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/***********************************************************************
|
|
|
|
Creates an undo number array. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
trx_undo_arr_t*
|
|
|
|
trx_undo_arr_create(void)
|
|
|
|
/*=====================*/
|
|
|
|
{
|
|
|
|
trx_undo_arr_t* arr;
|
|
|
|
mem_heap_t* heap;
|
|
|
|
ulint i;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
heap = mem_heap_create(1024);
|
|
|
|
|
|
|
|
arr = mem_heap_alloc(heap, sizeof(trx_undo_arr_t));
|
|
|
|
|
|
|
|
arr->infos = mem_heap_alloc(heap, sizeof(trx_undo_inf_t)
|
2006-08-29 09:30:31 +00:00
|
|
|
* UNIV_MAX_PARALLELISM);
|
2005-10-27 07:29:40 +00:00
|
|
|
arr->n_cells = UNIV_MAX_PARALLELISM;
|
|
|
|
arr->n_used = 0;
|
|
|
|
|
|
|
|
arr->heap = heap;
|
|
|
|
|
|
|
|
for (i = 0; i < UNIV_MAX_PARALLELISM; i++) {
|
|
|
|
|
|
|
|
(trx_undo_arr_get_nth_info(arr, i))->in_use = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return(arr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Frees an undo number array. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
trx_undo_arr_free(
|
|
|
|
/*==============*/
|
|
|
|
trx_undo_arr_t* arr) /* in: undo number array */
|
|
|
|
{
|
|
|
|
ut_ad(arr->n_used == 0);
|
|
|
|
|
|
|
|
mem_heap_free(arr->heap);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Stores info of an undo log record to the array if it is not stored yet. */
|
|
|
|
static
|
|
|
|
ibool
|
|
|
|
trx_undo_arr_store_info(
|
|
|
|
/*====================*/
|
|
|
|
/* out: FALSE if the record already existed in the
|
|
|
|
array */
|
|
|
|
trx_t* trx, /* in: transaction */
|
|
|
|
dulint undo_no)/* in: undo number */
|
|
|
|
{
|
|
|
|
trx_undo_inf_t* cell;
|
|
|
|
trx_undo_inf_t* stored_here;
|
|
|
|
trx_undo_arr_t* arr;
|
|
|
|
ulint n_used;
|
|
|
|
ulint n;
|
|
|
|
ulint i;
|
|
|
|
|
|
|
|
n = 0;
|
|
|
|
arr = trx->undo_no_arr;
|
|
|
|
n_used = arr->n_used;
|
|
|
|
stored_here = NULL;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
for (i = 0;; i++) {
|
|
|
|
cell = trx_undo_arr_get_nth_info(arr, i);
|
|
|
|
|
|
|
|
if (!cell->in_use) {
|
|
|
|
if (!stored_here) {
|
|
|
|
/* Not in use, we may store here */
|
|
|
|
cell->undo_no = undo_no;
|
|
|
|
cell->in_use = TRUE;
|
|
|
|
|
|
|
|
arr->n_used++;
|
|
|
|
|
|
|
|
stored_here = cell;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
n++;
|
|
|
|
|
|
|
|
if (0 == ut_dulint_cmp(cell->undo_no, undo_no)) {
|
|
|
|
|
|
|
|
if (stored_here) {
|
|
|
|
stored_here->in_use = FALSE;
|
|
|
|
ut_ad(arr->n_used > 0);
|
|
|
|
arr->n_used--;
|
|
|
|
}
|
|
|
|
|
|
|
|
ut_ad(arr->n_used == n_used);
|
|
|
|
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
if (n == n_used && stored_here) {
|
|
|
|
|
|
|
|
ut_ad(arr->n_used == 1 + n_used);
|
|
|
|
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Removes an undo number from the array. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
trx_undo_arr_remove_info(
|
|
|
|
/*=====================*/
|
|
|
|
trx_undo_arr_t* arr, /* in: undo number array */
|
|
|
|
dulint undo_no)/* in: undo number */
|
|
|
|
{
|
|
|
|
trx_undo_inf_t* cell;
|
|
|
|
ulint n_used;
|
|
|
|
ulint n;
|
|
|
|
ulint i;
|
|
|
|
|
|
|
|
n_used = arr->n_used;
|
|
|
|
n = 0;
|
|
|
|
|
|
|
|
for (i = 0;; i++) {
|
|
|
|
cell = trx_undo_arr_get_nth_info(arr, i);
|
|
|
|
|
|
|
|
if (cell->in_use
|
2006-08-29 09:30:31 +00:00
|
|
|
&& 0 == ut_dulint_cmp(cell->undo_no, undo_no)) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
cell->in_use = FALSE;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_ad(arr->n_used > 0);
|
|
|
|
|
|
|
|
arr->n_used--;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Gets the biggest undo number in an array. */
|
|
|
|
static
|
|
|
|
dulint
|
|
|
|
trx_undo_arr_get_biggest(
|
|
|
|
/*=====================*/
|
|
|
|
/* out: biggest value, ut_dulint_zero if
|
|
|
|
the array is empty */
|
|
|
|
trx_undo_arr_t* arr) /* in: undo number array */
|
|
|
|
{
|
|
|
|
trx_undo_inf_t* cell;
|
|
|
|
ulint n_used;
|
|
|
|
dulint biggest;
|
|
|
|
ulint n;
|
|
|
|
ulint i;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
n = 0;
|
|
|
|
n_used = arr->n_used;
|
|
|
|
biggest = ut_dulint_zero;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
for (i = 0;; i++) {
|
|
|
|
cell = trx_undo_arr_get_nth_info(arr, i);
|
|
|
|
|
|
|
|
if (cell->in_use) {
|
|
|
|
n++;
|
|
|
|
if (ut_dulint_cmp(cell->undo_no, biggest) > 0) {
|
|
|
|
|
|
|
|
biggest = cell->undo_no;
|
|
|
|
}
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
if (n == n_used) {
|
|
|
|
return(biggest);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
Tries truncate the undo logs. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
trx_roll_try_truncate(
|
|
|
|
/*==================*/
|
|
|
|
trx_t* trx) /* in: transaction */
|
|
|
|
{
|
|
|
|
trx_undo_arr_t* arr;
|
|
|
|
dulint limit;
|
|
|
|
dulint biggest;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_ad(mutex_own(&(trx->undo_mutex)));
|
|
|
|
ut_ad(mutex_own(&((trx->rseg)->mutex)));
|
|
|
|
|
|
|
|
trx->pages_undone = 0;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
arr = trx->undo_no_arr;
|
|
|
|
|
|
|
|
limit = trx->undo_no;
|
|
|
|
|
|
|
|
if (arr->n_used > 0) {
|
|
|
|
biggest = trx_undo_arr_get_biggest(arr);
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
if (ut_dulint_cmp(biggest, limit) >= 0) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
limit = ut_dulint_add(biggest, 1);
|
|
|
|
}
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (trx->insert_undo) {
|
|
|
|
trx_undo_truncate_end(trx, trx->insert_undo, limit);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (trx->update_undo) {
|
|
|
|
trx_undo_truncate_end(trx, trx->update_undo, limit);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
Pops the topmost undo log record in a single undo log and updates the info
|
|
|
|
about the topmost record in the undo log memory struct. */
|
|
|
|
static
|
|
|
|
trx_undo_rec_t*
|
|
|
|
trx_roll_pop_top_rec(
|
|
|
|
/*=================*/
|
|
|
|
/* out: undo log record, the page s-latched */
|
|
|
|
trx_t* trx, /* in: transaction */
|
|
|
|
trx_undo_t* undo, /* in: undo log */
|
|
|
|
mtr_t* mtr) /* in: mtr */
|
|
|
|
{
|
2006-02-23 19:25:29 +00:00
|
|
|
page_t* undo_page;
|
2005-10-27 07:29:40 +00:00
|
|
|
ulint offset;
|
|
|
|
trx_undo_rec_t* prev_rec;
|
|
|
|
page_t* prev_rec_page;
|
|
|
|
|
|
|
|
ut_ad(mutex_own(&(trx->undo_mutex)));
|
|
|
|
|
2007-01-18 09:59:00 +00:00
|
|
|
undo_page = trx_undo_page_get_s_latched(undo->space, undo->zip_size,
|
2005-10-27 07:29:40 +00:00
|
|
|
undo->top_page_no, mtr);
|
|
|
|
offset = undo->top_offset;
|
|
|
|
|
2006-08-29 09:30:31 +00:00
|
|
|
/* fprintf(stderr, "Thread %lu undoing trx %lu undo record %lu\n",
|
|
|
|
os_thread_get_curr_id(), ut_dulint_get_low(trx->id),
|
|
|
|
ut_dulint_get_low(undo->top_undo_no)); */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
prev_rec = trx_undo_get_prev_rec(undo_page + offset,
|
2006-08-29 09:30:31 +00:00
|
|
|
undo->hdr_page_no, undo->hdr_offset,
|
|
|
|
mtr);
|
2005-10-27 07:29:40 +00:00
|
|
|
if (prev_rec == NULL) {
|
|
|
|
|
|
|
|
undo->empty = TRUE;
|
|
|
|
} else {
|
2006-10-09 16:22:47 +00:00
|
|
|
prev_rec_page = page_align(prev_rec);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
if (prev_rec_page != undo_page) {
|
|
|
|
|
|
|
|
trx->pages_undone++;
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-10-12 07:02:36 +00:00
|
|
|
undo->top_page_no = page_get_page_no(prev_rec_page);
|
2005-10-27 07:29:40 +00:00
|
|
|
undo->top_offset = prev_rec - prev_rec_page;
|
|
|
|
undo->top_undo_no = trx_undo_rec_get_undo_no(prev_rec);
|
|
|
|
}
|
|
|
|
|
|
|
|
return(undo_page + offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
Pops the topmost record when the two undo logs of a transaction are seen
|
|
|
|
as a single stack of records ordered by their undo numbers. Inserts the
|
|
|
|
undo number of the popped undo record to the array of currently processed
|
|
|
|
undo numbers in the transaction. When the query thread finishes processing
|
|
|
|
of this undo record, it must be released with trx_undo_rec_release. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
trx_undo_rec_t*
|
|
|
|
trx_roll_pop_top_rec_of_trx(
|
|
|
|
/*========================*/
|
|
|
|
/* out: undo log record copied to heap, NULL
|
|
|
|
if none left, or if the undo number of the
|
|
|
|
top record would be less than the limit */
|
|
|
|
trx_t* trx, /* in: transaction */
|
|
|
|
dulint limit, /* in: least undo number we need */
|
|
|
|
dulint* roll_ptr,/* out: roll pointer to undo record */
|
|
|
|
mem_heap_t* heap) /* in: memory heap where copied */
|
|
|
|
{
|
|
|
|
trx_undo_t* undo;
|
|
|
|
trx_undo_t* ins_undo;
|
|
|
|
trx_undo_t* upd_undo;
|
|
|
|
trx_undo_rec_t* undo_rec;
|
|
|
|
trx_undo_rec_t* undo_rec_copy;
|
|
|
|
dulint undo_no;
|
|
|
|
ibool is_insert;
|
|
|
|
trx_rseg_t* rseg;
|
|
|
|
ulint progress_pct;
|
|
|
|
mtr_t mtr;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
rseg = trx->rseg;
|
|
|
|
try_again:
|
|
|
|
mutex_enter(&(trx->undo_mutex));
|
|
|
|
|
|
|
|
if (trx->pages_undone >= TRX_ROLL_TRUNC_THRESHOLD) {
|
|
|
|
mutex_enter(&(rseg->mutex));
|
|
|
|
|
|
|
|
trx_roll_try_truncate(trx);
|
|
|
|
|
|
|
|
mutex_exit(&(rseg->mutex));
|
|
|
|
}
|
|
|
|
|
|
|
|
ins_undo = trx->insert_undo;
|
|
|
|
upd_undo = trx->update_undo;
|
|
|
|
|
|
|
|
if (!ins_undo || ins_undo->empty) {
|
|
|
|
undo = upd_undo;
|
|
|
|
} else if (!upd_undo || upd_undo->empty) {
|
|
|
|
undo = ins_undo;
|
|
|
|
} else if (ut_dulint_cmp(upd_undo->top_undo_no,
|
|
|
|
ins_undo->top_undo_no) > 0) {
|
|
|
|
undo = upd_undo;
|
|
|
|
} else {
|
|
|
|
undo = ins_undo;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!undo || undo->empty
|
2006-08-29 09:30:31 +00:00
|
|
|
|| (ut_dulint_cmp(limit, undo->top_undo_no) > 0)) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
if ((trx->undo_no_arr)->n_used == 0) {
|
2005-10-27 07:29:40 +00:00
|
|
|
/* Rollback is ending */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
mutex_enter(&(rseg->mutex));
|
|
|
|
|
|
|
|
trx_roll_try_truncate(trx);
|
|
|
|
|
|
|
|
mutex_exit(&(rseg->mutex));
|
|
|
|
}
|
|
|
|
|
|
|
|
mutex_exit(&(trx->undo_mutex));
|
|
|
|
|
|
|
|
return(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (undo == ins_undo) {
|
|
|
|
is_insert = TRUE;
|
|
|
|
} else {
|
|
|
|
is_insert = FALSE;
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
*roll_ptr = trx_undo_build_roll_ptr(is_insert, (undo->rseg)->id,
|
2006-08-29 09:30:31 +00:00
|
|
|
undo->top_page_no,
|
|
|
|
undo->top_offset);
|
2005-10-27 07:29:40 +00:00
|
|
|
mtr_start(&mtr);
|
|
|
|
|
|
|
|
undo_rec = trx_roll_pop_top_rec(trx, undo, &mtr);
|
|
|
|
|
|
|
|
undo_no = trx_undo_rec_get_undo_no(undo_rec);
|
|
|
|
|
|
|
|
ut_ad(ut_dulint_cmp(ut_dulint_add(undo_no, 1), trx->undo_no) == 0);
|
|
|
|
|
|
|
|
/* We print rollback progress info if we are in a crash recovery
|
|
|
|
and the transaction has at least 1000 row operations to undo. */
|
|
|
|
|
|
|
|
if (trx == trx_roll_crash_recv_trx && trx_roll_max_undo_no > 1000) {
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
progress_pct = 100 - (ulint)
|
2006-08-29 09:30:31 +00:00
|
|
|
((ut_conv_dulint_to_longlong(undo_no) * 100)
|
|
|
|
/ trx_roll_max_undo_no);
|
2005-10-27 07:29:40 +00:00
|
|
|
if (progress_pct != trx_roll_progress_printed_pct) {
|
|
|
|
if (trx_roll_progress_printed_pct == 0) {
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"\nInnoDB: Progress in percents:"
|
|
|
|
" %lu", (ulong) progress_pct);
|
2005-10-27 07:29:40 +00:00
|
|
|
} else {
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
" %lu", (ulong) progress_pct);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
fflush(stderr);
|
|
|
|
trx_roll_progress_printed_pct = progress_pct;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
trx->undo_no = undo_no;
|
|
|
|
|
|
|
|
if (!trx_undo_arr_store_info(trx, undo_no)) {
|
|
|
|
/* A query thread is already processing this undo log record */
|
|
|
|
|
|
|
|
mutex_exit(&(trx->undo_mutex));
|
|
|
|
|
|
|
|
mtr_commit(&mtr);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
goto try_again;
|
|
|
|
}
|
|
|
|
|
|
|
|
undo_rec_copy = trx_undo_rec_copy(undo_rec, heap);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
mutex_exit(&(trx->undo_mutex));
|
|
|
|
|
|
|
|
mtr_commit(&mtr);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
return(undo_rec_copy);
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
Reserves an undo log record for a query thread to undo. This should be
|
|
|
|
called if the query thread gets the undo log record not using the pop
|
|
|
|
function above. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
ibool
|
|
|
|
trx_undo_rec_reserve(
|
|
|
|
/*=================*/
|
|
|
|
/* out: TRUE if succeeded */
|
|
|
|
trx_t* trx, /* in: transaction */
|
|
|
|
dulint undo_no)/* in: undo number of the record */
|
|
|
|
{
|
|
|
|
ibool ret;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
mutex_enter(&(trx->undo_mutex));
|
|
|
|
|
|
|
|
ret = trx_undo_arr_store_info(trx, undo_no);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
mutex_exit(&(trx->undo_mutex));
|
|
|
|
|
|
|
|
return(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Releases a reserved undo record. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
trx_undo_rec_release(
|
|
|
|
/*=================*/
|
|
|
|
trx_t* trx, /* in: transaction */
|
|
|
|
dulint undo_no)/* in: undo number */
|
|
|
|
{
|
|
|
|
trx_undo_arr_t* arr;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
mutex_enter(&(trx->undo_mutex));
|
|
|
|
|
|
|
|
arr = trx->undo_no_arr;
|
|
|
|
|
|
|
|
trx_undo_arr_remove_info(arr, undo_no);
|
|
|
|
|
|
|
|
mutex_exit(&(trx->undo_mutex));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2006-02-23 19:25:29 +00:00
|
|
|
Starts a rollback operation. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
trx_rollback(
|
|
|
|
/*=========*/
|
|
|
|
trx_t* trx, /* in: transaction */
|
|
|
|
trx_sig_t* sig, /* in: signal starting the rollback */
|
|
|
|
que_thr_t** next_thr)/* in/out: next query thread to run;
|
|
|
|
if the value which is passed in is
|
|
|
|
a pointer to a NULL pointer, then the
|
|
|
|
calling function can start running
|
|
|
|
a new query thread; if the passed value is
|
|
|
|
NULL, the parameter is ignored */
|
|
|
|
{
|
|
|
|
que_t* roll_graph;
|
|
|
|
que_thr_t* thr;
|
2006-08-29 09:30:31 +00:00
|
|
|
/* que_thr_t* thr2; */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
ut_ad(mutex_own(&kernel_mutex));
|
|
|
|
ut_ad((trx->undo_no_arr == NULL) || ((trx->undo_no_arr)->n_used == 0));
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/* Initialize the rollback field in the transaction */
|
|
|
|
|
|
|
|
if (sig->type == TRX_SIG_TOTAL_ROLLBACK) {
|
|
|
|
|
|
|
|
trx->roll_limit = ut_dulint_zero;
|
|
|
|
|
|
|
|
} else if (sig->type == TRX_SIG_ROLLBACK_TO_SAVEPT) {
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
trx->roll_limit = (sig->savept).least_undo_no;
|
|
|
|
|
|
|
|
} else if (sig->type == TRX_SIG_ERROR_OCCURRED) {
|
|
|
|
|
|
|
|
trx->roll_limit = trx->last_sql_stat_start.least_undo_no;
|
|
|
|
} else {
|
|
|
|
ut_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
ut_a(ut_dulint_cmp(trx->roll_limit, trx->undo_no) <= 0);
|
|
|
|
|
|
|
|
trx->pages_undone = 0;
|
|
|
|
|
|
|
|
if (trx->undo_no_arr == NULL) {
|
|
|
|
trx->undo_no_arr = trx_undo_arr_create();
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/* Build a 'query' graph which will perform the undo operations */
|
|
|
|
|
|
|
|
roll_graph = trx_roll_graph_build(trx);
|
|
|
|
|
|
|
|
trx->graph = roll_graph;
|
|
|
|
trx->que_state = TRX_QUE_ROLLING_BACK;
|
|
|
|
|
|
|
|
thr = que_fork_start_command(roll_graph);
|
|
|
|
|
|
|
|
ut_ad(thr);
|
|
|
|
|
2006-08-29 09:30:31 +00:00
|
|
|
/* thr2 = que_fork_start_command(roll_graph);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
ut_ad(thr2); */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
if (next_thr && (*next_thr == NULL)) {
|
|
|
|
*next_thr = thr;
|
2006-08-29 09:30:31 +00:00
|
|
|
/* srv_que_task_enqueue_low(thr2); */
|
2005-10-27 07:29:40 +00:00
|
|
|
} else {
|
|
|
|
srv_que_task_enqueue_low(thr);
|
2006-08-29 09:30:31 +00:00
|
|
|
/* srv_que_task_enqueue_low(thr2); */
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
Builds an undo 'query' graph for a transaction. The actual rollback is
|
|
|
|
performed by executing this query graph like a query subprocedure call.
|
|
|
|
The reply about the completion of the rollback will be sent by this
|
|
|
|
graph. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
que_t*
|
|
|
|
trx_roll_graph_build(
|
|
|
|
/*=================*/
|
|
|
|
/* out, own: the query graph */
|
|
|
|
trx_t* trx) /* in: trx handle */
|
|
|
|
{
|
|
|
|
mem_heap_t* heap;
|
|
|
|
que_fork_t* fork;
|
|
|
|
que_thr_t* thr;
|
2006-08-29 09:30:31 +00:00
|
|
|
/* que_thr_t* thr2; */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
ut_ad(mutex_own(&kernel_mutex));
|
|
|
|
|
|
|
|
heap = mem_heap_create(512);
|
|
|
|
fork = que_fork_create(NULL, NULL, QUE_FORK_ROLLBACK, heap);
|
|
|
|
fork->trx = trx;
|
|
|
|
|
|
|
|
thr = que_thr_create(fork, heap);
|
2006-08-29 09:30:31 +00:00
|
|
|
/* thr2 = que_thr_create(fork, heap); */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
thr->child = row_undo_node_create(trx, thr, heap);
|
2006-08-29 09:30:31 +00:00
|
|
|
/* thr2->child = row_undo_node_create(trx, thr2, heap); */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
return(fork);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Finishes error processing after the necessary partial rollback has been
|
|
|
|
done. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
trx_finish_error_processing(
|
|
|
|
/*========================*/
|
|
|
|
trx_t* trx) /* in: transaction */
|
|
|
|
{
|
|
|
|
trx_sig_t* sig;
|
|
|
|
trx_sig_t* next_sig;
|
|
|
|
|
|
|
|
ut_ad(mutex_own(&kernel_mutex));
|
|
|
|
|
|
|
|
sig = UT_LIST_GET_FIRST(trx->signals);
|
|
|
|
|
|
|
|
while (sig != NULL) {
|
|
|
|
next_sig = UT_LIST_GET_NEXT(signals, sig);
|
|
|
|
|
|
|
|
if (sig->type == TRX_SIG_ERROR_OCCURRED) {
|
|
|
|
|
|
|
|
trx_sig_remove(trx, sig);
|
|
|
|
}
|
|
|
|
|
|
|
|
sig = next_sig;
|
|
|
|
}
|
|
|
|
|
|
|
|
trx->que_state = TRX_QUE_RUNNING;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Finishes a partial rollback operation. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
trx_finish_partial_rollback_off_kernel(
|
|
|
|
/*===================================*/
|
|
|
|
trx_t* trx, /* in: transaction */
|
|
|
|
que_thr_t** next_thr)/* in/out: next query thread to run;
|
|
|
|
if the value which is passed in is a pointer
|
|
|
|
to a NULL pointer, then the calling function
|
|
|
|
can start running a new query thread; if this
|
|
|
|
parameter is NULL, it is ignored */
|
|
|
|
{
|
|
|
|
trx_sig_t* sig;
|
|
|
|
|
|
|
|
ut_ad(mutex_own(&kernel_mutex));
|
|
|
|
|
|
|
|
sig = UT_LIST_GET_FIRST(trx->signals);
|
|
|
|
|
|
|
|
/* Remove the signal from the signal queue and send reply message
|
|
|
|
to it */
|
|
|
|
|
|
|
|
trx_sig_reply(sig, next_thr);
|
|
|
|
trx_sig_remove(trx, sig);
|
|
|
|
|
|
|
|
trx->que_state = TRX_QUE_RUNNING;
|
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
Finishes a transaction rollback. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
trx_finish_rollback_off_kernel(
|
|
|
|
/*===========================*/
|
|
|
|
que_t* graph, /* in: undo graph which can now be freed */
|
|
|
|
trx_t* trx, /* in: transaction */
|
|
|
|
que_thr_t** next_thr)/* in/out: next query thread to run;
|
|
|
|
if the value which is passed in is
|
|
|
|
a pointer to a NULL pointer, then the
|
2006-02-23 19:25:29 +00:00
|
|
|
calling function can start running
|
2005-10-27 07:29:40 +00:00
|
|
|
a new query thread; if this parameter is
|
|
|
|
NULL, it is ignored */
|
|
|
|
{
|
|
|
|
trx_sig_t* sig;
|
|
|
|
trx_sig_t* next_sig;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_ad(mutex_own(&kernel_mutex));
|
|
|
|
|
|
|
|
ut_a(trx->undo_no_arr == NULL || trx->undo_no_arr->n_used == 0);
|
|
|
|
|
|
|
|
/* Free the memory reserved by the undo graph */
|
|
|
|
que_graph_free(graph);
|
|
|
|
|
|
|
|
sig = UT_LIST_GET_FIRST(trx->signals);
|
|
|
|
|
|
|
|
if (sig->type == TRX_SIG_ROLLBACK_TO_SAVEPT) {
|
|
|
|
|
|
|
|
trx_finish_partial_rollback_off_kernel(trx, next_thr);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
} else if (sig->type == TRX_SIG_ERROR_OCCURRED) {
|
|
|
|
|
|
|
|
trx_finish_error_processing(trx);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef UNIV_DEBUG
|
2006-02-23 19:25:29 +00:00
|
|
|
if (lock_print_waits) {
|
2005-10-27 07:29:40 +00:00
|
|
|
fprintf(stderr, "Trx %lu rollback finished\n",
|
2006-08-29 09:30:31 +00:00
|
|
|
(ulong) ut_dulint_get_low(trx->id));
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
|
2007-09-05 10:18:03 +00:00
|
|
|
trx_commit_off_kernel(trx);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* Remove all TRX_SIG_TOTAL_ROLLBACK signals from the signal queue and
|
|
|
|
send reply messages to them */
|
|
|
|
|
|
|
|
trx->que_state = TRX_QUE_RUNNING;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
while (sig != NULL) {
|
|
|
|
next_sig = UT_LIST_GET_NEXT(signals, sig);
|
|
|
|
|
|
|
|
if (sig->type == TRX_SIG_TOTAL_ROLLBACK) {
|
|
|
|
|
|
|
|
trx_sig_reply(sig, next_thr);
|
|
|
|
|
|
|
|
trx_sig_remove(trx, sig);
|
|
|
|
}
|
|
|
|
|
|
|
|
sig = next_sig;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Creates a rollback command node struct. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
roll_node_t*
|
|
|
|
roll_node_create(
|
|
|
|
/*=============*/
|
|
|
|
/* out, own: rollback node struct */
|
|
|
|
mem_heap_t* heap) /* in: mem heap where created */
|
|
|
|
{
|
|
|
|
roll_node_t* node;
|
|
|
|
|
|
|
|
node = mem_heap_alloc(heap, sizeof(roll_node_t));
|
|
|
|
node->common.type = QUE_NODE_ROLLBACK;
|
|
|
|
node->state = ROLL_NODE_SEND;
|
|
|
|
|
|
|
|
node->partial = FALSE;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
return(node);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************
|
|
|
|
Performs an execution step for a rollback command node in a query graph. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
que_thr_t*
|
|
|
|
trx_rollback_step(
|
|
|
|
/*==============*/
|
|
|
|
/* out: query thread to run next, or NULL */
|
|
|
|
que_thr_t* thr) /* in: query thread */
|
|
|
|
{
|
|
|
|
roll_node_t* node;
|
|
|
|
ulint sig_no;
|
|
|
|
trx_savept_t* savept;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
node = thr->run_node;
|
|
|
|
|
|
|
|
ut_ad(que_node_get_type(node) == QUE_NODE_ROLLBACK);
|
|
|
|
|
|
|
|
if (thr->prev_node == que_node_get_parent(node)) {
|
|
|
|
node->state = ROLL_NODE_SEND;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (node->state == ROLL_NODE_SEND) {
|
|
|
|
mutex_enter(&kernel_mutex);
|
|
|
|
|
|
|
|
node->state = ROLL_NODE_WAIT;
|
|
|
|
|
|
|
|
if (node->partial) {
|
|
|
|
sig_no = TRX_SIG_ROLLBACK_TO_SAVEPT;
|
|
|
|
savept = &(node->savept);
|
|
|
|
} else {
|
|
|
|
sig_no = TRX_SIG_TOTAL_ROLLBACK;
|
|
|
|
savept = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Send a rollback signal to the transaction */
|
|
|
|
|
2006-06-13 20:23:26 +00:00
|
|
|
trx_sig_send(thr_get_trx(thr), sig_no, TRX_SIG_SELF, thr,
|
2006-08-29 09:30:31 +00:00
|
|
|
savept, NULL);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
thr->state = QUE_THR_SIG_REPLY_WAIT;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
mutex_exit(&kernel_mutex);
|
|
|
|
|
|
|
|
return(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
ut_ad(node->state == ROLL_NODE_WAIT);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
thr->run_node = que_node_get_parent(node);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
return(thr);
|
|
|
|
}
|