mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 03:47:17 +02:00
Merge branch '10.3' into 10.4
This commit is contained in:
commit
7841a7eb09
339 changed files with 7429 additions and 2362 deletions
|
|
@ -575,7 +575,7 @@ thd_done:
|
|||
|
||||
row->trx_is_read_only = trx->read_only;
|
||||
|
||||
row->trx_is_autocommit_non_locking = trx_is_autocommit_non_locking(trx);
|
||||
row->trx_is_autocommit_non_locking = trx->is_autocommit_non_locking();
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
|
@ -1229,7 +1229,24 @@ static void fetch_data_into_cache_low(trx_i_s_cache_t *cache, const trx_t *trx)
|
|||
{
|
||||
i_s_locks_row_t *requested_lock_row;
|
||||
|
||||
assert_trx_nonlocking_or_in_list(trx);
|
||||
#ifdef UNIV_DEBUG
|
||||
{
|
||||
const auto state= trx->state;
|
||||
|
||||
if (trx->is_autocommit_non_locking())
|
||||
{
|
||||
ut_ad(trx->read_only);
|
||||
ut_ad(!trx->is_recovered);
|
||||
ut_ad(trx->mysql_thd);
|
||||
ut_ad(state == TRX_STATE_NOT_STARTED || state == TRX_STATE_ACTIVE);
|
||||
}
|
||||
else
|
||||
ut_ad(state == TRX_STATE_ACTIVE ||
|
||||
state == TRX_STATE_PREPARED ||
|
||||
state == TRX_STATE_PREPARED_RECOVERED ||
|
||||
state == TRX_STATE_COMMITTED_IN_MEMORY);
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
if (add_trx_relevant_locks_to_cache(cache, trx, &requested_lock_row))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -104,12 +104,18 @@ trx_rollback_to_savepoint_low(
|
|||
heap = mem_heap_create(512);
|
||||
|
||||
roll_node = roll_node_create(heap);
|
||||
ut_ad(!trx->in_rollback);
|
||||
|
||||
if (savept != NULL) {
|
||||
roll_node->savept = savept;
|
||||
check_trx_state(trx);
|
||||
ut_ad(trx->mysql_thd);
|
||||
ut_ad(!trx->is_recovered);
|
||||
ut_ad(trx->state == TRX_STATE_ACTIVE);
|
||||
} else {
|
||||
assert_trx_nonlocking_or_in_list(trx);
|
||||
ut_d(trx_state_t state = trx->state);
|
||||
ut_ad(state == TRX_STATE_ACTIVE
|
||||
|| state == TRX_STATE_PREPARED
|
||||
|| state == TRX_STATE_PREPARED_RECOVERED);
|
||||
}
|
||||
|
||||
trx->error_state = DB_SUCCESS;
|
||||
|
|
@ -220,7 +226,7 @@ dberr_t trx_rollback_for_mysql(trx_t* trx)
|
|||
|
||||
switch (trx->state) {
|
||||
case TRX_STATE_NOT_STARTED:
|
||||
trx->will_lock = 0;
|
||||
trx->will_lock = false;
|
||||
ut_ad(trx->mysql_thd);
|
||||
#ifdef WITH_WSREP
|
||||
trx->wsrep= false;
|
||||
|
|
@ -230,13 +236,14 @@ dberr_t trx_rollback_for_mysql(trx_t* trx)
|
|||
|
||||
case TRX_STATE_ACTIVE:
|
||||
ut_ad(trx->mysql_thd);
|
||||
assert_trx_nonlocking_or_in_list(trx);
|
||||
ut_ad(!trx->is_recovered);
|
||||
ut_ad(!trx->is_autocommit_non_locking() || trx->read_only);
|
||||
return(trx_rollback_for_mysql_low(trx));
|
||||
|
||||
case TRX_STATE_PREPARED:
|
||||
case TRX_STATE_PREPARED_RECOVERED:
|
||||
ut_ad(!trx_is_autocommit_non_locking(trx));
|
||||
if (trx->rsegs.m_redo.undo) {
|
||||
ut_ad(!trx->is_autocommit_non_locking());
|
||||
if (trx->has_logged_persistent()) {
|
||||
/* The XA ROLLBACK of a XA PREPARE transaction
|
||||
will consist of multiple mini-transactions.
|
||||
|
||||
|
|
@ -274,7 +281,7 @@ dberr_t trx_rollback_for_mysql(trx_t* trx)
|
|||
return(trx_rollback_for_mysql_low(trx));
|
||||
|
||||
case TRX_STATE_COMMITTED_IN_MEMORY:
|
||||
check_trx_state(trx);
|
||||
ut_ad(!trx->is_autocommit_non_locking());
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -303,7 +310,9 @@ trx_rollback_last_sql_stat_for_mysql(
|
|||
return(DB_SUCCESS);
|
||||
|
||||
case TRX_STATE_ACTIVE:
|
||||
assert_trx_nonlocking_or_in_list(trx);
|
||||
ut_ad(trx->mysql_thd);
|
||||
ut_ad(!trx->is_recovered);
|
||||
ut_ad(!trx->is_autocommit_non_locking() || trx->read_only);
|
||||
|
||||
trx->op_info = "rollback of SQL statement";
|
||||
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ trx_init(
|
|||
|
||||
trx->auto_commit = false;
|
||||
|
||||
trx->will_lock = 0;
|
||||
trx->will_lock = false;
|
||||
|
||||
trx->ddl = false;
|
||||
|
||||
|
|
@ -355,7 +355,7 @@ trx_t *trx_create()
|
|||
ib_alloc_t* alloc;
|
||||
|
||||
/* We just got trx from pool, it should be non locking */
|
||||
ut_ad(trx->will_lock == 0);
|
||||
ut_ad(!trx->will_lock);
|
||||
ut_ad(!trx->rw_trx_hash_pins);
|
||||
|
||||
DBUG_LOG("trx", "Create: " << trx);
|
||||
|
|
@ -571,7 +571,7 @@ void trx_disconnect_prepared(trx_t *trx)
|
|||
trx->is_recovered= true;
|
||||
trx->mysql_thd= NULL;
|
||||
/* todo/fixme: suggest to do it at innodb prepare */
|
||||
trx->will_lock= 0;
|
||||
trx->will_lock= false;
|
||||
}
|
||||
|
||||
/****************************************************************//**
|
||||
|
|
@ -916,11 +916,10 @@ void trx_t::remove_flush_observer()
|
|||
|
||||
/** Assign a rollback segment for modifying temporary tables.
|
||||
@return the assigned rollback segment */
|
||||
trx_rseg_t*
|
||||
trx_t::assign_temp_rseg()
|
||||
trx_rseg_t *trx_t::assign_temp_rseg()
|
||||
{
|
||||
ut_ad(!rsegs.m_noredo.rseg);
|
||||
ut_ad(!trx_is_autocommit_non_locking(this));
|
||||
ut_ad(!is_autocommit_non_locking());
|
||||
compile_time_assert(ut_is_2pow(TRX_SYS_N_RSEGS));
|
||||
|
||||
/* Choose a temporary rollback segment between 0 and 127
|
||||
|
|
@ -967,8 +966,8 @@ trx_start_low(
|
|||
&& thd_trx_is_read_only(trx->mysql_thd));
|
||||
|
||||
if (!trx->auto_commit) {
|
||||
++trx->will_lock;
|
||||
} else if (trx->will_lock == 0) {
|
||||
trx->will_lock = true;
|
||||
} else if (!trx->will_lock) {
|
||||
trx->read_only = true;
|
||||
}
|
||||
|
||||
|
|
@ -1011,7 +1010,7 @@ trx_start_low(
|
|||
|
||||
trx_sys.register_rw(trx);
|
||||
} else {
|
||||
if (!trx_is_autocommit_non_locking(trx)) {
|
||||
if (!trx->is_autocommit_non_locking()) {
|
||||
|
||||
/* If this is a read-only transaction that is writing
|
||||
to a temporary table then it needs a transaction id
|
||||
|
|
@ -1199,12 +1198,12 @@ trx_flush_log_if_needed_low(
|
|||
bool flush = srv_file_flush_method != SRV_NOSYNC;
|
||||
|
||||
switch (srv_flush_log_at_trx_commit) {
|
||||
case 3:
|
||||
case 2:
|
||||
/* Write the log but do not flush it to disk */
|
||||
flush = false;
|
||||
/* fall through */
|
||||
case 1:
|
||||
case 3:
|
||||
/* Write the log and optionally flush it to disk */
|
||||
log_write_up_to(lsn, flush);
|
||||
return;
|
||||
|
|
@ -1304,12 +1303,15 @@ inline void trx_t::commit_in_memory(const mtr_t *mtr)
|
|||
must_flush_log_later= false;
|
||||
read_view.close();
|
||||
|
||||
if (trx_is_autocommit_non_locking(this))
|
||||
if (is_autocommit_non_locking())
|
||||
{
|
||||
ut_ad(id == 0);
|
||||
ut_ad(read_only);
|
||||
ut_ad(!will_lock);
|
||||
ut_a(!is_recovered);
|
||||
ut_ad(!rsegs.m_redo.rseg);
|
||||
ut_ad(mysql_thd);
|
||||
ut_ad(state == TRX_STATE_ACTIVE);
|
||||
|
||||
/* Note: We are asserting without holding the lock mutex. But
|
||||
that is OK because this transaction is not waiting and cannot
|
||||
|
|
@ -1323,12 +1325,11 @@ inline void trx_t::commit_in_memory(const mtr_t *mtr)
|
|||
However, the trx_sys_t::mutex will protect the trx_t instance
|
||||
and it cannot be removed from the trx_list and freed
|
||||
without first acquiring the trx_sys_t::mutex. */
|
||||
ut_ad(trx_state_eq(this, TRX_STATE_ACTIVE));
|
||||
state= TRX_STATE_NOT_STARTED;
|
||||
|
||||
MONITOR_INC(MONITOR_TRX_NL_RO_COMMIT);
|
||||
|
||||
DBUG_LOG("trx", "Autocommit in memory: " << this);
|
||||
state= TRX_STATE_NOT_STARTED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1475,8 +1476,6 @@ inline void trx_t::commit_in_memory(const mtr_t *mtr)
|
|||
@param mtr mini-transaction (if there are any persistent modifications) */
|
||||
void trx_t::commit_low(mtr_t *mtr)
|
||||
{
|
||||
assert_trx_nonlocking_or_in_list(this);
|
||||
ut_ad(!trx_state_eq(this, TRX_STATE_COMMITTED_IN_MEMORY));
|
||||
ut_ad(!mtr || mtr->is_active());
|
||||
ut_d(bool aborted = in_rollback && error_state == DB_DEADLOCK);
|
||||
ut_ad(!mtr == (aborted || !has_logged()));
|
||||
|
|
@ -1485,13 +1484,13 @@ void trx_t::commit_low(mtr_t *mtr)
|
|||
/* undo_no is non-zero if we're doing the final commit. */
|
||||
if (fts_trx && undo_no)
|
||||
{
|
||||
ut_a(!trx_is_autocommit_non_locking(this));
|
||||
dberr_t error= fts_commit(this);
|
||||
ut_a(!is_autocommit_non_locking());
|
||||
/* FTS-FIXME: Temporarily tolerate DB_DUPLICATE_KEY instead of
|
||||
dying. This is a possible scenario if there is a crash between
|
||||
insert to DELETED table committing and transaction committing. The
|
||||
fix would be able to return error from this function */
|
||||
ut_a(error == DB_SUCCESS || error == DB_DUPLICATE_KEY);
|
||||
if (dberr_t error= fts_commit(this))
|
||||
ut_a(error == DB_DUPLICATE_KEY);
|
||||
}
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
|
|
@ -1751,7 +1750,6 @@ trx_print_low(
|
|||
/*!< in: mem_heap_get_size(trx->lock.lock_heap) */
|
||||
{
|
||||
ibool newline;
|
||||
const char* op_info;
|
||||
|
||||
fprintf(f, "TRANSACTION " TRX_ID_FMT, trx_get_id_for_print(trx));
|
||||
|
||||
|
|
@ -1778,9 +1776,7 @@ trx_print_low(
|
|||
fprintf(f, ", state %lu", (ulong) trx->state);
|
||||
ut_ad(0);
|
||||
state_ok:
|
||||
|
||||
/* prevent a race condition */
|
||||
op_info = trx->op_info;
|
||||
const char* op_info = trx->op_info;
|
||||
|
||||
if (*op_info) {
|
||||
putc(' ', f);
|
||||
|
|
@ -2251,7 +2247,7 @@ trx_start_internal_low(
|
|||
/* Ensure it is not flagged as an auto-commit-non-locking
|
||||
transaction. */
|
||||
|
||||
trx->will_lock = 1;
|
||||
trx->will_lock = true;
|
||||
|
||||
trx->internal = true;
|
||||
|
||||
|
|
@ -2267,7 +2263,7 @@ trx_start_internal_read_only_low(
|
|||
/* Ensure it is not flagged as an auto-commit-non-locking
|
||||
transaction. */
|
||||
|
||||
trx->will_lock = 1;
|
||||
trx->will_lock = true;
|
||||
|
||||
trx->internal = true;
|
||||
|
||||
|
|
@ -2288,13 +2284,7 @@ trx_start_for_ddl_low(
|
|||
the data dictionary will be locked in crash recovery. */
|
||||
|
||||
trx_set_dict_operation(trx, op);
|
||||
|
||||
/* Ensure it is not flagged as an auto-commit-non-locking
|
||||
transation. */
|
||||
trx->will_lock = 1;
|
||||
|
||||
trx->ddl= true;
|
||||
|
||||
trx_start_internal_low(trx);
|
||||
return;
|
||||
|
||||
|
|
@ -2321,7 +2311,7 @@ trx_set_rw_mode(
|
|||
trx_t* trx) /*!< in/out: transaction that is RW */
|
||||
{
|
||||
ut_ad(trx->rsegs.m_redo.rseg == 0);
|
||||
ut_ad(!trx_is_autocommit_non_locking(trx));
|
||||
ut_ad(!trx->is_autocommit_non_locking());
|
||||
ut_ad(!trx->read_only);
|
||||
ut_ad(trx->id == 0);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue