mirror of
https://github.com/MariaDB/server.git
synced 2026-05-14 19:07:15 +02:00
Many files:
Fix Bug #3300 : if innodb_locks_unsafe_for_binlog is set, release locks on rows that we do not UPDATE or DELETE sql/ha_innodb.cc: Fix Bug #3300 : if innodb_locks_unsafe_for_binlog is set, release locks on rows that we do not UPDATE or DELETE innobase/row/row0mysql.c: Fix Bug #3300 : if innodb_locks_unsafe_for_binlog is set, release locks on rows that we do not UPDATE or DELETE innobase/row/row0sel.c: Fix Bug #3300 : if innodb_locks_unsafe_for_binlog is set, release locks on rows that we do not UPDATE or DELETE innobase/include/trx0trx.ic: Fix Bug #3300 : if innodb_locks_unsafe_for_binlog is set, release locks on rows that we do not UPDATE or DELETE innobase/include/row0mysql.h: Fix Bug #3300 : if innodb_locks_unsafe_for_binlog is set, release locks on rows that we do not UPDATE or DELETE innobase/include/trx0trx.h: Fix Bug #3300 : if innodb_locks_unsafe_for_binlog is set, release locks on rows that we do not UPDATE or DELETE innobase/lock/lock0lock.c: Fix Bug #3300 : if innodb_locks_unsafe_for_binlog is set, release locks on rows that we do not UPDATE or DELETE innobase/trx/trx0trx.c: Fix Bug #3300 : if innodb_locks_unsafe_for_binlog is set, release locks on rows that we do not UPDATE or DELETE
This commit is contained in:
parent
258d9a9658
commit
8561600a5a
8 changed files with 294 additions and 71 deletions
|
|
@ -243,17 +243,27 @@ row_update_for_mysql(
|
|||
the MySQL format */
|
||||
row_prebuilt_t* prebuilt); /* in: prebuilt struct in MySQL
|
||||
handle */
|
||||
|
||||
/*************************************************************************
|
||||
Does an unlock of a row for MySQL. */
|
||||
This can only be used when srv_locks_unsafe_for_binlog is TRUE. Before
|
||||
calling this function we must use trx_reset_new_rec_lock_info() and
|
||||
trx_register_new_rec_lock() to store the information which new record locks
|
||||
really were set. This function removes a newly set lock under prebuilt->pcur,
|
||||
and also under prebuilt->clust_pcur. Currently, this is only used and tested
|
||||
in the case of an UPDATE or a DELETE statement, where the row lock is of the
|
||||
LOCK_X type.
|
||||
Thus, this implements a 'mini-rollback' that releases the latest record
|
||||
locks we set. */
|
||||
|
||||
int
|
||||
row_unlock_for_mysql(
|
||||
/*=================*/
|
||||
/* out: error code or DB_SUCCESS */
|
||||
row_prebuilt_t* prebuilt); /* in: prebuilt struct in MySQL
|
||||
row_prebuilt_t* prebuilt, /* in: prebuilt struct in MySQL
|
||||
handle */
|
||||
|
||||
ibool has_latches_on_recs);/* TRUE if called so that we have
|
||||
the latches on the records under pcur
|
||||
and clust_pcur, and we do not need to
|
||||
reposition the cursors. */
|
||||
/*************************************************************************
|
||||
Creates an query graph node of 'update' type to be used in the MySQL
|
||||
interface. */
|
||||
|
|
|
|||
|
|
@ -16,10 +16,39 @@ Created 3/26/1996 Heikki Tuuri
|
|||
#include "que0types.h"
|
||||
#include "mem0mem.h"
|
||||
#include "read0types.h"
|
||||
#include "dict0types.h"
|
||||
#include "trx0xa.h"
|
||||
|
||||
extern ulint trx_n_mysql_transactions;
|
||||
|
||||
/*****************************************************************
|
||||
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 */
|
||||
/*****************************************************************
|
||||
Registers that we have set a new record lock on an index. This can only be
|
||||
called twice after calling trx_reset_new_rec_lock_info(), since we only have
|
||||
space to store 2 indexes! */
|
||||
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
|
||||
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 */
|
||||
/************************************************************************
|
||||
Releases the search latch if trx has reserved it. */
|
||||
|
||||
|
|
@ -495,8 +524,18 @@ struct trx_struct{
|
|||
lock_t* auto_inc_lock; /* possible auto-inc lock reserved by
|
||||
the transaction; note that it is also
|
||||
in the lock list trx_locks */
|
||||
ibool trx_create_lock;/* this is TRUE if we have created a
|
||||
new lock for a record accessed */
|
||||
dict_index_t* new_rec_locks[2];/* these are normally NULL; if
|
||||
srv_locks_unsafe_for_binlog is TRUE,
|
||||
in a cursor search, if we set a new
|
||||
record lock on an index, this is set
|
||||
to point to the index; this is
|
||||
used in releasing the locks under the
|
||||
cursors if we are performing an UPDATE
|
||||
and we determine after retrieving
|
||||
the row that it does not need to be
|
||||
locked; thus, these can be used to
|
||||
implement a 'mini-rollback' that
|
||||
releases the latest record locks */
|
||||
UT_LIST_NODE_T(trx_t)
|
||||
trx_list; /* list of transactions */
|
||||
UT_LIST_NODE_T(trx_t)
|
||||
|
|
|
|||
|
|
@ -39,4 +39,52 @@ trx_start_if_not_started_low(
|
|||
}
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
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;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
Registers that we have set a new record lock on an index. This can only be
|
||||
called twice after calling trx_reset_new_rec_lock_info(), since we only have
|
||||
space to store 2 indexes! */
|
||||
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
|
||||
index*/
|
||||
{
|
||||
if (trx->new_rec_locks[0] == NULL) {
|
||||
trx->new_rec_locks[0] = index;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ut_a(trx->new_rec_locks[1] == NULL);
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue