mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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.
This commit is contained in:
@ -5302,7 +5302,6 @@ typedef void (*wsrep_thd_processor_fun)(THD *);
|
|||||||
pthread_handler_t start_wsrep_THD(void *arg)
|
pthread_handler_t start_wsrep_THD(void *arg)
|
||||||
{
|
{
|
||||||
THD *thd;
|
THD *thd;
|
||||||
rpl_sql_thread_info sql_info(NULL);
|
|
||||||
wsrep_thd_processor_fun processor= (wsrep_thd_processor_fun)arg;
|
wsrep_thd_processor_fun processor= (wsrep_thd_processor_fun)arg;
|
||||||
|
|
||||||
if (my_thread_init())
|
if (my_thread_init())
|
||||||
@ -5333,7 +5332,6 @@ pthread_handler_t start_wsrep_THD(void *arg)
|
|||||||
thd->bootstrap=1;
|
thd->bootstrap=1;
|
||||||
thd->max_client_packet_length= thd->net.max_packet;
|
thd->max_client_packet_length= thd->net.max_packet;
|
||||||
thd->security_ctx->master_access= ~(ulong)0;
|
thd->security_ctx->master_access= ~(ulong)0;
|
||||||
thd->system_thread_info.rpl_sql_info= &sql_info;
|
|
||||||
|
|
||||||
/* from handle_one_connection... */
|
/* from handle_one_connection... */
|
||||||
pthread_detach_this_thread();
|
pthread_detach_this_thread();
|
||||||
|
@ -6812,7 +6812,7 @@ void mysql_init_multi_delete(LEX *lex)
|
|||||||
static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
|
static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
|
||||||
Parser_state *parser_state)
|
Parser_state *parser_state)
|
||||||
{
|
{
|
||||||
bool is_autocommit=
|
bool is_autocommit=
|
||||||
!thd->in_multi_stmt_transaction_mode() &&
|
!thd->in_multi_stmt_transaction_mode() &&
|
||||||
thd->wsrep_conflict_state == NO_CONFLICT &&
|
thd->wsrep_conflict_state == NO_CONFLICT &&
|
||||||
!thd->wsrep_applier &&
|
!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");
|
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);
|
wsrep_replay_transaction(thd);
|
||||||
}
|
}
|
||||||
|
@ -3548,8 +3548,10 @@ Prepared_statement::set_parameters(String *expanded_query,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_WSREP
|
#ifdef WITH_WSREP
|
||||||
|
/* forward declaration */
|
||||||
void wsrep_replay_transaction(THD *thd);
|
void wsrep_replay_transaction(THD *thd);
|
||||||
#endif /* WITH_WSREP */
|
#endif /* WITH_WSREP */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Execute a prepared statement. Re-prepare it a limited number
|
Execute a prepared statement. Re-prepare it a limited number
|
||||||
of times if necessary.
|
of times if necessary.
|
||||||
@ -3639,7 +3641,9 @@ reexecute:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MUST_REPLAY:
|
case MUST_REPLAY:
|
||||||
(void)wsrep_replay_transaction(thd);
|
(void) wsrep_replay_transaction(thd);
|
||||||
|
/* fallthrough */
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
|
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
|
||||||
|
@ -88,30 +88,6 @@ void wsrep_client_rollback(THD *thd)
|
|||||||
|
|
||||||
#define NUMBER_OF_FIELDS_TO_IDENTIFY_COORDINATOR 1
|
#define NUMBER_OF_FIELDS_TO_IDENTIFY_COORDINATOR 1
|
||||||
#define NUMBER_OF_FIELDS_TO_IDENTIFY_WORKER 2
|
#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)
|
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") };
|
static LEX_STRING dbname= { C_STRING_WITH_LEN("mysql") };
|
||||||
|
|
||||||
rli->mi = new Master_info( &dbname, false);
|
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;
|
rli->mi->rpl_filter = new Rpl_filter;
|
||||||
copy_filter_setting(rli->mi->rpl_filter, get_or_create_rpl_filter("", 0));
|
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
|
else
|
||||||
thd->variables.option_bits&= ~(OPTION_BIN_LOG);
|
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");
|
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->wsrep_exec_mode= REPL_RECV;
|
||||||
thd->net.vio= 0;
|
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->variables.tx_isolation = shadow->tx_isolation;
|
||||||
thd->reset_db(shadow->db, shadow->db_length);
|
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->rpl_filter;
|
||||||
delete thd->wsrep_rgi->rli->mi;
|
delete thd->wsrep_rgi->rli->mi;
|
||||||
delete thd->wsrep_rgi->rli;
|
delete thd->wsrep_rgi->rli;
|
||||||
delete thd->wsrep_rgi;
|
delete thd->wsrep_rgi;
|
||||||
thd->wsrep_rgi = NULL;
|
thd->wsrep_rgi = NULL;
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wsrep_replay_transaction(THD *thd)
|
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",
|
WSREP_ERROR("trx_replay failed for: %d, query: %s",
|
||||||
rcode, thd->query() ? thd->query() : "void");
|
rcode, thd->query() ? thd->query() : "void");
|
||||||
/* we're now in inconsistent state, must abort */
|
/* 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);
|
unireg_abort(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user