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

Proposed by Alexey Kopytov
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 502
Proposed branch: lp:~akopytov/percona-server/bug719386-5.1
Merge into: lp:percona-server/5.1
Diff against target: 77 lines (+35/-0)
2 files modified
Percona-Server/sql/sp_head.cc (+20/-0)
Percona-Server/sql/sql_class.h (+15/-0)
To merge this branch: bzr merge lp:~akopytov/percona-server/bug719386-5.1
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+129699@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
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

> I don't think it makes any practical difference.

Not much of a practical difference, but it's a code quality thing, there is no reason not to add const if it can be added. Anyway, I trust your judgment.

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-05-09 04:14:12 +0000
+++ Percona-Server/sql/sp_head.cc 2012-10-15 15:43:33 +0000
@@ -2898,6 +2898,8 @@
2898 char *query;2898 char *query;
2899 uint32 query_length;2899 uint32 query_length;
2900 int res;2900 int res;
2901 QUERY_START_TIME_INFO time_info;
2902
2901 DBUG_ENTER("sp_instr_stmt::execute");2903 DBUG_ENTER("sp_instr_stmt::execute");
2902 DBUG_PRINT("info", ("command: %d", m_lex_keeper.sql_command()));2904 DBUG_PRINT("info", ("command: %d", m_lex_keeper.sql_command()));
29032905
@@ -2907,6 +2909,19 @@
2907 /* This s-p instr is profilable and will be captured. */2909 /* This s-p instr is profilable and will be captured. */
2908 thd->profiling.set_query_source(m_query.str, m_query.length);2910 thd->profiling.set_query_source(m_query.str, m_query.length);
2909#endif2911#endif
2912
2913 memset(&time_info, 0, sizeof(time_info));
2914
2915 if (thd->enable_slow_log)
2916 {
2917 /*
2918 Save start time info for the CALL statement and overwrite it with the
2919 current time for log_slow_statement() to log the individual query timing.
2920 */
2921 thd->get_time(&time_info);
2922 thd->set_time();
2923 }
2924
2910 if (!(res= alloc_query(thd, m_query.str, m_query.length)) &&2925 if (!(res= alloc_query(thd, m_query.str, m_query.length)) &&
2911 !(res=subst_spvars(thd, this, &m_query)))2926 !(res=subst_spvars(thd, this, &m_query)))
2912 {2927 {
@@ -2939,6 +2954,11 @@
2939 if (!thd->is_error())2954 if (!thd->is_error())
2940 thd->main_da.reset_diagnostics_area();2955 thd->main_da.reset_diagnostics_area();
2941 }2956 }
2957
2958 /* Restore the original query start time */
2959 if (thd->enable_slow_log)
2960 thd->set_time(&time_info);
2961
2942 DBUG_RETURN(res || thd->is_error());2962 DBUG_RETURN(res || thd->is_error());
2943}2963}
29442964
29452965
=== modified file 'Percona-Server/sql/sql_class.h'
--- Percona-Server/sql/sql_class.h 2012-08-20 03:14:02 +0000
+++ Percona-Server/sql/sql_class.h 2012-10-15 15:43:33 +0000
@@ -1329,6 +1329,11 @@
1329 Ha_data() :ha_ptr(NULL) {}1329 Ha_data() :ha_ptr(NULL) {}
1330};1330};
13311331
1332typedef struct
1333{
1334 time_t start_time;
1335 ulonglong start_utime;
1336} QUERY_START_TIME_INFO;
13321337
1333/**1338/**
1334 @class THD1339 @class THD
@@ -2217,6 +2222,16 @@
2217 start_time= user_time= t;2222 start_time= user_time= t;
2218 start_utime= utime_after_lock= my_micro_time();2223 start_utime= utime_after_lock= my_micro_time();
2219 }2224 }
2225 void get_time(QUERY_START_TIME_INFO *time_info)
2226 {
2227 time_info->start_time= start_time;
2228 time_info->start_utime= start_utime;
2229 }
2230 void set_time(QUERY_START_TIME_INFO *time_info)
2231 {
2232 start_time= time_info->start_time;
2233 start_utime= time_info->start_utime;
2234 }
2220 /*TODO: this will be obsolete when we have support for 64 bit my_time_t */2235 /*TODO: this will be obsolete when we have support for 64 bit my_time_t */
2221 inline bool is_valid_time() 2236 inline bool is_valid_time()
2222 { 2237 {

Subscribers

People subscribed via source and target branches