Merge lp:~percona-dev/percona-server/release-5.1.50-12-bug_fix_658274 into lp:percona-server/release-5.1.50-12

Proposed by Oleg Tsarev
Status: Merged
Approved by: Vadim Tkachenko
Approved revision: no longer in the source branch.
Merged at revision: 129
Proposed branch: lp:~percona-dev/percona-server/release-5.1.50-12-bug_fix_658274
Merge into: lp:percona-server/release-5.1.50-12
Diff against target: 298 lines (+105/-37)
1 file modified
response-time-distribution.patch (+105/-37)
To merge this branch: bzr merge lp:~percona-dev/percona-server/release-5.1.50-12-bug_fix_658274
Reviewer Review Type Date Requested Status
Vadim Tkachenko Approve
Review via email: mp+38795@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Vadim Tkachenko (vadim-tk) wrote :

ok

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'response-time-distribution.patch'
--- response-time-distribution.patch 2010-10-19 00:14:36 +0000
+++ response-time-distribution.patch 2010-10-19 01:28:40 +0000
@@ -6,8 +6,8 @@
6# Any small change to this file in the main branch6# Any small change to this file in the main branch
7# should be done or reviewed by the maintainer!7# should be done or reviewed by the maintainer!
8diff -ruN a/include/mysql_com.h b/include/mysql_com.h8diff -ruN a/include/mysql_com.h b/include/mysql_com.h
9--- a/include/mysql_com.h 2010-09-14 20:27:52.000000000 +00009--- a/include/mysql_com.h 2010-10-16 07:28:32.000000000 +0400
10+++ b/include/mysql_com.h 2010-09-14 20:31:41.000000000 +000010+++ b/include/mysql_com.h 2010-10-16 07:29:04.000000000 +0400
11@@ -128,10 +128,11 @@11@@ -128,10 +128,11 @@
12 #define REFRESH_FAST 32768 /* Intern flag */12 #define REFRESH_FAST 32768 /* Intern flag */
13 13
@@ -25,8 +25,8 @@
25 #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */25 #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */
26 #define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */26 #define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */
27diff -ruN a/patch_info/response-time-distribution.info b/patch_info/response-time-distribution.info27diff -ruN a/patch_info/response-time-distribution.info b/patch_info/response-time-distribution.info
28--- a/patch_info/response-time-distribution.info 1970-01-01 00:00:00.000000000 +000028--- a/patch_info/response-time-distribution.info 1970-01-01 03:00:00.000000000 +0300
29+++ b/patch_info/response-time-distribution.info 2010-09-14 20:31:41.000000000 +000029+++ b/patch_info/response-time-distribution.info 2010-10-16 07:29:04.000000000 +0400
30@@ -0,0 +1,9 @@30@@ -0,0 +1,9 @@
31+File=response-time-distribution.patch31+File=response-time-distribution.patch
32+Name=Response time distribution32+Name=Response time distribution
@@ -38,8 +38,8 @@
38+2010-07-02 first version avaliable38+2010-07-02 first version avaliable
39+2010-09-15 add column 'total'39+2010-09-15 add column 'total'
40diff -ruN a/sql/lex.h b/sql/lex.h40diff -ruN a/sql/lex.h b/sql/lex.h
41--- a/sql/lex.h 2010-09-14 20:27:52.000000000 +000041--- a/sql/lex.h 2010-10-16 07:28:35.000000000 +0400
42+++ b/sql/lex.h 2010-09-14 20:31:41.000000000 +000042+++ b/sql/lex.h 2010-10-16 07:29:04.000000000 +0400
43@@ -415,6 +415,7 @@43@@ -415,6 +415,7 @@
44 { "PURGE", SYM(PURGE)},44 { "PURGE", SYM(PURGE)},
45 { "QUARTER", SYM(QUARTER_SYM)},45 { "QUARTER", SYM(QUARTER_SYM)},
@@ -49,8 +49,8 @@
49 { "RANGE", SYM(RANGE_SYM)},49 { "RANGE", SYM(RANGE_SYM)},
50 { "READ", SYM(READ_SYM)},50 { "READ", SYM(READ_SYM)},
51diff -ruN a/sql/Makefile.am b/sql/Makefile.am51diff -ruN a/sql/Makefile.am b/sql/Makefile.am
52--- a/sql/Makefile.am 2010-09-14 20:27:51.000000000 +000052--- a/sql/Makefile.am 2010-10-16 07:28:31.000000000 +0400
53+++ b/sql/Makefile.am 2010-09-14 20:31:41.000000000 +000053+++ b/sql/Makefile.am 2010-10-16 07:29:04.000000000 +0400
54@@ -67,7 +67,7 @@54@@ -67,7 +67,7 @@
55 sql_repl.h slave.h rpl_filter.h rpl_injector.h \55 sql_repl.h slave.h rpl_filter.h rpl_injector.h \
56 log_event.h rpl_record.h \56 log_event.h rpl_record.h \
@@ -70,8 +70,8 @@
70 sql_profile.cc \70 sql_profile.cc \
71 sql_prepare.cc sql_error.cc sql_locale.cc \71 sql_prepare.cc sql_error.cc sql_locale.cc \
72diff -ruN a/sql/Makefile.in b/sql/Makefile.in72diff -ruN a/sql/Makefile.in b/sql/Makefile.in
73--- a/sql/Makefile.in 2010-09-14 20:27:51.000000000 +000073--- a/sql/Makefile.in 2010-10-16 07:28:31.000000000 +0400
74+++ b/sql/Makefile.in 2010-09-14 20:31:41.000000000 +000074+++ b/sql/Makefile.in 2010-10-16 07:29:04.000000000 +0400
75@@ -122,7 +122,7 @@75@@ -122,7 +122,7 @@
76 sql_string.$(OBJEXT) sql_manager.$(OBJEXT) sql_map.$(OBJEXT) \76 sql_string.$(OBJEXT) sql_manager.$(OBJEXT) sql_map.$(OBJEXT) \
77 mysqld.$(OBJEXT) password.$(OBJEXT) hash_filo.$(OBJEXT) \77 mysqld.$(OBJEXT) password.$(OBJEXT) hash_filo.$(OBJEXT) \
@@ -108,8 +108,8 @@
108 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/repl_failsafe.Po@am__quote@108 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/repl_failsafe.Po@am__quote@
109 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpl_filter.Po@am__quote@109 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpl_filter.Po@am__quote@
110diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc110diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
111--- a/sql/mysqld.cc 2010-09-14 20:27:52.000000000 +0000111--- a/sql/mysqld.cc 2010-10-16 07:28:35.000000000 +0400
112+++ b/sql/mysqld.cc 2010-09-14 20:32:15.000000000 +0000112+++ b/sql/mysqld.cc 2010-10-16 07:29:04.000000000 +0400
113@@ -32,6 +32,8 @@113@@ -32,6 +32,8 @@
114 114
115 #include "rpl_injector.h"115 #include "rpl_injector.h"
@@ -119,7 +119,7 @@
119 #ifdef HAVE_SYS_PRCTL_H119 #ifdef HAVE_SYS_PRCTL_H
120 #include <sys/prctl.h>120 #include <sys/prctl.h>
121 #endif121 #endif
122@@ -527,6 +533,8 @@122@@ -527,6 +529,8 @@
123 my_bool opt_query_cache_strip_comments = 0;123 my_bool opt_query_cache_strip_comments = 0;
124 my_bool opt_use_global_long_query_time= 0;124 my_bool opt_use_global_long_query_time= 0;
125 my_bool opt_slow_query_log_microseconds_timestamp= 0;125 my_bool opt_slow_query_log_microseconds_timestamp= 0;
@@ -128,7 +128,7 @@
128 my_bool lower_case_file_system= 0;128 my_bool lower_case_file_system= 0;
129 my_bool opt_large_pages= 0;129 my_bool opt_large_pages= 0;
130 my_bool opt_myisam_use_mmap= 0;130 my_bool opt_myisam_use_mmap= 0;
131@@ -1382,6 +1395,7 @@131@@ -1382,6 +1386,7 @@
132 free_global_thread_stats();132 free_global_thread_stats();
133 free_global_table_stats();133 free_global_table_stats();
134 free_global_index_stats();134 free_global_index_stats();
@@ -136,7 +136,7 @@
136 #ifdef HAVE_REPLICATION136 #ifdef HAVE_REPLICATION
137 end_slave_list();137 end_slave_list();
138 #endif138 #endif
139@@ -4082,6 +4096,7 @@139@@ -4082,6 +4087,7 @@
140 140
141 init_global_table_stats();141 init_global_table_stats();
142 init_global_index_stats();142 init_global_index_stats();
@@ -144,7 +144,7 @@
144 144
145 /* We have to initialize the storage engines before CSV logging */145 /* We have to initialize the storage engines before CSV logging */
146 if (ha_init())146 if (ha_init())
147@@ -5895,6 +6003,8 @@147@@ -5895,6 +5901,8 @@
148 OPT_USE_GLOBAL_LONG_QUERY_TIME,148 OPT_USE_GLOBAL_LONG_QUERY_TIME,
149 OPT_USE_GLOBAL_LOG_SLOW_CONTROL,149 OPT_USE_GLOBAL_LOG_SLOW_CONTROL,
150 OPT_SLOW_QUERY_LOG_MICROSECONDS_TIMESTAMP,150 OPT_SLOW_QUERY_LOG_MICROSECONDS_TIMESTAMP,
@@ -153,7 +153,7 @@
153 OPT_IGNORE_BUILTIN_INNODB,153 OPT_IGNORE_BUILTIN_INNODB,
154 OPT_BINLOG_DIRECT_NON_TRANS_UPDATE,154 OPT_BINLOG_DIRECT_NON_TRANS_UPDATE,
155 OPT_DEFAULT_CHARACTER_SET_OLD155 OPT_DEFAULT_CHARACTER_SET_OLD
156@@ -6964,6 +7074,21 @@156@@ -6964,6 +6972,21 @@
157 "Use microsecond time's precision in slow query log",157 "Use microsecond time's precision in slow query log",
158 (uchar**) &opt_slow_query_log_microseconds_timestamp, (uchar**) &opt_slow_query_log_microseconds_timestamp,158 (uchar**) &opt_slow_query_log_microseconds_timestamp, (uchar**) &opt_slow_query_log_microseconds_timestamp,
159 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},159 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
@@ -176,8 +176,8 @@
176 "If set to 1, table names are stored in lowercase on disk and table names "176 "If set to 1, table names are stored in lowercase on disk and table names "
177 "will be case-insensitive. Should be set to 2 if you are using a case-"177 "will be case-insensitive. Should be set to 2 if you are using a case-"
178diff -ruN a/sql/mysql_priv.h b/sql/mysql_priv.h178diff -ruN a/sql/mysql_priv.h b/sql/mysql_priv.h
179--- a/sql/mysql_priv.h 2010-09-14 20:27:52.000000000 +0000179--- a/sql/mysql_priv.h 2010-10-16 07:28:35.000000000 +0400
180+++ b/sql/mysql_priv.h 2010-09-14 20:31:41.000000000 +0000180+++ b/sql/mysql_priv.h 2010-10-16 07:29:04.000000000 +0400
181@@ -2090,6 +2090,8 @@181@@ -2090,6 +2090,8 @@
182 extern my_bool opt_query_cache_strip_comments;182 extern my_bool opt_query_cache_strip_comments;
183 extern my_bool opt_use_global_long_query_time;183 extern my_bool opt_use_global_long_query_time;
@@ -188,9 +188,9 @@
188 extern my_bool opt_old_style_user_limits, trust_function_creators;188 extern my_bool opt_old_style_user_limits, trust_function_creators;
189 extern uint opt_crash_binlog_innodb;189 extern uint opt_crash_binlog_innodb;
190diff -ruN a/sql/query_response_time.cc b/sql/query_response_time.cc190diff -ruN a/sql/query_response_time.cc b/sql/query_response_time.cc
191--- a/sql/query_response_time.cc 1970-01-01 00:00:00.000000000 +0000191--- a/sql/query_response_time.cc 1970-01-01 03:00:00.000000000 +0300
192+++ b/sql/query_response_time.cc 2010-09-14 20:32:15.000000000 +0000192+++ b/sql/query_response_time.cc 2010-10-18 15:23:12.000000000 +0400
193@@ -0,0 +1,279 @@193@@ -0,0 +1,347 @@
194+#include "my_global.h"194+#include "my_global.h"
195+#include "mysql_priv.h"195+#include "mysql_priv.h"
196+#include "mysql_com.h"196+#include "mysql_com.h"
@@ -341,6 +341,74 @@
341+ }341+ }
342+ buffer[result_length]= 0;342+ buffer[result_length]= 0;
343+}343+}
344+#ifdef __x86_64__
345+typedef uint64 TimeCounter;
346+void add_time_atomic(TimeCounter* counter, uint64 time)
347+{
348+ __sync_fetch_and_add(counter,time);
349+}
350+#endif // __x86_64__
351+#ifdef __i386__
352+inline uint32 get_high(uint64 value)
353+{
354+ return ((value >> 32) << 32);
355+}
356+inline uint32 get_low(uint64 value)
357+{
358+ return ((value << 32) >> 32);
359+}
360+class TimeCounter
361+{
362+public:
363+ TimeCounter& operator=(uint64 time)
364+ {
365+ this->m_high= get_high(time);
366+ this->m_low= get_low(time);
367+ return *this;
368+ }
369+ operator uint64() const
370+ {
371+ return ((static_cast<uint64>(m_high) << 32) + static_cast<uint64>(m_low));
372+ }
373+ void add(uint64 time)
374+ {
375+ uint32 time_high = get_high(time);
376+ uint32 time_low = get_low(time);
377+ uint64 time_low64= time_low;
378+ while(true)
379+ {
380+ uint32 old_low= this->m_low;
381+ uint64 old_low64= old_low;
382+
383+ uint64 new_low64= old_low64 + time_low64;
384+ uint32 new_low= (get_low(new_low64));
385+ bool add_high= (get_high(new_low64) != 0);
386+
387+ if(!__sync_bool_compare_and_swap(&m_low,old_low,new_low))
388+ {
389+ continue;
390+ }
391+ if(add_high)
392+ {
393+ ++time_high;
394+ }
395+ if(time_high > 0)
396+ {
397+ __sync_fetch_and_add(&m_high,time_high);
398+ }
399+ break;
400+ }
401+ }
402+private:
403+ uint32 m_low;
404+ uint32 m_high;
405+};
406+void add_time_atomic(TimeCounter* counter, uint64 time)
407+{
408+ counter->add(time);
409+}
410+#endif // __i386__
411+
344+class time_collector412+class time_collector
345+{413+{
346+public:414+public:
@@ -363,15 +431,15 @@
363+ if(m_utility->bound(i) > time)431+ if(m_utility->bound(i) > time)
364+ {432+ {
365+ __sync_fetch_and_add(&(m_count[i]),(uint32)1);433+ __sync_fetch_and_add(&(m_count[i]),(uint32)1);
366+ __sync_fetch_and_add(&(m_total[i]),time);434+ add_time_atomic(&(m_total[i]),time);
367+ break;435+ break;
368+ }436+ }
369+ }437+ }
370+ }438+ }
371+private:439+private:
372+ utility* m_utility;440+ utility* m_utility;
373+ uint32 m_count[OVERALL_POWER_COUNT + 1];441+ uint32 m_count[OVERALL_POWER_COUNT + 1];
374+ uint64 m_total[OVERALL_POWER_COUNT + 1];442+ TimeCounter m_total[OVERALL_POWER_COUNT + 1];
375+};443+};
376+444+
377+class collector445+class collector
@@ -471,8 +539,8 @@
471+ return query_response_time::g_collector.fill(thd,tables,cond);539+ return query_response_time::g_collector.fill(thd,tables,cond);
472+}540+}
473diff -ruN a/sql/query_response_time.h b/sql/query_response_time.h541diff -ruN a/sql/query_response_time.h b/sql/query_response_time.h
474--- a/sql/query_response_time.h 1970-01-01 00:00:00.000000000 +0000542--- a/sql/query_response_time.h 1970-01-01 03:00:00.000000000 +0300
475+++ b/sql/query_response_time.h 2010-09-14 20:32:15.000000000 +0000543+++ b/sql/query_response_time.h 2010-10-16 07:29:04.000000000 +0400
476@@ -0,0 +1,69 @@544@@ -0,0 +1,69 @@
477+#ifndef QUERY_RESPONSE_TIME_H545+#ifndef QUERY_RESPONSE_TIME_H
478+#define QUERY_RESPONSE_TIME_H546+#define QUERY_RESPONSE_TIME_H
@@ -544,8 +612,8 @@
544+612+
545+#endif // QUERY_RESPONSE_TIME_H613+#endif // QUERY_RESPONSE_TIME_H
546diff -ruN a/sql/set_var.cc b/sql/set_var.cc614diff -ruN a/sql/set_var.cc b/sql/set_var.cc
547--- a/sql/set_var.cc 2010-09-14 20:27:52.000000000 +0000615--- a/sql/set_var.cc 2010-10-16 07:28:35.000000000 +0400
548+++ b/sql/set_var.cc 2010-09-14 20:31:41.000000000 +0000616+++ b/sql/set_var.cc 2010-10-16 07:29:04.000000000 +0400
549@@ -1004,6 +1004,10 @@617@@ -1004,6 +1004,10 @@
550 static sys_var_use_global_long_query_time sys_use_global_long_query_time;618 static sys_var_use_global_long_query_time sys_use_global_long_query_time;
551 static sys_var_bool_ptr sys_slow_query_log_microseconds_timestamp(&vars, "slow_query_log_microseconds_timestamp",619 static sys_var_bool_ptr sys_slow_query_log_microseconds_timestamp(&vars, "slow_query_log_microseconds_timestamp",
@@ -558,8 +626,8 @@
558 static sys_var_log_state sys_var_log_slow(&vars, "log_slow_queries",626 static sys_var_log_state sys_var_log_slow(&vars, "log_slow_queries",
559 &opt_slow_log, QUERY_LOG_SLOW);627 &opt_slow_log, QUERY_LOG_SLOW);
560diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc628diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
561--- a/sql/sql_parse.cc 2010-09-14 20:27:52.000000000 +0000629--- a/sql/sql_parse.cc 2010-10-16 07:28:35.000000000 +0400
562+++ b/sql/sql_parse.cc 2010-09-14 20:31:41.000000000 +0000630+++ b/sql/sql_parse.cc 2010-10-16 07:29:04.000000000 +0400
563@@ -27,6 +27,7 @@631@@ -27,6 +27,7 @@
564 #include "sp_cache.h"632 #include "sp_cache.h"
565 #include "events.h"633 #include "events.h"
@@ -634,8 +702,8 @@
634 {702 {
635 pthread_mutex_lock(&LOCK_global_user_client_stats);703 pthread_mutex_lock(&LOCK_global_user_client_stats);
636diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc704diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
637--- a/sql/sql_show.cc 2010-09-14 20:27:52.000000000 +0000705--- a/sql/sql_show.cc 2010-10-16 07:28:32.000000000 +0400
638+++ b/sql/sql_show.cc 2010-09-14 20:32:15.000000000 +0000706+++ b/sql/sql_show.cc 2010-10-16 07:29:04.000000000 +0400
639@@ -31,6 +31,7 @@707@@ -31,6 +31,7 @@
640 #include "event_data_objects.h"708 #include "event_data_objects.h"
641 #endif709 #endif
@@ -669,8 +737,8 @@
669 fill_schema_schemata, make_schemata_old_format, 0, 1, -1, 0, 0},737 fill_schema_schemata, make_schemata_old_format, 0, 1, -1, 0, 0},
670 {"SCHEMA_PRIVILEGES", schema_privileges_fields_info, create_schema_table,738 {"SCHEMA_PRIVILEGES", schema_privileges_fields_info, create_schema_table,
671diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy739diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy
672--- a/sql/sql_yacc.yy 2010-09-14 20:27:52.000000000 +0000740--- a/sql/sql_yacc.yy 2010-10-16 07:28:35.000000000 +0400
673+++ b/sql/sql_yacc.yy 2010-09-14 20:31:41.000000000 +0000741+++ b/sql/sql_yacc.yy 2010-10-16 07:29:04.000000000 +0400
674@@ -1079,6 +1079,7 @@742@@ -1079,6 +1079,7 @@
675 %token PURGE743 %token PURGE
676 %token QUARTER_SYM744 %token QUARTER_SYM
@@ -711,8 +779,8 @@
711 | READ_ONLY_SYM {}779 | READ_ONLY_SYM {}
712 | REBUILD_SYM {}780 | REBUILD_SYM {}
713diff -ruN a/sql/table.h b/sql/table.h781diff -ruN a/sql/table.h b/sql/table.h
714--- a/sql/table.h 2010-09-14 20:27:52.000000000 +0000782--- a/sql/table.h 2010-10-16 07:28:32.000000000 +0400
715+++ b/sql/table.h 2010-09-14 20:31:41.000000000 +0000783+++ b/sql/table.h 2010-10-16 07:29:04.000000000 +0400
716@@ -963,6 +963,7 @@784@@ -963,6 +963,7 @@
717 SCH_PROFILES,785 SCH_PROFILES,
718 SCH_REFERENTIAL_CONSTRAINTS,786 SCH_REFERENTIAL_CONSTRAINTS,

Subscribers

People subscribed via source and target branches

to all changes: