Merge 10.1 into 10.2

This commit is contained in:
Marko Mäkelä 2020-04-27 13:28:13 +03:00
commit c06845d6f0
33 changed files with 216 additions and 282 deletions

View File

@ -154,17 +154,13 @@ ENDFUNCTION()
# and extension will be the same as for target file.
MACRO(INSTALL_SYMLINK linkname target destination component)
IF(UNIX)
GET_TARGET_PROPERTY(location ${target} LOCATION)
GET_FILENAME_COMPONENT(path ${location} PATH)
GET_FILENAME_COMPONENT(name ${location} NAME)
SET(output ${path}/${linkname})
SET(output ${CMAKE_CURRENT_BINARY_DIR}/${linkname})
ADD_CUSTOM_COMMAND(
OUTPUT ${output}
COMMAND ${CMAKE_COMMAND} ARGS -E remove -f ${output}
COMMAND ${CMAKE_COMMAND} ARGS -E remove -f ${linkname}
COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink
${name}
$<TARGET_FILE_NAME:${target}>
${linkname}
WORKING_DIRECTORY ${path}
DEPENDS ${target}
)

View File

@ -3359,7 +3359,8 @@ sub mysql_install_db {
# ----------------------------------------------------------------------
# export MYSQLD_BOOTSTRAP_CMD variable containing <path>/mysqld <args>
# ----------------------------------------------------------------------
$ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args);
$ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args)
unless defined $ENV{'MYSQLD_BOOTSTRAP_CMD'};
# Extra options can come not only from the command line, but also
# from option files or combinations. We want them on a command line

View File

@ -5,6 +5,7 @@
#
--source include/galera_cluster.inc
--source include/have_binlog_format_row.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--connection node_2

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB
Copyright (c) 2009, 2020, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -2640,19 +2640,20 @@ void Item_func_rand::seed_random(Item *arg)
TODO: do not do reinit 'rand' for every execute of PS/SP if
args[0] is a constant.
*/
uint32 tmp;
uint32 tmp= (uint32) arg->val_int();
#ifdef WITH_WSREP
THD *thd= current_thd;
if (WSREP(thd))
if (WSREP_ON)
{
if (thd->wsrep_exec_mode==REPL_RECV)
tmp= thd->wsrep_rand;
else
tmp= thd->wsrep_rand= (uint32) arg->val_int();
}
else
THD *thd= current_thd;
if (thd->variables.wsrep_on)
{
if (thd->wsrep_exec_mode==REPL_RECV)
tmp= thd->wsrep_rand;
else
thd->wsrep_rand= tmp;
}
}
#endif /* WITH_WSREP */
tmp= (uint32) arg->val_int();
my_rnd_init(rand, (uint32) (tmp*0x10001L+55555555L),
(uint32) (tmp*0x10000001L));

View File

@ -1783,7 +1783,7 @@ binlog_commit_flush_stmt_cache(THD *thd, bool all,
#ifdef WITH_WSREP
if (thd->wsrep_mysql_replicated > 0)
{
DBUG_ASSERT(WSREP_ON);
DBUG_ASSERT(WSREP(thd));
WSREP_DEBUG("avoiding binlog_commit_flush_trx_cache: %d",
thd->wsrep_mysql_replicated);
return 0;
@ -6623,14 +6623,15 @@ int MYSQL_BIN_LOG::rotate(bool force_rotate, bool* check_purge)
int error= 0;
DBUG_ENTER("MYSQL_BIN_LOG::rotate");
if (wsrep_to_isolation)
#ifdef WITH_WSREP
if (WSREP_ON && wsrep_to_isolation)
{
DBUG_ASSERT(WSREP_ON);
*check_purge= false;
WSREP_DEBUG("avoiding binlog rotate due to TO isolation: %d",
WSREP_DEBUG("avoiding binlog rotate due to TO isolation: %d",
wsrep_to_isolation);
DBUG_RETURN(0);
}
#endif /* WITH_WSREP */
//todo: fix the macro def and restore safe_mutex_assert_owner(&LOCK_log);
*check_purge= false;

View File

@ -5583,7 +5583,7 @@ Query_log_event::do_shall_skip(rpl_group_info *rgi)
}
}
#ifdef WITH_WSREP
else if (WSREP_ON && wsrep_mysql_replication_bundle && opt_slave_domain_parallel_threads == 0 &&
else if (WSREP(thd) && wsrep_mysql_replication_bundle && opt_slave_domain_parallel_threads == 0 &&
thd->wsrep_mysql_replicated > 0 &&
(is_begin() || is_commit()))
{
@ -5597,7 +5597,7 @@ Query_log_event::do_shall_skip(rpl_group_info *rgi)
thd->wsrep_mysql_replicated = 0;
}
}
#endif
#endif /* WITH_WSREP */
DBUG_RETURN(Log_event::do_shall_skip(rgi));
}
@ -8590,7 +8590,7 @@ Xid_log_event::do_shall_skip(rpl_group_info *rgi)
DBUG_RETURN(Log_event::EVENT_SKIP_COUNT);
}
#ifdef WITH_WSREP
else if (wsrep_mysql_replication_bundle && WSREP_ON &&
else if (WSREP(thd) && wsrep_mysql_replication_bundle &&
opt_slave_domain_parallel_threads == 0)
{
if (++thd->wsrep_mysql_replicated < (int)wsrep_mysql_replication_bundle)

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2019, MariaDB Corporation.
Copyright (c) 2008, 2020, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -5922,8 +5922,10 @@ int mysqld_main(int argc, char **argv)
set_user(mysqld_user, user_info);
}
#ifdef WITH_WSREP
if (WSREP_ON && wsrep_check_opts())
global_system_variables.wsrep_on= 0;
#endif
/*
The subsequent calls may take a long time : e.g. innodb log read.

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB Corporation
Copyright (c) 2009, 2020, MariaDB Corporation
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -5192,8 +5192,10 @@ pthread_handler_t handle_slave_sql(void *arg)
if (!sql_slave_killed(serial_rgi))
{
slave_output_error_info(serial_rgi, thd);
if (WSREP_ON && rli->last_error().number == ER_UNKNOWN_COM_ERROR)
if (WSREP(thd) && rli->last_error().number == ER_UNKNOWN_COM_ERROR)
{
wsrep_node_dropped= TRUE;
}
}
goto err;
}
@ -5326,7 +5328,7 @@ err_during_init:
If slave stopped due to node going non primary, we set global flag to
trigger automatic restart of slave when node joins back to cluster.
*/
if (WSREP_ON && wsrep_node_dropped && wsrep_restart_slave)
if (WSREP(thd) && wsrep_node_dropped && wsrep_restart_slave)
{
if (wsrep_ready_get())
{

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB
Copyright (c) 2010, 2020, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -4190,7 +4190,7 @@ restart:
}
}
if (WSREP_ON &&
if (WSREP(thd) &&
wsrep_replicate_myisam &&
(*start) &&
(*start)->table &&

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2008, 2019, MariaDB
Copyright (c) 2008, 2020, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -1823,7 +1823,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (parser_state.init(thd, thd->query(), thd->query_length()))
break;
if (WSREP_ON)
if (WSREP(thd))
wsrep_mysql_parse(thd, thd->query(), thd->query_length(), &parser_state,
is_com_multi, is_next_command);
else
@ -1906,13 +1906,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
*/
statistic_increment(thd->status_var.questions, &LOCK_status);
if(!WSREP(thd))
if (!WSREP(thd))
thd->set_time(); /* Reset the query start time. */
parser_state.reset(beginning_of_next_stmt, length);
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
if (WSREP_ON)
if (WSREP(thd))
wsrep_mysql_parse(thd, beginning_of_next_stmt, length, &parser_state,
is_com_multi, is_next_command);
else

View File

@ -5418,7 +5418,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
DBUG_ENTER("mysql_create_like_table");
#ifdef WITH_WSREP
if (WSREP_ON && !thd->wsrep_applier &&
if (WSREP(thd) && !thd->wsrep_applier &&
wsrep_create_like_table(thd, table, src_table, create_info))
DBUG_RETURN(res);
#endif

View File

@ -148,5 +148,9 @@ void wsrep_unlock_rollback()
void wsrep_set_data_home_dir(const char *)
{ }
void wsrep_log(void (*)(const char *, ...), const char *, ...)
{
}
my_bool wsrep_thd_is_applier(MYSQL_THD thd)
{ return false; }

View File

@ -181,13 +181,7 @@ extern void wsrep_prepend_PATH (const char* path);
/* Other global variables */
extern wsrep_seqno_t wsrep_locked_seqno;
#define WSREP_ON \
(global_system_variables.wsrep_on)
#define WSREP_ON_NEW \
((global_system_variables.wsrep_on) && \
wsrep_provider && \
strcmp(wsrep_provider, WSREP_NONE))
#define WSREP_ON unlikely(global_system_variables.wsrep_on)
#define WSREP(thd) \
(WSREP_ON && thd->variables.wsrep_on)

View File

@ -1715,19 +1715,13 @@ thd_trx_is_auto_commit(
/** Enter InnoDB engine after checking the max number of user threads
allowed, else the thread is put into sleep.
@param[in,out] prebuilt row prebuilt handler */
static inline
void
innobase_srv_conc_enter_innodb(
row_prebuilt_t* prebuilt)
static inline void innobase_srv_conc_enter_innodb(row_prebuilt_t *prebuilt)
{
#ifdef WITH_WSREP
if (wsrep_on(prebuilt->trx->mysql_thd) &&
wsrep_thd_is_BF(prebuilt->trx->mysql_thd, FALSE)) {
return;
}
#endif /* WITH_WSREP */
trx_t* trx = prebuilt->trx;
trx_t* trx = prebuilt->trx;
#ifdef WITH_WSREP
if (trx->is_wsrep() && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) return;
#endif /* WITH_WSREP */
if (srv_thread_concurrency) {
if (trx->n_tickets_to_enter_innodb > 0) {
@ -1755,21 +1749,15 @@ innobase_srv_conc_enter_innodb(
/** Note that the thread wants to leave InnoDB only if it doesn't have
any spare tickets.
@param[in,out] m_prebuilt row prebuilt handler */
static inline
void
innobase_srv_conc_exit_innodb(
row_prebuilt_t* prebuilt)
static inline void innobase_srv_conc_exit_innodb(row_prebuilt_t *prebuilt)
{
ut_ad(!sync_check_iterate(sync_check()));
#ifdef WITH_WSREP
if (wsrep_on(prebuilt->trx->mysql_thd) &&
wsrep_thd_is_BF(prebuilt->trx->mysql_thd, FALSE)) {
return;
}
#endif /* WITH_WSREP */
trx_t* trx = prebuilt->trx;
trx_t* trx = prebuilt->trx;
#ifdef WITH_WSREP
if (trx->is_wsrep() && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) return;
#endif /* WITH_WSREP */
/* This is to avoid making an unnecessary function call. */
if (trx->declared_to_be_inside_innodb
@ -2763,6 +2751,9 @@ innobase_trx_init(
trx->check_unique_secondary = !thd_test_options(
thd, OPTION_RELAXED_UNIQUE_CHECKS);
#ifdef WITH_WSREP
trx->wsrep = wsrep_on(thd);
#endif
DBUG_VOID_RETURN;
}
@ -4475,19 +4466,17 @@ innobase_commit_low(
trx_t* trx) /*!< in: transaction handle */
{
#ifdef WITH_WSREP
THD* thd = (THD*)trx->mysql_thd;
const char* tmp = 0;
if (thd && wsrep_on(thd)) {
if (trx->is_wsrep()) {
#ifdef WSREP_PROC_INFO
char info[64];
info[sizeof(info) - 1] = '\0';
snprintf(info, sizeof(info) - 1,
"innobase_commit_low():trx_commit_for_mysql(%lld)",
(long long) wsrep_thd_trx_seqno(thd));
tmp = thd_proc_info(thd, info);
(long long) wsrep_thd_trx_seqno(trx->mysql_thd));
tmp = thd_proc_info(trx->mysql_thd, info);
#else
tmp = thd_proc_info(thd, "innobase_commit_low()");
tmp = thd_proc_info(trx->mysql_thd, "innobase_commit_low()");
#endif /* WSREP_PROC_INFO */
}
#endif /* WITH_WSREP */
@ -4497,7 +4486,7 @@ innobase_commit_low(
}
trx->will_lock = 0;
#ifdef WITH_WSREP
if (thd && wsrep_on(thd)) { thd_proc_info(thd, tmp); }
if (trx->is_wsrep()) { thd_proc_info(trx->mysql_thd, tmp); }
#endif /* WITH_WSREP */
}
@ -8113,7 +8102,7 @@ ha_innobase::write_row(
{
dberr_t error;
#ifdef WITH_WSREP
ibool auto_inc_inserted= FALSE; /* if NULL was inserted */
bool wsrep_auto_inc_inserted= false;
#endif
int error_result = 0;
bool auto_inc_used = false;
@ -8144,7 +8133,7 @@ ha_innobase::write_row(
}
#ifdef WITH_WSREP
if (wsrep_is_load_multi_commit(m_user_thd))
if (trx->is_wsrep() && wsrep_is_load_multi_commit(m_user_thd))
{
/* Note that this transaction is still active. */
trx_register_for_2pc(m_prebuilt->trx);
@ -8161,7 +8150,9 @@ ha_innobase::write_row(
m_prebuilt->autoinc_error = DB_SUCCESS;
#ifdef WITH_WSREP
auto_inc_inserted= (table->next_number_field->val_int() == 0);
wsrep_auto_inc_inserted = trx->is_wsrep()
&& wsrep_drupal_282555_workaround
&& table->next_number_field->val_int() == 0;
#endif
if ((error_result = update_auto_increment())) {
@ -8255,18 +8246,14 @@ ha_innobase::write_row(
m_prebuilt->autoinc_offset,
m_prebuilt->autoinc_increment);
if (wsrep_on(m_user_thd) &&
auto_inc_inserted &&
wsrep_drupal_282555_workaround &&
if (wsrep_auto_inc_inserted &&
wsrep_thd_retry_counter(m_user_thd) == 0 &&
!thd_test_options(m_user_thd,
OPTION_NOT_AUTOCOMMIT |
OPTION_BEGIN)) {
WSREP_DEBUG(
"retrying insert: %s",
(*wsrep_thd_query(m_user_thd)) ?
wsrep_thd_query(m_user_thd) :
(char *)"void");
wsrep_thd_query(m_user_thd));
error= DB_SUCCESS;
wsrep_thd_set_conflict_state(
m_user_thd, MUST_ABORT);
@ -8306,7 +8293,7 @@ set_max_autoinc:
m_prebuilt autoinc values don't get
properly assigned. Fetch values from
server side. */
if (wsrep_on(m_user_thd) &&
if (trx->is_wsrep() &&
wsrep_thd_exec_mode(m_user_thd) == REPL_RECV)
{
wsrep_thd_auto_increment_variables(
@ -8355,8 +8342,7 @@ report_error:
error, m_prebuilt->table->flags, m_user_thd);
#ifdef WITH_WSREP
if (!error_result
&& wsrep_on(m_user_thd)
if (!error_result && trx->is_wsrep()
&& wsrep_thd_exec_mode(m_user_thd) == LOCAL_STATE
&& !wsrep_consistency_check(m_user_thd)
&& !wsrep_thd_ignore_table(m_user_thd)) {
@ -8364,10 +8350,9 @@ report_error:
NULL)) {
DBUG_PRINT("wsrep", ("row key failed"));
error_result = HA_ERR_INTERNAL_ERROR;
goto wsrep_error;
goto func_exit;
}
}
wsrep_error:
#endif /* WITH_WSREP */
if (error_result == HA_FTS_INVALID_DOCID) {
@ -9000,7 +8985,7 @@ ha_innobase::update_row(
m_prebuilt autoinc values don't get
properly assigned. Fetch values from
server side. */
if (wsrep_on(m_user_thd) &&
if (trx->is_wsrep() &&
wsrep_thd_exec_mode(m_user_thd) == REPL_RECV)
{
wsrep_thd_auto_increment_variables(
@ -9051,9 +9036,8 @@ func_exit:
innobase_active_small();
#ifdef WITH_WSREP
if (error == DB_SUCCESS &&
if (error == DB_SUCCESS && trx->is_wsrep() &&
wsrep_thd_exec_mode(m_user_thd) == LOCAL_STATE &&
wsrep_on(m_user_thd) &&
!wsrep_thd_ignore_table(m_user_thd)) {
DBUG_PRINT("wsrep", ("update row key"));
@ -9061,14 +9045,11 @@ func_exit:
new_row)) {
WSREP_DEBUG("WSREP: UPDATE_ROW_KEY FAILED");
DBUG_PRINT("wsrep", ("row key failed"));
err = HA_ERR_INTERNAL_ERROR;
goto wsrep_error;
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
}
}
wsrep_error:
#endif /* WITH_WSREP */
DBUG_RETURN(err);
}
@ -9115,18 +9096,15 @@ ha_innobase::delete_row(
innobase_active_small();
#ifdef WITH_WSREP
if (error == DB_SUCCESS
if (error == DB_SUCCESS && trx->is_wsrep()
&& wsrep_thd_exec_mode(m_user_thd) == LOCAL_STATE
&& wsrep_on(m_user_thd)
&& !wsrep_thd_ignore_table(m_user_thd)) {
if (wsrep_append_keys(m_user_thd, WSREP_KEY_EXCLUSIVE, record,
NULL)) {
DBUG_PRINT("wsrep", ("delete fail"));
error = (dberr_t) HA_ERR_INTERNAL_ERROR;
goto wsrep_error;
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
}
}
wsrep_error:
#endif /* WITH_WSREP */
DBUG_RETURN(convert_error_code_to_mysql(
error, m_prebuilt->table->flags, m_user_thd));
@ -10320,30 +10298,27 @@ wsrep_append_foreign_key(
wsrep_key_type key_type) /*!< in: access type of this key
(shared, exclusive, semi...) */
{
ut_a(trx);
THD* thd = (THD*)trx->mysql_thd;
THD* thd = trx->mysql_thd;
if (!trx->is_wsrep() || wsrep_thd_exec_mode(thd) != LOCAL_STATE) {
return DB_SUCCESS;
}
if (!foreign ||
(!foreign->referenced_table && !foreign->foreign_table)) {
WSREP_INFO("FK: %s missing in: %s",
(!foreign ? "constraint" :
(!foreign->referenced_table ?
"referenced table" : "foreign table")),
wsrep_thd_query(thd));
return DB_ERROR;
}
ulint rcode = DB_SUCCESS;
char cache_key[513] = {'\0'};
int cache_key_len=0;
bool const copy = true;
if (!wsrep_on(trx->mysql_thd) ||
wsrep_thd_exec_mode(thd) != LOCAL_STATE) {
return DB_SUCCESS;
}
if (!thd || !foreign ||
(!foreign->referenced_table && !foreign->foreign_table)) {
WSREP_INFO("FK: %s missing in: %s",
(!thd) ? "thread" :
((!foreign) ? "constraint" :
((!foreign->referenced_table) ?
"referenced table" : "foreign table")),
(thd && wsrep_thd_query(thd)) ?
wsrep_thd_query(thd) : "void");
return DB_ERROR;
}
if ( !((referenced) ?
foreign->referenced_table : foreign->foreign_table)) {
WSREP_DEBUG("pulling %s table into cache",
@ -15975,9 +15950,7 @@ ha_innobase::external_lock(
DBUG_PRINT("enter",("lock_type: %d", lock_type));
update_thd(thd);
trx_t* trx = m_prebuilt->trx;
trx_t* trx = m_prebuilt->trx;
ut_ad(m_prebuilt->table);
/* Statement based binlogging does not work in isolation level
@ -15992,26 +15965,21 @@ ha_innobase::external_lock(
&& thd_binlog_format(thd) == BINLOG_FORMAT_STMT
&& thd_binlog_filter_ok(thd)
&& thd_sqlcom_can_generate_row_events(thd)) {
bool skip = false;
bool skip = false;
#ifdef WITH_WSREP
skip = trx->is_wsrep()
&& wsrep_thd_exec_mode(thd) != LOCAL_STATE;
#endif /* WITH_WSREP */
/* used by test case */
DBUG_EXECUTE_IF("no_innodb_binlog_errors", skip = true;);
if (!skip) {
#ifdef WITH_WSREP
if (!wsrep_on(thd) || wsrep_thd_exec_mode(thd) == LOCAL_STATE)
{
#endif /* WITH_WSREP */
my_error(ER_BINLOG_STMT_MODE_AND_ROW_ENGINE, MYF(0),
" InnoDB is limited to row-logging when"
" transaction isolation level is"
" READ COMMITTED or READ UNCOMMITTED.");
DBUG_RETURN(HA_ERR_LOGGING_IMPOSSIBLE);
#ifdef WITH_WSREP
}
#endif /* WITH_WSREP */
}
}

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation.
Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -1045,10 +1045,6 @@ std::string
lock_get_info(
const lock_t*);
/*******************************************************************//**
@return whether wsrep_on is true on trx->mysql_thd*/
#define wsrep_on_trx(trx) ((trx)->mysql_thd && wsrep_on((trx)->mysql_thd))
#endif /* WITH_WSREP */
#include "lock0lock.ic"

View File

@ -873,6 +873,13 @@ public:
rolled back by trx_rollback_or_clean_recovered().
Protected by trx_t::mutex for transactions that are in trx_sys. */
bool is_recovered;
#ifdef WITH_WSREP
/** whether wsrep_on(mysql_thd) held at the start of transaction */
bool wsrep;
bool is_wsrep() const { return UNIV_UNLIKELY(wsrep); }
#else /* WITH_WSREP */
bool is_wsrep() const { return false; }
#endif /* WITH_WSREP */
ReadView* read_view; /*!< consistent read view used in the
transaction, or NULL if not yet set */

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2019, MariaDB Corporation.
Copyright (c) 2014, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -1100,9 +1100,7 @@ wsrep_kill_victim(
ut_ad(trx_mutex_own(lock->trx));
/* quit for native mysql */
if (!wsrep_on(trx->mysql_thd)) {
return;
}
if (!trx->is_wsrep()) return;
my_bool bf_this = wsrep_thd_is_BF(trx->mysql_thd, FALSE);
my_bool bf_other = wsrep_thd_is_BF(lock->trx->mysql_thd, TRUE);
@ -1185,7 +1183,7 @@ lock_rec_other_has_conflicting(
if (lock_rec_has_to_wait(true, trx, mode, lock, is_supremum)) {
#ifdef WITH_WSREP
if (wsrep_on_trx(trx)) {
if (trx->is_wsrep()) {
trx_mutex_enter(lock->trx);
/* Below function will roll back either trx
or lock->trx depending on priority of the
@ -1478,7 +1476,7 @@ lock_rec_create_low(
ut_ad(index->table->get_ref_count() > 0 || !index->table->can_be_evicted);
#ifdef WITH_WSREP
if (c_lock && wsrep_on_trx(trx)
if (c_lock && trx->is_wsrep()
&& wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
lock_t *hash = (lock_t *)c_lock->hash;
lock_t *prev = NULL;
@ -1879,8 +1877,7 @@ lock_rec_add_to_queue(
#ifdef WITH_WSREP
//ut_a(!other_lock || (wsrep_thd_is_BF(trx->mysql_thd, FALSE) &&
// wsrep_thd_is_BF(other_lock->trx->mysql_thd, TRUE)));
if (other_lock &&
wsrep_on(trx->mysql_thd) &&
if (other_lock && trx->is_wsrep() &&
!wsrep_thd_is_BF(trx->mysql_thd, FALSE) &&
!wsrep_thd_is_BF(other_lock->trx->mysql_thd, TRUE)) {
@ -3656,7 +3653,7 @@ lock_table_create(
UT_LIST_ADD_LAST(trx->lock.trx_locks, lock);
#ifdef WITH_WSREP
if (c_lock && wsrep_on_trx(trx)) {
if (c_lock && trx->is_wsrep()) {
if (wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
ut_list_insert(table->locks, c_lock, lock,
TableLockGetNode());
@ -3886,7 +3883,7 @@ lock_table_enqueue_waiting(
}
#ifdef WITH_WSREP
if (trx->lock.was_chosen_as_deadlock_victim && wsrep_on_trx(trx)) {
if (trx->is_wsrep() && trx->lock.was_chosen_as_deadlock_victim) {
return(DB_DEADLOCK);
}
#endif /* WITH_WSREP */
@ -3959,7 +3956,7 @@ lock_table_other_has_incompatible(
&& (wait || !lock_get_wait(lock))) {
#ifdef WITH_WSREP
if (wsrep_on(lock->trx->mysql_thd)) {
if (lock->trx->is_wsrep()) {
if (wsrep_debug) {
ib::info() << "WSREP: table lock abort for table:"
<< table->name.m_name;
@ -5253,7 +5250,7 @@ lock_rec_queue_validate(
explicit granted lock. */
#ifdef WITH_WSREP
if (wsrep_on(other_lock->trx->mysql_thd)) {
if (other_lock->trx->is_wsrep()) {
if (!lock_get_wait(other_lock) ) {
ib::info() << "WSREP impl BF lock conflict for my impl lock:\n BF:" <<
((wsrep_thd_is_BF(impl_trx->mysql_thd, FALSE)) ? "BF" : "normal") << " exec: " <<

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2019, MariaDB Corporation.
Copyright (c) 2014, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -192,8 +192,7 @@ wsrep_is_BF_lock_timeout(
const trx_t* trx,
bool locked = true)
{
if (wsrep_on_trx(trx)
&& wsrep_thd_is_BF(trx->mysql_thd, FALSE)
if (trx->is_wsrep() && wsrep_thd_is_BF(trx->mysql_thd, FALSE)
&& trx->error_state != DB_DEADLOCK) {
ib::info() << "WSREP: BF lock wait long for trx:" << ib::hex(trx->id)
<< " query: " << wsrep_thd_query(trx->mysql_thd);
@ -402,8 +401,9 @@ lock_wait_suspend_thread(
if (lock_wait_timeout < 100000000
&& wait_time > (double) lock_wait_timeout
#ifdef WITH_WSREP
&& (!wsrep_on_trx(trx) ||
(!wsrep_is_BF_lock_timeout(trx, false) && trx->error_state != DB_DEADLOCK))
&& (!trx->is_wsrep()
|| (!wsrep_is_BF_lock_timeout(trx, false)
&& trx->error_state != DB_DEADLOCK))
#endif /* WITH_WSREP */
) {

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2019, 2020 MariaDB Corporation.
Copyright (c) 2016, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -1779,7 +1779,7 @@ row_ins_check_foreign_constraint(
if (check_ref) {
err = DB_SUCCESS;
#ifdef WITH_WSREP
if (!wsrep_on(trx->mysql_thd)) {
if (!trx->is_wsrep()) {
goto end_scan;
}
enum wsrep_key_type key_type;

View File

@ -464,7 +464,7 @@ func_exit:
inline bool wsrep_must_process_fk(const upd_node_t* node, const trx_t* trx)
{
if (!wsrep_on_trx(trx)) {
if (!trx->is_wsrep()) {
return false;
}
return que_node_get_type(node->common.parent) != QUE_NODE_UPDATE

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2018, MariaDB Corporation.
Copyright (c) 2015, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@ -122,8 +122,7 @@ srv_conc_enter_innodb_with_atomics(
for (;;) {
ulint sleep_in_us;
#ifdef WITH_WSREP
if (wsrep_on(trx->mysql_thd) &&
wsrep_trx_is_aborting(trx->mysql_thd)) {
if (trx->is_wsrep() && wsrep_trx_is_aborting(trx->mysql_thd)) {
if (wsrep_debug) {
ib::info() <<
"srv_conc_enter due to MUST_ABORT";

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2019, MariaDB Corporation.
Copyright (c) 2015, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -102,6 +102,9 @@ trx_init(
trx->state = TRX_STATE_NOT_STARTED;
trx->is_recovered = false;
#ifdef WITH_WSREP
trx->wsrep = false;
#endif /* WITH_WSREP */
trx->op_info = "";
@ -1814,12 +1817,7 @@ trx_commit_in_memory(
trx_mutex_enter(trx);
trx->dict_operation = TRX_DICT_OP_NONE;
#ifdef WITH_WSREP
if (trx->mysql_thd && wsrep_on(trx->mysql_thd)) {
trx->lock.was_chosen_as_deadlock_victim = FALSE;
}
#endif
trx->lock.was_chosen_as_deadlock_victim = false;
DBUG_LOG("trx", "Commit in memory: " << trx);
trx->state = TRX_STATE_NOT_STARTED;

View File

@ -296,7 +296,7 @@ static MYSQL_SYSVAR_BOOL(encrypt_tables, maria_encrypt_tables, PLUGIN_VAR_OPCMDA
"and not FIXED/DYNAMIC)",
0, 0, 0);
#ifdef HAVE_PSI_INTERFACE
#if defined HAVE_PSI_INTERFACE && !defined EMBEDDED_LIBRARY
static PSI_mutex_info all_aria_mutexes[]=
{

View File

@ -5,7 +5,7 @@ Copyright (c) 2013, 2018, MariaDB Corporation.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2019, MariaDB Corporation.
Copyright (c) 2013, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@ -1939,8 +1939,7 @@ innobase_srv_conc_enter_innodb(
trx_t* trx) /*!< in: transaction handle */
{
#ifdef WITH_WSREP
if (wsrep_on(trx->mysql_thd) &&
wsrep_thd_is_BF(trx->mysql_thd, FALSE)) return;
if (trx->is_wsrep() && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) return;
#endif /* WITH_WSREP */
if (srv_thread_concurrency) {
if (trx->n_tickets_to_enter_innodb > 0) {
@ -1978,8 +1977,7 @@ innobase_srv_conc_exit_innodb(
ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
#endif /* UNIV_SYNC_DEBUG */
#ifdef WITH_WSREP
if (wsrep_on(trx->mysql_thd) &&
wsrep_thd_is_BF(trx->mysql_thd, FALSE)) return;
if (trx->is_wsrep() && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) return;
#endif /* WITH_WSREP */
/* This is to avoid making an unnecessary function call. */
@ -2922,6 +2920,9 @@ innobase_trx_init(
trx->check_unique_secondary = !thd_test_options(
thd, OPTION_RELAXED_UNIQUE_CHECKS);
#ifdef WITH_WSREP
trx->wsrep = wsrep_on(thd);
#endif
/* Transaction on start caches the fake_changes state and uses it for
complete transaction lifetime.
@ -4645,19 +4646,17 @@ innobase_commit_low(
trx_t* trx) /*!< in: transaction handle */
{
#ifdef WITH_WSREP
THD* thd = (THD*)trx->mysql_thd;
const char* tmp = 0;
if (thd && wsrep_on(thd)) {
if (trx->is_wsrep()) {
#ifdef WSREP_PROC_INFO
char info[64];
info[sizeof(info) - 1] = '\0';
snprintf(info, sizeof(info) - 1,
"innobase_commit_low():trx_commit_for_mysql(%lld)",
(long long) wsrep_thd_trx_seqno(thd));
tmp = thd_proc_info(thd, info);
(long long) wsrep_thd_trx_seqno(trx->mysql_thd));
tmp = thd_proc_info(trx->mysql_thd, info);
#else
tmp = thd_proc_info(thd, "innobase_commit_low()");
tmp = thd_proc_info(trx->mysql_thd, "innobase_commit_low()");
#endif /* WSREP_PROC_INFO */
}
#endif /* WITH_WSREP */
@ -4666,7 +4665,7 @@ innobase_commit_low(
trx_commit_for_mysql(trx);
}
#ifdef WITH_WSREP
if (thd && wsrep_on(thd)) { thd_proc_info(thd, tmp); }
if (trx->is_wsrep()) { thd_proc_info(trx->mysql_thd, tmp); }
#endif /* WITH_WSREP */
}
@ -8676,19 +8675,19 @@ ha_innobase::write_row(
sql_command = thd_sql_command(user_thd);
if ((sql_command == SQLCOM_ALTER_TABLE
|| sql_command == SQLCOM_OPTIMIZE
|| sql_command == SQLCOM_CREATE_INDEX
if (num_write_row >= 10000
&& (sql_command == SQLCOM_ALTER_TABLE
|| sql_command == SQLCOM_OPTIMIZE
|| sql_command == SQLCOM_CREATE_INDEX
#ifdef WITH_WSREP
|| (wsrep_on(user_thd) && wsrep_load_data_splitting &&
sql_command == SQLCOM_LOAD &&
!thd_test_options(
user_thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
|| (sql_command == SQLCOM_LOAD &&
trx->is_wsrep() && wsrep_load_data_splitting &&
!thd_test_options(
user_thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
#endif /* WITH_WSREP */
|| sql_command == SQLCOM_DROP_INDEX)
&& num_write_row >= 10000) {
|| sql_command == SQLCOM_DROP_INDEX)) {
#ifdef WITH_WSREP
if (wsrep_on(user_thd) && sql_command == SQLCOM_LOAD) {
if (sql_command == SQLCOM_LOAD && trx->is_wsrep()) {
WSREP_DEBUG("forced trx split for LOAD: %s",
wsrep_thd_query(user_thd));
}
@ -8727,9 +8726,8 @@ no_commit:
;
} else if (src_table == prebuilt->table) {
#ifdef WITH_WSREP
if (wsrep_on(user_thd) &&
wsrep_load_data_splitting &&
sql_command == SQLCOM_LOAD &&
if (sql_command == SQLCOM_LOAD && trx->is_wsrep() &&
wsrep_load_data_splitting &&
!thd_test_options(user_thd,
OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
{
@ -8759,9 +8757,8 @@ no_commit:
prebuilt->sql_stat_start = TRUE;
} else {
#ifdef WITH_WSREP
if (wsrep_on(user_thd) &&
wsrep_load_data_splitting &&
sql_command == SQLCOM_LOAD &&
if (sql_command == SQLCOM_LOAD && trx->is_wsrep() &&
wsrep_load_data_splitting &&
!thd_test_options(user_thd,
OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
{
@ -8906,21 +8903,19 @@ no_commit:
prebuilt->autoinc_offset,
prebuilt->autoinc_increment);
if (wsrep_on(current_thd) &&
if (trx->is_wsrep() &&
auto_inc_inserted &&
wsrep_drupal_282555_workaround &&
wsrep_thd_retry_counter(current_thd) == 0 &&
!thd_test_options(current_thd,
wsrep_thd_retry_counter(user_thd) == 0 &&
!thd_test_options(user_thd,
OPTION_NOT_AUTOCOMMIT |
OPTION_BEGIN)) {
WSREP_DEBUG(
"retrying insert: %s",
(*wsrep_thd_query(current_thd)) ?
wsrep_thd_query(current_thd) :
(char *)"void");
wsrep_thd_query(user_thd));
error= DB_SUCCESS;
wsrep_thd_set_conflict_state(
current_thd, MUST_ABORT);
user_thd, MUST_ABORT);
innobase_srv_conc_exit_innodb(prebuilt->trx);
/* jump straight to func exit over
* later wsrep hooks */
@ -8989,18 +8984,16 @@ report_error:
user_thd);
#ifdef WITH_WSREP
if (!error_result
&& wsrep_on(user_thd)
&& wsrep_thd_exec_mode(user_thd) == LOCAL_STATE
if (!error_result && trx->is_wsrep()
&& wsrep_thd_exec_mode(user_thd) == LOCAL_STATE
&& !wsrep_consistency_check(user_thd)
&& !wsrep_thd_ignore_table(user_thd)) {
if (wsrep_append_keys(user_thd, WSREP_KEY_EXCLUSIVE, record, NULL)) {
DBUG_PRINT("wsrep", ("row key failed"));
error_result = HA_ERR_INTERNAL_ERROR;
goto wsrep_error;
goto func_exit;
}
}
wsrep_error:
#endif /* WITH_WSREP */
if (error_result == HA_FTS_INVALID_DOCID) {
@ -9508,9 +9501,8 @@ func_exit:
innobase_active_small();
#ifdef WITH_WSREP
if (error == DB_SUCCESS &&
if (error == DB_SUCCESS && trx->is_wsrep() &&
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
wsrep_on(user_thd) &&
!wsrep_thd_ignore_table(user_thd))
{
DBUG_PRINT("wsrep", ("update row key"));
@ -9519,11 +9511,9 @@ func_exit:
new_row)) {
WSREP_DEBUG("WSREP: UPDATE_ROW_KEY FAILED");
DBUG_PRINT("wsrep", ("row key failed"));
err = HA_ERR_INTERNAL_ERROR;
goto wsrep_error;
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
}
}
wsrep_error:
#endif /* WITH_WSREP */
DBUG_RETURN(err);
@ -9570,25 +9560,20 @@ ha_innobase::delete_row(
/* Tell the InnoDB server that there might be work for
utility threads: */
innobase_active_small();
#ifdef WITH_WSREP
if (error == DB_SUCCESS &&
if (error == DB_SUCCESS && trx->is_wsrep() &&
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
wsrep_on(user_thd) &&
!wsrep_thd_ignore_table(user_thd))
{
if (wsrep_append_keys(user_thd, WSREP_KEY_EXCLUSIVE, record,
NULL)) {
NULL)) {
DBUG_PRINT("wsrep", ("delete fail"));
error = (dberr_t) HA_ERR_INTERNAL_ERROR;
goto wsrep_error;
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
}
}
wsrep_error:
#endif /* WITH_WSREP */
DBUG_RETURN(convert_error_code_to_mysql(
error, prebuilt->table->flags, user_thd));
}
@ -10844,8 +10829,7 @@ wsrep_append_foreign_key(
int cache_key_len;
bool const copy = true;
if (!wsrep_on(trx->mysql_thd) ||
wsrep_thd_exec_mode(thd) != LOCAL_STATE)
if (!trx->is_wsrep() || wsrep_thd_exec_mode(thd) != LOCAL_STATE)
return DB_SUCCESS;
if (!thd || !foreign ||
@ -15468,12 +15452,11 @@ ha_innobase::external_lock(
THD* thd, /*!< in: handle to the user thread */
int lock_type) /*!< in: lock type */
{
trx_t* trx;
DBUG_ENTER("ha_innobase::external_lock");
DBUG_PRINT("enter",("lock_type: %d", lock_type));
update_thd(thd);
trx_t* trx = prebuilt->trx;
/* Statement based binlogging does not work in isolation level
READ UNCOMMITTED and READ COMMITTED since the necessary
@ -15487,22 +15470,19 @@ ha_innobase::external_lock(
&& thd_binlog_format(thd) == BINLOG_FORMAT_STMT
&& thd_binlog_filter_ok(thd)
&& thd_sqlcom_can_generate_row_events(thd)) {
bool skip = 0;
bool skip = false;
#ifdef WITH_WSREP
skip = trx->is_wsrep()
&& wsrep_thd_exec_mode(thd) != LOCAL_STATE;
#endif /* WITH_WSREP */
/* used by test case */
DBUG_EXECUTE_IF("no_innodb_binlog_errors", skip = true;);
if (!skip) {
#ifdef WITH_WSREP
if (!wsrep_on(thd) || wsrep_thd_exec_mode(thd) == LOCAL_STATE)
{
#endif /* WITH_WSREP */
my_error(ER_BINLOG_STMT_MODE_AND_ROW_ENGINE, MYF(0),
" InnoDB is limited to row-logging when "
"transaction isolation level is "
"READ COMMITTED or READ UNCOMMITTED.");
DBUG_RETURN(HA_ERR_LOGGING_IMPOSSIBLE);
#ifdef WITH_WSREP
}
#endif /* WITH_WSREP */
my_error(ER_BINLOG_STMT_MODE_AND_ROW_ENGINE, MYF(0),
" InnoDB is limited to row-logging when "
"transaction isolation level is "
"READ COMMITTED or READ UNCOMMITTED.");
DBUG_RETURN(HA_ERR_LOGGING_IMPOSSIBLE);
}
}
@ -15533,8 +15513,6 @@ ha_innobase::external_lock(
}
trx = prebuilt->trx;
prebuilt->sql_stat_start = TRUE;
prebuilt->hint_need_to_fetch_extra_cols = 0;

View File

@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -1013,8 +1014,6 @@ std::string
lock_get_info(
const lock_t*);
#define wsrep_on_trx(trx) ((trx)->mysql_thd && wsrep_on((trx)->mysql_thd))
#ifndef UNIV_NONINL
#include "lock0lock.ic"
#endif

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2019, MariaDB Corporation.
Copyright (c) 2015, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -815,15 +815,21 @@ struct trx_t{
ro_trx_list the first time they try to acquire a lock ie. by default
we treat all read-only transactions as non-locking. */
trx_state_t state;
trx_lock_t lock; /*!< Information about the transaction
locks and state. Protected by
trx->mutex or lock_sys->mutex
or both */
ulint is_recovered; /*!< 0=normal transaction,
1=recovered, must be rolled back,
bool is_recovered; /*!< false=normal transaction,
true=recovered, must be rolled back,
protected by trx_sys->mutex when
trx->in_rw_trx_list holds */
#ifdef WITH_WSREP
/** whether wsrep_on(mysql_thd) held at the start of transaction */
bool wsrep;
bool is_wsrep() const { return UNIV_UNLIKELY(wsrep); }
#else /* WITH_WSREP */
bool is_wsrep() const { return false; }
#endif /* WITH_WSREP */
/* These fields are not protected by any mutex. */
const char* op_info; /*!< English text describing the

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2019, MariaDB Corporation.
Copyright (c) 2014, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -1770,7 +1770,7 @@ wsrep_kill_victim(
ut_ad(trx_mutex_own(lock->trx));
/* quit for native mysql */
if (!wsrep_on(trx->mysql_thd)) return;
if (!trx->is_wsrep()) return;
my_bool bf_this = wsrep_thd_is_BF(trx->mysql_thd, FALSE);
my_bool bf_other = wsrep_thd_is_BF(lock->trx->mysql_thd, TRUE);
@ -1856,7 +1856,7 @@ lock_rec_other_has_conflicting(
#ifdef WITH_WSREP
if (lock_rec_has_to_wait(TRUE, trx, mode, lock, is_supremum)) {
if (wsrep_on_trx(trx)) {
if (trx->is_wsrep()) {
trx_mutex_enter(lock->trx);
/* Below function will roll back either trx
or lock->trx depending on priority of the
@ -2318,8 +2318,7 @@ lock_rec_create(
ut_ad(index->table->n_ref_count > 0 || !index->table->can_be_evicted);
#ifdef WITH_WSREP
if (c_lock &&
wsrep_on_trx(trx) &&
if (c_lock && trx->is_wsrep() &&
wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
lock_t *hash = (lock_t *)c_lock->hash;
lock_t *prev = NULL;
@ -5009,7 +5008,7 @@ lock_table_create(
UT_LIST_ADD_LAST(trx_locks, trx->lock.trx_locks, lock);
#ifdef WITH_WSREP
if (c_lock && wsrep_on_trx(trx)) {
if (c_lock && trx->is_wsrep()) {
if (wsrep_thd_is_wsrep(trx->mysql_thd)
&& wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
UT_LIST_INSERT_AFTER(
@ -5248,7 +5247,7 @@ lock_table_enqueue_waiting(
/* Enqueue the lock request that will wait to be granted */
#ifdef WITH_WSREP
if (trx->lock.was_chosen_as_deadlock_victim && wsrep_on_trx(trx)) {
if (trx->lock.was_chosen_as_deadlock_victim && trx->is_wsrep()) {
return(DB_DEADLOCK);
}

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2019, MariaDB Corporation.
Copyright (c) 2014, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -255,8 +255,7 @@ wsrep_is_BF_lock_timeout(
const trx_t* trx,
bool locked = true)
{
if (wsrep_on_trx(trx)
&& wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
if (trx->is_wsrep() && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
fprintf(stderr, "WSREP: BF lock wait long for trx " TRX_ID_FMT "\n", trx->id);
srv_print_innodb_monitor = TRUE;
srv_print_innodb_lock_monitor = TRUE;
@ -447,7 +446,7 @@ lock_wait_suspend_thread(
if (lock_wait_timeout < 100000000
&& wait_time > (double) lock_wait_timeout) {
#ifdef WITH_WSREP
if (!wsrep_on_trx(trx) ||
if (!trx->is_wsrep() ||
(!wsrep_is_BF_lock_timeout(trx) &&
trx->error_state != DB_DEADLOCK)) {
#endif /* WITH_WSREP */

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2018, MariaDB Corporation.
Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -1651,7 +1651,7 @@ run_again:
if (check_ref) {
err = DB_SUCCESS;
#ifdef WITH_WSREP
if (!wsrep_on(trx->mysql_thd)) {
if (!trx->is_wsrep()) {
goto end_scan;
}
enum wsrep_key_type key_type;

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2018, 2019, MariaDB Corporation.
Copyright (c) 2018, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -1814,7 +1814,7 @@ row_upd_store_row(
inline bool wsrep_must_process_fk(const upd_node_t* node, const trx_t* trx)
{
if (!wsrep_on_trx(trx)) {
if (!trx->is_wsrep()) {
return false;
}
return que_node_get_type(node->common.parent) != QUE_NODE_UPDATE

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
Copyright (c) 2017, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@ -218,8 +218,7 @@ srv_conc_enter_innodb_with_atomics(
for (;;) {
ulint sleep_in_us;
#ifdef WITH_WSREP
if (wsrep_on(trx->mysql_thd) &&
wsrep_trx_is_aborting(trx->mysql_thd)) {
if (trx->is_wsrep() && wsrep_trx_is_aborting(trx->mysql_thd)) {
if (wsrep_debug)
fprintf(stderr,
"srv_conc_enter due to MUST_ABORT");
@ -430,8 +429,7 @@ retry:
return;
}
#ifdef WITH_WSREP
if (wsrep_on(trx->mysql_thd) &&
wsrep_thd_is_brute_force(trx->mysql_thd)) {
if (trx->is_wsrep() && wsrep_thd_is_brute_force(trx->mysql_thd)) {
srv_conc_force_enter_innodb(trx);
return;
}
@ -514,8 +512,7 @@ retry:
srv_conc.n_waiting++;
#ifdef WITH_WSREP
if (wsrep_on(trx->mysql_thd) &&
wsrep_trx_is_aborting(trx->mysql_thd)) {
if (trx->is_wsrep() && wsrep_trx_is_aborting(trx->mysql_thd)) {
os_fast_mutex_unlock(&srv_conc_mutex);
if (wsrep_debug)
fprintf(stderr, "srv_conc_enter due to MUST_ABORT");

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2019, MariaDB Corporation.
Copyright (c) 2016, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -379,8 +379,7 @@ trx_rollback_to_savepoint_for_mysql_low(
trx->op_info = "";
#ifdef WITH_WSREP
if (wsrep_on(trx->mysql_thd) &&
trx->lock.was_chosen_as_deadlock_victim) {
if (trx->is_wsrep()) {
trx->lock.was_chosen_as_deadlock_victim = FALSE;
}
#endif
@ -1083,12 +1082,6 @@ trx_roll_try_truncate(
if (trx->update_undo) {
trx_undo_truncate_end(trx, trx->update_undo, limit);
}
#ifdef WITH_WSREP_OUT
if (wsrep_on(trx->mysql_thd)) {
trx->lock.was_chosen_as_deadlock_victim = FALSE;
}
#endif /* WITH_WSREP */
}
/***********************************************************************//**

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2019, MariaDB Corporation.
Copyright (c) 2015, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -1555,11 +1555,7 @@ trx_commit_in_memory(
ut_ad(!trx->in_ro_trx_list);
ut_ad(!trx->in_rw_trx_list);
#ifdef WITH_WSREP
if (trx->mysql_thd && wsrep_on(trx->mysql_thd)) {
trx->lock.was_chosen_as_deadlock_victim = FALSE;
}
#endif
trx->lock.was_chosen_as_deadlock_victim = FALSE;
trx->dict_operation = TRX_DICT_OP_NONE;
trx->error_state = DB_SUCCESS;