mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
System Versioning 1.0 pre4
Merge branch '10.3' into trunk
This commit is contained in:
@ -1551,9 +1551,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
"<?>")));
|
||||
bool drop_more_results= 0;
|
||||
|
||||
if (!is_com_multi)
|
||||
inc_thread_running();
|
||||
|
||||
/* keep it withing 1 byte */
|
||||
compile_time_assert(COM_END == 255);
|
||||
|
||||
@ -2411,10 +2408,8 @@ com_multi_end:
|
||||
thd->m_digest= NULL;
|
||||
|
||||
if (!is_com_multi)
|
||||
{
|
||||
dec_thread_running();
|
||||
thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory
|
||||
}
|
||||
|
||||
thd->reset_kill_query(); /* Ensure that killed_errmsg is released */
|
||||
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
|
||||
|
||||
@ -5791,14 +5786,19 @@ end_with_restore_list:
|
||||
thd->print_aborted_warning(3, "RELEASE");
|
||||
}
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP(thd) && (thd->wsrep_conflict_state != NO_CONFLICT &&
|
||||
thd->wsrep_conflict_state != REPLAYING))
|
||||
{
|
||||
DBUG_ASSERT(thd->is_error()); // the error is already issued
|
||||
}
|
||||
else
|
||||
if (WSREP(thd)) {
|
||||
|
||||
if (thd->wsrep_conflict_state == NO_CONFLICT ||
|
||||
thd->wsrep_conflict_state == REPLAYING)
|
||||
{
|
||||
my_ok(thd);
|
||||
}
|
||||
} else {
|
||||
#endif /* WITH_WSREP */
|
||||
my_ok(thd);
|
||||
#ifdef WITH_WSREP
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
my_ok(thd);
|
||||
break;
|
||||
}
|
||||
case SQLCOM_ROLLBACK:
|
||||
@ -5835,13 +5835,16 @@ end_with_restore_list:
|
||||
if (tx_release)
|
||||
thd->set_killed(KILL_CONNECTION);
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP(thd) && thd->wsrep_conflict_state != NO_CONFLICT)
|
||||
{
|
||||
DBUG_ASSERT(thd->is_error()); // the error is already issued
|
||||
}
|
||||
else
|
||||
if (WSREP(thd)) {
|
||||
if (thd->wsrep_conflict_state == NO_CONFLICT) {
|
||||
my_ok(thd);
|
||||
}
|
||||
} else {
|
||||
#endif /* WITH_WSREP */
|
||||
my_ok(thd);
|
||||
#ifdef WITH_WSREP
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
my_ok(thd);
|
||||
break;
|
||||
}
|
||||
case SQLCOM_RELEASE_SAVEPOINT:
|
||||
@ -6298,8 +6301,9 @@ finish:
|
||||
trans_rollback_stmt(thd);
|
||||
}
|
||||
#ifdef WITH_WSREP
|
||||
else if (thd->spcont &&
|
||||
if (thd->spcont &&
|
||||
(thd->wsrep_conflict_state == MUST_ABORT ||
|
||||
thd->wsrep_conflict_state == ABORTED ||
|
||||
thd->wsrep_conflict_state == CERT_FAILURE))
|
||||
{
|
||||
/*
|
||||
@ -8798,13 +8802,13 @@ void add_join_natural(TABLE_LIST *a, TABLE_LIST *b, List<String> *using_fields,
|
||||
|
||||
|
||||
/**
|
||||
Find a thread by id and return it, locking it LOCK_thd_data
|
||||
Find a thread by id and return it, locking it LOCK_thd_kill
|
||||
|
||||
@param id Identifier of the thread we're looking for
|
||||
@param query_id If true, search by query_id instead of thread_id
|
||||
|
||||
@return NULL - not found
|
||||
pointer - thread found, and its LOCK_thd_data is locked.
|
||||
pointer - thread found, and its LOCK_thd_kill is locked.
|
||||
*/
|
||||
|
||||
THD *find_thread_by_id(longlong id, bool query_id)
|
||||
@ -8818,7 +8822,7 @@ THD *find_thread_by_id(longlong id, bool query_id)
|
||||
continue;
|
||||
if (id == (query_id ? tmp->query_id : (longlong) tmp->thread_id))
|
||||
{
|
||||
mysql_mutex_lock(&tmp->LOCK_thd_data); // Lock from delete
|
||||
mysql_mutex_lock(&tmp->LOCK_thd_kill); // Lock from delete
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -8874,13 +8878,13 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
|
||||
thd->security_ctx->user_matches(tmp->security_ctx)) &&
|
||||
!wsrep_thd_is_BF(tmp, true))
|
||||
{
|
||||
tmp->awake(kill_signal);
|
||||
tmp->awake_no_mutex(kill_signal);
|
||||
error=0;
|
||||
}
|
||||
else
|
||||
error= (type == KILL_TYPE_QUERY ? ER_KILL_QUERY_DENIED_ERROR :
|
||||
ER_KILL_DENIED_ERROR);
|
||||
mysql_mutex_unlock(&tmp->LOCK_thd_data);
|
||||
mysql_mutex_unlock(&tmp->LOCK_thd_kill);
|
||||
}
|
||||
DBUG_PRINT("exit", ("%d", error));
|
||||
DBUG_RETURN(error);
|
||||
@ -8938,7 +8942,7 @@ static uint kill_threads_for_user(THD *thd, LEX_USER *user,
|
||||
DBUG_RETURN(ER_KILL_DENIED_ERROR);
|
||||
}
|
||||
if (!threads_to_kill.push_back(tmp, thd->mem_root))
|
||||
mysql_mutex_lock(&tmp->LOCK_thd_data); // Lock from delete
|
||||
mysql_mutex_lock(&tmp->LOCK_thd_kill); // Lock from delete
|
||||
}
|
||||
}
|
||||
mysql_mutex_unlock(&LOCK_thread_count);
|
||||
@ -8949,17 +8953,17 @@ static uint kill_threads_for_user(THD *thd, LEX_USER *user,
|
||||
THD *ptr= it2++;
|
||||
do
|
||||
{
|
||||
ptr->awake(kill_signal);
|
||||
ptr->awake_no_mutex(kill_signal);
|
||||
/*
|
||||
Careful here: The list nodes are allocated on the memroots of the
|
||||
THDs to be awakened.
|
||||
But those THDs may be terminated and deleted as soon as we release
|
||||
LOCK_thd_data, which will make the list nodes invalid.
|
||||
LOCK_thd_kill, which will make the list nodes invalid.
|
||||
Since the operation "it++" dereferences the "next" pointer of the
|
||||
previous list node, we need to do this while holding LOCK_thd_data.
|
||||
previous list node, we need to do this while holding LOCK_thd_kill.
|
||||
*/
|
||||
next_ptr= it2++;
|
||||
mysql_mutex_unlock(&ptr->LOCK_thd_data);
|
||||
mysql_mutex_unlock(&ptr->LOCK_thd_kill);
|
||||
(*rows)++;
|
||||
} while ((ptr= next_ptr));
|
||||
}
|
||||
|
Reference in New Issue
Block a user