bzr merge -r3889..3890 lp:codership-mysql/5.5
This commit is contained in:
parent
eec8297107
commit
9129c8f1d3
@ -105,11 +105,7 @@
|
|||||||
|
|
||||||
#ifdef WITH_WSREP
|
#ifdef WITH_WSREP
|
||||||
#include "wsrep_mysqld.h"
|
#include "wsrep_mysqld.h"
|
||||||
#include "rpl_rli.h"
|
|
||||||
static void wsrep_client_rollback(THD *thd);
|
static void wsrep_client_rollback(THD *thd);
|
||||||
|
|
||||||
extern Format_description_log_event *wsrep_format_desc;
|
|
||||||
|
|
||||||
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);
|
||||||
#endif /* WITH_WSREP */
|
#endif /* WITH_WSREP */
|
||||||
@ -606,13 +602,6 @@ bool is_log_table_write_query(enum enum_sql_command command)
|
|||||||
return (sql_command_flags[command] & CF_WRITE_LOGS_COMMAND) != 0;
|
return (sql_command_flags[command] & CF_WRITE_LOGS_COMMAND) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_WSREP
|
|
||||||
bool is_show_query(enum enum_sql_command command)
|
|
||||||
{
|
|
||||||
DBUG_ASSERT(command >= 0 && command <= SQLCOM_END);
|
|
||||||
return (sql_command_flags[command] & CF_STATUS_COMMAND) != 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
void execute_init_command(THD *thd, LEX_STRING *init_command,
|
void execute_init_command(THD *thd, LEX_STRING *init_command,
|
||||||
mysql_rwlock_t *var_lock)
|
mysql_rwlock_t *var_lock)
|
||||||
{
|
{
|
||||||
@ -813,7 +802,7 @@ void do_handle_bootstrap(THD *thd)
|
|||||||
close_connection(thd, ER_OUT_OF_RESOURCES, 1);
|
close_connection(thd, ER_OUT_OF_RESOURCES, 1);
|
||||||
#else
|
#else
|
||||||
close_connection(thd, ER_OUT_OF_RESOURCES);
|
close_connection(thd, ER_OUT_OF_RESOURCES);
|
||||||
#endif
|
#endif /* WITH_WSREP */
|
||||||
#endif
|
#endif
|
||||||
thd->fatal_error();
|
thd->fatal_error();
|
||||||
goto end;
|
goto end;
|
||||||
@ -898,7 +887,7 @@ bool do_command(THD *thd)
|
|||||||
}
|
}
|
||||||
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
|
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* WITH_WSREP */
|
||||||
/*
|
/*
|
||||||
indicator of uninitialized lex => normal flow of errors handling
|
indicator of uninitialized lex => normal flow of errors handling
|
||||||
(see my_message_sql)
|
(see my_message_sql)
|
||||||
@ -991,7 +980,7 @@ bool do_command(THD *thd)
|
|||||||
}
|
}
|
||||||
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
|
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* WITH_WSREP */
|
||||||
/* Instrument this broken statement as "statement/com/error" */
|
/* Instrument this broken statement as "statement/com/error" */
|
||||||
thd->m_statement_psi= MYSQL_REFINE_STATEMENT(thd->m_statement_psi,
|
thd->m_statement_psi= MYSQL_REFINE_STATEMENT(thd->m_statement_psi,
|
||||||
com_statement_info[COM_END].
|
com_statement_info[COM_END].
|
||||||
@ -1072,7 +1061,7 @@ bool do_command(THD *thd)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* WITH_WSREP */
|
||||||
/* Restore read timeout value */
|
/* Restore read timeout value */
|
||||||
my_net_set_read_timeout(net, thd->variables.net_read_timeout);
|
my_net_set_read_timeout(net, thd->variables.net_read_timeout);
|
||||||
|
|
||||||
@ -1094,7 +1083,7 @@ bool do_command(THD *thd)
|
|||||||
thd->wsrep_retry_query_len = 0;
|
thd->wsrep_retry_query_len = 0;
|
||||||
thd->wsrep_retry_command = COM_CONNECT;
|
thd->wsrep_retry_command = COM_CONNECT;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* WITH_WSREP */
|
||||||
out:
|
out:
|
||||||
/* The statement instrumentation must be closed in all cases. */
|
/* The statement instrumentation must be closed in all cases. */
|
||||||
DBUG_ASSERT(thd->m_statement_psi == NULL);
|
DBUG_ASSERT(thd->m_statement_psi == NULL);
|
||||||
@ -1455,7 +1444,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
wsrep_mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
|
wsrep_mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
|
||||||
#else
|
#else
|
||||||
mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
|
mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
|
||||||
#endif
|
#endif /* WITH_WSREP */
|
||||||
|
|
||||||
while (!thd->killed && (parser_state.m_lip.found_semicolon != NULL) &&
|
while (!thd->killed && (parser_state.m_lip.found_semicolon != NULL) &&
|
||||||
! thd->is_error())
|
! thd->is_error())
|
||||||
@ -1533,14 +1522,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
thd->set_time(); /* Reset the query start time. */
|
thd->set_time(); /* Reset the query start time. */
|
||||||
#else
|
#else
|
||||||
thd->set_time(); /* Reset the query start time. */
|
thd->set_time(); /* Reset the query start time. */
|
||||||
#endif
|
#endif /* WITH_WSREP */
|
||||||
parser_state.reset(beginning_of_next_stmt, length);
|
parser_state.reset(beginning_of_next_stmt, length);
|
||||||
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
|
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
|
||||||
#ifdef WITH_WSREP
|
#ifdef WITH_WSREP
|
||||||
wsrep_mysql_parse(thd, beginning_of_next_stmt, length, &parser_state);
|
wsrep_mysql_parse(thd, beginning_of_next_stmt, length, &parser_state);
|
||||||
#else
|
#else
|
||||||
mysql_parse(thd, beginning_of_next_stmt, length, &parser_state);
|
mysql_parse(thd, beginning_of_next_stmt, length, &parser_state);
|
||||||
#endif
|
#endif /* WITH_WSREP */
|
||||||
}
|
}
|
||||||
|
|
||||||
DBUG_PRINT("info",("query ready"));
|
DBUG_PRINT("info",("query ready"));
|
||||||
@ -2345,6 +2334,13 @@ err:
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WITH_WSREP
|
||||||
|
static bool wsrep_is_show_query(enum enum_sql_command command)
|
||||||
|
{
|
||||||
|
DBUG_ASSERT(command >= 0 && command <= SQLCOM_END);
|
||||||
|
return (sql_command_flags[command] & CF_STATUS_COMMAND) != 0;
|
||||||
|
}
|
||||||
|
#endif /* WITH_WSREP */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Execute command saved in thd and lex->sql_command.
|
Execute command saved in thd and lex->sql_command.
|
||||||
@ -2589,7 +2585,7 @@ mysql_execute_command(THD *thd)
|
|||||||
*/
|
*/
|
||||||
if (thd->variables.wsrep_on && !thd->wsrep_applier && !wsrep_ready &&
|
if (thd->variables.wsrep_on && !thd->wsrep_applier && !wsrep_ready &&
|
||||||
lex->sql_command != SQLCOM_SET_OPTION &&
|
lex->sql_command != SQLCOM_SET_OPTION &&
|
||||||
!is_show_query(lex->sql_command))
|
!wsrep_is_show_query(lex->sql_command))
|
||||||
{
|
{
|
||||||
#if DIRTY_HACK
|
#if DIRTY_HACK
|
||||||
/* Dirty hack for lp:1002714 - trying to recognize mysqldump connection
|
/* Dirty hack for lp:1002714 - trying to recognize mysqldump connection
|
||||||
@ -6575,6 +6571,8 @@ void mysql_init_multi_delete(LEX *lex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_WSREP
|
#ifdef WITH_WSREP
|
||||||
|
static void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow*);
|
||||||
|
static void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow*);
|
||||||
void wsrep_replay_transaction(THD *thd)
|
void wsrep_replay_transaction(THD *thd)
|
||||||
{
|
{
|
||||||
/* checking if BF trx must be replayed */
|
/* checking if BF trx must be replayed */
|
||||||
@ -6606,11 +6604,11 @@ void wsrep_replay_transaction(THD *thd)
|
|||||||
thd_proc_info(thd, "wsrep replaying trx");
|
thd_proc_info(thd, "wsrep replaying trx");
|
||||||
WSREP_DEBUG("replay trx: %s %lld",
|
WSREP_DEBUG("replay trx: %s %lld",
|
||||||
thd->query() ? thd->query() : "void",
|
thd->query() ? thd->query() : "void",
|
||||||
(long long)thd->wsrep_trx_seqno);
|
(long long)wsrep_thd_trx_seqno(thd));
|
||||||
struct wsrep_thd_shadow shadow;
|
struct wsrep_thd_shadow shadow;
|
||||||
wsrep_prepare_bf_thd(thd, &shadow);
|
wsrep_prepare_bf_thd(thd, &shadow);
|
||||||
int rcode = wsrep->replay_trx(wsrep,
|
int rcode = wsrep->replay_trx(wsrep,
|
||||||
&thd->wsrep_trx_handle,
|
&thd->wsrep_ws_handle,
|
||||||
(void *)thd);
|
(void *)thd);
|
||||||
|
|
||||||
wsrep_return_from_bf_mode(thd, &shadow);
|
wsrep_return_from_bf_mode(thd, &shadow);
|
||||||
@ -6623,12 +6621,12 @@ void wsrep_replay_transaction(THD *thd)
|
|||||||
{
|
{
|
||||||
case WSREP_OK:
|
case WSREP_OK:
|
||||||
thd->wsrep_conflict_state= NO_CONFLICT;
|
thd->wsrep_conflict_state= NO_CONFLICT;
|
||||||
wsrep->post_commit(wsrep, &thd->wsrep_trx_handle);
|
wsrep->post_commit(wsrep, &thd->wsrep_ws_handle);
|
||||||
WSREP_DEBUG("trx_replay successful for: %ld %llu",
|
WSREP_DEBUG("trx_replay successful for: %ld %llu",
|
||||||
thd->thread_id, (long long)thd->real_id);
|
thd->thread_id, (long long)thd->real_id);
|
||||||
break;
|
break;
|
||||||
case WSREP_TRX_FAIL:
|
case WSREP_TRX_FAIL:
|
||||||
if (thd->get_stmt_da()->is_sent())
|
if (thd->stmt_da->is_sent)
|
||||||
{
|
{
|
||||||
WSREP_ERROR("replay failed, thd has reported status");
|
WSREP_ERROR("replay failed, thd has reported status");
|
||||||
}
|
}
|
||||||
@ -6638,8 +6636,7 @@ void wsrep_replay_transaction(THD *thd)
|
|||||||
my_error(ER_LOCK_DEADLOCK, MYF(0), "wsrep aborted transaction");
|
my_error(ER_LOCK_DEADLOCK, MYF(0), "wsrep aborted transaction");
|
||||||
}
|
}
|
||||||
thd->wsrep_conflict_state= ABORTED;
|
thd->wsrep_conflict_state= ABORTED;
|
||||||
thd->wsrep_bf_thd = NULL;
|
wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle);
|
||||||
wsrep->post_rollback(wsrep, &thd->wsrep_trx_handle);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WSREP_ERROR("trx_replay failed for: %d, query: %s",
|
WSREP_ERROR("trx_replay failed for: %d, query: %s",
|
||||||
@ -8985,7 +8982,7 @@ Relay_log_info* wsrep_relay_log_init(const char* log_fname)
|
|||||||
return rli;
|
return rli;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow)
|
static void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow)
|
||||||
{
|
{
|
||||||
shadow->options = thd->variables.option_bits;
|
shadow->options = thd->variables.option_bits;
|
||||||
shadow->wsrep_exec_mode = thd->wsrep_exec_mode;
|
shadow->wsrep_exec_mode = thd->wsrep_exec_mode;
|
||||||
@ -9009,7 +9006,7 @@ void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow)
|
|||||||
thd->tx_isolation = ISO_READ_COMMITTED;
|
thd->tx_isolation = ISO_READ_COMMITTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow)
|
static void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow)
|
||||||
{
|
{
|
||||||
thd->variables.option_bits = shadow->options;
|
thd->variables.option_bits = shadow->options;
|
||||||
thd->wsrep_exec_mode = shadow->wsrep_exec_mode;
|
thd->wsrep_exec_mode = shadow->wsrep_exec_mode;
|
||||||
|
@ -322,8 +322,6 @@ extern int wsrep_thd_is_brute_force(void *thd_ptr);
|
|||||||
extern "C" int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr,
|
extern "C" int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr,
|
||||||
my_bool signal);
|
my_bool signal);
|
||||||
extern "C" int wsrep_thd_in_locking_session(void *thd_ptr);
|
extern "C" int wsrep_thd_in_locking_session(void *thd_ptr);
|
||||||
void *wsrep_prepare_bf_thd(THD *thd);
|
|
||||||
void wsrep_return_from_bf_mode(void *shadow, THD *thd);
|
|
||||||
|
|
||||||
/* this is visible for client build so that innodb plugin gets this */
|
/* this is visible for client build so that innodb plugin gets this */
|
||||||
typedef struct wsrep_aborting_thd {
|
typedef struct wsrep_aborting_thd {
|
||||||
@ -376,8 +374,6 @@ int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_,
|
|||||||
const TABLE_LIST* table_list);
|
const TABLE_LIST* table_list);
|
||||||
void wsrep_to_isolation_end(THD *thd);
|
void wsrep_to_isolation_end(THD *thd);
|
||||||
|
|
||||||
void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow*);
|
|
||||||
void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow*);
|
|
||||||
int wsrep_to_buf_helper(
|
int wsrep_to_buf_helper(
|
||||||
THD* thd, const char *query, uint query_len, uchar** buf, uint* buf_len);
|
THD* thd, const char *query, uint query_len, uchar** buf, uint* buf_len);
|
||||||
int wsrep_create_sp(THD *thd, uchar** buf, uint* buf_len);
|
int wsrep_create_sp(THD *thd, uchar** buf, uint* buf_len);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user