Commit eec82971 authored by Jan Lindström's avatar Jan Lindström

Fixed performance schema instrumentation on galera and added correct mutexing...

Fixed performance schema instrumentation on galera and added correct mutexing when cancelling waiting trx on InnoDB
parent 1a34a56a
...@@ -10149,7 +10149,7 @@ void init_server_psi_keys(void) ...@@ -10149,7 +10149,7 @@ void init_server_psi_keys(void)
stmt_info_new_packet.m_key= 0; stmt_info_new_packet.m_key= 0;
stmt_info_new_packet.m_name= ""; stmt_info_new_packet.m_name= "";
stmt_info_new_packet.m_flags= PSI_FLAG_MUTABLE; stmt_info_new_packet.m_flags= PSI_FLAG_MUTABLE;
mysql_statement_register(category, & stmt_info_new_packet, 1); mysql_statement_register(category, &stmt_info_new_packet, 1);
#endif #endif
} }
......
...@@ -1082,6 +1082,7 @@ bool do_command(THD *thd) ...@@ -1082,6 +1082,7 @@ bool do_command(THD *thd)
if (WSREP(thd)) { if (WSREP(thd)) {
while (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT) while (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT)
{ {
WSREP_DEBUG("Retry autocommit for: %s\n", thd->wsrep_retry_query);
return_value= dispatch_command(command, thd, thd->wsrep_retry_query, return_value= dispatch_command(command, thd, thd->wsrep_retry_query,
thd->wsrep_retry_query_len); thd->wsrep_retry_query_len);
} }
...@@ -3244,12 +3245,6 @@ case SQLCOM_PREPARE: ...@@ -3244,12 +3245,6 @@ case SQLCOM_PREPARE:
/* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */ /* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */
if (create_info.tmp_table()) if (create_info.tmp_table())
thd->variables.option_bits|= OPTION_KEEP_LOG; thd->variables.option_bits|= OPTION_KEEP_LOG;
#ifdef WITH_WSREP
if (!thd->is_current_stmt_binlog_format_row() ||
!(create_info.options & HA_LEX_CREATE_TMP_TABLE))
WSREP_TO_ISOLATION_BEGIN(create_table->db, create_table->table_name,
NULL)
#endif /* WITH_WSREP */
/* regular create */ /* regular create */
if (create_info.options & HA_LEX_CREATE_TABLE_LIKE) if (create_info.options & HA_LEX_CREATE_TABLE_LIKE)
{ {
...@@ -3259,6 +3254,12 @@ case SQLCOM_PREPARE: ...@@ -3259,6 +3254,12 @@ case SQLCOM_PREPARE:
} }
else else
{ {
#ifdef WITH_WSREP
if (!thd->is_current_stmt_binlog_format_row() ||
!(create_info.options & HA_LEX_CREATE_TMP_TABLE))
WSREP_TO_ISOLATION_BEGIN(create_table->db, create_table->table_name,
NULL)
#endif /* WITH_WSREP */
/* Regular CREATE TABLE */ /* Regular CREATE TABLE */
res= mysql_create_table(thd, create_table, res= mysql_create_table(thd, create_table,
&create_info, &alter_info); &create_info, &alter_info);
...@@ -6671,6 +6672,11 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, ...@@ -6671,6 +6672,11 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
if (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT) if (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT)
{ {
thd->wsrep_conflict_state= NO_CONFLICT; thd->wsrep_conflict_state= NO_CONFLICT;
/* Performance Schema Interface instrumentation, begin */
thd->m_statement_psi= MYSQL_REFINE_STATEMENT(thd->m_statement_psi,
com_statement_info[thd->get_command()].m_key);
MYSQL_SET_STATEMENT_TEXT(thd->m_statement_psi, thd->query(),
thd->query_length());
} }
mysql_parse(thd, rawbuf, length, parser_state); mysql_parse(thd, rawbuf, length, parser_state);
...@@ -6701,6 +6707,9 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, ...@@ -6701,6 +6707,9 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
WSREP_DEBUG("wsrep retrying AC query: %s", WSREP_DEBUG("wsrep retrying AC query: %s",
(thd->query()) ? thd->query() : "void"); (thd->query()) ? thd->query() : "void");
/* Performance Schema Interface instrumentation, end */
MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
thd->m_statement_psi= NULL;
close_thread_tables(thd); close_thread_tables(thd);
thd->wsrep_conflict_state= RETRY_AUTOCOMMIT; thd->wsrep_conflict_state= RETRY_AUTOCOMMIT;
...@@ -6800,6 +6809,7 @@ void mysql_parse(THD *thd, char *rawbuf, uint length, ...@@ -6800,6 +6809,7 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
MYSQL_REFINE_STATEMENT(thd->m_statement_psi, MYSQL_REFINE_STATEMENT(thd->m_statement_psi,
sql_statement_info[thd->lex->sql_command]. sql_statement_info[thd->lex->sql_command].
m_key); m_key);
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
if (mqh_used && thd->user_connect && if (mqh_used && thd->user_connect &&
check_mqh(thd, lex->sql_command)) check_mqh(thd, lex->sql_command))
......
...@@ -9461,7 +9461,6 @@ ha_innobase::wsrep_append_keys( ...@@ -9461,7 +9461,6 @@ ha_innobase::wsrep_append_keys(
} else { } else {
ut_a(table->s->keys <= 256); ut_a(table->s->keys <= 256);
uint i; uint i;
WSREP_DEBUG("WSREP: append key");
for (i=0; i<table->s->keys; ++i) { for (i=0; i<table->s->keys; ++i) {
uint len; uint len;
...@@ -9515,7 +9514,6 @@ ha_innobase::wsrep_append_keys( ...@@ -9515,7 +9514,6 @@ ha_innobase::wsrep_append_keys(
uchar digest[16]; uchar digest[16];
int rcode; int rcode;
WSREP_DEBUG("WSREP: append key 2");
wsrep_calc_row_hash(digest, record0, table, prebuilt, thd); wsrep_calc_row_hash(digest, record0, table, prebuilt, thd);
if ((rcode = wsrep_append_key(thd, trx, table_share, table, if ((rcode = wsrep_append_key(thd, trx, table_share, table,
(const char*) digest, 16, (const char*) digest, 16,
......
...@@ -1880,7 +1880,7 @@ lock_rec_create( ...@@ -1880,7 +1880,7 @@ lock_rec_create(
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (c_lock && wsrep_thd_is_brute_force(trx->mysql_thd)) { if (c_lock && wsrep_thd_is_brute_force(trx->mysql_thd)) {
lock_t *hash = (lock_t*)c_lock->hash; lock_t *hash = (lock_t*)c_lock->hash;
lock_t *prev = NULL; lock_t *prev = NULL;
while (hash && while (hash &&
...@@ -1899,9 +1899,10 @@ lock_rec_create( ...@@ -1899,9 +1899,10 @@ lock_rec_create(
* delayed conflict resolution '...kill_one_trx' was not called, * delayed conflict resolution '...kill_one_trx' was not called,
* if victim was waiting for some other lock * if victim was waiting for some other lock
*/ */
// if (c_lock && c_lock->trx->que_state == TRX_QUE_LOCK_WAIT) { // if (c_lock && c_lock->trx->que_state == TRX_QUE_LOCK_WAIT) {
if (c_lock && c_lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) { if (c_lock && c_lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) {
// c_lock->trx->was_chosen_as_deadlock_victim = TRUE; trx_t* c_trx = c_lock->trx;
// c_lock->trx->was_chosen_as_deadlock_victim = TRUE;
c_lock->trx->lock.was_chosen_as_deadlock_victim = TRUE; c_lock->trx->lock.was_chosen_as_deadlock_victim = TRUE;
//if (wsrep_debug && c_lock->trx->wait_lock != c_lock) { //if (wsrep_debug && c_lock->trx->wait_lock != c_lock) {
...@@ -1917,7 +1918,13 @@ lock_rec_create( ...@@ -1917,7 +1918,13 @@ lock_rec_create(
lock_set_lock_and_trx_wait(lock, trx); lock_set_lock_and_trx_wait(lock, trx);
// lock_cancel_waiting_and_release(c_lock->trx->wait_lock); // lock_cancel_waiting_and_release(c_lock->trx->wait_lock);
if (trx != c_trx) {
trx_mutex_enter(c_trx);
}
lock_cancel_waiting_and_release(c_lock->trx->lock.wait_lock); lock_cancel_waiting_and_release(c_lock->trx->lock.wait_lock);
if (trx != c_trx) {
trx_mutex_exit(c_trx);
}
/* trx might not wait for c_lock, but some other lock /* trx might not wait for c_lock, but some other lock
does not matter if wait_lock was released above does not matter if wait_lock was released above
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment