diff options
author | Nirbhay Choubey <nirbhay@skysql.com> | 2014-09-22 12:15:44 -0400 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@skysql.com> | 2014-09-22 12:15:44 -0400 |
commit | 4538665a63491a36bdbfa631df7dd457010bc293 (patch) | |
tree | 7341de3cf3f29f982dcdac1e6dc2e188dff80e7a | |
parent | c4356bfccb972a3b1a8798ba552c92881a3f74e1 (diff) | |
download | mariadb-git-4538665a63491a36bdbfa631df7dd457010bc293.tar.gz |
MDEV-6740 : Galera crash in rpl_sql_thread_info/cached_charset_compare
Properly initialized rpl_sql_thread_info for bf threads.
Also removed some dead code.
-rw-r--r-- | sql/mysqld.cc | 2 | ||||
-rw-r--r-- | sql/sql_parse.cc | 4 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 6 | ||||
-rw-r--r-- | sql/wsrep_thd.cc | 37 |
4 files changed, 16 insertions, 33 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 1d6699940bd..64b51ec8138 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5302,7 +5302,6 @@ typedef void (*wsrep_thd_processor_fun)(THD *); pthread_handler_t start_wsrep_THD(void *arg) { THD *thd; - rpl_sql_thread_info sql_info(NULL); wsrep_thd_processor_fun processor= (wsrep_thd_processor_fun)arg; if (my_thread_init()) @@ -5333,7 +5332,6 @@ pthread_handler_t start_wsrep_THD(void *arg) thd->bootstrap=1; thd->max_client_packet_length= thd->net.max_packet; thd->security_ctx->master_access= ~(ulong)0; - thd->system_thread_info.rpl_sql_info= &sql_info; /* from handle_one_connection... */ pthread_detach_this_thread(); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 380573ca224..8eb282b38f0 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -6812,7 +6812,7 @@ void mysql_init_multi_delete(LEX *lex) static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, Parser_state *parser_state) { - bool is_autocommit= + bool is_autocommit= !thd->in_multi_stmt_transaction_mode() && thd->wsrep_conflict_state == NO_CONFLICT && !thd->wsrep_applier && @@ -6840,7 +6840,7 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, WSREP_DEBUG("abort in exec query state, avoiding autocommit"); } - if (thd->wsrep_conflict_state== MUST_REPLAY) + if (thd->wsrep_conflict_state == MUST_REPLAY) { wsrep_replay_transaction(thd); } diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 8a6de8b6693..7fa284b235d 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -3548,8 +3548,10 @@ Prepared_statement::set_parameters(String *expanded_query, } #ifdef WITH_WSREP +/* forward declaration */ void wsrep_replay_transaction(THD *thd); #endif /* WITH_WSREP */ + /** Execute a prepared statement. Re-prepare it a limited number of times if necessary. @@ -3639,7 +3641,9 @@ reexecute: break; case MUST_REPLAY: - (void)wsrep_replay_transaction(thd); + (void) wsrep_replay_transaction(thd); + /* fallthrough */ + default: break; } mysql_mutex_unlock(&thd->LOCK_wsrep_thd); diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index 6fc91c9fa31..5fac6cca1c6 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -88,30 +88,6 @@ void wsrep_client_rollback(THD *thd) #define NUMBER_OF_FIELDS_TO_IDENTIFY_COORDINATOR 1 #define NUMBER_OF_FIELDS_TO_IDENTIFY_WORKER 2 -//#include "rpl_info_factory.h" - -static Relay_log_info* wsrep_relay_log_init(const char* log_fname) -{ - - /* MySQL 5.6 version has rli factory: */ -#ifdef MYSQL_56 - uint rli_option = INFO_REPOSITORY_DUMMY; - Relay_log_info *rli= NULL; - rli = Rpl_info_factory::create_rli(rli_option, false); - rli->set_rli_description_event( - new Format_description_log_event(BINLOG_VERSION)); -#endif - Relay_log_info* rli= new Relay_log_info(false); - rli->sql_driver_thd= current_thd; - - rli->no_storage= true; - rli->relay_log.description_event_for_exec= - new Format_description_log_event(4); - - return rli; -} - -class Master_info; static rpl_group_info* wsrep_relay_group_init(const char* log_fname) { @@ -126,7 +102,6 @@ static rpl_group_info* wsrep_relay_group_init(const char* log_fname) static LEX_STRING dbname= { C_STRING_WITH_LEN("mysql") }; rli->mi = new Master_info( &dbname, false); - //rli->mi = new Master_info( &(C_STRING_WITH_LEN("wsrep")), false); rli->mi->rpl_filter = new Rpl_filter; copy_filter_setting(rli->mi->rpl_filter, get_or_create_rpl_filter("", 0)); @@ -151,9 +126,11 @@ static void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow) else thd->variables.option_bits&= ~(OPTION_BIN_LOG); - //if (!thd->wsrep_rli) thd->wsrep_rli= wsrep_relay_log_init("wsrep_relay"); if (!thd->wsrep_rgi) thd->wsrep_rgi= wsrep_relay_group_init("wsrep_relay"); - // thd->wsrep_rli->info_thd = thd; + + /* thd->system_thread_info.rpl_sql_info isn't initialized. */ + thd->system_thread_info.rpl_sql_info= + new rpl_sql_thread_info(thd->wsrep_rgi->rli->mi->rpl_filter); thd->wsrep_exec_mode= REPL_RECV; thd->net.vio= 0; @@ -177,12 +154,12 @@ static void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow) thd->variables.tx_isolation = shadow->tx_isolation; thd->reset_db(shadow->db, shadow->db_length); + delete thd->system_thread_info.rpl_sql_info; delete thd->wsrep_rgi->rli->mi->rpl_filter; delete thd->wsrep_rgi->rli->mi; delete thd->wsrep_rgi->rli; delete thd->wsrep_rgi; thd->wsrep_rgi = NULL; -; } void wsrep_replay_transaction(THD *thd) @@ -280,6 +257,10 @@ void wsrep_replay_transaction(THD *thd) WSREP_ERROR("trx_replay failed for: %d, query: %s", rcode, thd->query() ? thd->query() : "void"); /* we're now in inconsistent state, must abort */ + + /* http://bazaar.launchpad.net/~codership/codership-mysql/5.6/revision/3962#sql/wsrep_thd.cc */ + mysql_mutex_unlock(&thd->LOCK_wsrep_thd); + unireg_abort(1); break; } |