Skip to content

Commit 376b0ea

Browse files
committed
Revert "SQL: Backup_query_start_time RAII"
This reverts commit 07b1a77.
1 parent a544f92 commit 376b0ea

File tree

2 files changed

+9
-28
lines changed

2 files changed

+9
-28
lines changed

sql/sp_head.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3272,7 +3272,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
32723272
int res;
32733273
bool save_enable_slow_log;
32743274
const CSET_STRING query_backup= thd->query_string;
3275-
Backup_query_start_time time_info;
3275+
QUERY_START_TIME_INFO time_info;
32763276
Sub_statement_state backup_state;
32773277
DBUG_ENTER("sp_instr_stmt::execute");
32783278
DBUG_PRINT("info", ("command: %d", m_lex_keeper.sql_command()));
@@ -3288,7 +3288,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
32883288
Save start time info for the CALL statement and overwrite it with the
32893289
current time for log_slow_statement() to log the individual query timing.
32903290
*/
3291-
time_info.backup(*thd);
3291+
thd->backup_query_start_time(&time_info);
32923292
thd->set_time();
32933293
}
32943294
thd->store_slow_query_state(&backup_state);
@@ -3354,6 +3354,9 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
33543354
thd->get_stmt_da()->reset_diagnostics_area();
33553355
}
33563356
}
3357+
/* Restore the original query start time */
3358+
if (thd->enable_slow_log)
3359+
thd->restore_query_start_time(&time_info);
33573360

33583361
DBUG_RETURN(res || thd->is_error());
33593362
}

sql/sql_class.h

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2089,36 +2089,14 @@ struct QUERY_START_TIME_INFO
20892089
my_time_t start_time;
20902090
ulong start_time_sec_part;
20912091
ulonglong start_utime, utime_after_lock;
2092-
};
2093-
2094-
class Backup_query_start_time : public QUERY_START_TIME_INFO
2095-
{
2096-
QUERY_START_TIME_INFO *m_origin;
20972092

2098-
public:
2099-
Backup_query_start_time() : m_origin(NULL)
2100-
{}
2101-
Backup_query_start_time(QUERY_START_TIME_INFO &origin)
2093+
void backup_query_start_time(QUERY_START_TIME_INFO *backup)
21022094
{
2103-
backup(origin);
2095+
*backup= *this;
21042096
}
2105-
~Backup_query_start_time()
2097+
void restore_query_start_time(QUERY_START_TIME_INFO *backup)
21062098
{
2107-
restore();
2108-
}
2109-
void backup(QUERY_START_TIME_INFO &origin)
2110-
{
2111-
m_origin= &origin;
2112-
QUERY_START_TIME_INFO *backup_= this;
2113-
*backup_= origin;
2114-
}
2115-
void restore()
2116-
{
2117-
if (m_origin)
2118-
{
2119-
*m_origin= *this;
2120-
m_origin= NULL;
2121-
}
2099+
*this= *backup;
21222100
}
21232101
};
21242102

0 commit comments

Comments
 (0)