1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Ensure that process "State" is properly cleaned after query execution

In some cases "SHOW PROCESSLIST" could show "Reset for next command"
as State, even if the previous query had finished properly.

Fixed by clearing State after end of command and also setting the State
for the "Connect" command.

Other things:
- Changed usage of 'thd->set_command(COM_SLEEP)' to
  'thd->mark_connection_idle()'.
- Changed thread_state_info() to return "" instead of NULL. This is
  just a safety measurement and in line with the logic of the
  rest of the function.
This commit is contained in:
Monty
2023-11-06 17:37:11 +02:00
parent 01623ac9ea
commit 2447172afb
10 changed files with 22 additions and 12 deletions

View File

@ -4630,13 +4630,24 @@ public:
public:
/** Overloaded to guard query/query_length fields */
virtual void set_statement(Statement *stmt);
void set_command(enum enum_server_command command)
inline void set_command(enum enum_server_command command)
{
DBUG_ASSERT(command != COM_SLEEP);
m_command= command;
#ifdef HAVE_PSI_THREAD_INTERFACE
PSI_STATEMENT_CALL(set_thread_command)(m_command);
#endif
}
/* As sleep needs a bit of special handling, we have a special case for it */
inline void mark_connection_idle()
{
proc_info= 0;
m_command= COM_SLEEP;
#ifdef HAVE_PSI_THREAD_INTERFACE
PSI_STATEMENT_CALL(set_thread_command)(m_command);
#endif
}
inline enum enum_server_command get_command() const
{ return m_command; }