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
1=== modified file 'response-time-distribution.patch'
2--- response-time-distribution.patch 2010-10-19 00:14:36 +0000
3+++ response-time-distribution.patch 2010-10-19 01:28:40 +0000
4@@ -6,8 +6,8 @@
5 # Any small change to this file in the main branch
6 # should be done or reviewed by the maintainer!
7 diff -ruN a/include/mysql_com.h b/include/mysql_com.h
8---- a/include/mysql_com.h 2010-09-14 20:27:52.000000000 +0000
9-+++ b/include/mysql_com.h 2010-09-14 20:31:41.000000000 +0000
10+--- a/include/mysql_com.h 2010-10-16 07:28:32.000000000 +0400
11++++ b/include/mysql_com.h 2010-10-16 07:29:04.000000000 +0400
12 @@ -128,10 +128,11 @@
13 #define REFRESH_FAST 32768 /* Intern flag */
14
15@@ -25,8 +25,8 @@
16 #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */
17 #define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */
18 diff -ruN a/patch_info/response-time-distribution.info b/patch_info/response-time-distribution.info
19---- a/patch_info/response-time-distribution.info 1970-01-01 00:00:00.000000000 +0000
20-+++ b/patch_info/response-time-distribution.info 2010-09-14 20:31:41.000000000 +0000
21+--- a/patch_info/response-time-distribution.info 1970-01-01 03:00:00.000000000 +0300
22++++ b/patch_info/response-time-distribution.info 2010-10-16 07:29:04.000000000 +0400
23 @@ -0,0 +1,9 @@
24 +File=response-time-distribution.patch
25 +Name=Response time distribution
26@@ -38,8 +38,8 @@
27 +2010-07-02 first version avaliable
28 +2010-09-15 add column 'total'
29 diff -ruN a/sql/lex.h b/sql/lex.h
30---- a/sql/lex.h 2010-09-14 20:27:52.000000000 +0000
31-+++ b/sql/lex.h 2010-09-14 20:31:41.000000000 +0000
32+--- a/sql/lex.h 2010-10-16 07:28:35.000000000 +0400
33++++ b/sql/lex.h 2010-10-16 07:29:04.000000000 +0400
34 @@ -415,6 +415,7 @@
35 { "PURGE", SYM(PURGE)},
36 { "QUARTER", SYM(QUARTER_SYM)},
37@@ -49,8 +49,8 @@
38 { "RANGE", SYM(RANGE_SYM)},
39 { "READ", SYM(READ_SYM)},
40 diff -ruN a/sql/Makefile.am b/sql/Makefile.am
41---- a/sql/Makefile.am 2010-09-14 20:27:51.000000000 +0000
42-+++ b/sql/Makefile.am 2010-09-14 20:31:41.000000000 +0000
43+--- a/sql/Makefile.am 2010-10-16 07:28:31.000000000 +0400
44++++ b/sql/Makefile.am 2010-10-16 07:29:04.000000000 +0400
45 @@ -67,7 +67,7 @@
46 sql_repl.h slave.h rpl_filter.h rpl_injector.h \
47 log_event.h rpl_record.h \
48@@ -70,8 +70,8 @@
49 sql_profile.cc \
50 sql_prepare.cc sql_error.cc sql_locale.cc \
51 diff -ruN a/sql/Makefile.in b/sql/Makefile.in
52---- a/sql/Makefile.in 2010-09-14 20:27:51.000000000 +0000
53-+++ b/sql/Makefile.in 2010-09-14 20:31:41.000000000 +0000
54+--- a/sql/Makefile.in 2010-10-16 07:28:31.000000000 +0400
55++++ b/sql/Makefile.in 2010-10-16 07:29:04.000000000 +0400
56 @@ -122,7 +122,7 @@
57 sql_string.$(OBJEXT) sql_manager.$(OBJEXT) sql_map.$(OBJEXT) \
58 mysqld.$(OBJEXT) password.$(OBJEXT) hash_filo.$(OBJEXT) \
59@@ -108,8 +108,8 @@
60 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/repl_failsafe.Po@am__quote@
61 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpl_filter.Po@am__quote@
62 diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
63---- a/sql/mysqld.cc 2010-09-14 20:27:52.000000000 +0000
64-+++ b/sql/mysqld.cc 2010-09-14 20:32:15.000000000 +0000
65+--- a/sql/mysqld.cc 2010-10-16 07:28:35.000000000 +0400
66++++ b/sql/mysqld.cc 2010-10-16 07:29:04.000000000 +0400
67 @@ -32,6 +32,8 @@
68
69 #include "rpl_injector.h"
70@@ -119,7 +119,7 @@
71 #ifdef HAVE_SYS_PRCTL_H
72 #include <sys/prctl.h>
73 #endif
74-@@ -527,6 +533,8 @@
75+@@ -527,6 +529,8 @@
76 my_bool opt_query_cache_strip_comments = 0;
77 my_bool opt_use_global_long_query_time= 0;
78 my_bool opt_slow_query_log_microseconds_timestamp= 0;
79@@ -128,7 +128,7 @@
80 my_bool lower_case_file_system= 0;
81 my_bool opt_large_pages= 0;
82 my_bool opt_myisam_use_mmap= 0;
83-@@ -1382,6 +1395,7 @@
84+@@ -1382,6 +1386,7 @@
85 free_global_thread_stats();
86 free_global_table_stats();
87 free_global_index_stats();
88@@ -136,7 +136,7 @@
89 #ifdef HAVE_REPLICATION
90 end_slave_list();
91 #endif
92-@@ -4082,6 +4096,7 @@
93+@@ -4082,6 +4087,7 @@
94
95 init_global_table_stats();
96 init_global_index_stats();
97@@ -144,7 +144,7 @@
98
99 /* We have to initialize the storage engines before CSV logging */
100 if (ha_init())
101-@@ -5895,6 +6003,8 @@
102+@@ -5895,6 +5901,8 @@
103 OPT_USE_GLOBAL_LONG_QUERY_TIME,
104 OPT_USE_GLOBAL_LOG_SLOW_CONTROL,
105 OPT_SLOW_QUERY_LOG_MICROSECONDS_TIMESTAMP,
106@@ -153,7 +153,7 @@
107 OPT_IGNORE_BUILTIN_INNODB,
108 OPT_BINLOG_DIRECT_NON_TRANS_UPDATE,
109 OPT_DEFAULT_CHARACTER_SET_OLD
110-@@ -6964,6 +7074,21 @@
111+@@ -6964,6 +6972,21 @@
112 "Use microsecond time's precision in slow query log",
113 (uchar**) &opt_slow_query_log_microseconds_timestamp, (uchar**) &opt_slow_query_log_microseconds_timestamp,
114 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
115@@ -176,8 +176,8 @@
116 "If set to 1, table names are stored in lowercase on disk and table names "
117 "will be case-insensitive. Should be set to 2 if you are using a case-"
118 diff -ruN a/sql/mysql_priv.h b/sql/mysql_priv.h
119---- a/sql/mysql_priv.h 2010-09-14 20:27:52.000000000 +0000
120-+++ b/sql/mysql_priv.h 2010-09-14 20:31:41.000000000 +0000
121+--- a/sql/mysql_priv.h 2010-10-16 07:28:35.000000000 +0400
122++++ b/sql/mysql_priv.h 2010-10-16 07:29:04.000000000 +0400
123 @@ -2090,6 +2090,8 @@
124 extern my_bool opt_query_cache_strip_comments;
125 extern my_bool opt_use_global_long_query_time;
126@@ -188,9 +188,9 @@
127 extern my_bool opt_old_style_user_limits, trust_function_creators;
128 extern uint opt_crash_binlog_innodb;
129 diff -ruN a/sql/query_response_time.cc b/sql/query_response_time.cc
130---- a/sql/query_response_time.cc 1970-01-01 00:00:00.000000000 +0000
131-+++ b/sql/query_response_time.cc 2010-09-14 20:32:15.000000000 +0000
132-@@ -0,0 +1,279 @@
133+--- a/sql/query_response_time.cc 1970-01-01 03:00:00.000000000 +0300
134++++ b/sql/query_response_time.cc 2010-10-18 15:23:12.000000000 +0400
135+@@ -0,0 +1,347 @@
136 +#include "my_global.h"
137 +#include "mysql_priv.h"
138 +#include "mysql_com.h"
139@@ -341,6 +341,74 @@
140 + }
141 + buffer[result_length]= 0;
142 +}
143++#ifdef __x86_64__
144++typedef uint64 TimeCounter;
145++void add_time_atomic(TimeCounter* counter, uint64 time)
146++{
147++ __sync_fetch_and_add(counter,time);
148++}
149++#endif // __x86_64__
150++#ifdef __i386__
151++inline uint32 get_high(uint64 value)
152++{
153++ return ((value >> 32) << 32);
154++}
155++inline uint32 get_low(uint64 value)
156++{
157++ return ((value << 32) >> 32);
158++}
159++class TimeCounter
160++{
161++public:
162++ TimeCounter& operator=(uint64 time)
163++ {
164++ this->m_high= get_high(time);
165++ this->m_low= get_low(time);
166++ return *this;
167++ }
168++ operator uint64() const
169++ {
170++ return ((static_cast<uint64>(m_high) << 32) + static_cast<uint64>(m_low));
171++ }
172++ void add(uint64 time)
173++ {
174++ uint32 time_high = get_high(time);
175++ uint32 time_low = get_low(time);
176++ uint64 time_low64= time_low;
177++ while(true)
178++ {
179++ uint32 old_low= this->m_low;
180++ uint64 old_low64= old_low;
181++
182++ uint64 new_low64= old_low64 + time_low64;
183++ uint32 new_low= (get_low(new_low64));
184++ bool add_high= (get_high(new_low64) != 0);
185++
186++ if(!__sync_bool_compare_and_swap(&m_low,old_low,new_low))
187++ {
188++ continue;
189++ }
190++ if(add_high)
191++ {
192++ ++time_high;
193++ }
194++ if(time_high > 0)
195++ {
196++ __sync_fetch_and_add(&m_high,time_high);
197++ }
198++ break;
199++ }
200++ }
201++private:
202++ uint32 m_low;
203++ uint32 m_high;
204++};
205++void add_time_atomic(TimeCounter* counter, uint64 time)
206++{
207++ counter->add(time);
208++}
209++#endif // __i386__
210++
211 +class time_collector
212 +{
213 +public:
214@@ -363,15 +431,15 @@
215 + if(m_utility->bound(i) > time)
216 + {
217 + __sync_fetch_and_add(&(m_count[i]),(uint32)1);
218-+ __sync_fetch_and_add(&(m_total[i]),time);
219-+ break;
220++ add_time_atomic(&(m_total[i]),time);
221++ break;
222 + }
223 + }
224 + }
225 +private:
226 + utility* m_utility;
227 + uint32 m_count[OVERALL_POWER_COUNT + 1];
228-+ uint64 m_total[OVERALL_POWER_COUNT + 1];
229++ TimeCounter m_total[OVERALL_POWER_COUNT + 1];
230 +};
231 +
232 +class collector
233@@ -471,8 +539,8 @@
234 + return query_response_time::g_collector.fill(thd,tables,cond);
235 +}
236 diff -ruN a/sql/query_response_time.h b/sql/query_response_time.h
237---- a/sql/query_response_time.h 1970-01-01 00:00:00.000000000 +0000
238-+++ b/sql/query_response_time.h 2010-09-14 20:32:15.000000000 +0000
239+--- a/sql/query_response_time.h 1970-01-01 03:00:00.000000000 +0300
240++++ b/sql/query_response_time.h 2010-10-16 07:29:04.000000000 +0400
241 @@ -0,0 +1,69 @@
242 +#ifndef QUERY_RESPONSE_TIME_H
243 +#define QUERY_RESPONSE_TIME_H
244@@ -544,8 +612,8 @@
245 +
246 +#endif // QUERY_RESPONSE_TIME_H
247 diff -ruN a/sql/set_var.cc b/sql/set_var.cc
248---- a/sql/set_var.cc 2010-09-14 20:27:52.000000000 +0000
249-+++ b/sql/set_var.cc 2010-09-14 20:31:41.000000000 +0000
250+--- a/sql/set_var.cc 2010-10-16 07:28:35.000000000 +0400
251++++ b/sql/set_var.cc 2010-10-16 07:29:04.000000000 +0400
252 @@ -1004,6 +1004,10 @@
253 static sys_var_use_global_long_query_time sys_use_global_long_query_time;
254 static sys_var_bool_ptr sys_slow_query_log_microseconds_timestamp(&vars, "slow_query_log_microseconds_timestamp",
255@@ -558,8 +626,8 @@
256 static sys_var_log_state sys_var_log_slow(&vars, "log_slow_queries",
257 &opt_slow_log, QUERY_LOG_SLOW);
258 diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
259---- a/sql/sql_parse.cc 2010-09-14 20:27:52.000000000 +0000
260-+++ b/sql/sql_parse.cc 2010-09-14 20:31:41.000000000 +0000
261+--- a/sql/sql_parse.cc 2010-10-16 07:28:35.000000000 +0400
262++++ b/sql/sql_parse.cc 2010-10-16 07:29:04.000000000 +0400
263 @@ -27,6 +27,7 @@
264 #include "sp_cache.h"
265 #include "events.h"
266@@ -634,8 +702,8 @@
267 {
268 pthread_mutex_lock(&LOCK_global_user_client_stats);
269 diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
270---- a/sql/sql_show.cc 2010-09-14 20:27:52.000000000 +0000
271-+++ b/sql/sql_show.cc 2010-09-14 20:32:15.000000000 +0000
272+--- a/sql/sql_show.cc 2010-10-16 07:28:32.000000000 +0400
273++++ b/sql/sql_show.cc 2010-10-16 07:29:04.000000000 +0400
274 @@ -31,6 +31,7 @@
275 #include "event_data_objects.h"
276 #endif
277@@ -669,8 +737,8 @@
278 fill_schema_schemata, make_schemata_old_format, 0, 1, -1, 0, 0},
279 {"SCHEMA_PRIVILEGES", schema_privileges_fields_info, create_schema_table,
280 diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy
281---- a/sql/sql_yacc.yy 2010-09-14 20:27:52.000000000 +0000
282-+++ b/sql/sql_yacc.yy 2010-09-14 20:31:41.000000000 +0000
283+--- a/sql/sql_yacc.yy 2010-10-16 07:28:35.000000000 +0400
284++++ b/sql/sql_yacc.yy 2010-10-16 07:29:04.000000000 +0400
285 @@ -1079,6 +1079,7 @@
286 %token PURGE
287 %token QUARTER_SYM
288@@ -711,8 +779,8 @@
289 | READ_ONLY_SYM {}
290 | REBUILD_SYM {}
291 diff -ruN a/sql/table.h b/sql/table.h
292---- a/sql/table.h 2010-09-14 20:27:52.000000000 +0000
293-+++ b/sql/table.h 2010-09-14 20:31:41.000000000 +0000
294+--- a/sql/table.h 2010-10-16 07:28:32.000000000 +0400
295++++ b/sql/table.h 2010-10-16 07:29:04.000000000 +0400
296 @@ -963,6 +963,7 @@
297 SCH_PROFILES,
298 SCH_REFERENTIAL_CONSTRAINTS,

Subscribers

People subscribed via source and target branches

to all changes: