2001-02-17 14:19:19 +02:00
|
|
|
/******************************************************
|
|
|
|
The transaction
|
|
|
|
|
|
|
|
(c) 1996 Innobase Oy
|
|
|
|
|
|
|
|
Created 3/26/1996 Heikki Tuuri
|
|
|
|
*******************************************************/
|
|
|
|
|
|
|
|
/*****************************************************************
|
|
|
|
Starts the transaction if it is not yet started. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
trx_start_if_not_started(
|
|
|
|
/*=====================*/
|
|
|
|
trx_t* trx) /* in: transaction */
|
|
|
|
{
|
|
|
|
ut_ad(trx->conc_state != TRX_COMMITTED_IN_MEMORY);
|
|
|
|
|
|
|
|
if (trx->conc_state == TRX_NOT_STARTED) {
|
|
|
|
|
|
|
|
trx_start(trx, ULINT_UNDEFINED);
|
|
|
|
}
|
|
|
|
}
|
trx0trx.ic, trx0trx.h, srv0srv.h, row0sel.h, dict0mem.h:
Modifications for query cache + trxs, fix of q.c.+ foreign keys
innobase/include/dict0mem.h:
Modifications for query cache + trxs, fix of q.c.+ foreign keys
innobase/include/row0sel.h:
Modifications for query cache + trxs, fix of q.c.+ foreign keys
innobase/include/srv0srv.h:
Modifications for query cache + trxs, fix of q.c.+ foreign keys
innobase/include/trx0trx.h:
Modifications for query cache + trxs, fix of q.c.+ foreign keys
innobase/include/trx0trx.ic:
Modifications for query cache + trxs, fix of q.c.+ foreign keys
2002-09-20 05:18:55 +03:00
|
|
|
|
|
|
|
/*****************************************************************
|
|
|
|
Starts the transaction if it is not yet started. Assumes we have reserved
|
|
|
|
the kernel mutex! */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
trx_start_if_not_started_low(
|
|
|
|
/*=========================*/
|
|
|
|
trx_t* trx) /* in: transaction */
|
|
|
|
{
|
|
|
|
ut_ad(trx->conc_state != TRX_COMMITTED_IN_MEMORY);
|
|
|
|
|
|
|
|
if (trx->conc_state == TRX_NOT_STARTED) {
|
|
|
|
|
|
|
|
trx_start_low(trx, ULINT_UNDEFINED);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-01 20:44:35 +03:00
|
|
|
/*****************************************************************
|
|
|
|
Resets the new record lock info in a transaction struct. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
trx_reset_new_rec_lock_info(
|
|
|
|
/*========================*/
|
|
|
|
trx_t* trx) /* in: transaction struct */
|
|
|
|
{
|
|
|
|
trx->new_rec_locks[0] = NULL;
|
|
|
|
trx->new_rec_locks[1] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************
|
2005-07-01 21:06:23 +03:00
|
|
|
Registers that we have set a new record lock on an index. We only have
|
|
|
|
space to store 2 indexes! If this is called more than twice after
|
|
|
|
trx_reset_new_rec_lock_info(), then this function does nothing. */
|
2005-07-01 20:44:35 +03:00
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
trx_register_new_rec_lock(
|
|
|
|
/*======================*/
|
|
|
|
trx_t* trx, /* in: transaction struct */
|
|
|
|
dict_index_t* index) /* in: trx sets a new record lock on this
|
2005-07-01 21:06:23 +03:00
|
|
|
index */
|
2005-07-01 20:44:35 +03:00
|
|
|
{
|
|
|
|
if (trx->new_rec_locks[0] == NULL) {
|
|
|
|
trx->new_rec_locks[0] = index;
|
trx0trx.ic, trx0trx.h, srv0srv.h, row0sel.h, dict0mem.h:
Modifications for query cache + trxs, fix of q.c.+ foreign keys
innobase/include/dict0mem.h:
Modifications for query cache + trxs, fix of q.c.+ foreign keys
innobase/include/row0sel.h:
Modifications for query cache + trxs, fix of q.c.+ foreign keys
innobase/include/srv0srv.h:
Modifications for query cache + trxs, fix of q.c.+ foreign keys
innobase/include/trx0trx.h:
Modifications for query cache + trxs, fix of q.c.+ foreign keys
innobase/include/trx0trx.ic:
Modifications for query cache + trxs, fix of q.c.+ foreign keys
2002-09-20 05:18:55 +03:00
|
|
|
|
2005-07-01 20:44:35 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-07-01 21:06:23 +03:00
|
|
|
if (trx->new_rec_locks[0] == index) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (trx->new_rec_locks[1] != NULL) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2005-07-01 20:44:35 +03:00
|
|
|
|
|
|
|
trx->new_rec_locks[1] = index;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************
|
|
|
|
Checks if trx has set a new record lock on an index. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ibool
|
|
|
|
trx_new_rec_locks_contain(
|
|
|
|
/*======================*/
|
|
|
|
/* out: TRUE if trx has set a new record lock
|
|
|
|
on index */
|
|
|
|
trx_t* trx, /* in: transaction struct */
|
|
|
|
dict_index_t* index) /* in: index */
|
|
|
|
{
|
|
|
|
return(trx->new_rec_locks[0] == index
|
|
|
|
|| trx->new_rec_locks[1] == index);
|
|
|
|
}
|