Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
07b1a774
Commit
07b1a774
authored
Jan 09, 2018
by
Aleksey Midenkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQL: Backup_query_start_time RAII
parent
3395ab73
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
9 deletions
+28
-9
sql/sp_head.cc
sql/sp_head.cc
+2
-5
sql/sql_class.h
sql/sql_class.h
+26
-4
No files found.
sql/sp_head.cc
View file @
07b1a774
...
...
@@ -3273,7 +3273,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
int
res
;
bool
save_enable_slow_log
;
const
CSET_STRING
query_backup
=
thd
->
query_string
;
QUERY_START_TIME_INFO
time_info
;
Backup_query_start_time
time_info
;
Sub_statement_state
backup_state
;
DBUG_ENTER
(
"sp_instr_stmt::execute"
);
DBUG_PRINT
(
"info"
,
(
"command: %d"
,
m_lex_keeper
.
sql_command
()));
...
...
@@ -3289,7 +3289,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.
*/
t
hd
->
backup_query_start_time
(
&
time_info
);
t
ime_info
.
backup
(
*
thd
);
thd
->
set_time
();
}
thd
->
store_slow_query_state
(
&
backup_state
);
...
...
@@ -3355,9 +3355,6 @@ 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
());
}
...
...
sql/sql_class.h
View file @
07b1a774
...
...
@@ -2085,14 +2085,36 @@ 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
;
void
backup_query_start_time
(
QUERY_START_TIME_INFO
*
backup
)
public:
Backup_query_start_time
()
:
m_origin
(
NULL
)
{}
Backup_query_start_time
(
QUERY_START_TIME_INFO
&
origin
)
{
*
backup
=
*
this
;
backup
(
origin
)
;
}
void
restore_query_start_time
(
QUERY_START_TIME_INFO
*
backup
)
~
Backup_query_start_time
(
)
{
*
this
=
*
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
;
}
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment