Revert "SQL: Backup_query_start_time RAII"
This reverts commit 07b1a7743096b01ea55407bada7bfad8c609397c.
This commit is contained in:
parent
a544f920e3
commit
376b0ea1da
@ -3272,7 +3272,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
|
||||
int res;
|
||||
bool save_enable_slow_log;
|
||||
const CSET_STRING query_backup= thd->query_string;
|
||||
Backup_query_start_time time_info;
|
||||
QUERY_START_TIME_INFO time_info;
|
||||
Sub_statement_state backup_state;
|
||||
DBUG_ENTER("sp_instr_stmt::execute");
|
||||
DBUG_PRINT("info", ("command: %d", m_lex_keeper.sql_command()));
|
||||
@ -3288,7 +3288,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
|
||||
Save start time info for the CALL statement and overwrite it with the
|
||||
current time for log_slow_statement() to log the individual query timing.
|
||||
*/
|
||||
time_info.backup(*thd);
|
||||
thd->backup_query_start_time(&time_info);
|
||||
thd->set_time();
|
||||
}
|
||||
thd->store_slow_query_state(&backup_state);
|
||||
@ -3354,6 +3354,9 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
|
||||
thd->get_stmt_da()->reset_diagnostics_area();
|
||||
}
|
||||
}
|
||||
/* Restore the original query start time */
|
||||
if (thd->enable_slow_log)
|
||||
thd->restore_query_start_time(&time_info);
|
||||
|
||||
DBUG_RETURN(res || thd->is_error());
|
||||
}
|
||||
|
@ -2089,36 +2089,14 @@ struct QUERY_START_TIME_INFO
|
||||
my_time_t start_time;
|
||||
ulong start_time_sec_part;
|
||||
ulonglong start_utime, utime_after_lock;
|
||||
};
|
||||
|
||||
class Backup_query_start_time : public QUERY_START_TIME_INFO
|
||||
{
|
||||
QUERY_START_TIME_INFO *m_origin;
|
||||
|
||||
public:
|
||||
Backup_query_start_time() : m_origin(NULL)
|
||||
{}
|
||||
Backup_query_start_time(QUERY_START_TIME_INFO &origin)
|
||||
void backup_query_start_time(QUERY_START_TIME_INFO *backup)
|
||||
{
|
||||
backup(origin);
|
||||
*backup= *this;
|
||||
}
|
||||
~Backup_query_start_time()
|
||||
void restore_query_start_time(QUERY_START_TIME_INFO *backup)
|
||||
{
|
||||
restore();
|
||||
}
|
||||
void backup(QUERY_START_TIME_INFO &origin)
|
||||
{
|
||||
m_origin= &origin;
|
||||
QUERY_START_TIME_INFO *backup_= this;
|
||||
*backup_= origin;
|
||||
}
|
||||
void restore()
|
||||
{
|
||||
if (m_origin)
|
||||
{
|
||||
*m_origin= *this;
|
||||
m_origin= NULL;
|
||||
}
|
||||
*this= *backup;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user