1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge branch '10.1' into 10.2

This commit is contained in:
Sergei Golubchik
2018-05-10 13:01:42 +02:00
145 changed files with 2320 additions and 2653 deletions

View File

@ -429,7 +429,7 @@ static bool some_non_temp_table_to_be_updated(THD *thd, TABLE_LIST *tables)
/*
Implicitly commit a active transaction if statement requires so.
Check whether the statement implicitly commits an active transaction.
@param thd Thread handle.
@param mask Bitmask used for the SQL command match.
@ -437,7 +437,7 @@ static bool some_non_temp_table_to_be_updated(THD *thd, TABLE_LIST *tables)
@return 0 No implicit commit
@return 1 Do a commit
*/
static bool stmt_causes_implicit_commit(THD *thd, uint mask)
bool stmt_causes_implicit_commit(THD *thd, uint mask)
{
LEX *lex= thd->lex;
bool skip= FALSE;
@ -1198,13 +1198,13 @@ bool do_command(THD *thd)
#ifdef WITH_WSREP
if (WSREP(thd))
{
mysql_mutex_lock(&thd->LOCK_wsrep_thd);
mysql_mutex_lock(&thd->LOCK_thd_data);
thd->wsrep_query_state= QUERY_IDLE;
if (thd->wsrep_conflict_state==MUST_ABORT)
{
wsrep_client_rollback(thd);
}
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
mysql_mutex_unlock(&thd->LOCK_thd_data);
}
#endif /* WITH_WSREP */
@ -1250,15 +1250,15 @@ bool do_command(THD *thd)
packet_length= my_net_read_packet(net, 1);
#ifdef WITH_WSREP
if (WSREP(thd)) {
mysql_mutex_lock(&thd->LOCK_wsrep_thd);
mysql_mutex_lock(&thd->LOCK_thd_data);
/* these THD's are aborted or are aborting during being idle */
if (thd->wsrep_conflict_state == ABORTING)
{
while (thd->wsrep_conflict_state == ABORTING) {
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
mysql_mutex_unlock(&thd->LOCK_thd_data);
my_sleep(1000);
mysql_mutex_lock(&thd->LOCK_wsrep_thd);
mysql_mutex_lock(&thd->LOCK_thd_data);
}
thd->store_globals();
}
@ -1268,7 +1268,7 @@ bool do_command(THD *thd)
}
thd->wsrep_query_state= QUERY_EXEC;
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
mysql_mutex_unlock(&thd->LOCK_thd_data);
}
#endif /* WITH_WSREP */
@ -1281,13 +1281,13 @@ bool do_command(THD *thd)
#ifdef WITH_WSREP
if (WSREP(thd))
{
mysql_mutex_lock(&thd->LOCK_wsrep_thd);
mysql_mutex_lock(&thd->LOCK_thd_data);
if (thd->wsrep_conflict_state == MUST_ABORT)
{
DBUG_PRINT("wsrep",("aborted for wsrep rollback: %lu", thd->real_id));
wsrep_client_rollback(thd);
}
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
mysql_mutex_unlock(&thd->LOCK_thd_data);
}
#endif /* WITH_WSREP */
@ -1562,7 +1562,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->wsrep_PA_safe= true;
}
mysql_mutex_lock(&thd->LOCK_wsrep_thd);
mysql_mutex_lock(&thd->LOCK_thd_data);
thd->wsrep_query_state= QUERY_EXEC;
if (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT)
{
@ -1579,14 +1579,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
my_message(ER_LOCK_DEADLOCK, "Deadlock: wsrep aborted transaction",
MYF(0));
WSREP_DEBUG("Deadlock error for: %s", thd->query());
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
mysql_mutex_unlock(&thd->LOCK_thd_data);
thd->reset_killed();
thd->mysys_var->abort = 0;
thd->wsrep_conflict_state = NO_CONFLICT;
thd->wsrep_retry_counter = 0;
goto dispatch_end;
}
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
mysql_mutex_unlock(&thd->LOCK_thd_data);
}
#endif /* WITH_WSREP */
#if defined(ENABLED_PROFILING)
@ -2353,10 +2353,10 @@ com_multi_end:
DBUG_ASSERT((command != COM_QUIT && command != COM_STMT_CLOSE)
|| thd->get_stmt_da()->is_disabled());
/* wsrep BF abort in query exec phase */
mysql_mutex_lock(&thd->LOCK_wsrep_thd);
mysql_mutex_lock(&thd->LOCK_thd_data);
do_end_of_statement= thd->wsrep_conflict_state != REPLAYING &&
thd->wsrep_conflict_state != RETRY_AUTOCOMMIT;
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
mysql_mutex_unlock(&thd->LOCK_thd_data);
}
else
do_end_of_statement= true;
@ -6248,6 +6248,10 @@ finish:
lex->unit.cleanup();
/* close/reopen tables that were marked to need reopen under LOCK TABLES */
if (! thd->lex->requires_prelocking())
thd->locked_tables_list.reopen_tables(thd, true);
if (! thd->in_sub_stmt)
{
if (thd->killed != NOT_KILLED)
@ -7726,13 +7730,22 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
com_statement_info[thd->get_command()].m_key);
MYSQL_SET_STATEMENT_TEXT(thd->m_statement_psi, thd->query(),
thd->query_length());
DBUG_EXECUTE_IF("sync.wsrep_retry_autocommit",
{
const char act[]=
"now "
"SIGNAL wsrep_retry_autocommit_reached "
"WAIT_FOR wsrep_retry_autocommit_continue";
DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act)));
});
}
mysql_parse(thd, rawbuf, length, parser_state, is_com_multi,
is_next_command);
if (WSREP(thd)) {
/* wsrep BF abort in query exec phase */
mysql_mutex_lock(&thd->LOCK_wsrep_thd);
mysql_mutex_lock(&thd->LOCK_thd_data);
if (thd->wsrep_conflict_state == MUST_ABORT) {
wsrep_client_rollback(thd);
@ -7741,8 +7754,11 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
if (thd->wsrep_conflict_state == MUST_REPLAY)
{
mysql_mutex_unlock(&thd->LOCK_thd_data);
if (thd->lex->explain)
delete_explain_query(thd->lex);
mysql_mutex_lock(&thd->LOCK_thd_data);
wsrep_replay_transaction(thd);
}
@ -7784,13 +7800,13 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
if (thd->wsrep_conflict_state != REPLAYING)
thd->wsrep_retry_counter= 0; // reset
}
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
mysql_mutex_unlock(&thd->LOCK_thd_data);
thd->reset_killed();
}
else
{
set_if_smaller(thd->wsrep_retry_counter, 0); // reset; eventually ok
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
mysql_mutex_unlock(&thd->LOCK_thd_data);
}
}
@ -8807,7 +8823,7 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
if (((thd->security_ctx->master_access & SUPER_ACL) ||
thd->security_ctx->user_matches(tmp->security_ctx)) &&
!wsrep_thd_is_BF(tmp, true))
!wsrep_thd_is_BF(tmp, false))
{
tmp->awake(kill_signal);
error=0;