diff --git a/include/my_pthread.h b/include/my_pthread.h index 3f56f7dd058..81dd63ee331 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -739,13 +739,14 @@ struct st_my_thread_var #endif }; -extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const)); +struct st_my_thread_var *_my_thread_var(void); extern void **my_thread_var_dbug(void); extern safe_mutex_t **my_thread_var_mutex_in_use(void); extern uint my_thread_end_wait_time; extern my_bool safe_mutex_deadlock_detector; #define my_thread_var (_my_thread_var()) #define my_errno my_thread_var->thr_errno +int set_mysys_var(struct st_my_thread_var *mysys_var); /* Keep track of shutdown,signal, and main threads so that my_end() will not report errors with them diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index f26a09bff18..b588a7a05f2 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3213,7 +3213,8 @@ sub mysql_install_db { # ---------------------------------------------------------------------- # export MYSQLD_BOOTSTRAP_CMD variable containing /mysqld # ---------------------------------------------------------------------- - $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 diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result b/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result index 91f875377e2..8717d002d32 100644 --- a/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result @@ -705,6 +705,11 @@ FULLTEXT(f2), FOREIGN KEY(f1) REFERENCES mdev20987_1(f1))ENGINE=InnoDB; INSERT INTO mdev20987_1 VALUES(1); INSERT INTO mdev20987_2 VALUES(1, 'mariadb'); +CREATE TABLE mdev22358 (a INT, b TEXT, FULLTEXT KEY ftidx (b)) ENGINE=InnoDB; +ALTER TABLE mdev22358 DROP KEY ftidx; +INSERT INTO mdev22358 (a) VALUES (2),(2); +ALTER TABLE mdev22358 ADD UNIQUE KEY uidx (a), ADD FULLTEXT KEY ftidx (b); +ERROR 23000: Duplicate entry '2' for key 'uidx' # restart SHOW CREATE TABLE t2; Table Create Table @@ -713,7 +718,7 @@ t2 CREATE TABLE `t2` ( PRIMARY KEY (`FTS_DOC_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DELETE FROM t1 WHERE MATCH(char_column) AGAINST ('bbb'); -DROP TABLE t1, t2, mdev20987_2, mdev20987_1; +DROP TABLE t1, t2, mdev20987_2, mdev20987_1, mdev22358; "----------Test28---------" create table `fts_test`(`a` text,fulltext key(`a`))engine=innodb; set session autocommit=0; diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_misc.test b/mysql-test/suite/innodb_fts/t/innodb_fts_misc.test index e1f4874a1d4..8f4902fd2de 100644 --- a/mysql-test/suite/innodb_fts/t/innodb_fts_misc.test +++ b/mysql-test/suite/innodb_fts/t/innodb_fts_misc.test @@ -672,10 +672,16 @@ CREATE TABLE mdev20987_2(f1 INT NOT NULL, f2 CHAR(100), FOREIGN KEY(f1) REFERENCES mdev20987_1(f1))ENGINE=InnoDB; INSERT INTO mdev20987_1 VALUES(1); INSERT INTO mdev20987_2 VALUES(1, 'mariadb'); + +CREATE TABLE mdev22358 (a INT, b TEXT, FULLTEXT KEY ftidx (b)) ENGINE=InnoDB; +ALTER TABLE mdev22358 DROP KEY ftidx; +INSERT INTO mdev22358 (a) VALUES (2),(2); +--error ER_DUP_ENTRY +ALTER TABLE mdev22358 ADD UNIQUE KEY uidx (a), ADD FULLTEXT KEY ftidx (b); --source include/restart_mysqld.inc SHOW CREATE TABLE t2; DELETE FROM t1 WHERE MATCH(char_column) AGAINST ('bbb'); -DROP TABLE t1, t2, mdev20987_2, mdev20987_1; +DROP TABLE t1, t2, mdev20987_2, mdev20987_1, mdev22358; --echo "----------Test28---------" create table `fts_test`(`a` text,fulltext key(`a`))engine=innodb; diff --git a/mysql-test/suite/sql_sequence/rebuild.test b/mysql-test/suite/sql_sequence/rebuild.test index 7c00e0be7cc..2994b90c98f 100644 --- a/mysql-test/suite/sql_sequence/rebuild.test +++ b/mysql-test/suite/sql_sequence/rebuild.test @@ -1,4 +1,5 @@ --source include/have_innodb.inc +--source include/have_perfschema.inc --echo # --echo # MDEV-15977 Assertion `! thd->in_sub_stmt' failed in trans_commit_stmt diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index b298c7b1bd7..66c2543c51d 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -141,7 +141,7 @@ void my_thread_global_reinit(void) my_thread_destroy_internal_mutex(); my_thread_init_internal_mutex(); - tmp= my_pthread_getspecific(struct st_my_thread_var*, THR_KEY_mysys); + tmp= my_thread_var; DBUG_ASSERT(tmp); my_thread_destory_thr_mutex(tmp); @@ -279,7 +279,7 @@ my_bool my_thread_init(void) fprintf(stderr,"my_thread_init(): pthread_self: %p\n", pthread_self()); #endif - if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys)) + if (my_thread_var) { #ifdef EXTRA_DEBUG_THREADS fprintf(stderr,"my_thread_init() called more than once in thread 0x%lx\n", @@ -297,7 +297,7 @@ my_bool my_thread_init(void) error= 1; goto end; } - pthread_setspecific(THR_KEY_mysys,tmp); + set_mysys_var(tmp); tmp->pthread_self= pthread_self(); my_thread_init_thr_mutex(tmp); @@ -334,7 +334,7 @@ end: void my_thread_end(void) { struct st_my_thread_var *tmp; - tmp= my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys); + tmp= my_thread_var; #ifdef EXTRA_DEBUG_THREADS fprintf(stderr,"my_thread_end(): tmp: %p pthread_self: %p thread_id: %ld\n", @@ -355,7 +355,7 @@ void my_thread_end(void) as the key is used by DBUG. */ DBUG_POP(); - pthread_setspecific(THR_KEY_mysys,0); + set_mysys_var(NULL); if (tmp && tmp->init) { @@ -439,7 +439,7 @@ extern void **my_thread_var_dbug() struct st_my_thread_var *tmp; if (!my_thread_global_init_done) return NULL; - tmp= my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys); + tmp= my_thread_var; return tmp && tmp->init ? &tmp->dbug : 0; } #endif /* DBUG_OFF */ @@ -451,7 +451,7 @@ safe_mutex_t **my_thread_var_mutex_in_use() struct st_my_thread_var *tmp; if (!my_thread_global_init_done) return NULL; - tmp= my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys); + tmp= my_thread_var; return tmp ? &tmp->mutex_in_use : 0; } diff --git a/sql/item_func.cc b/sql/item_func.cc index c1350fd1818..e6d33bd1c4d 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2009, 2019, 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 @@ -2561,19 +2561,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 (wsrep_thd_is_applying(thd)) - tmp= thd->wsrep_rand; - else - tmp= thd->wsrep_rand= (uint32) arg->val_int(); - } - else + THD *thd= current_thd; + if (WSREP(thd)) + { + if (wsrep_thd_is_applying(thd)) + 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)); diff --git a/sql/log_event.cc b/sql/log_event.cc index 269dd335644..1a77397bf79 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -9080,7 +9080,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(thd) && + else if (WSREP(thd) && wsrep_mysql_replication_bundle && opt_slave_domain_parallel_threads == 0) { if (++thd->wsrep_mysql_replicated < (int)wsrep_mysql_replication_bundle) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index e71e15a3dfc..3be37e6ecf4 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2008, 2020, 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 @@ -1947,10 +1947,10 @@ static void mysqld_exit(int exit_code) set_malloc_size_cb(NULL); if (global_status_var.global_memory_used) { -#ifdef SAFEMALLOC - sf_report_leaked_memory(0); -#endif - DBUG_SLOW_ASSERT(global_status_var.global_memory_used == 0); + fprintf(stderr, "Warning: Memory not freed: %lld\n", + (longlong) global_status_var.global_memory_used); + if (exit_code == 0) + SAFEMALLOC_REPORT_MEMORY(0); } cleanup_tls(); DBUG_LEAVE; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 5d585b11ce0..284534eee9b 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2010, 2019, 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 diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index efcc56d67be..3a0c7a8514c 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2012 Monty Program Ab +/* Copyright (C) 2012, 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 @@ -47,7 +47,6 @@ static void threadpool_remove_connection(THD *thd); static int threadpool_process_request(THD *thd); static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data); -extern "C" pthread_key(struct st_my_thread_var*, THR_KEY_mysys); extern bool do_command(THD*); static inline TP_connection *get_TP_connection(THD *thd) @@ -86,14 +85,14 @@ struct Worker_thread_context void save() { - psi_thread = PSI_CALL_get_thread(); - mysys_var= (st_my_thread_var *)pthread_getspecific(THR_KEY_mysys); + psi_thread= PSI_CALL_get_thread(); + mysys_var= my_thread_var; } void restore() { PSI_CALL_set_thread(psi_thread); - pthread_setspecific(THR_KEY_mysys,mysys_var); + set_mysys_var(mysys_var); pthread_setspecific(THR_THD, 0); } }; @@ -144,7 +143,7 @@ static void thread_attach(THD* thd) attaching the thd. */ wsrep_wait_rollback_complete_and_acquire_ownership(thd); #endif /* WITH_WSREP */ - pthread_setspecific(THR_KEY_mysys,thd->mysys_var); + set_mysys_var(thd->mysys_var); thd->thread_stack=(char*)&thd; thd->store_globals(); PSI_CALL_set_thread(thd->event_scheduler.m_psi); @@ -229,9 +228,9 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data) Store them in THD. */ - pthread_setspecific(THR_KEY_mysys, 0); + set_mysys_var(NULL); my_thread_init(); - st_my_thread_var* mysys_var= (st_my_thread_var *)pthread_getspecific(THR_KEY_mysys); + st_my_thread_var* mysys_var= my_thread_var; if (!mysys_var ||!(thd= connect->create_thd(NULL))) { /* Out of memory? */ diff --git a/sql/wsrep_dummy.cc b/sql/wsrep_dummy.cc index ac55dc5c843..8e2b09cfe55 100644 --- a/sql/wsrep_dummy.cc +++ b/sql/wsrep_dummy.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2014 SkySQL Ab. +/* Copyright (C) 2014, 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 @@ -136,5 +136,9 @@ my_bool wsrep_get_debug() void wsrep_commit_ordered(THD* ) { } +void wsrep_log(void (*)(const char *, ...), const char *, ...) +{ +} + my_bool wsrep_thd_is_applying(const THD*) { return 0;} diff --git a/storage/innobase/dict/dict0stats_bg.cc b/storage/innobase/dict/dict0stats_bg.cc index e90b5da2411..2d358f2c9e3 100644 --- a/storage/innobase/dict/dict0stats_bg.cc +++ b/storage/innobase/dict/dict0stats_bg.cc @@ -32,6 +32,7 @@ Created Apr 25, 2012 Vasil Dimov #include "srv0start.h" #include "fil0fil.h" #ifdef WITH_WSREP +# include "trx0trx.h" # include "mysql/service_wsrep.h" # include "wsrep.h" # include "log.h" @@ -147,12 +148,12 @@ dict_stats_recalc_pool_add( schedule new estimates for table and index statistics to be calculated. @param[in,out] table persistent or temporary table @param[in] thd current session */ -void dict_stats_update_if_needed(dict_table_t* table, THD* thd) +void dict_stats_update_if_needed(dict_table_t *table, const trx_t &trx) #else /** Update the table modification counter and if necessary, schedule new estimates for table and index statistics to be calculated. @param[in,out] table persistent or temporary table */ -void dict_stats_update_if_needed_func(dict_table_t* table) +void dict_stats_update_if_needed_func(dict_table_t *table) #endif { ut_ad(table->stat_initialized); @@ -179,9 +180,9 @@ void dict_stats_update_if_needed_func(dict_table_t* table) generated row locks and allow BF thread lock waits to be enqueued at head of waiting queue. */ - if (wsrep_on(thd) - && !wsrep_thd_is_applying(thd) - && wsrep_thd_is_BF(thd, 0)) { + if (trx.is_wsrep() + && !wsrep_thd_is_applying(trx.mysql_thd) + && wsrep_thd_is_BF(trx.mysql_thd, 0)) { WSREP_DEBUG("Avoiding background statistics" " calculation for table %s.", table->name.m_name); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 9dd1ec926b9..9ade00882a8 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1668,19 +1668,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) { @@ -1708,21 +1702,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 @@ -2684,6 +2672,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; } @@ -4364,19 +4355,17 @@ innobase_commit_low( trx_t* trx) /*!< in: transaction handle */ { #ifdef WITH_WSREP - THD* thd = (THD*)trx->mysql_thd; const char* tmp = 0; - if (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 */ @@ -4386,7 +4375,7 @@ innobase_commit_low( } trx->will_lock = 0; #ifdef WITH_WSREP - if (wsrep_on(thd)) { thd_proc_info(thd, tmp); } + if (trx->is_wsrep()) { thd_proc_info(trx->mysql_thd, tmp); } #endif /* WITH_WSREP */ } @@ -4499,7 +4488,7 @@ innobase_commit_ordered_2( #ifdef WITH_WSREP /* If the transaction is not run in 2pc, we must assign wsrep XID here in order to get it written in rollback segment. */ - if (wsrep_on(thd)) { + if (trx->is_wsrep()) { thd_get_xid(thd, (MYSQL_XID*)trx->xid); } #endif /* WITH_WSREP */ @@ -5116,28 +5105,25 @@ UNIV_INTERN void lock_cancel_waiting_and_release(lock_t* lock); /** Cancel any pending lock request associated with the current THD. @sa THD::awake() @sa ha_kill_query() */ -static void innobase_kill_query(handlerton*, THD* thd, enum thd_kill_levels) +static void innobase_kill_query(handlerton*, THD *thd, enum thd_kill_levels) { - DBUG_ENTER("innobase_kill_query"); + DBUG_ENTER("innobase_kill_query"); + + if (trx_t *trx= thd_to_trx(thd)) + { + ut_ad(trx->mysql_thd == thd); #ifdef WITH_WSREP - if (wsrep_on(thd) && wsrep_thd_is_aborting(thd)) { - /* if victim has been signaled by BF thread and/or aborting - is already progressing, following query aborting is not necessary - any more. - Also, BF thread should own trx mutex for the victim, which would - conflict with trx_mutex_enter() below - */ - DBUG_VOID_RETURN; - } + if (trx->is_wsrep() && wsrep_thd_is_aborting(thd)) + /* if victim has been signaled by BF thread and/or aborting is already + progressing, following query aborting is not necessary any more. + Also, BF thread should own trx mutex for the victim. */ + DBUG_VOID_RETURN; #endif /* WITH_WSREP */ + /* Cancel a pending lock request if there are any */ + lock_trx_handle_wait(trx); + } - if (trx_t* trx = thd_to_trx(thd)) { - ut_ad(trx->mysql_thd == thd); - /* Cancel a pending lock request if there are any */ - lock_trx_handle_wait(trx); - } - - DBUG_VOID_RETURN; + DBUG_VOID_RETURN; } @@ -7960,7 +7946,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; @@ -7990,7 +7976,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())) { @@ -8087,18 +8075,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_self_abort(m_user_thd); innobase_srv_conc_exit_innodb( @@ -8138,7 +8122,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_is_applying(m_user_thd)) { wsrep_thd_auto_increment_variables( @@ -8185,8 +8169,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_is_local(m_user_thd) && !wsrep_thd_ignore_table(m_user_thd) && !wsrep_consistency_check(m_user_thd) @@ -8198,10 +8181,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) { @@ -8852,8 +8834,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) && - wsrep_thd_is_applying(m_user_thd)) + if (trx->is_wsrep() && wsrep_thd_is_applying(m_user_thd)) wsrep_thd_auto_increment_variables( m_user_thd, &offset, &increment); else @@ -8897,11 +8878,9 @@ func_exit: innobase_active_small(); #ifdef WITH_WSREP - if (error == DB_SUCCESS - && wsrep_on(m_user_thd) + if (error == DB_SUCCESS && trx->is_wsrep() && wsrep_thd_is_local(m_user_thd) && !wsrep_thd_ignore_table(m_user_thd)) { - DBUG_PRINT("wsrep", ("update row key")); if (wsrep_append_keys(m_user_thd, @@ -8911,14 +8890,11 @@ func_exit: old_row, 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); } @@ -8968,20 +8944,16 @@ ha_innobase::delete_row( innobase_active_small(); #ifdef WITH_WSREP - if (error == DB_SUCCESS - && wsrep_on(m_user_thd) + if (error == DB_SUCCESS && trx->is_wsrep() && wsrep_thd_is_local(m_user_thd) && !wsrep_thd_ignore_table(m_user_thd)) { - if (wsrep_append_keys(m_user_thd, WSREP_SERVICE_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)); @@ -10172,29 +10144,26 @@ wsrep_append_foreign_key( Wsrep_service_key_type key_type) /*!< in: access type of this key (shared, exclusive, reference...) */ { - ut_a(trx); - THD* thd = (THD*)trx->mysql_thd; - ulint rcode = DB_SUCCESS; - char cache_key[513] = {'\0'}; - int cache_key_len=0; - - if (!wsrep_on(trx->mysql_thd) || - wsrep_thd_is_local(trx->mysql_thd) == false) { + if (!trx->is_wsrep() || !wsrep_thd_is_local(trx->mysql_thd)) { return DB_SUCCESS; } - if (!thd || !foreign || + THD* thd = trx->mysql_thd; + + if (!foreign || (!foreign->referenced_table && !foreign->foreign_table)) { WSREP_INFO("FK: %s missing in: %s", - (!thd) ? "thread" : - ((!foreign) ? "constraint" : - ((!foreign->referenced_table) ? + (!foreign ? "constraint" : + (!foreign->referenced_table ? "referenced table" : "foreign table")), - (thd && wsrep_thd_query(thd)) ? - wsrep_thd_query(thd) : "void"); + wsrep_thd_query(thd)); return DB_ERROR; } + ulint rcode = DB_SUCCESS; + char cache_key[513] = {'\0'}; + int cache_key_len=0; + if ( !((referenced) ? foreign->referenced_table : foreign->foreign_table)) { WSREP_DEBUG("pulling %s table into cache", @@ -15586,9 +15555,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 @@ -15603,25 +15570,20 @@ 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_is_local(thd); +#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_is_local(m_user_thd)) { -#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 */ } } diff --git a/storage/innobase/include/dict0stats.h b/storage/innobase/include/dict0stats.h index ab001130364..2e001cb56e9 100644 --- a/storage/innobase/include/dict0stats.h +++ b/storage/innobase/include/dict0stats.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2009, 2018, 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 @@ -115,16 +115,16 @@ dict_stats_deinit( /** Update the table modification counter and if necessary, schedule new estimates for table and index statistics to be calculated. @param[in,out] table persistent or temporary table -@param[in] thd current session */ -void dict_stats_update_if_needed(dict_table_t* table, THD* thd) - MY_ATTRIBUTE((nonnull(1))); +@param[in] trx transaction */ +void dict_stats_update_if_needed(dict_table_t *table, const trx_t &trx) + MY_ATTRIBUTE((nonnull)); #else /** Update the table modification counter and if necessary, schedule new estimates for table and index statistics to be calculated. @param[in,out] table persistent or temporary table */ -void dict_stats_update_if_needed_func(dict_table_t* table) +void dict_stats_update_if_needed_func(dict_table_t *table) MY_ATTRIBUTE((nonnull)); -# define dict_stats_update_if_needed(t,thd) dict_stats_update_if_needed_func(t) +# define dict_stats_update_if_needed(t,trx) dict_stats_update_if_needed_func(t) #endif /*********************************************************************//** diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index 29e2aacaf5c..0206a7e9a67 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -1044,10 +1044,6 @@ std::string lock_get_info( const lock_t*); -/*******************************************************************//** -@return whether wsrep_on is true on trx->mysql_thd*/ -#define wsrep_on_trx(trx) wsrep_on((trx)->mysql_thd) - #endif /* WITH_WSREP */ #include "lock0lock.ic" diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h index a14f8f7b63c..90d2f7edbab 100644 --- a/storage/innobase/include/row0upd.h +++ b/storage/innobase/include/row0upd.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2018, 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 @@ -338,16 +338,6 @@ row_upd_changes_some_index_ord_field_binary( /*========================================*/ const dict_table_t* table, /*!< in: table */ const upd_t* update);/*!< in: update vector for the row */ -/** Stores to the heap the row on which the node->pcur is positioned. -@param[in] node row update node -@param[in] thd mysql thread handle -@param[in,out] mysql_table NULL, or mysql table object when - user thread invokes dml */ -void -row_upd_store_row( - upd_node_t* node, - THD* thd, - TABLE* mysql_table); /***********************************************************//** Updates a row in a table. This is a high-level function used in SQL execution graphs. diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 738f725c60d..6911f2ec084 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -840,6 +840,13 @@ public: Transitions to COMMITTED are protected by trx_t::mutex. */ trx_state_t state; +#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 */ diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 60b8fdb0070..d0b553168b2 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -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 @@ -1087,9 +1087,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; if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { return; @@ -1171,7 +1169,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 @@ -1413,7 +1411,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; @@ -1819,8 +1817,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)) { @@ -3518,7 +3515,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()); @@ -3748,7 +3745,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 */ @@ -3821,7 +3818,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; @@ -4888,7 +4885,7 @@ func_exit: 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: " << diff --git a/storage/innobase/lock/lock0wait.cc b/storage/innobase/lock/lock0wait.cc index 94104172577..b1f9b3c7d9b 100644 --- a/storage/innobase/lock/lock0wait.cc +++ b/storage/innobase/lock/lock0wait.cc @@ -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); @@ -399,8 +398,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 */ ) { diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 65e34b317c3..145edda41df 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -1039,7 +1039,7 @@ row_prebuilt_free( rtr_clean_rtr_info(prebuilt->rtr_info, true); } if (prebuilt->table) { - dict_table_close(prebuilt->table, dict_locked, TRUE); + dict_table_close(prebuilt->table, dict_locked, FALSE); } mem_heap_free(prebuilt->heap); @@ -1575,7 +1575,7 @@ error_exit: memcpy(prebuilt->row_id, node->sys_buf, DATA_ROW_ID_LEN); } - dict_stats_update_if_needed(table, trx->mysql_thd); + dict_stats_update_if_needed(table, *trx); trx->op_info = ""; if (blob_heap != NULL) { @@ -1959,7 +1959,7 @@ row_update_for_mysql(row_prebuilt_t* prebuilt) } if (update_statistics) { - dict_stats_update_if_needed(prebuilt->table, trx->mysql_thd); + dict_stats_update_if_needed(prebuilt->table, *trx); } else { /* Always update the table modification counter. */ prebuilt->table->stat_modified_counter++; @@ -2209,7 +2209,7 @@ static dberr_t row_update_vers_insert(que_thr_t* thr, upd_node_t* node) case DB_SUCCESS: srv_stats.n_rows_inserted.inc( static_cast(trx->id)); - dict_stats_update_if_needed(table, trx->mysql_thd); + dict_stats_update_if_needed(table, *trx); goto exit; } } @@ -2303,8 +2303,7 @@ row_update_cascade_for_mysql( } if (stats) { - dict_stats_update_if_needed(node->table, - trx->mysql_thd); + dict_stats_update_if_needed(node->table, *trx); } else { /* Always update the table modification counter. */ diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index 61920532c29..ed6cb72850d 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2017, 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 @@ -1198,8 +1198,7 @@ row_purge_record_func( if (node->table->stat_initialized && srv_stats_include_delete_marked) { dict_stats_update_if_needed( - node->table, - thr->graph->trx->mysql_thd); + node->table, *thr->graph->trx); } MONITOR_INC(MONITOR_N_DEL_ROW_PURGE); } diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc index 5ba9de18ae9..c4d2b607b59 100644 --- a/storage/innobase/row/row0uins.cc +++ b/storage/innobase/row/row0uins.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2017, 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 @@ -600,8 +600,8 @@ row_undo_ins( already be holding dict_sys.mutex, which would be acquired when updating statistics. */ if (!dict_locked) { - dict_stats_update_if_needed( - node->table, node->trx->mysql_thd); + dict_stats_update_if_needed(node->table, + *node->trx); } } break; diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc index d2707130439..20a86c873ee 100644 --- a/storage/innobase/row/row0umod.cc +++ b/storage/innobase/row/row0umod.cc @@ -1422,8 +1422,8 @@ rollback_clust: already be holding dict_sys.mutex, which would be acquired when updating statistics. */ if (update_statistics && !dict_locked) { - dict_stats_update_if_needed( - node->table, node->trx->mysql_thd); + dict_stats_update_if_needed(node->table, + *node->trx); } else { node->table->stat_modified_counter++; } diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index 6ddd4046f09..8e87aa15cf7 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -432,7 +432,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 @@ -2191,6 +2191,7 @@ row_upd_store_v_row( @param[in] thd mysql thread handle @param[in,out] mysql_table NULL, or mysql table object when user thread invokes dml */ +static void row_upd_store_row( upd_node_t* node, diff --git a/storage/innobase/row/row0vers.cc b/storage/innobase/row/row0vers.cc index 5935b0a11ca..68e032eaa91 100644 --- a/storage/innobase/row/row0vers.cc +++ b/storage/innobase/row/row0vers.cc @@ -616,7 +616,6 @@ row_vers_build_cur_vrow_low( /** Check a virtual column value index secondary virtual index matches that of current cluster index record, which is recreated from information stored in undo log -@param[in] in_purge called by purge thread @param[in] rec record in the clustered index @param[in] icentry the index entry built from a cluster row @param[in] clust_index cluster index @@ -632,7 +631,6 @@ stored in undo log static bool row_vers_vc_matches_cluster( - bool in_purge, const rec_t* rec, const dtuple_t* icentry, dict_index_t* clust_index, @@ -693,12 +691,6 @@ row_vers_vc_matches_cluster( version = rec; - /* If this is called by purge thread, set TRX_UNDO_PREV_IN_PURGE - bit to search the undo log until we hit the current undo log with - roll_ptr */ - ulint status = (in_purge ? TRX_UNDO_PREV_IN_PURGE : 0) - | TRX_UNDO_GET_OLD_V_VALUE; - while (n_cmp_v_col < n_fields - n_non_v_col) { heap2 = heap; heap = mem_heap_create(1024); @@ -706,11 +698,12 @@ row_vers_vc_matches_cluster( version, clust_index, clust_offsets); ut_ad(cur_roll_ptr != 0); - ut_ad(in_purge == (roll_ptr != 0)); + ut_ad(roll_ptr != 0); trx_undo_prev_version_build( rec, mtr, version, clust_index, clust_offsets, - heap, &prev_version, NULL, vrow, status); + heap, &prev_version, NULL, vrow, + TRX_UNDO_PREV_IN_PURGE | TRX_UNDO_GET_OLD_V_VALUE); if (heap2) { mem_heap_free(heap2); @@ -992,7 +985,7 @@ row_vers_old_has_index_entry( secondary indexes.) */ if (entry && row_vers_vc_matches_cluster( - also_curr, rec, entry, + rec, entry, clust_index, clust_offsets, index, ientry, roll_ptr, trx_id, NULL, &vrow, mtr)) { diff --git a/storage/innobase/srv/srv0conc.cc b/storage/innobase/srv/srv0conc.cc index 157c2688c33..79a16f48a3b 100644 --- a/storage/innobase/srv/srv0conc.cc +++ b/storage/innobase/srv/srv0conc.cc @@ -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 @@ -118,8 +118,7 @@ srv_conc_enter_innodb_with_atomics( for (;;) { ulint sleep_in_us; #ifdef WITH_WSREP - if (wsrep_on(trx->mysql_thd) && - wsrep_thd_is_aborting(trx->mysql_thd)) { + if (trx->is_wsrep() && wsrep_thd_is_aborting(trx->mysql_thd)) { if (wsrep_get_debug()) { ib::info() << "srv_conc_enter due to MUST_ABORT"; diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index a09339231d6..fbc9d746f57 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -451,7 +451,7 @@ trx_rollback_to_savepoint_for_mysql_low( trx->op_info = ""; #ifdef WITH_WSREP - trx->lock.was_chosen_as_wsrep_victim = FALSE; + trx->lock.was_chosen_as_wsrep_victim = false; #endif return(err); } diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 8077861ff81..082a553c4a6 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -109,6 +109,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 = ""; @@ -1510,9 +1513,7 @@ trx_commit_in_memory( trx_mutex_enter(trx); trx->dict_operation = TRX_DICT_OP_NONE; -#ifdef WITH_WSREP - trx->lock.was_chosen_as_wsrep_victim = FALSE; -#endif + trx->lock.was_chosen_as_deadlock_victim = false; DBUG_LOG("trx", "Commit in memory: " << trx); trx->state = TRX_STATE_NOT_STARTED; diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 86bfac19253..75566351b27 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -297,7 +297,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[]= {