mirror of
https://github.com/MariaDB/server.git
synced 2025-04-22 15:15:41 +02:00
Fixed performance schema instrumentation on galera and added correct mutexing when cancelling waiting trx on InnoDB
This commit is contained in:
parent
1a34a56a9f
commit
eec8297107
4 changed files with 27 additions and 12 deletions
|
@ -10149,7 +10149,7 @@ void init_server_psi_keys(void)
|
|||
stmt_info_new_packet.m_key= 0;
|
||||
stmt_info_new_packet.m_name= "";
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
@ -1082,6 +1082,7 @@ bool do_command(THD *thd)
|
|||
if (WSREP(thd)) {
|
||||
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,
|
||||
thd->wsrep_retry_query_len);
|
||||
}
|
||||
|
@ -3244,12 +3245,6 @@ case SQLCOM_PREPARE:
|
|||
/* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */
|
||||
if (create_info.tmp_table())
|
||||
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 */
|
||||
if (create_info.options & HA_LEX_CREATE_TABLE_LIKE)
|
||||
{
|
||||
|
@ -3259,6 +3254,12 @@ case SQLCOM_PREPARE:
|
|||
}
|
||||
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 */
|
||||
res= mysql_create_table(thd, create_table,
|
||||
&create_info, &alter_info);
|
||||
|
@ -6671,6 +6672,11 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
|
|||
if (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT)
|
||||
{
|
||||
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);
|
||||
|
||||
|
@ -6701,6 +6707,9 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
|
|||
WSREP_DEBUG("wsrep retrying AC query: %s",
|
||||
(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);
|
||||
|
||||
thd->wsrep_conflict_state= RETRY_AUTOCOMMIT;
|
||||
|
@ -6800,6 +6809,7 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
|
|||
MYSQL_REFINE_STATEMENT(thd->m_statement_psi,
|
||||
sql_statement_info[thd->lex->sql_command].
|
||||
m_key);
|
||||
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
if (mqh_used && thd->user_connect &&
|
||||
check_mqh(thd, lex->sql_command))
|
||||
|
|
|
@ -9461,7 +9461,6 @@ ha_innobase::wsrep_append_keys(
|
|||
} else {
|
||||
ut_a(table->s->keys <= 256);
|
||||
uint i;
|
||||
WSREP_DEBUG("WSREP: append key");
|
||||
|
||||
for (i=0; i<table->s->keys; ++i) {
|
||||
uint len;
|
||||
|
@ -9515,7 +9514,6 @@ ha_innobase::wsrep_append_keys(
|
|||
uchar digest[16];
|
||||
int rcode;
|
||||
|
||||
WSREP_DEBUG("WSREP: append key 2");
|
||||
wsrep_calc_row_hash(digest, record0, table, prebuilt, thd);
|
||||
if ((rcode = wsrep_append_key(thd, trx, table_share, table,
|
||||
(const char*) digest, 16,
|
||||
|
|
|
@ -1880,7 +1880,7 @@ lock_rec_create(
|
|||
|
||||
#ifdef WITH_WSREP
|
||||
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;
|
||||
|
||||
while (hash &&
|
||||
|
@ -1899,9 +1899,10 @@ lock_rec_create(
|
|||
* delayed conflict resolution '...kill_one_trx' was not called,
|
||||
* 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) {
|
||||
// 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;
|
||||
|
||||
//if (wsrep_debug && c_lock->trx->wait_lock != c_lock) {
|
||||
|
@ -1917,7 +1918,13 @@ lock_rec_create(
|
|||
lock_set_lock_and_trx_wait(lock, trx);
|
||||
|
||||
// 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);
|
||||
if (trx != c_trx) {
|
||||
trx_mutex_exit(c_trx);
|
||||
}
|
||||
|
||||
/* trx might not wait for c_lock, but some other lock
|
||||
does not matter if wait_lock was released above
|
||||
|
|
Loading…
Add table
Reference in a new issue