Merge lp:~akopytov/percona-server/bug719386-5.5 into lp:percona-server/5.5

Proposed by Alexey Kopytov
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 340
Proposed branch: lp:~akopytov/percona-server/bug719386-5.5
Merge into: lp:percona-server/5.5
Diff against target: 78 lines (+36/-0)
2 files modified
Percona-Server/sql/sp_head.cc (+20/-0)
Percona-Server/sql/sql_class.h (+16/-0)
To merge this branch: bzr merge lp:~akopytov/percona-server/bug719386-5.5
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Laurynas Biveinis (community) Needs Fixing
Stewart Smith (community) Approve
Sergei Glushchenko (community) g2 Approve
Review via email: mp+129700@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :

Approve g2

review: Approve (g2)
Revision history for this message
Stewart Smith (stewart) :
review: Approve
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

I think THD::get_time() method should be const, likewise the arg of THD::set_time().

review: Needs Fixing
Revision history for this message
Alexey Kopytov (akopytov) wrote :

I don't think it makes any practical difference.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Percona-Server/sql/sp_head.cc'
--- Percona-Server/sql/sp_head.cc 2012-06-01 12:15:25 +0000
+++ Percona-Server/sql/sp_head.cc 2012-10-15 15:45:27 +0000
@@ -3099,6 +3099,8 @@
3099sp_instr_stmt::execute(THD *thd, uint *nextp)3099sp_instr_stmt::execute(THD *thd, uint *nextp)
3100{3100{
3101 int res;3101 int res;
3102 QUERY_START_TIME_INFO time_info;
3103
3102 DBUG_ENTER("sp_instr_stmt::execute");3104 DBUG_ENTER("sp_instr_stmt::execute");
3103 DBUG_PRINT("info", ("command: %d", m_lex_keeper.sql_command()));3105 DBUG_PRINT("info", ("command: %d", m_lex_keeper.sql_command()));
31043106
@@ -3107,6 +3109,19 @@
3107 /* This s-p instr is profilable and will be captured. */3109 /* This s-p instr is profilable and will be captured. */
3108 thd->profiling.set_query_source(m_query.str, m_query.length);3110 thd->profiling.set_query_source(m_query.str, m_query.length);
3109#endif3111#endif
3112
3113 memset(&time_info, 0, sizeof(time_info));
3114
3115 if (thd->enable_slow_log)
3116 {
3117 /*
3118 Save start time info for the CALL statement and overwrite it with the
3119 current time for log_slow_statement() to log the individual query timing.
3120 */
3121 thd->get_time(&time_info);
3122 thd->set_time();
3123 }
3124
3110 if (!(res= alloc_query(thd, m_query.str, m_query.length)) &&3125 if (!(res= alloc_query(thd, m_query.str, m_query.length)) &&
3111 !(res=subst_spvars(thd, this, &m_query)))3126 !(res=subst_spvars(thd, this, &m_query)))
3112 {3127 {
@@ -3143,6 +3158,11 @@
3143 if (!thd->is_error())3158 if (!thd->is_error())
3144 thd->stmt_da->reset_diagnostics_area();3159 thd->stmt_da->reset_diagnostics_area();
3145 }3160 }
3161
3162 /* Restore the original query start time */
3163 if (thd->enable_slow_log)
3164 thd->set_time(&time_info);
3165
3146 DBUG_RETURN(res || thd->is_error());3166 DBUG_RETURN(res || thd->is_error());
3147}3167}
31483168
31493169
=== modified file 'Percona-Server/sql/sql_class.h'
--- Percona-Server/sql/sql_class.h 2012-09-17 13:08:32 +0000
+++ Percona-Server/sql/sql_class.h 2012-10-15 15:45:27 +0000
@@ -1497,6 +1497,12 @@
14971497
1498extern "C" void my_message_sql(uint error, const char *str, myf MyFlags);1498extern "C" void my_message_sql(uint error, const char *str, myf MyFlags);
14991499
1500typedef struct
1501{
1502 time_t start_time;
1503 ulonglong start_utime;
1504} QUERY_START_TIME_INFO;
1505
1500/**1506/**
1501 @class THD1507 @class THD
1502 For each client connection we create a separate thread with THD serving as1508 For each client connection we create a separate thread with THD serving as
@@ -2493,6 +2499,16 @@
2493 start_time= user_time= t;2499 start_time= user_time= t;
2494 start_utime= utime_after_lock= my_micro_time();2500 start_utime= utime_after_lock= my_micro_time();
2495 }2501 }
2502 void get_time(QUERY_START_TIME_INFO *time_info)
2503 {
2504 time_info->start_time= start_time;
2505 time_info->start_utime= start_utime;
2506 }
2507 void set_time(QUERY_START_TIME_INFO *time_info)
2508 {
2509 start_time= time_info->start_time;
2510 start_utime= time_info->start_utime;
2511 }
2496 /*TODO: this will be obsolete when we have support for 64 bit my_time_t */2512 /*TODO: this will be obsolete when we have support for 64 bit my_time_t */
2497 inline bool is_valid_time() 2513 inline bool is_valid_time()
2498 { 2514 {

Subscribers

People subscribed via source and target branches