]> git.pld-linux.org Git - packages/mysql.git/blob - mysql-userstatv2.patch
- no patching of configure
[packages/mysql.git] / mysql-userstatv2.patch
1 diff -r 1ac0113deff5 BUILD/Makefile.in
2 --- a/BUILD/Makefile.in Mon Jun 01 00:35:44 2009 -0700
3 +++ b/BUILD/Makefile.in Mon Jun 01 00:36:01 2009 -0700
4 @@ -146,6 +146,7 @@
5  LIBDL = @LIBDL@
6  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
7  LIBOBJS = @LIBOBJS@
8 +LIBRT = @LIBRT@
9  LIBS = @LIBS@
10  LIBTOOL = @LIBTOOL@
11  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
12 diff -r 1ac0113deff5 Docs/Makefile.in
13 --- a/Docs/Makefile.in  Mon Jun 01 00:35:44 2009 -0700
14 +++ b/Docs/Makefile.in  Mon Jun 01 00:36:01 2009 -0700
15 @@ -144,6 +144,7 @@
16  LIBDL = @LIBDL@
17  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
18  LIBOBJS = @LIBOBJS@
19 +LIBRT = @LIBRT@
20  LIBS = @LIBS@
21  LIBTOOL = @LIBTOOL@
22  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
23 diff -r 1ac0113deff5 Makefile.in
24 --- a/Makefile.in       Mon Jun 01 00:35:44 2009 -0700
25 +++ b/Makefile.in       Mon Jun 01 00:36:01 2009 -0700
26 @@ -171,6 +171,7 @@
27  LIBDL = @LIBDL@
28  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
29  LIBOBJS = @LIBOBJS@
30 +LIBRT = @LIBRT@
31  LIBS = @LIBS@
32  LIBTOOL = @LIBTOOL@
33  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
34 diff -r 1ac0113deff5 SSL/Makefile.in
35 --- a/SSL/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
36 +++ b/SSL/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
37 @@ -144,6 +144,7 @@
38  LIBDL = @LIBDL@
39  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
40  LIBOBJS = @LIBOBJS@
41 +LIBRT = @LIBRT@
42  LIBS = @LIBS@
43  LIBTOOL = @LIBTOOL@
44  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
45 diff -r 1ac0113deff5 client/Makefile.in
46 --- a/client/Makefile.in        Mon Jun 01 00:35:44 2009 -0700
47 +++ b/client/Makefile.in        Mon Jun 01 00:36:01 2009 -0700
48 @@ -247,6 +247,7 @@
49  LIBDL = @LIBDL@
50  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
51  LIBOBJS = @LIBOBJS@
52 +LIBRT = @LIBRT@
53  LIBS = @CLIENT_LIBS@
54  LIBTOOL = @LIBTOOL@
55  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
56 diff -r 1ac0113deff5 cmd-line-utils/Makefile.in
57 --- a/cmd-line-utils/Makefile.in        Mon Jun 01 00:35:44 2009 -0700
58 +++ b/cmd-line-utils/Makefile.in        Mon Jun 01 00:36:01 2009 -0700
59 @@ -157,6 +157,7 @@
60  LIBDL = @LIBDL@
61  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
62  LIBOBJS = @LIBOBJS@
63 +LIBRT = @LIBRT@
64  LIBS = @LIBS@
65  LIBTOOL = @LIBTOOL@
66  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
67 diff -r 1ac0113deff5 cmd-line-utils/libedit/Makefile.in
68 --- a/cmd-line-utils/libedit/Makefile.in        Mon Jun 01 00:35:44 2009 -0700
69 +++ b/cmd-line-utils/libedit/Makefile.in        Mon Jun 01 00:36:01 2009 -0700
70 @@ -166,6 +166,7 @@
71  LIBDL = @LIBDL@
72  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
73  LIBOBJS = @LIBOBJS@
74 +LIBRT = @LIBRT@
75  LIBS = @LIBS@
76  LIBTOOL = @LIBTOOL@
77  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
78 diff -r 1ac0113deff5 cmd-line-utils/readline/Makefile.in
79 --- a/cmd-line-utils/readline/Makefile.in       Mon Jun 01 00:35:44 2009 -0700
80 +++ b/cmd-line-utils/readline/Makefile.in       Mon Jun 01 00:36:01 2009 -0700
81 @@ -173,6 +173,7 @@
82  LIBDL = @LIBDL@
83  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
84  LIBOBJS = @LIBOBJS@
85 +LIBRT = @LIBRT@
86  LIBS = @LIBS@
87  LIBTOOL = @LIBTOOL@
88  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
89 diff -r 1ac0113deff5 configure.in
90 --- a/configure.in      Mon Jun 01 00:35:44 2009 -0700
91 +++ b/configure.in      Mon Jun 01 00:36:01 2009 -0700
92 @@ -2122,7 +2122,18 @@
93         # We also disable for SCO for the time being, the headers for the
94         # thread library we use conflicts with other headers.
95      ;;
96 - *) AC_CHECK_FUNCS(clock_gettime)
97 +*) 
98 +   # most systems require the program be linked with librt library to use
99 +   # the function clock_gettime 
100 +   my_save_LIBS="$LIBS"
101 +   LIBS=""
102 +   AC_CHECK_LIB(rt,clock_gettime)
103 +   LIBRT=$LIBS
104 +   LIBS="$my_save_LIBS"
105 +   AC_SUBST(LIBRT)
106 +
107 +   LIBS="$LIBS $LIBRT"
108 +   AC_CHECK_FUNCS(clock_gettime)
109      ;;
110  esac
111  
112 @@ -2758,7 +2769,7 @@
113    AC_DEFINE([THREAD_SAFE_CLIENT], [1], [Should be client be thread safe])
114  fi
115  
116 -CLIENT_LIBS="$NON_THREADED_LIBS $openssl_libs $ZLIB_LIBS $STATIC_NSS_FLAGS"
117 +CLIENT_LIBS="$NON_THREADED_LIBS $openssl_libs $ZLIB_LIBS $STATIC_NSS_FLAGS $LIBRT"
118  
119  AC_SUBST(CLIENT_LIBS)
120  AC_SUBST(NON_THREADED_LIBS)
121 diff -r 1ac0113deff5 dbug/Makefile.in
122 --- a/dbug/Makefile.in  Mon Jun 01 00:35:44 2009 -0700
123 +++ b/dbug/Makefile.in  Mon Jun 01 00:36:01 2009 -0700
124 @@ -192,6 +192,7 @@
125  LIBDL = @LIBDL@
126  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
127  LIBOBJS = @LIBOBJS@
128 +LIBRT = @LIBRT@
129  LIBS = @LIBS@
130  LIBTOOL = @LIBTOOL@
131  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
132 diff -r 1ac0113deff5 extra/Makefile.in
133 --- a/extra/Makefile.in Mon Jun 01 00:35:44 2009 -0700
134 +++ b/extra/Makefile.in Mon Jun 01 00:36:01 2009 -0700
135 @@ -240,6 +240,7 @@
136  LIBDL = @LIBDL@
137  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
138  LIBOBJS = @LIBOBJS@
139 +LIBRT = @LIBRT@
140  LIBS = @LIBS@
141  LIBTOOL = @LIBTOOL@
142  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
143 diff -r 1ac0113deff5 extra/yassl/Makefile.in
144 --- a/extra/yassl/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
145 +++ b/extra/yassl/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
146 @@ -142,6 +142,7 @@
147  LIBDL = @LIBDL@
148  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
149  LIBOBJS = @LIBOBJS@
150 +LIBRT = @LIBRT@
151  LIBS = @LIBS@
152  LIBTOOL = @LIBTOOL@
153  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
154 diff -r 1ac0113deff5 extra/yassl/src/Makefile.in
155 --- a/extra/yassl/src/Makefile.in       Mon Jun 01 00:35:44 2009 -0700
156 +++ b/extra/yassl/src/Makefile.in       Mon Jun 01 00:36:01 2009 -0700
157 @@ -151,6 +151,7 @@
158  LIBDL = @LIBDL@
159  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
160  LIBOBJS = @LIBOBJS@
161 +LIBRT = @LIBRT@
162  LIBS = @LIBS@
163  LIBTOOL = @LIBTOOL@
164  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
165 diff -r 1ac0113deff5 extra/yassl/taocrypt/Makefile.in
166 --- a/extra/yassl/taocrypt/Makefile.in  Mon Jun 01 00:35:44 2009 -0700
167 +++ b/extra/yassl/taocrypt/Makefile.in  Mon Jun 01 00:36:01 2009 -0700
168 @@ -142,6 +142,7 @@
169  LIBDL = @LIBDL@
170  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
171  LIBOBJS = @LIBOBJS@
172 +LIBRT = @LIBRT@
173  LIBS = @LIBS@
174  LIBTOOL = @LIBTOOL@
175  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
176 diff -r 1ac0113deff5 extra/yassl/taocrypt/benchmark/Makefile.in
177 --- a/extra/yassl/taocrypt/benchmark/Makefile.in        Mon Jun 01 00:35:44 2009 -0700
178 +++ b/extra/yassl/taocrypt/benchmark/Makefile.in        Mon Jun 01 00:36:01 2009 -0700
179 @@ -153,6 +153,7 @@
180  LIBDL = @LIBDL@
181  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
182  LIBOBJS = @LIBOBJS@
183 +LIBRT = @LIBRT@
184  LIBS = @LIBS@
185  LIBTOOL = @LIBTOOL@
186  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
187 diff -r 1ac0113deff5 extra/yassl/taocrypt/src/Makefile.in
188 --- a/extra/yassl/taocrypt/src/Makefile.in      Mon Jun 01 00:35:44 2009 -0700
189 +++ b/extra/yassl/taocrypt/src/Makefile.in      Mon Jun 01 00:36:01 2009 -0700
190 @@ -164,6 +164,7 @@
191  LIBDL = @LIBDL@
192  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
193  LIBOBJS = @LIBOBJS@
194 +LIBRT = @LIBRT@
195  LIBS = @LIBS@
196  LIBTOOL = @LIBTOOL@
197  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
198 diff -r 1ac0113deff5 extra/yassl/taocrypt/test/Makefile.in
199 --- a/extra/yassl/taocrypt/test/Makefile.in     Mon Jun 01 00:35:44 2009 -0700
200 +++ b/extra/yassl/taocrypt/test/Makefile.in     Mon Jun 01 00:36:01 2009 -0700
201 @@ -153,6 +153,7 @@
202  LIBDL = @LIBDL@
203  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
204  LIBOBJS = @LIBOBJS@
205 +LIBRT = @LIBRT@
206  LIBS = @LIBS@
207  LIBTOOL = @LIBTOOL@
208  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
209 diff -r 1ac0113deff5 extra/yassl/testsuite/Makefile.in
210 --- a/extra/yassl/testsuite/Makefile.in Mon Jun 01 00:35:44 2009 -0700
211 +++ b/extra/yassl/testsuite/Makefile.in Mon Jun 01 00:36:01 2009 -0700
212 @@ -156,6 +156,7 @@
213  LIBDL = @LIBDL@
214  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
215  LIBOBJS = @LIBOBJS@
216 +LIBRT = @LIBRT@
217  LIBS = @LIBS@
218  LIBTOOL = @LIBTOOL@
219  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
220 diff -r 1ac0113deff5 heap/Makefile.in
221 --- a/heap/Makefile.in  Mon Jun 01 00:35:44 2009 -0700
222 +++ b/heap/Makefile.in  Mon Jun 01 00:36:01 2009 -0700
223 @@ -202,6 +202,7 @@
224  LIBDL = @LIBDL@
225  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
226  LIBOBJS = @LIBOBJS@
227 +LIBRT = @LIBRT@
228  LIBS = @LIBS@
229  LIBTOOL = @LIBTOOL@
230  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
231 diff -r 1ac0113deff5 include/Makefile.in
232 --- a/include/Makefile.in       Mon Jun 01 00:35:44 2009 -0700
233 +++ b/include/Makefile.in       Mon Jun 01 00:36:01 2009 -0700
234 @@ -160,6 +160,7 @@
235  LIBDL = @LIBDL@
236  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
237  LIBOBJS = @LIBOBJS@
238 +LIBRT = @LIBRT@
239  LIBS = @LIBS@
240  LIBTOOL = @LIBTOOL@
241  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
242 diff -r 1ac0113deff5 include/mysql_com.h
243 --- a/include/mysql_com.h       Mon Jun 01 00:35:44 2009 -0700
244 +++ b/include/mysql_com.h       Mon Jun 01 00:36:01 2009 -0700
245 @@ -106,6 +106,11 @@
246                                            thread */
247  #define REFRESH_MASTER          128     /* Remove all bin logs in the index
248                                            and truncate the index */
249 +#define REFRESH_TABLE_STATS     256     /* Refresh table stats hash table */
250 +#define REFRESH_INDEX_STATS     512     /* Refresh index stats hash table */
251 +#define REFRESH_USER_STATS      1024    /* Refresh user stats hash table */
252 +#define REFRESH_SLOW_QUERY_LOG  4096    /* Flush slow query log and rotate*/
253 +#define REFRESH_CLIENT_STATS    8192    /* Refresh client stats hash table */
254  
255  /* The following can't be set with mysql_refresh() */
256  #define REFRESH_READ_LOCK      16384   /* Lock tables for read */
257 diff -r 1ac0113deff5 libmysql/Makefile.in
258 --- a/libmysql/Makefile.in      Mon Jun 01 00:35:44 2009 -0700
259 +++ b/libmysql/Makefile.in      Mon Jun 01 00:36:01 2009 -0700
260 @@ -224,6 +224,7 @@
261  LIBDL = @LIBDL@
262  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
263  LIBOBJS = @LIBOBJS@
264 +LIBRT = @LIBRT@
265  LIBS = @CLIENT_LIBS@ 
266  LIBTOOL = @LIBTOOL@
267  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
268 diff -r 1ac0113deff5 libmysql_r/Makefile.in
269 --- a/libmysql_r/Makefile.in    Mon Jun 01 00:35:44 2009 -0700
270 +++ b/libmysql_r/Makefile.in    Mon Jun 01 00:36:01 2009 -0700
271 @@ -221,6 +221,7 @@
272  LIBDL = @LIBDL@
273  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
274  LIBOBJS = @LIBOBJS@
275 +LIBRT = @LIBRT@
276  LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@
277  LIBTOOL = @LIBTOOL@
278  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
279 diff -r 1ac0113deff5 libmysqld/Makefile.in
280 --- a/libmysqld/Makefile.in     Mon Jun 01 00:35:44 2009 -0700
281 +++ b/libmysqld/Makefile.in     Mon Jun 01 00:36:01 2009 -0700
282 @@ -246,6 +246,7 @@
283  LIBDL = @LIBDL@
284  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
285  LIBOBJS = @LIBOBJS@
286 +LIBRT = @LIBRT@
287  LIBS = @LIBS@
288  LIBTOOL = @LIBTOOL@
289  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
290 diff -r 1ac0113deff5 libmysqld/examples/Makefile.in
291 --- a/libmysqld/examples/Makefile.in    Mon Jun 01 00:35:44 2009 -0700
292 +++ b/libmysqld/examples/Makefile.in    Mon Jun 01 00:36:01 2009 -0700
293 @@ -192,6 +192,7 @@
294  LIBDL = @LIBDL@
295  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
296  LIBOBJS = @LIBOBJS@
297 +LIBRT = @LIBRT@
298  LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ $(yassl_libs)
299  LIBTOOL = @LIBTOOL@
300  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
301 diff -r 1ac0113deff5 man/Makefile.in
302 --- a/man/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
303 +++ b/man/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
304 @@ -151,6 +151,7 @@
305  LIBDL = @LIBDL@
306  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
307  LIBOBJS = @LIBOBJS@
308 +LIBRT = @LIBRT@
309  LIBS = @LIBS@
310  LIBTOOL = @LIBTOOL@
311  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
312 diff -r 1ac0113deff5 myisam/Makefile.in
313 --- a/myisam/Makefile.in        Mon Jun 01 00:35:44 2009 -0700
314 +++ b/myisam/Makefile.in        Mon Jun 01 00:36:01 2009 -0700
315 @@ -235,6 +235,7 @@
316  LIBDL = @LIBDL@
317  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
318  LIBOBJS = @LIBOBJS@
319 +LIBRT = @LIBRT@
320  LIBS = @LIBS@
321  LIBTOOL = @LIBTOOL@
322  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
323 diff -r 1ac0113deff5 myisammrg/Makefile.in
324 --- a/myisammrg/Makefile.in     Mon Jun 01 00:35:44 2009 -0700
325 +++ b/myisammrg/Makefile.in     Mon Jun 01 00:36:01 2009 -0700
326 @@ -183,6 +183,7 @@
327  LIBDL = @LIBDL@
328  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
329  LIBOBJS = @LIBOBJS@
330 +LIBRT = @LIBRT@
331  LIBS = @LIBS@
332  LIBTOOL = @LIBTOOL@
333  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
334 diff -r 1ac0113deff5 mysql-test/Makefile.in
335 --- a/mysql-test/Makefile.in    Mon Jun 01 00:35:44 2009 -0700
336 +++ b/mysql-test/Makefile.in    Mon Jun 01 00:36:01 2009 -0700
337 @@ -161,6 +161,7 @@
338  LIBDL = @LIBDL@
339  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
340  LIBOBJS = @LIBOBJS@
341 +LIBRT = @LIBRT@
342  LIBS = @LIBS@
343  LIBTOOL = @LIBTOOL@
344  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
345 diff -r 1ac0113deff5 mysql-test/ndb/Makefile.in
346 --- a/mysql-test/ndb/Makefile.in        Mon Jun 01 00:35:44 2009 -0700
347 +++ b/mysql-test/ndb/Makefile.in        Mon Jun 01 00:36:01 2009 -0700
348 @@ -147,6 +147,7 @@
349  LIBDL = @LIBDL@
350  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
351  LIBOBJS = @LIBOBJS@
352 +LIBRT = @LIBRT@
353  LIBS = @LIBS@
354  LIBTOOL = @LIBTOOL@
355  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
356 diff -r 1ac0113deff5 mysql-test/r/information_schema.result
357 --- a/mysql-test/r/information_schema.result    Mon Jun 01 00:35:44 2009 -0700
358 +++ b/mysql-test/r/information_schema.result    Mon Jun 01 00:36:01 2009 -0700
359 @@ -37,10 +37,12 @@
360  select * from v1;
361  c
362  CHARACTER_SETS
363 +CLIENT_STATISTICS
364  COLLATIONS
365  COLLATION_CHARACTER_SET_APPLICABILITY
366  COLUMNS
367  COLUMN_PRIVILEGES
368 +INDEX_STATISTICS
369  KEY_COLUMN_USAGE
370  PROFILING
371  ROUTINES
372 @@ -50,8 +52,10 @@
373  TABLES
374  TABLE_CONSTRAINTS
375  TABLE_PRIVILEGES
376 +TABLE_STATISTICS
377  TRIGGERS
378  USER_PRIVILEGES
379 +USER_STATISTICS
380  VIEWS
381  columns_priv
382  db
383 @@ -83,6 +87,7 @@
384  TABLES TABLES
385  TABLE_CONSTRAINTS      TABLE_CONSTRAINTS
386  TABLE_PRIVILEGES       TABLE_PRIVILEGES
387 +TABLE_STATISTICS       TABLE_STATISTICS
388  TRIGGERS       TRIGGERS
389  tables_priv    tables_priv
390  time_zone      time_zone
391 @@ -102,6 +107,7 @@
392  TABLES TABLES
393  TABLE_CONSTRAINTS      TABLE_CONSTRAINTS
394  TABLE_PRIVILEGES       TABLE_PRIVILEGES
395 +TABLE_STATISTICS       TABLE_STATISTICS
396  TRIGGERS       TRIGGERS
397  tables_priv    tables_priv
398  time_zone      time_zone
399 @@ -121,6 +127,7 @@
400  TABLES TABLES
401  TABLE_CONSTRAINTS      TABLE_CONSTRAINTS
402  TABLE_PRIVILEGES       TABLE_PRIVILEGES
403 +TABLE_STATISTICS       TABLE_STATISTICS
404  TRIGGERS       TRIGGERS
405  tables_priv    tables_priv
406  time_zone      time_zone
407 @@ -594,12 +601,13 @@
408  where table_schema='information_schema' limit 2;
409  TABLE_NAME     TABLE_TYPE      ENGINE
410  CHARACTER_SETS SYSTEM VIEW     MEMORY
411 -COLLATIONS     SYSTEM VIEW     MEMORY
412 +CLIENT_STATISTICS      SYSTEM VIEW     MEMORY
413  show tables from information_schema like "T%";
414  Tables_in_information_schema (T%)
415  TABLES
416  TABLE_CONSTRAINTS
417  TABLE_PRIVILEGES
418 +TABLE_STATISTICS
419  TRIGGERS
420  create database information_schema;
421  ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
422 @@ -609,6 +617,7 @@
423  TABLES SYSTEM VIEW
424  TABLE_CONSTRAINTS      SYSTEM VIEW
425  TABLE_PRIVILEGES       SYSTEM VIEW
426 +TABLE_STATISTICS       SYSTEM VIEW
427  TRIGGERS       SYSTEM VIEW
428  create table t1(a int);
429  ERROR 42S02: Unknown table 't1' in information_schema
430 @@ -621,6 +630,7 @@
431  TABLES
432  TABLE_CONSTRAINTS
433  TABLE_PRIVILEGES
434 +TABLE_STATISTICS
435  TRIGGERS
436  select table_name from tables where table_name='user';
437  table_name
438 @@ -730,7 +740,7 @@
439  CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1;
440  CREATE VIEW a2 AS SELECT t_CRASHME FROM a1;
441  count(*)
442 -102
443 +106
444  drop view a2, a1;
445  drop table t_crashme;
446  select table_schema,table_name, column_name from
447 @@ -790,18 +800,20 @@
448  TABLE_NAME     COLUMN_NAME     PRIVILEGES
449  COLUMNS        TABLE_NAME      select
450  COLUMN_PRIVILEGES      TABLE_NAME      select
451 +INDEX_STATISTICS       TABLE_NAME      select
452  KEY_COLUMN_USAGE       TABLE_NAME      select
453  STATISTICS     TABLE_NAME      select
454  TABLES TABLE_NAME      select
455  TABLE_CONSTRAINTS      TABLE_NAME      select
456  TABLE_PRIVILEGES       TABLE_NAME      select
457 +TABLE_STATISTICS       TABLE_NAME      select
458  VIEWS  TABLE_NAME      select
459  delete from mysql.user where user='mysqltest_4';
460  delete from mysql.db where user='mysqltest_4';
461  flush privileges;
462  SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
463  table_schema   count(*)
464 -information_schema     17
465 +information_schema     21
466  mysql  17
467  create table t1 (i int, j int);
468  create trigger trg1 before insert on t1 for each row
469 @@ -1187,10 +1199,12 @@
470          );
471  table_name     column_name
472  CHARACTER_SETS CHARACTER_SET_NAME
473 +CLIENT_STATISTICS      CLIENT
474  COLLATIONS     COLLATION_NAME
475  COLLATION_CHARACTER_SET_APPLICABILITY  COLLATION_NAME
476  COLUMNS        TABLE_SCHEMA
477  COLUMN_PRIVILEGES      TABLE_SCHEMA
478 +INDEX_STATISTICS       TABLE_SCHEMA
479  KEY_COLUMN_USAGE       CONSTRAINT_SCHEMA
480  PROFILING      QUERY_ID
481  ROUTINES       ROUTINE_SCHEMA
482 @@ -1200,8 +1214,10 @@
483  TABLES TABLE_SCHEMA
484  TABLE_CONSTRAINTS      CONSTRAINT_SCHEMA
485  TABLE_PRIVILEGES       TABLE_SCHEMA
486 +TABLE_STATISTICS       TABLE_SCHEMA
487  TRIGGERS       TRIGGER_SCHEMA
488  USER_PRIVILEGES        GRANTEE
489 +USER_STATISTICS        USER
490  VIEWS  TABLE_SCHEMA
491  SELECT t.table_name, c1.column_name
492  FROM information_schema.tables t
493 @@ -1219,10 +1235,12 @@
494          );
495  table_name     column_name
496  CHARACTER_SETS CHARACTER_SET_NAME
497 +CLIENT_STATISTICS      CLIENT
498  COLLATIONS     COLLATION_NAME
499  COLLATION_CHARACTER_SET_APPLICABILITY  COLLATION_NAME
500  COLUMNS        TABLE_SCHEMA
501  COLUMN_PRIVILEGES      TABLE_SCHEMA
502 +INDEX_STATISTICS       TABLE_SCHEMA
503  KEY_COLUMN_USAGE       CONSTRAINT_SCHEMA
504  PROFILING      QUERY_ID
505  ROUTINES       ROUTINE_SCHEMA
506 @@ -1232,8 +1250,10 @@
507  TABLES TABLE_SCHEMA
508  TABLE_CONSTRAINTS      CONSTRAINT_SCHEMA
509  TABLE_PRIVILEGES       TABLE_SCHEMA
510 +TABLE_STATISTICS       TABLE_SCHEMA
511  TRIGGERS       TRIGGER_SCHEMA
512  USER_PRIVILEGES        GRANTEE
513 +USER_STATISTICS        USER
514  VIEWS  TABLE_SCHEMA
515  SELECT MAX(table_name) FROM information_schema.tables;
516  MAX(table_name)
517 @@ -1302,10 +1322,12 @@
518  group by t.table_name order by num1, t.table_name;
519  table_name     group_concat(t.table_schema, '.', t.table_name) num1
520  CHARACTER_SETS information_schema.CHARACTER_SETS       1
521 +CLIENT_STATISTICS      information_schema.CLIENT_STATISTICS    1
522  COLLATIONS     information_schema.COLLATIONS   1
523  COLLATION_CHARACTER_SET_APPLICABILITY  information_schema.COLLATION_CHARACTER_SET_APPLICABILITY        1
524  COLUMNS        information_schema.COLUMNS      1
525  COLUMN_PRIVILEGES      information_schema.COLUMN_PRIVILEGES    1
526 +INDEX_STATISTICS       information_schema.INDEX_STATISTICS     1
527  KEY_COLUMN_USAGE       information_schema.KEY_COLUMN_USAGE     1
528  PROFILING      information_schema.PROFILING    1
529  ROUTINES       information_schema.ROUTINES     1
530 @@ -1315,8 +1337,10 @@
531  TABLES information_schema.TABLES       1
532  TABLE_CONSTRAINTS      information_schema.TABLE_CONSTRAINTS    1
533  TABLE_PRIVILEGES       information_schema.TABLE_PRIVILEGES     1
534 +TABLE_STATISTICS       information_schema.TABLE_STATISTICS     1
535  TRIGGERS       information_schema.TRIGGERS     1
536  USER_PRIVILEGES        information_schema.USER_PRIVILEGES      1
537 +USER_STATISTICS        information_schema.USER_STATISTICS      1
538  VIEWS  information_schema.VIEWS        1
539  show global status like "Uptime_%";
540  Variable_name  Value
541 diff -r 1ac0113deff5 mysql-test/r/information_schema_db.result
542 --- a/mysql-test/r/information_schema_db.result Mon Jun 01 00:35:44 2009 -0700
543 +++ b/mysql-test/r/information_schema_db.result Mon Jun 01 00:36:01 2009 -0700
544 @@ -6,10 +6,12 @@
545  show tables;
546  Tables_in_information_schema
547  CHARACTER_SETS
548 +CLIENT_STATISTICS
549  COLLATIONS
550  COLLATION_CHARACTER_SET_APPLICABILITY
551  COLUMNS
552  COLUMN_PRIVILEGES
553 +INDEX_STATISTICS
554  KEY_COLUMN_USAGE
555  PROFILING
556  ROUTINES
557 @@ -19,14 +21,17 @@
558  TABLES
559  TABLE_CONSTRAINTS
560  TABLE_PRIVILEGES
561 +TABLE_STATISTICS
562  TRIGGERS
563  USER_PRIVILEGES
564 +USER_STATISTICS
565  VIEWS
566  show tables from INFORMATION_SCHEMA like 'T%';
567  Tables_in_information_schema (T%)
568  TABLES
569  TABLE_CONSTRAINTS
570  TABLE_PRIVILEGES
571 +TABLE_STATISTICS
572  TRIGGERS
573  create database `inf%`;
574  create database mbase;
575 diff -r 1ac0113deff5 mysql-test/r/mysqlshow.result
576 --- a/mysql-test/r/mysqlshow.result     Mon Jun 01 00:35:44 2009 -0700
577 +++ b/mysql-test/r/mysqlshow.result     Mon Jun 01 00:36:01 2009 -0700
578 @@ -80,10 +80,12 @@
579  |                Tables                 |
580  +---------------------------------------+
581  | CHARACTER_SETS                        |
582 +| CLIENT_STATISTICS                     |
583  | COLLATIONS                            |
584  | COLLATION_CHARACTER_SET_APPLICABILITY |
585  | COLUMNS                               |
586  | COLUMN_PRIVILEGES                     |
587 +| INDEX_STATISTICS                      |
588  | KEY_COLUMN_USAGE                      |
589  | PROFILING                             |
590  | ROUTINES                              |
591 @@ -93,8 +95,10 @@
592  | TABLES                                |
593  | TABLE_CONSTRAINTS                     |
594  | TABLE_PRIVILEGES                      |
595 +| TABLE_STATISTICS                      |
596  | TRIGGERS                              |
597  | USER_PRIVILEGES                       |
598 +| USER_STATISTICS                       |
599  | VIEWS                                 |
600  +---------------------------------------+
601  Database: INFORMATION_SCHEMA
602 @@ -102,10 +106,12 @@
603  |                Tables                 |
604  +---------------------------------------+
605  | CHARACTER_SETS                        |
606 +| CLIENT_STATISTICS                     |
607  | COLLATIONS                            |
608  | COLLATION_CHARACTER_SET_APPLICABILITY |
609  | COLUMNS                               |
610  | COLUMN_PRIVILEGES                     |
611 +| INDEX_STATISTICS                      |
612  | KEY_COLUMN_USAGE                      |
613  | PROFILING                             |
614  | ROUTINES                              |
615 @@ -115,8 +121,10 @@
616  | TABLES                                |
617  | TABLE_CONSTRAINTS                     |
618  | TABLE_PRIVILEGES                      |
619 +| TABLE_STATISTICS                      |
620  | TRIGGERS                              |
621  | USER_PRIVILEGES                       |
622 +| USER_STATISTICS                       |
623  | VIEWS                                 |
624  +---------------------------------------+
625  Wildcard: inf_rmation_schema
626 diff -r 1ac0113deff5 mysys/Makefile.in
627 --- a/mysys/Makefile.in Mon Jun 01 00:35:44 2009 -0700
628 +++ b/mysys/Makefile.in Mon Jun 01 00:36:01 2009 -0700
629 @@ -228,6 +228,7 @@
630  LIBDL = @LIBDL@
631  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
632  LIBOBJS = @LIBOBJS@
633 +LIBRT = @LIBRT@
634  LIBS = @LIBS@
635  LIBTOOL = @LIBTOOL@
636  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
637 diff -r 1ac0113deff5 ndb/Makefile.in
638 --- a/ndb/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
639 +++ b/ndb/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
640 @@ -171,6 +171,7 @@
641  LIBDL = @LIBDL@
642  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
643  LIBOBJS = @LIBOBJS@
644 +LIBRT = @LIBRT@
645  LIBS = @LIBS@
646  LIBTOOL = @LIBTOOL@
647  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
648 diff -r 1ac0113deff5 ndb/docs/Makefile.in
649 --- a/ndb/docs/Makefile.in      Mon Jun 01 00:35:44 2009 -0700
650 +++ b/ndb/docs/Makefile.in      Mon Jun 01 00:36:01 2009 -0700
651 @@ -149,6 +149,7 @@
652  LIBDL = @LIBDL@
653  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
654  LIBOBJS = @LIBOBJS@
655 +LIBRT = @LIBRT@
656  LIBS = @LIBS@
657  LIBTOOL = @LIBTOOL@
658  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
659 diff -r 1ac0113deff5 ndb/include/Makefile.in
660 --- a/ndb/include/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
661 +++ b/ndb/include/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
662 @@ -179,6 +179,7 @@
663  LIBDL = @LIBDL@
664  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
665  LIBOBJS = @LIBOBJS@
666 +LIBRT = @LIBRT@
667  LIBS = @LIBS@
668  LIBTOOL = @LIBTOOL@
669  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
670 diff -r 1ac0113deff5 ndb/src/Makefile.in
671 --- a/ndb/src/Makefile.in       Mon Jun 01 00:35:44 2009 -0700
672 +++ b/ndb/src/Makefile.in       Mon Jun 01 00:36:01 2009 -0700
673 @@ -204,6 +204,7 @@
674  LIBDL = @LIBDL@
675  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
676  LIBOBJS = @LIBOBJS@
677 +LIBRT = @LIBRT@
678  LIBS = @LIBS@
679  LIBTOOL = @LIBTOOL@
680  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
681 diff -r 1ac0113deff5 ndb/src/common/Makefile.in
682 --- a/ndb/src/common/Makefile.in        Mon Jun 01 00:35:44 2009 -0700
683 +++ b/ndb/src/common/Makefile.in        Mon Jun 01 00:36:01 2009 -0700
684 @@ -174,6 +174,7 @@
685  LIBDL = @LIBDL@
686  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
687  LIBOBJS = @LIBOBJS@
688 +LIBRT = @LIBRT@
689  LIBS = @LIBS@
690  LIBTOOL = @LIBTOOL@
691  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
692 diff -r 1ac0113deff5 ndb/src/common/debugger/Makefile.in
693 --- a/ndb/src/common/debugger/Makefile.in       Mon Jun 01 00:35:44 2009 -0700
694 +++ b/ndb/src/common/debugger/Makefile.in       Mon Jun 01 00:36:01 2009 -0700
695 @@ -206,6 +206,7 @@
696  LIBDL = @LIBDL@
697  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
698  LIBOBJS = @LIBOBJS@
699 +LIBRT = @LIBRT@
700  LIBS = @LIBS@
701  LIBTOOL = @LIBTOOL@
702  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
703 diff -r 1ac0113deff5 ndb/src/common/debugger/signaldata/Makefile.in
704 --- a/ndb/src/common/debugger/signaldata/Makefile.in    Mon Jun 01 00:35:44 2009 -0700
705 +++ b/ndb/src/common/debugger/signaldata/Makefile.in    Mon Jun 01 00:36:01 2009 -0700
706 @@ -211,6 +211,7 @@
707  LIBDL = @LIBDL@
708  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
709  LIBOBJS = @LIBOBJS@
710 +LIBRT = @LIBRT@
711  LIBS = @LIBS@
712  LIBTOOL = @LIBTOOL@
713  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
714 diff -r 1ac0113deff5 ndb/src/common/logger/Makefile.in
715 --- a/ndb/src/common/logger/Makefile.in Mon Jun 01 00:35:44 2009 -0700
716 +++ b/ndb/src/common/logger/Makefile.in Mon Jun 01 00:36:01 2009 -0700
717 @@ -197,6 +197,7 @@
718  LIBDL = @LIBDL@
719  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
720  LIBOBJS = @LIBOBJS@
721 +LIBRT = @LIBRT@
722  LIBS = @LIBS@
723  LIBTOOL = @LIBTOOL@
724  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
725 diff -r 1ac0113deff5 ndb/src/common/mgmcommon/Makefile.in
726 --- a/ndb/src/common/mgmcommon/Makefile.in      Mon Jun 01 00:35:44 2009 -0700
727 +++ b/ndb/src/common/mgmcommon/Makefile.in      Mon Jun 01 00:36:01 2009 -0700
728 @@ -211,6 +211,7 @@
729  LIBDL = @LIBDL@
730  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
731  LIBOBJS = @LIBOBJS@
732 +LIBRT = @LIBRT@
733  LIBS = @LIBS@
734  LIBTOOL = @LIBTOOL@
735  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
736 diff -r 1ac0113deff5 ndb/src/common/portlib/Makefile.in
737 --- a/ndb/src/common/portlib/Makefile.in        Mon Jun 01 00:35:44 2009 -0700
738 +++ b/ndb/src/common/portlib/Makefile.in        Mon Jun 01 00:36:01 2009 -0700
739 @@ -222,6 +222,7 @@
740  LIBDL = @LIBDL@
741  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
742  LIBOBJS = @LIBOBJS@
743 +LIBRT = @LIBRT@
744  LIBS = @LIBS@
745  LIBTOOL = @LIBTOOL@
746  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
747 diff -r 1ac0113deff5 ndb/src/common/transporter/Makefile.in
748 --- a/ndb/src/common/transporter/Makefile.in    Mon Jun 01 00:35:44 2009 -0700
749 +++ b/ndb/src/common/transporter/Makefile.in    Mon Jun 01 00:36:01 2009 -0700
750 @@ -197,6 +197,7 @@
751  LIBDL = @LIBDL@
752  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
753  LIBOBJS = @LIBOBJS@
754 +LIBRT = @LIBRT@
755  LIBS = @LIBS@
756  LIBTOOL = @LIBTOOL@
757  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
758 diff -r 1ac0113deff5 ndb/src/common/util/Makefile.in
759 --- a/ndb/src/common/util/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
760 +++ b/ndb/src/common/util/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
761 @@ -217,6 +217,7 @@
762  LIBDL = @LIBDL@
763  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
764  LIBOBJS = @LIBOBJS@
765 +LIBRT = @LIBRT@
766  LIBS = @LIBS@
767  LIBTOOL = @LIBTOOL@
768  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
769 diff -r 1ac0113deff5 ndb/src/cw/Makefile.in
770 --- a/ndb/src/cw/Makefile.in    Mon Jun 01 00:35:44 2009 -0700
771 +++ b/ndb/src/cw/Makefile.in    Mon Jun 01 00:36:01 2009 -0700
772 @@ -156,6 +156,7 @@
773  LIBDL = @LIBDL@
774  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
775  LIBOBJS = @LIBOBJS@
776 +LIBRT = @LIBRT@
777  LIBS = @LIBS@
778  LIBTOOL = @LIBTOOL@
779  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
780 diff -r 1ac0113deff5 ndb/src/cw/cpcd/Makefile.in
781 --- a/ndb/src/cw/cpcd/Makefile.in       Mon Jun 01 00:35:44 2009 -0700
782 +++ b/ndb/src/cw/cpcd/Makefile.in       Mon Jun 01 00:36:01 2009 -0700
783 @@ -207,6 +207,7 @@
784  LIBDL = @LIBDL@
785  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
786  LIBOBJS = @LIBOBJS@
787 +LIBRT = @LIBRT@
788  LIBS = @LIBS@
789  LIBTOOL = @LIBTOOL@
790  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
791 diff -r 1ac0113deff5 ndb/src/kernel/Makefile.in
792 --- a/ndb/src/kernel/Makefile.in        Mon Jun 01 00:35:44 2009 -0700
793 +++ b/ndb/src/kernel/Makefile.in        Mon Jun 01 00:36:01 2009 -0700
794 @@ -227,6 +227,7 @@
795  LIBDL = @LIBDL@
796  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
797  LIBOBJS = @LIBOBJS@
798 +LIBRT = @LIBRT@
799  LIBS = @LIBS@
800  LIBTOOL = @LIBTOOL@
801  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
802 diff -r 1ac0113deff5 ndb/src/kernel/blocks/Makefile.in
803 --- a/ndb/src/kernel/blocks/Makefile.in Mon Jun 01 00:35:44 2009 -0700
804 +++ b/ndb/src/kernel/blocks/Makefile.in Mon Jun 01 00:36:01 2009 -0700
805 @@ -156,6 +156,7 @@
806  LIBDL = @LIBDL@
807  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
808  LIBOBJS = @LIBOBJS@
809 +LIBRT = @LIBRT@
810  LIBS = @LIBS@
811  LIBTOOL = @LIBTOOL@
812  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
813 diff -r 1ac0113deff5 ndb/src/kernel/blocks/backup/Makefile.in
814 --- a/ndb/src/kernel/blocks/backup/Makefile.in  Mon Jun 01 00:35:44 2009 -0700
815 +++ b/ndb/src/kernel/blocks/backup/Makefile.in  Mon Jun 01 00:36:01 2009 -0700
816 @@ -196,6 +196,7 @@
817  LIBDL = @LIBDL@
818  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
819  LIBOBJS = @LIBOBJS@
820 +LIBRT = @LIBRT@
821  LIBS = @LIBS@
822  LIBTOOL = @LIBTOOL@
823  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
824 diff -r 1ac0113deff5 ndb/src/kernel/blocks/cmvmi/Makefile.in
825 --- a/ndb/src/kernel/blocks/cmvmi/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
826 +++ b/ndb/src/kernel/blocks/cmvmi/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
827 @@ -196,6 +196,7 @@
828  LIBDL = @LIBDL@
829  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
830  LIBOBJS = @LIBOBJS@
831 +LIBRT = @LIBRT@
832  LIBS = @LIBS@
833  LIBTOOL = @LIBTOOL@
834  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
835 diff -r 1ac0113deff5 ndb/src/kernel/blocks/dbacc/Makefile.in
836 --- a/ndb/src/kernel/blocks/dbacc/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
837 +++ b/ndb/src/kernel/blocks/dbacc/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
838 @@ -196,6 +196,7 @@
839  LIBDL = @LIBDL@
840  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
841  LIBOBJS = @LIBOBJS@
842 +LIBRT = @LIBRT@
843  LIBS = @LIBS@
844  LIBTOOL = @LIBTOOL@
845  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
846 diff -r 1ac0113deff5 ndb/src/kernel/blocks/dbdict/Makefile.in
847 --- a/ndb/src/kernel/blocks/dbdict/Makefile.in  Mon Jun 01 00:35:44 2009 -0700
848 +++ b/ndb/src/kernel/blocks/dbdict/Makefile.in  Mon Jun 01 00:36:01 2009 -0700
849 @@ -206,6 +206,7 @@
850  LIBDL = @LIBDL@
851  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
852  LIBOBJS = @LIBOBJS@
853 +LIBRT = @LIBRT@
854  LIBS = @LIBS@
855  LIBTOOL = @LIBTOOL@
856  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
857 diff -r 1ac0113deff5 ndb/src/kernel/blocks/dbdih/Makefile.in
858 --- a/ndb/src/kernel/blocks/dbdih/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
859 +++ b/ndb/src/kernel/blocks/dbdih/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
860 @@ -203,6 +203,7 @@
861  LIBDL = @LIBDL@
862  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
863  LIBOBJS = @LIBOBJS@
864 +LIBRT = @LIBRT@
865  LIBS = @LIBS@
866  LIBTOOL = @LIBTOOL@
867  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
868 diff -r 1ac0113deff5 ndb/src/kernel/blocks/dblqh/Makefile.in
869 --- a/ndb/src/kernel/blocks/dblqh/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
870 +++ b/ndb/src/kernel/blocks/dblqh/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
871 @@ -204,6 +204,7 @@
872  LIBDL = @LIBDL@
873  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
874  LIBOBJS = @LIBOBJS@
875 +LIBRT = @LIBRT@
876  LIBS = @LIBS@
877  LIBTOOL = @LIBTOOL@
878  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
879 diff -r 1ac0113deff5 ndb/src/kernel/blocks/dbtc/Makefile.in
880 --- a/ndb/src/kernel/blocks/dbtc/Makefile.in    Mon Jun 01 00:35:44 2009 -0700
881 +++ b/ndb/src/kernel/blocks/dbtc/Makefile.in    Mon Jun 01 00:36:01 2009 -0700
882 @@ -196,6 +196,7 @@
883  LIBDL = @LIBDL@
884  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
885  LIBOBJS = @LIBOBJS@
886 +LIBRT = @LIBRT@
887  LIBS = @LIBS@
888  LIBTOOL = @LIBTOOL@
889  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
890 diff -r 1ac0113deff5 ndb/src/kernel/blocks/dbtup/Makefile.in
891 --- a/ndb/src/kernel/blocks/dbtup/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
892 +++ b/ndb/src/kernel/blocks/dbtup/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
893 @@ -204,6 +204,7 @@
894  LIBDL = @LIBDL@
895  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
896  LIBOBJS = @LIBOBJS@
897 +LIBRT = @LIBRT@
898  LIBS = @LIBS@
899  LIBTOOL = @LIBTOOL@
900  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
901 diff -r 1ac0113deff5 ndb/src/kernel/blocks/dbtux/Makefile.in
902 --- a/ndb/src/kernel/blocks/dbtux/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
903 +++ b/ndb/src/kernel/blocks/dbtux/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
904 @@ -199,6 +199,7 @@
905  LIBDL = @LIBDL@
906  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
907  LIBOBJS = @LIBOBJS@
908 +LIBRT = @LIBRT@
909  LIBS = @LIBS@
910  LIBTOOL = @LIBTOOL@
911  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
912 diff -r 1ac0113deff5 ndb/src/kernel/blocks/dbutil/Makefile.in
913 --- a/ndb/src/kernel/blocks/dbutil/Makefile.in  Mon Jun 01 00:35:44 2009 -0700
914 +++ b/ndb/src/kernel/blocks/dbutil/Makefile.in  Mon Jun 01 00:36:01 2009 -0700
915 @@ -196,6 +196,7 @@
916  LIBDL = @LIBDL@
917  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
918  LIBOBJS = @LIBOBJS@
919 +LIBRT = @LIBRT@
920  LIBS = @LIBS@
921  LIBTOOL = @LIBTOOL@
922  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
923 diff -r 1ac0113deff5 ndb/src/kernel/blocks/ndbcntr/Makefile.in
924 --- a/ndb/src/kernel/blocks/ndbcntr/Makefile.in Mon Jun 01 00:35:44 2009 -0700
925 +++ b/ndb/src/kernel/blocks/ndbcntr/Makefile.in Mon Jun 01 00:36:01 2009 -0700
926 @@ -197,6 +197,7 @@
927  LIBDL = @LIBDL@
928  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
929  LIBOBJS = @LIBOBJS@
930 +LIBRT = @LIBRT@
931  LIBS = @LIBS@
932  LIBTOOL = @LIBTOOL@
933  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
934 diff -r 1ac0113deff5 ndb/src/kernel/blocks/ndbfs/Makefile.in
935 --- a/ndb/src/kernel/blocks/ndbfs/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
936 +++ b/ndb/src/kernel/blocks/ndbfs/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
937 @@ -197,6 +197,7 @@
938  LIBDL = @LIBDL@
939  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
940  LIBOBJS = @LIBOBJS@
941 +LIBRT = @LIBRT@
942  LIBS = @LIBS@
943  LIBTOOL = @LIBTOOL@
944  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
945 diff -r 1ac0113deff5 ndb/src/kernel/blocks/qmgr/Makefile.in
946 --- a/ndb/src/kernel/blocks/qmgr/Makefile.in    Mon Jun 01 00:35:44 2009 -0700
947 +++ b/ndb/src/kernel/blocks/qmgr/Makefile.in    Mon Jun 01 00:36:01 2009 -0700
948 @@ -196,6 +196,7 @@
949  LIBDL = @LIBDL@
950  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
951  LIBOBJS = @LIBOBJS@
952 +LIBRT = @LIBRT@
953  LIBS = @LIBS@
954  LIBTOOL = @LIBTOOL@
955  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
956 diff -r 1ac0113deff5 ndb/src/kernel/blocks/suma/Makefile.in
957 --- a/ndb/src/kernel/blocks/suma/Makefile.in    Mon Jun 01 00:35:44 2009 -0700
958 +++ b/ndb/src/kernel/blocks/suma/Makefile.in    Mon Jun 01 00:36:01 2009 -0700
959 @@ -196,6 +196,7 @@
960  LIBDL = @LIBDL@
961  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
962  LIBOBJS = @LIBOBJS@
963 +LIBRT = @LIBRT@
964  LIBS = @LIBS@
965  LIBTOOL = @LIBTOOL@
966  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
967 diff -r 1ac0113deff5 ndb/src/kernel/blocks/trix/Makefile.in
968 --- a/ndb/src/kernel/blocks/trix/Makefile.in    Mon Jun 01 00:35:44 2009 -0700
969 +++ b/ndb/src/kernel/blocks/trix/Makefile.in    Mon Jun 01 00:36:01 2009 -0700
970 @@ -196,6 +196,7 @@
971  LIBDL = @LIBDL@
972  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
973  LIBOBJS = @LIBOBJS@
974 +LIBRT = @LIBRT@
975  LIBS = @LIBS@
976  LIBTOOL = @LIBTOOL@
977  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
978 diff -r 1ac0113deff5 ndb/src/kernel/error/Makefile.in
979 --- a/ndb/src/kernel/error/Makefile.in  Mon Jun 01 00:35:44 2009 -0700
980 +++ b/ndb/src/kernel/error/Makefile.in  Mon Jun 01 00:36:01 2009 -0700
981 @@ -206,6 +206,7 @@
982  LIBDL = @LIBDL@
983  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
984  LIBOBJS = @LIBOBJS@
985 +LIBRT = @LIBRT@
986  LIBS = @LIBS@
987  LIBTOOL = @LIBTOOL@
988  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
989 diff -r 1ac0113deff5 ndb/src/kernel/vm/Makefile.in
990 --- a/ndb/src/kernel/vm/Makefile.in     Mon Jun 01 00:35:44 2009 -0700
991 +++ b/ndb/src/kernel/vm/Makefile.in     Mon Jun 01 00:36:01 2009 -0700
992 @@ -207,6 +207,7 @@
993  LIBDL = @LIBDL@
994  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
995  LIBOBJS = @LIBOBJS@
996 +LIBRT = @LIBRT@
997  LIBS = @LIBS@
998  LIBTOOL = @LIBTOOL@
999  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1000 diff -r 1ac0113deff5 ndb/src/mgmapi/Makefile.in
1001 --- a/ndb/src/mgmapi/Makefile.in        Mon Jun 01 00:35:44 2009 -0700
1002 +++ b/ndb/src/mgmapi/Makefile.in        Mon Jun 01 00:36:01 2009 -0700
1003 @@ -205,6 +205,7 @@
1004  LIBDL = @LIBDL@
1005  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1006  LIBOBJS = @LIBOBJS@
1007 +LIBRT = @LIBRT@
1008  LIBS = @LIBS@
1009  LIBTOOL = @LIBTOOL@
1010  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1011 diff -r 1ac0113deff5 ndb/src/mgmclient/Makefile.in
1012 --- a/ndb/src/mgmclient/Makefile.in     Mon Jun 01 00:35:44 2009 -0700
1013 +++ b/ndb/src/mgmclient/Makefile.in     Mon Jun 01 00:36:01 2009 -0700
1014 @@ -216,6 +216,7 @@
1015  LIBDL = @LIBDL@
1016  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1017  LIBOBJS = @LIBOBJS@
1018 +LIBRT = @LIBRT@
1019  LIBS = @LIBS@
1020  LIBTOOL = @LIBTOOL@
1021  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1022 diff -r 1ac0113deff5 ndb/src/mgmsrv/Makefile.in
1023 --- a/ndb/src/mgmsrv/Makefile.in        Mon Jun 01 00:35:44 2009 -0700
1024 +++ b/ndb/src/mgmsrv/Makefile.in        Mon Jun 01 00:36:01 2009 -0700
1025 @@ -213,6 +213,7 @@
1026  LIBDL = @LIBDL@
1027  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1028  LIBOBJS = @LIBOBJS@
1029 +LIBRT = @LIBRT@
1030  LIBS = @LIBS@
1031  LIBTOOL = @LIBTOOL@
1032  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1033 diff -r 1ac0113deff5 ndb/src/ndbapi/Makefile.in
1034 --- a/ndb/src/ndbapi/Makefile.in        Mon Jun 01 00:35:44 2009 -0700
1035 +++ b/ndb/src/ndbapi/Makefile.in        Mon Jun 01 00:36:01 2009 -0700
1036 @@ -215,6 +215,7 @@
1037  LIBDL = @LIBDL@
1038  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1039  LIBOBJS = @LIBOBJS@
1040 +LIBRT = @LIBRT@
1041  LIBS = @LIBS@
1042  LIBTOOL = @LIBTOOL@
1043  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1044 diff -r 1ac0113deff5 ndb/test/Makefile.in
1045 --- a/ndb/test/Makefile.in      Mon Jun 01 00:35:44 2009 -0700
1046 +++ b/ndb/test/Makefile.in      Mon Jun 01 00:36:01 2009 -0700
1047 @@ -156,6 +156,7 @@
1048  LIBDL = @LIBDL@
1049  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1050  LIBOBJS = @LIBOBJS@
1051 +LIBRT = @LIBRT@
1052  LIBS = @LIBS@
1053  LIBTOOL = @LIBTOOL@
1054  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1055 diff -r 1ac0113deff5 ndb/test/ndbapi/Makefile.in
1056 --- a/ndb/test/ndbapi/Makefile.in       Mon Jun 01 00:35:44 2009 -0700
1057 +++ b/ndb/test/ndbapi/Makefile.in       Mon Jun 01 00:36:01 2009 -0700
1058 @@ -595,6 +595,7 @@
1059  LIBDL = @LIBDL@
1060  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1061  LIBOBJS = @LIBOBJS@
1062 +LIBRT = @LIBRT@
1063  LIBS = @LIBS@
1064  LIBTOOL = @LIBTOOL@
1065  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1066 diff -r 1ac0113deff5 ndb/test/ndbapi/bank/Makefile.in
1067 --- a/ndb/test/ndbapi/bank/Makefile.in  Mon Jun 01 00:35:44 2009 -0700
1068 +++ b/ndb/test/ndbapi/bank/Makefile.in  Mon Jun 01 00:36:01 2009 -0700
1069 @@ -282,6 +282,7 @@
1070  LIBDL = @LIBDL@
1071  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1072  LIBOBJS = @LIBOBJS@
1073 +LIBRT = @LIBRT@
1074  LIBS = @LIBS@
1075  LIBTOOL = @LIBTOOL@
1076  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1077 diff -r 1ac0113deff5 ndb/test/run-test/Makefile.in
1078 --- a/ndb/test/run-test/Makefile.in     Mon Jun 01 00:35:44 2009 -0700
1079 +++ b/ndb/test/run-test/Makefile.in     Mon Jun 01 00:36:01 2009 -0700
1080 @@ -243,6 +243,7 @@
1081  LIBDL = @LIBDL@
1082  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1083  LIBOBJS = @LIBOBJS@
1084 +LIBRT = @LIBRT@
1085  LIBS = @LIBS@
1086  LIBTOOL = @LIBTOOL@
1087  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1088 diff -r 1ac0113deff5 ndb/test/src/Makefile.in
1089 --- a/ndb/test/src/Makefile.in  Mon Jun 01 00:35:44 2009 -0700
1090 +++ b/ndb/test/src/Makefile.in  Mon Jun 01 00:36:01 2009 -0700
1091 @@ -213,6 +213,7 @@
1092  LIBDL = @LIBDL@
1093  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1094  LIBOBJS = @LIBOBJS@
1095 +LIBRT = @LIBRT@
1096  LIBS = @LIBS@
1097  LIBTOOL = @LIBTOOL@
1098  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1099 diff -r 1ac0113deff5 ndb/test/tools/Makefile.in
1100 --- a/ndb/test/tools/Makefile.in        Mon Jun 01 00:35:44 2009 -0700
1101 +++ b/ndb/test/tools/Makefile.in        Mon Jun 01 00:36:01 2009 -0700
1102 @@ -325,6 +325,7 @@
1103  LIBDL = @LIBDL@
1104  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1105  LIBOBJS = @LIBOBJS@
1106 +LIBRT = @LIBRT@
1107  LIBS = @LIBS@
1108  LIBTOOL = @LIBTOOL@
1109  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1110 diff -r 1ac0113deff5 ndb/tools/Makefile.in
1111 --- a/ndb/tools/Makefile.in     Mon Jun 01 00:35:44 2009 -0700
1112 +++ b/ndb/tools/Makefile.in     Mon Jun 01 00:36:01 2009 -0700
1113 @@ -344,6 +344,7 @@
1114  LIBDL = @LIBDL@
1115  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1116  LIBOBJS = @LIBOBJS@
1117 +LIBRT = @LIBRT@
1118  LIBS = @LIBS@
1119  LIBTOOL = @LIBTOOL@
1120  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1121 diff -r 1ac0113deff5 netware/Makefile.in
1122 --- a/netware/Makefile.in       Mon Jun 01 00:35:44 2009 -0700
1123 +++ b/netware/Makefile.in       Mon Jun 01 00:36:01 2009 -0700
1124 @@ -199,6 +199,7 @@
1125  LIBDL = @LIBDL@
1126  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1127  LIBOBJS = @LIBOBJS@
1128 +LIBRT = @LIBRT@
1129  LIBS = @LIBS@
1130  LIBTOOL = @LIBTOOL@
1131  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1132 diff -r 1ac0113deff5 os2/Makefile.in
1133 --- a/os2/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
1134 +++ b/os2/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
1135 @@ -156,6 +156,7 @@
1136  LIBDL = @LIBDL@
1137  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1138  LIBOBJS = @LIBOBJS@
1139 +LIBRT = @LIBRT@
1140  LIBS = @LIBS@
1141  LIBTOOL = @LIBTOOL@
1142  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1143 diff -r 1ac0113deff5 os2/include/Makefile.in
1144 --- a/os2/include/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
1145 +++ b/os2/include/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
1146 @@ -156,6 +156,7 @@
1147  LIBDL = @LIBDL@
1148  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1149  LIBOBJS = @LIBOBJS@
1150 +LIBRT = @LIBRT@
1151  LIBS = @LIBS@
1152  LIBTOOL = @LIBTOOL@
1153  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1154 diff -r 1ac0113deff5 os2/include/sys/Makefile.in
1155 --- a/os2/include/sys/Makefile.in       Mon Jun 01 00:35:44 2009 -0700
1156 +++ b/os2/include/sys/Makefile.in       Mon Jun 01 00:36:01 2009 -0700
1157 @@ -144,6 +144,7 @@
1158  LIBDL = @LIBDL@
1159  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1160  LIBOBJS = @LIBOBJS@
1161 +LIBRT = @LIBRT@
1162  LIBS = @LIBS@
1163  LIBTOOL = @LIBTOOL@
1164  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1165 diff -r 1ac0113deff5 patch_info/userstats.info
1166 --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
1167 +++ b/patch_info/userstats.info Mon Jun 01 00:36:01 2009 -0700
1168 @@ -0,0 +1,14 @@
1169 +File=userstatsv2.patch
1170 +Name=SHOW USER/TABLE/INDEX statistics
1171 +Version=V2
1172 +Author=Google
1173 +License=GPL
1174 +Comment=Added INFORMATION_SCHEMA.*_STATISTICS
1175 +2008-12-01
1176 +YK: fix behavior for prepared statements
1177 +
1178 +2008-11-26
1179 +YK: add switch variable "userstat_running" to control INFORMATION_SCHEMA.*_STATISTICS (default:OFF)
1180 +
1181 +2008-12-09
1182 +YK: fixed "Row_sent: 0" problem at microslow_innodb.patch
1183 diff -r 1ac0113deff5 pstack/Makefile.in
1184 --- a/pstack/Makefile.in        Mon Jun 01 00:35:44 2009 -0700
1185 +++ b/pstack/Makefile.in        Mon Jun 01 00:36:01 2009 -0700
1186 @@ -196,6 +196,7 @@
1187  LIBDL = @LIBDL@
1188  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1189  LIBOBJS = @LIBOBJS@
1190 +LIBRT = @LIBRT@
1191  LIBS = @LIBS@
1192  LIBTOOL = @LIBTOOL@
1193  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1194 diff -r 1ac0113deff5 pstack/aout/Makefile.in
1195 --- a/pstack/aout/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
1196 +++ b/pstack/aout/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
1197 @@ -134,6 +134,7 @@
1198  LIBDL = @LIBDL@
1199  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1200  LIBOBJS = @LIBOBJS@
1201 +LIBRT = @LIBRT@
1202  LIBS = @LIBS@
1203  LIBTOOL = @LIBTOOL@
1204  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1205 diff -r 1ac0113deff5 regex/Makefile.in
1206 --- a/regex/Makefile.in Mon Jun 01 00:35:44 2009 -0700
1207 +++ b/regex/Makefile.in Mon Jun 01 00:36:01 2009 -0700
1208 @@ -180,6 +180,7 @@
1209  LIBDL = @LIBDL@
1210  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1211  LIBOBJS = @LIBOBJS@
1212 +LIBRT = @LIBRT@
1213  LIBS = @LIBS@
1214  LIBTOOL = @LIBTOOL@
1215  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1216 diff -r 1ac0113deff5 scripts/Makefile.in
1217 --- a/scripts/Makefile.in       Mon Jun 01 00:35:44 2009 -0700
1218 +++ b/scripts/Makefile.in       Mon Jun 01 00:36:01 2009 -0700
1219 @@ -176,6 +176,7 @@
1220  LIBDL = @LIBDL@
1221  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1222  LIBOBJS = @LIBOBJS@
1223 +LIBRT = @LIBRT@
1224  LIBS = @LIBS@
1225  LIBTOOL = @LIBTOOL@
1226  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1227 diff -r 1ac0113deff5 server-tools/Makefile.in
1228 --- a/server-tools/Makefile.in  Mon Jun 01 00:35:44 2009 -0700
1229 +++ b/server-tools/Makefile.in  Mon Jun 01 00:36:01 2009 -0700
1230 @@ -155,6 +155,7 @@
1231  LIBDL = @LIBDL@
1232  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1233  LIBOBJS = @LIBOBJS@
1234 +LIBRT = @LIBRT@
1235  LIBS = @LIBS@
1236  LIBTOOL = @LIBTOOL@
1237  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1238 diff -r 1ac0113deff5 server-tools/instance-manager/Makefile.in
1239 --- a/server-tools/instance-manager/Makefile.in Mon Jun 01 00:35:44 2009 -0700
1240 +++ b/server-tools/instance-manager/Makefile.in Mon Jun 01 00:36:01 2009 -0700
1241 @@ -205,6 +205,7 @@
1242  LIBDL = @LIBDL@
1243  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1244  LIBOBJS = @LIBOBJS@
1245 +LIBRT = @LIBRT@
1246  LIBS = @LIBS@
1247  LIBTOOL = @LIBTOOL@
1248  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1249 diff -r 1ac0113deff5 sql/Makefile.in
1250 --- a/sql/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
1251 +++ b/sql/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
1252 @@ -274,6 +274,7 @@
1253  LIBDL = @LIBDL@
1254  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1255  LIBOBJS = @LIBOBJS@
1256 +LIBRT = @LIBRT@
1257  LIBS = @LIBS@
1258  LIBTOOL = @LIBTOOL@
1259  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1260 diff -r 1ac0113deff5 sql/ha_innodb.cc
1261 --- a/sql/ha_innodb.cc  Mon Jun 01 00:35:44 2009 -0700
1262 +++ b/sql/ha_innodb.cc  Mon Jun 01 00:36:01 2009 -0700
1263 @@ -3338,6 +3338,8 @@
1264  
1265         error = row_insert_for_mysql((byte*) record, prebuilt);
1266  
1267 +        if (error == DB_SUCCESS) rows_changed++;
1268 +
1269         if (error == DB_SUCCESS && auto_inc_used) {
1270  
1271                 /* Fetch the value that was set in the autoincrement field */
1272 @@ -3610,6 +3612,8 @@
1273                 }
1274         }
1275  
1276 +       if (error == DB_SUCCESS) rows_changed++;
1277 +
1278         innodb_srv_conc_exit_innodb(prebuilt->trx);
1279  
1280         error = convert_error_code_to_mysql(error, user_thd);
1281 @@ -3658,6 +3662,8 @@
1282  
1283         error = row_update_for_mysql((byte*) record, prebuilt);
1284  
1285 +       if (error == DB_SUCCESS) rows_changed++;
1286 +
1287         innodb_srv_conc_exit_innodb(prebuilt->trx);
1288  
1289         error = convert_error_code_to_mysql(error, user_thd);
1290 @@ -4089,6 +4095,9 @@
1291         if (ret == DB_SUCCESS) {
1292                 error = 0;
1293                 table->status = 0;
1294 +                rows_read++;
1295 +                if (active_index >= 0 && active_index < MAX_KEY)
1296 +                        index_rows_read[active_index]++;
1297  
1298         } else if (ret == DB_RECORD_NOT_FOUND) {
1299                 error = HA_ERR_END_OF_FILE;
1300 diff -r 1ac0113deff5 sql/ha_myisam.cc
1301 --- a/sql/ha_myisam.cc  Mon Jun 01 00:35:44 2009 -0700
1302 +++ b/sql/ha_myisam.cc  Mon Jun 01 00:36:01 2009 -0700
1303 @@ -670,7 +670,9 @@
1304      if ((error= update_auto_increment()))
1305        return error;
1306    }
1307 -  return mi_write(file,buf);
1308 +  int error=mi_write(file,buf);
1309 +  if (!error) rows_changed++;
1310 +  return error;
1311  }
1312  
1313  int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
1314 @@ -1518,13 +1520,17 @@
1315    statistic_increment(table->in_use->status_var.ha_update_count,&LOCK_status);
1316    if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
1317      table->timestamp_field->set_time();
1318 -  return mi_update(file,old_data,new_data);
1319 +  int error=mi_update(file,old_data,new_data);
1320 +  if (!error) rows_changed++;
1321 +  return error;
1322  }
1323  
1324  int ha_myisam::delete_row(const byte * buf)
1325  {
1326    statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status);
1327 -  return mi_delete(file,buf);
1328 +  int error=mi_delete(file,buf);
1329 +  if (!error) rows_changed++;
1330 +  return error;
1331  }
1332  
1333  int ha_myisam::index_read(byte * buf, const byte * key,
1334 @@ -1535,6 +1541,13 @@
1335                       &LOCK_status);
1336    int error=mi_rkey(file,buf,active_index, key, key_len, find_flag);
1337    table->status=error ? STATUS_NOT_FOUND: 0;
1338 +  if (!error) {
1339 +    rows_read++;
1340 +
1341 +    int inx = (active_index == -1) ? file->lastinx : active_index;
1342 +    if (inx >= 0 && inx < MAX_KEY)
1343 +      index_rows_read[inx]++;
1344 +  }
1345    return error;
1346  }
1347  
1348 @@ -1545,6 +1558,13 @@
1349                       &LOCK_status);
1350    int error=mi_rkey(file,buf,index, key, key_len, find_flag);
1351    table->status=error ? STATUS_NOT_FOUND: 0;
1352 +  if (!error) {
1353 +    rows_read++;
1354 +
1355 +    int inx = index;
1356 +    if (inx >= 0 && inx < MAX_KEY)
1357 +      index_rows_read[inx]++;
1358 +  }
1359    return error;
1360  }
1361  
1362 @@ -1555,6 +1575,13 @@
1363                       &LOCK_status);
1364    int error=mi_rkey(file,buf,active_index, key, key_len, HA_READ_PREFIX_LAST);
1365    table->status=error ? STATUS_NOT_FOUND: 0;
1366 +  if (!error) {
1367 +    rows_read++;
1368 +
1369 +    int inx = (active_index == -1) ? file->lastinx : active_index;
1370 +    if (inx >= 0 && inx < MAX_KEY)
1371 +      index_rows_read[inx]++;
1372 +  }
1373    return error;
1374  }
1375  
1376 @@ -1565,6 +1592,13 @@
1377                       &LOCK_status);
1378    int error=mi_rnext(file,buf,active_index);
1379    table->status=error ? STATUS_NOT_FOUND: 0;
1380 +  if (!error) {
1381 +    rows_read++;
1382 +
1383 +    int inx = (active_index == -1) ? file->lastinx : active_index;
1384 +    if (inx >= 0 && inx < MAX_KEY)
1385 +      index_rows_read[inx]++;
1386 +  }
1387    return error;
1388  }
1389  
1390 @@ -1575,6 +1609,13 @@
1391                       &LOCK_status);
1392    int error=mi_rprev(file,buf, active_index);
1393    table->status=error ? STATUS_NOT_FOUND: 0;
1394 +  if (!error) {
1395 +    rows_read++;
1396 +
1397 +    int inx = (active_index == -1) ? file->lastinx : active_index;
1398 +    if (inx >= 0 && inx < MAX_KEY)
1399 +      index_rows_read[inx]++;
1400 +  }
1401    return error;
1402  }
1403  
1404 @@ -1585,6 +1626,13 @@
1405                       &LOCK_status);
1406    int error=mi_rfirst(file, buf, active_index);
1407    table->status=error ? STATUS_NOT_FOUND: 0;
1408 +  if (!error) {
1409 +    rows_read++;
1410 +
1411 +    int inx = (active_index == -1) ? file->lastinx : active_index;
1412 +    if (inx >= 0 && inx < MAX_KEY)
1413 +      index_rows_read[inx]++;
1414 +  }
1415    return error;
1416  }
1417  
1418 @@ -1595,6 +1643,13 @@
1419                       &LOCK_status);
1420    int error=mi_rlast(file, buf, active_index);
1421    table->status=error ? STATUS_NOT_FOUND: 0;
1422 +  if (!error) {
1423 +    rows_read++;
1424 +
1425 +    int inx = (active_index == -1) ? file->lastinx : active_index;
1426 +    if (inx >= 0 && inx < MAX_KEY)
1427 +      index_rows_read[inx]++;
1428 +  }
1429    return error;
1430  }
1431  
1432 @@ -1611,6 +1666,13 @@
1433      error= mi_rnext_same(file,buf);
1434    } while (error == HA_ERR_RECORD_DELETED);
1435    table->status=error ? STATUS_NOT_FOUND: 0;
1436 +  if (!error) {
1437 +    rows_read++;
1438 +
1439 +    int inx = (active_index == -1) ? file->lastinx : active_index;
1440 +    if (inx >= 0 && inx < MAX_KEY)
1441 +      index_rows_read[inx]++;
1442 +  }
1443    return error;
1444  }
1445  
1446 @@ -1628,6 +1690,7 @@
1447                       &LOCK_status);
1448    int error=mi_scan(file, buf);
1449    table->status=error ? STATUS_NOT_FOUND: 0;
1450 +  if (!error) rows_read++;
1451    return error;
1452  }
1453  
1454 @@ -1642,6 +1705,7 @@
1455                       &LOCK_status);
1456    int error=mi_rrnd(file, buf, my_get_ptr(pos,ref_length));
1457    table->status=error ? STATUS_NOT_FOUND: 0;
1458 +  if (!error) rows_read++;
1459    return error;
1460  }
1461  
1462 diff -r 1ac0113deff5 sql/handler.cc
1463 --- a/sql/handler.cc    Mon Jun 01 00:35:44 2009 -0700
1464 +++ b/sql/handler.cc    Mon Jun 01 00:36:01 2009 -0700
1465 @@ -726,6 +726,8 @@
1466      if (cookie)
1467        tc_log->unlog(cookie, xid);
1468      DBUG_EXECUTE_IF("crash_commit_after", abort(););
1469 +    if (is_real_trans)
1470 +      thd->diff_commit_trans++;
1471  end:
1472      if (is_real_trans)
1473        start_waiting_global_read_lock(thd);
1474 @@ -783,6 +785,7 @@
1475        thd->transaction.cleanup();
1476      }
1477    }
1478 +  thd->diff_rollback_trans++;
1479  #endif /* USING_TRANSACTIONS */
1480    DBUG_RETURN(error);
1481  }
1482 @@ -1223,6 +1226,7 @@
1483      statistic_increment(thd->status_var.ha_rollback_count,&LOCK_status);
1484      *ht=0; // keep it conveniently zero-filled
1485    }
1486 +  thd->diff_rollback_trans++;
1487    DBUG_RETURN(error);
1488  }
1489  
1490 @@ -1453,6 +1457,8 @@
1491      else
1492        dupp_ref=ref+ALIGN_SIZE(ref_length);
1493    }
1494 +  rows_read = rows_changed = 0;
1495 +  memset(index_rows_read, 0, sizeof(index_rows_read));
1496    DBUG_RETURN(error);
1497  }
1498  
1499 @@ -2287,6 +2293,111 @@
1500    return error;
1501  }
1502  
1503 +// Updates the global table stats with the TABLE this handler represents.
1504 +void handler::update_global_table_stats() {
1505 +  if (!opt_userstat_running) {
1506 +    rows_read = rows_changed = 0;
1507 +    return;
1508 +  }
1509 +
1510 +  if (!rows_read && !rows_changed) return;  // Nothing to update.
1511 +  // table_cache_key is db_name + '\0' + table_name + '\0'.
1512 +  if (!table->s || !table->s->table_cache_key || !table->s->table_name) return;
1513 +
1514 +  TABLE_STATS* table_stats;
1515 +  char key[NAME_LEN * 2 + 2];
1516 +  // [db] + '.' + [table]
1517 +  sprintf(key, "%s.%s", table->s->table_cache_key, table->s->table_name);
1518 +
1519 +  pthread_mutex_lock(&LOCK_global_table_stats);
1520 +  // Gets the global table stats, creating one if necessary.
1521 +  if (!(table_stats = (TABLE_STATS*)hash_search(&global_table_stats,
1522 +                                                (byte*)key,
1523 +                                                strlen(key)))) {
1524 +    if (!(table_stats = ((TABLE_STATS*)
1525 +                         my_malloc(sizeof(TABLE_STATS), MYF(MY_WME | MY_ZEROFILL))))) {
1526 +      // Out of memory.
1527 +      sql_print_error("Allocating table stats failed.");
1528 +      goto end;
1529 +    }
1530 +    strncpy(table_stats->table, key, sizeof(table_stats->table));
1531 +    table_stats->rows_read = 0;
1532 +    table_stats->rows_changed = 0;
1533 +    table_stats->rows_changed_x_indexes = 0;
1534 +    table_stats->engine_type = (int) ht->db_type;
1535 +
1536 +    if (my_hash_insert(&global_table_stats, (byte*)table_stats)) {
1537 +      // Out of memory.
1538 +      sql_print_error("Inserting table stats failed.");
1539 +      my_free((char*)table_stats, 0);
1540 +      goto end;
1541 +    }
1542 +  }
1543 +  // Updates the global table stats.
1544 +  table_stats->rows_read += rows_read;
1545 +  table_stats->rows_changed += rows_changed;
1546 +  table_stats->rows_changed_x_indexes +=
1547 +      rows_changed * (table->s->keys ? table->s->keys : 1);
1548 +  current_thd->diff_total_read_rows += rows_read;
1549 +  rows_read = rows_changed = 0;
1550 +end:
1551 +  pthread_mutex_unlock(&LOCK_global_table_stats);
1552 +}
1553 +
1554 +// Updates the global index stats with this handler's accumulated index reads.
1555 +void handler::update_global_index_stats() {
1556 +  // table_cache_key is db_name + '\0' + table_name + '\0'.
1557 +  if (!table->s || !table->s->table_cache_key || !table->s->table_name) return;
1558 +
1559 +  if (!opt_userstat_running) {
1560 +    for (int x = 0; x < table->s->keys; x++) {
1561 +      index_rows_read[x] = 0;
1562 +    }
1563 +    return;
1564 +  }
1565 +
1566 +  for (int x = 0; x < table->s->keys; x++) {
1567 +    if (index_rows_read[x]) {
1568 +      // Rows were read using this index.
1569 +      KEY* key_info = &table->key_info[x];
1570 +
1571 +      if (!key_info->name) continue;
1572 +
1573 +      INDEX_STATS* index_stats;
1574 +      char key[NAME_LEN * 3 + 3];
1575 +      // [db] + '.' + [table] + '.' + [index]
1576 +      sprintf(key, "%s.%s.%s",  table->s->table_cache_key,
1577 +              table->s->table_name, key_info->name);
1578 +
1579 +      pthread_mutex_lock(&LOCK_global_index_stats);
1580 +      // Gets the global index stats, creating one if necessary.
1581 +      if (!(index_stats = (INDEX_STATS*)hash_search(&global_index_stats,
1582 +                                                    (byte*)key,
1583 +                                                    strlen(key)))) {
1584 +        if (!(index_stats = ((INDEX_STATS*)
1585 +                             my_malloc(sizeof(INDEX_STATS), MYF(MY_WME | MY_ZEROFILL))))) {
1586 +          // Out of memory.
1587 +          sql_print_error("Allocating index stats failed.");
1588 +          goto end;
1589 +        }
1590 +        strncpy(index_stats->index, key, sizeof(index_stats->index));
1591 +        index_stats->rows_read = 0;
1592 +
1593 +        if (my_hash_insert(&global_index_stats, (byte*)index_stats)) {
1594 +          // Out of memory.
1595 +          sql_print_error("Inserting index stats failed.");
1596 +          my_free((char*)index_stats, 0);
1597 +          goto end;
1598 +        }
1599 +      }
1600 +      // Updates the global index stats.
1601 +      index_stats->rows_read += index_rows_read[x];
1602 +      index_rows_read[x] = 0;
1603 +end:
1604 +      pthread_mutex_unlock(&LOCK_global_index_stats);
1605 +    }
1606 +  }
1607 +}
1608  
1609  /****************************************************************************
1610  ** Some general functions that isn't in the handler class
1611 diff -r 1ac0113deff5 sql/handler.h
1612 --- a/sql/handler.h     Mon Jun 01 00:35:44 2009 -0700
1613 +++ b/sql/handler.h     Mon Jun 01 00:36:01 2009 -0700
1614 @@ -32,6 +32,10 @@
1615  #define USING_TRANSACTIONS
1616  #endif
1617  
1618 +#if MAX_KEY > 128
1619 +#error MAX_KEY is too large.  Values up to 128 are supported.
1620 +#endif
1621 +
1622  // the following is for checking tables
1623  
1624  #define HA_ADMIN_ALREADY_DONE    1
1625 @@ -604,6 +608,9 @@
1626    bool  auto_increment_column_changed;
1627    bool implicit_emptied;                /* Can be !=0 only if HEAP */
1628    const COND *pushed_cond;
1629 +  ulonglong rows_read;
1630 +  ulonglong rows_changed;
1631 +  ulonglong index_rows_read[MAX_KEY];
1632  
1633    handler(const handlerton *ht_arg, TABLE *table_arg) :table(table_arg),
1634      ht(ht_arg),
1635 @@ -615,8 +622,10 @@
1636      ref_length(sizeof(my_off_t)), block_size(0),
1637      raid_type(0), ft_handler(0), inited(NONE),
1638      locked(FALSE), implicit_emptied(0),
1639 -    pushed_cond(NULL)
1640 -    {}
1641 +    pushed_cond(NULL), rows_read(0), rows_changed(0)
1642 +    {
1643 +      memset(index_rows_read, 0, sizeof(index_rows_read));
1644 +    }
1645    virtual ~handler(void) { DBUG_ASSERT(locked == FALSE); /* TODO: DBUG_ASSERT(inited == NONE); */ }
1646    virtual handler *clone(MEM_ROOT *mem_root);
1647    int ha_open(const char *name, int mode, int test_if_locked);
1648 @@ -625,7 +634,11 @@
1649    virtual void print_error(int error, myf errflag);
1650    virtual bool get_error_message(int error, String *buf);
1651    uint get_dup_key(int error);
1652 -  void change_table_ptr(TABLE *table_arg) { table=table_arg; }
1653 +  void change_table_ptr(TABLE *table_arg) {
1654 +    table=table_arg;
1655 +    rows_read = rows_changed = 0;
1656 +    memset(index_rows_read, 0, sizeof(index_rows_read));
1657 +  }
1658    virtual double scan_time()
1659      { return ulonglong2double(data_file_length) / IO_SIZE + 2; }
1660    virtual double read_time(uint index, uint ranges, ha_rows rows)
1661 @@ -886,6 +899,9 @@
1662    virtual bool is_crashed() const  { return 0; }
1663    virtual bool auto_repair() const { return 0; }
1664  
1665 +  void update_global_table_stats();
1666 +  void update_global_index_stats();
1667 +
1668    /*
1669      default rename_table() and delete_table() rename/delete files with a
1670      given name and extensions from bas_ext()
1671 diff -r 1ac0113deff5 sql/lex.h
1672 --- a/sql/lex.h Mon Jun 01 00:35:44 2009 -0700
1673 +++ b/sql/lex.h Mon Jun 01 00:36:01 2009 -0700
1674 @@ -109,6 +109,7 @@
1675    { "CHECKSUM",                SYM(CHECKSUM_SYM)},
1676    { "CIPHER",          SYM(CIPHER_SYM)},
1677    { "CLIENT",          SYM(CLIENT_SYM)},
1678 +  { "CLIENT_STATISTICS", SYM(CLIENT_STATS_SYM)},
1679    { "CLOSE",           SYM(CLOSE_SYM)},
1680    { "CODE",             SYM(CODE_SYM)},
1681    { "COLLATE",         SYM(COLLATE_SYM)},
1682 @@ -238,6 +239,7 @@
1683    { "IN",              SYM(IN_SYM)},
1684    { "INDEX",           SYM(INDEX_SYM)},
1685    { "INDEXES",         SYM(INDEXES)},
1686 +  { "INDEX_STATISTICS",        SYM(INDEX_STATS_SYM)},
1687    { "INFILE",          SYM(INFILE)},
1688    { "INNER",           SYM(INNER_SYM)},
1689    { "INNOBASE",                SYM(INNOBASE_SYM)},
1690 @@ -443,6 +445,7 @@
1691    { "SIGNED",          SYM(SIGNED_SYM)},
1692    { "SIMPLE",          SYM(SIMPLE_SYM)},
1693    { "SLAVE",            SYM(SLAVE)},
1694 +  { "SLOW",             SYM(SLOW_SYM)},
1695    { "SNAPSHOT",         SYM(SNAPSHOT_SYM)},
1696    { "SMALLINT",                SYM(SMALLINT)},
1697    { "SOME",             SYM(ANY_SYM)},
1698 @@ -488,6 +491,7 @@
1699    { "TABLE",           SYM(TABLE_SYM)},
1700    { "TABLES",          SYM(TABLES)},
1701    { "TABLESPACE",      SYM(TABLESPACE)},
1702 +  { "TABLE_STATISTICS",        SYM(TABLE_STATS_SYM)},
1703    { "TEMPORARY",       SYM(TEMPORARY)},
1704    { "TEMPTABLE",       SYM(TEMPTABLE_SYM)},
1705    { "TERMINATED",      SYM(TERMINATED)},
1706 @@ -525,6 +529,7 @@
1707    { "USE",             SYM(USE_SYM)},
1708    { "USER",            SYM(USER)},
1709    { "USER_RESOURCES",  SYM(RESOURCES)},
1710 +  { "USER_STATISTICS", SYM(USER_STATS_SYM)},
1711    { "USE_FRM",         SYM(USE_FRM)},
1712    { "USING",           SYM(USING)},
1713    { "UTC_DATE",         SYM(UTC_DATE_SYM)},
1714 diff -r 1ac0113deff5 sql/log.cc
1715 --- a/sql/log.cc        Mon Jun 01 00:35:44 2009 -0700
1716 +++ b/sql/log.cc        Mon Jun 01 00:36:01 2009 -0700
1717 @@ -1958,18 +1958,24 @@
1718                            thd->current_insert_id);
1719         if (e.write(file))
1720           goto err;
1721 +        if (file == &log_file)
1722 +          thd->binlog_bytes_written += e.data_written;
1723        }
1724        if (thd->insert_id_used)
1725        {
1726         Intvar_log_event e(thd,(uchar) INSERT_ID_EVENT,thd->last_insert_id);
1727         if (e.write(file))
1728           goto err;
1729 +        if (file == &log_file)
1730 +          thd->binlog_bytes_written += e.data_written;
1731        }
1732        if (thd->rand_used)
1733        {
1734         Rand_log_event e(thd,thd->rand_saved_seed1,thd->rand_saved_seed2);
1735         if (e.write(file))
1736           goto err;
1737 +        if (file == &log_file)
1738 +          thd->binlog_bytes_written += e.data_written;
1739        }
1740        if (thd->user_var_events.elements)
1741        {
1742 @@ -1985,6 +1991,8 @@
1743                                user_var_event->charset_number);
1744           if (e.write(file))
1745             goto err;
1746 +         if (file == &log_file)
1747 +                 thd->binlog_bytes_written += e.data_written;
1748         }
1749        }
1750      }
1751 @@ -1995,6 +2003,8 @@
1752  
1753      if (event_info->write(file))
1754        goto err;
1755 +    if (file == &log_file)
1756 +           thd->binlog_bytes_written += event_info->data_written;
1757  
1758      if (file == &log_file) // we are writing to the real log (disk)
1759      {
1760 @@ -2117,6 +2127,7 @@
1761      */
1762      if (qinfo.write(&log_file))
1763        goto err;
1764 +    thd->binlog_bytes_written += qinfo.data_written;
1765  
1766      /* Read from the file used to cache the queries .*/
1767      if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0))
1768 @@ -2163,6 +2174,7 @@
1769          /* write the first half of the split header */
1770          if (my_b_write(&log_file, header, carry))
1771            goto err;
1772 +        thd->binlog_bytes_written += carry;
1773  
1774          /*
1775            copy fixed second half of header to cache so the correct
1776 @@ -2231,6 +2243,8 @@
1777        /* Write data to the binary log file */
1778        if (my_b_write(&log_file, cache->read_pos, length))
1779          goto err;
1780 +      thd->binlog_bytes_written += length;
1781 +
1782        cache->read_pos=cache->read_end;         // Mark buffer used up
1783        DBUG_EXECUTE_IF("half_binlogged_transaction", goto DBUG_skip_commit;);
1784      } while ((length=my_b_fill(cache)));
1785 @@ -2239,6 +2253,8 @@
1786  
1787      if (commit_event->write(&log_file))
1788        goto err;
1789 +    thd->binlog_bytes_written += commit_event->data_written;
1790 +
1791  #ifndef DBUG_OFF
1792  DBUG_skip_commit:
1793  #endif
1794 diff -r 1ac0113deff5 sql/mysql_priv.h
1795 --- a/sql/mysql_priv.h  Mon Jun 01 00:35:44 2009 -0700
1796 +++ b/sql/mysql_priv.h  Mon Jun 01 00:36:01 2009 -0700
1797 @@ -837,7 +837,15 @@
1798  bool multi_delete_set_locks_and_link_aux_tables(LEX *lex);
1799  void init_max_user_conn(void);
1800  void init_update_queries(void);
1801 +void init_global_user_stats(void);
1802 +void init_global_table_stats(void);
1803 +void init_global_index_stats(void);
1804 +void init_global_client_stats(void);
1805  void free_max_user_conn(void);
1806 +void free_global_user_stats(void);
1807 +void free_global_table_stats(void);
1808 +void free_global_index_stats(void);
1809 +void free_global_client_stats(void);
1810  pthread_handler_t handle_one_connection(void *arg);
1811  pthread_handler_t handle_bootstrap(void *arg);
1812  void end_thread(THD *thd,bool put_in_cache);
1813 @@ -1416,6 +1424,7 @@
1814  extern ulong max_connections,max_connect_errors, connect_timeout;
1815  extern ulong slave_net_timeout, slave_trans_retries;
1816  extern uint max_user_connections;
1817 +extern ulonglong denied_connections;
1818  extern ulong what_to_log,flush_time;
1819  extern ulong query_buff_size, thread_stack;
1820  extern ulong max_prepared_stmt_count, prepared_stmt_count;
1821 @@ -1446,6 +1455,7 @@
1822  extern my_bool opt_safe_show_db, opt_local_infile;
1823  extern my_bool opt_slave_compressed_protocol, use_temp_pool;
1824  extern my_bool opt_readonly, lower_case_file_system;
1825 +extern my_bool opt_userstat_running;
1826  extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
1827  extern my_bool opt_secure_auth;
1828  extern char* opt_secure_file_priv;
1829 @@ -1493,6 +1503,14 @@
1830  extern struct system_variables max_system_variables;
1831  extern struct system_status_var global_status_var;
1832  extern struct rand_struct sql_rand;
1833 +extern HASH global_user_stats;
1834 +extern HASH global_client_stats;
1835 +extern pthread_mutex_t LOCK_global_user_client_stats;
1836 +extern HASH global_table_stats;
1837 +extern pthread_mutex_t LOCK_global_table_stats;
1838 +extern HASH global_index_stats;
1839 +extern pthread_mutex_t LOCK_global_index_stats;
1840 +extern pthread_mutex_t LOCK_stats;
1841  
1842  extern const char *opt_date_time_formats[];
1843  extern KNOWN_DATE_TIME_FORMAT known_date_time_formats[];
1844 diff -r 1ac0113deff5 sql/mysqld.cc
1845 --- a/sql/mysqld.cc     Mon Jun 01 00:35:44 2009 -0700
1846 +++ b/sql/mysqld.cc     Mon Jun 01 00:36:01 2009 -0700
1847 @@ -417,6 +417,7 @@
1848  uint    opt_large_page_size= 0;
1849  my_bool opt_old_style_user_limits= 0, trust_function_creators= 0;
1850  char* opt_slow_logname= 0;
1851 +my_bool opt_userstat_running= 0;
1852  /*
1853    True if there is at least one per-hour limit for some user, so we should
1854    check them before each query (and possibly reset counters when hour is
1855 @@ -453,6 +454,7 @@
1856  ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
1857  ulong max_connections, max_connect_errors;
1858  uint  max_user_connections= 0;
1859 +ulonglong denied_connections = 0;
1860  /*
1861    Limit of the total number of prepared statements in the server.
1862    Is necessary to protect the server against out-of-memory attacks.
1863 @@ -555,6 +557,10 @@
1864                 LOCK_crypt, LOCK_bytes_sent, LOCK_bytes_received,
1865                 LOCK_global_system_variables,
1866                 LOCK_user_conn, LOCK_slave_list, LOCK_active_mi;
1867 +pthread_mutex_t LOCK_stats;
1868 +pthread_mutex_t LOCK_global_user_client_stats;
1869 +pthread_mutex_t LOCK_global_table_stats;
1870 +pthread_mutex_t LOCK_global_index_stats;
1871  /*
1872    The below lock protects access to two global server variables:
1873    max_prepared_stmt_count and prepared_stmt_count. These variables
1874 @@ -1196,6 +1202,10 @@
1875    x_free(opt_secure_file_priv);
1876    bitmap_free(&temp_pool);
1877    free_max_user_conn();
1878 +  free_global_user_stats();
1879 +  free_global_client_stats();
1880 +  free_global_table_stats();
1881 +  free_global_index_stats();
1882  #ifdef HAVE_REPLICATION
1883    end_slave_list();
1884    free_list(&replicate_do_db);
1885 @@ -1310,6 +1320,10 @@
1886    (void) pthread_cond_destroy(&COND_thread_cache);
1887    (void) pthread_cond_destroy(&COND_flush_thread_cache);
1888    (void) pthread_cond_destroy(&COND_manager);
1889 +  (void) pthread_mutex_destroy(&LOCK_stats);
1890 +  (void) pthread_mutex_destroy(&LOCK_global_user_client_stats);
1891 +  (void) pthread_mutex_destroy(&LOCK_global_table_stats);
1892 +  (void) pthread_mutex_destroy(&LOCK_global_index_stats);
1893  }
1894  
1895  #endif /*EMBEDDED_LIBRARY*/
1896 @@ -3157,6 +3171,10 @@
1897    (void) pthread_mutex_init(&LOCK_rpl_status, MY_MUTEX_INIT_FAST);
1898    (void) pthread_cond_init(&COND_rpl_status, NULL);
1899  #endif
1900 +  (void) pthread_mutex_init(&LOCK_stats, MY_MUTEX_INIT_FAST);
1901 +  (void) pthread_mutex_init(&LOCK_global_user_client_stats, MY_MUTEX_INIT_FAST);
1902 +  (void) pthread_mutex_init(&LOCK_global_table_stats, MY_MUTEX_INIT_FAST);
1903 +  (void) pthread_mutex_init(&LOCK_global_index_stats, MY_MUTEX_INIT_FAST);
1904    sp_cache_init();
1905    /* Parameter for threads created for connections */
1906    (void) pthread_attr_init(&connection_attrib);
1907 @@ -3428,6 +3446,10 @@
1908      sql_print_error("Out of memory");
1909      unireg_abort(1);
1910    }
1911 +
1912 +  init_global_table_stats();
1913 +  init_global_index_stats();
1914 +
1915    if (ha_init())
1916    {
1917      sql_print_error("Can't init databases");
1918 @@ -3510,6 +3532,8 @@
1919  
1920    init_max_user_conn();
1921    init_update_queries();
1922 +  init_global_user_stats();
1923 +  init_global_client_stats();
1924    DBUG_RETURN(0);
1925  }
1926  
1927 @@ -4236,6 +4260,7 @@
1928    {
1929      DBUG_PRINT("error",("Too many connections"));
1930      close_connection(thd, ER_CON_COUNT_ERROR, 1);
1931 +    statistic_increment(denied_connections, &LOCK_status);
1932      delete thd;
1933      DBUG_VOID_RETURN;
1934    }
1935 @@ -5056,6 +5081,7 @@
1936    OPT_PROFILING_USE_GETRUSAGE,
1937    OPT_SLOW_LOG,
1938    OPT_SLOW_QUERY_LOG_FILE,
1939 +  OPT_USERSTAT_RUNNING,
1940    OPT_USE_GLOBAL_LONG_QUERY_TIME,
1941    OPT_INNODB_ROLLBACK_ON_TIMEOUT,
1942    OPT_SECURE_FILE_PRIV,
1943 @@ -6523,6 +6549,10 @@
1944     (gptr*) &max_system_variables.net_wait_timeout, 0, GET_ULONG,
1945     REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT),
1946     0, 1, 0},
1947 +  {"userstat_running", OPT_USERSTAT_RUNNING,
1948 +   "Control USER_STATISTICS, CLIENT_STATISTICS, INDEX_STATISTICS and TABLE_STATISTICS running",
1949 +   (gptr*) &opt_userstat_running, (gptr*) &opt_userstat_running,
1950 +   0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
1951    {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
1952  };
1953  
1954 diff -r 1ac0113deff5 sql/set_var.cc
1955 --- a/sql/set_var.cc    Mon Jun 01 00:35:44 2009 -0700
1956 +++ b/sql/set_var.cc    Mon Jun 01 00:36:01 2009 -0700
1957 @@ -325,6 +325,7 @@
1958  sys_var_thd_ulong      sys_read_buff_size("read_buffer_size",
1959                                            &SV::read_buff_size);
1960  sys_var_bool_ptr       sys_readonly("read_only", &opt_readonly);
1961 +sys_var_bool_ptr       sys_userstat_running("userstat_running", &opt_userstat_running);
1962  sys_var_thd_ulong      sys_read_rnd_buff_size("read_rnd_buffer_size",
1963                                                &SV::read_rnd_buff_size);
1964  sys_var_thd_ulong      sys_div_precincrement("div_precision_increment",
1965 @@ -837,6 +838,7 @@
1966    &sys_trans_alloc_block_size,
1967    &sys_trans_prealloc_size,
1968    &sys_tx_isolation,
1969 +  &sys_userstat_running,
1970    &sys_version,
1971  #ifdef HAVE_BERKELEY_DB
1972    &sys_version_bdb,
1973 @@ -1190,6 +1192,7 @@
1974    {sys_tx_isolation.name,     (char*) &sys_tx_isolation,           SHOW_SYS},
1975    {sys_updatable_views_with_limit.name,
1976                                (char*) &sys_updatable_views_with_limit,SHOW_SYS},
1977 +  {sys_userstat_running.name, (char*) &sys_userstat_running,        SHOW_SYS},
1978    {sys_use_global_long_query_time.name, (char*) &sys_use_global_long_query_time, SHOW_SYS},
1979    {sys_version.name,          (char*) &sys_version,                 SHOW_SYS},
1980  #ifdef HAVE_BERKELEY_DB
1981 diff -r 1ac0113deff5 sql/share/Makefile.in
1982 --- a/sql/share/Makefile.in     Mon Jun 01 00:35:44 2009 -0700
1983 +++ b/sql/share/Makefile.in     Mon Jun 01 00:36:01 2009 -0700
1984 @@ -144,6 +144,7 @@
1985  LIBDL = @LIBDL@
1986  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
1987  LIBOBJS = @LIBOBJS@
1988 +LIBRT = @LIBRT@
1989  LIBS = @LIBS@
1990  LIBTOOL = @LIBTOOL@
1991  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
1992 diff -r 1ac0113deff5 sql/sql_base.cc
1993 --- a/sql/sql_base.cc   Mon Jun 01 00:35:44 2009 -0700
1994 +++ b/sql/sql_base.cc   Mon Jun 01 00:36:01 2009 -0700
1995 @@ -624,6 +624,12 @@
1996    DBUG_ENTER("close_thread_table");
1997    DBUG_ASSERT(table->key_read == 0);
1998    DBUG_ASSERT(!table->file || table->file->inited == handler::NONE);
1999 +  
2000 +  if(table->file)
2001 +  {
2002 +    table->file->update_global_table_stats();
2003 +    table->file->update_global_index_stats();
2004 +  }
2005  
2006    *table_ptr=table->next;
2007    if (table->needs_reopen_or_name_lock() ||
2008 @@ -670,6 +676,9 @@
2009  {
2010    DBUG_ENTER("close_temporary");
2011    char path[FN_REFLEN];
2012 +
2013 +  table->file->update_global_table_stats();
2014 +  table->file->update_global_index_stats();
2015    db_type table_type=table->s->db_type;
2016    strmov(path,table->s->path);
2017    free_io_cache(table);
2018 diff -r 1ac0113deff5 sql/sql_class.cc
2019 --- a/sql/sql_class.cc  Mon Jun 01 00:35:44 2009 -0700
2020 +++ b/sql/sql_class.cc  Mon Jun 01 00:36:01 2009 -0700
2021 @@ -239,6 +239,13 @@
2022    bzero(ha_data, sizeof(ha_data));
2023    mysys_var=0;
2024    binlog_evt_union.do_union= FALSE;
2025 +  busy_time = 0;
2026 +  cpu_time = 0;
2027 +  bytes_received = 0;
2028 +  bytes_sent = 0;
2029 +  binlog_bytes_written = 0;
2030 +  updated_row_count = 0;
2031 +  sent_row_count_2 = 0;
2032  #ifndef DBUG_OFF
2033    dbug_sentry=THD_SENTRY_MAGIC;
2034  #endif
2035 @@ -378,6 +385,88 @@
2036    total_warn_count= 0;
2037    update_charset();
2038    bzero((char *) &status_var, sizeof(status_var));
2039 +  reset_stats();
2040 +}
2041 +
2042 +// Resets stats in a THD.
2043 +void THD::reset_stats(void) {
2044 +  current_connect_time = time(NULL);
2045 +  last_global_update_time = current_connect_time;
2046 +  reset_diff_stats();
2047 +}
2048 +
2049 +// Resets the 'diff' stats, which are used to update global stats.
2050 +void THD::reset_diff_stats(void) {
2051 +  diff_total_busy_time = 0;
2052 +  diff_total_cpu_time = 0;
2053 +  diff_total_bytes_received = 0;
2054 +  diff_total_bytes_sent = 0;
2055 +  diff_total_binlog_bytes_written = 0;
2056 +  diff_total_sent_rows = 0;
2057 +  diff_total_updated_rows = 0;
2058 +  diff_total_read_rows = 0;
2059 +  diff_select_commands = 0;
2060 +  diff_update_commands = 0;
2061 +  diff_other_commands = 0;
2062 +  diff_commit_trans = 0;
2063 +  diff_rollback_trans = 0;
2064 +  diff_denied_connections = 0;
2065 +  diff_lost_connections = 0;
2066 +  diff_access_denied_errors = 0;
2067 +  diff_empty_queries = 0;
2068 +}
2069 +
2070 +// Updates 'diff' stats of a THD.
2071 +void THD::update_stats(bool ran_command) {
2072 +  if (opt_userstat_running) {
2073 +  diff_total_busy_time += busy_time;
2074 +  diff_total_cpu_time += cpu_time;
2075 +  diff_total_bytes_received += bytes_received;
2076 +  diff_total_bytes_sent += bytes_sent;
2077 +  diff_total_binlog_bytes_written += binlog_bytes_written;
2078 +  diff_total_sent_rows += sent_row_count_2;
2079 +  diff_total_updated_rows += updated_row_count;
2080 +  // diff_total_read_rows is updated in handler.cc.
2081 +
2082 +  if (ran_command) {
2083 +    // The replication thread has the COM_CONNECT command.
2084 +    if ((old_command == COM_QUERY || command == COM_CONNECT) &&
2085 +        (lex->sql_command >= 0 && lex->sql_command < SQLCOM_END)) {
2086 +      // A SQL query.
2087 +      if (lex->sql_command == SQLCOM_SELECT) {
2088 +        if (lex->orig_sql_command == SQLCOM_END) {
2089 +          diff_select_commands++;
2090 +          if (!sent_row_count_2)
2091 +            diff_empty_queries++;
2092 +        } else {
2093 +          // 'SHOW ' commands become SQLCOM_SELECT.
2094 +          diff_other_commands++;
2095 +          // 'SHOW ' commands shouldn't inflate total sent row count.
2096 +          diff_total_sent_rows -= sent_row_count_2;
2097 +        }
2098 +      } else if (is_update_query(lex->sql_command)) {
2099 +        diff_update_commands++;
2100 +      } else {
2101 +        diff_other_commands++;
2102 +      }
2103 +    }
2104 +  }
2105 +  // diff_commit_trans is updated in handler.cc.
2106 +  // diff_rollback_trans is updated in handler.cc.
2107 +  // diff_denied_connections is updated in sql_parse.cc.
2108 +  // diff_lost_connections is updated in sql_parse.cc.
2109 +  // diff_access_denied_errors is updated in sql_parse.cc.
2110 +
2111 +  /* reset counters to zero to avoid double-counting since values
2112 +     are already store in diff_total_*. */
2113 +  }
2114 +  busy_time = 0;
2115 +  cpu_time = 0;
2116 +  bytes_received = 0;
2117 +  bytes_sent = 0;
2118 +  binlog_bytes_written = 0;
2119 +  updated_row_count = 0;
2120 +  sent_row_count_2 = 0;
2121  }
2122  
2123  
2124 @@ -907,6 +996,33 @@
2125  }
2126  #endif
2127  
2128 +char *THD::get_client_host_port(THD *client)
2129 +{
2130 +  Security_context *client_sctx= client->security_ctx;
2131 +  char *client_host= NULL;
2132 +
2133 +  if (client->peer_port && (client_sctx->host || client_sctx->ip) &&
2134 +      security_ctx->host_or_ip[0])
2135 +  {
2136 +    if ((client_host= this->alloc(LIST_PROCESS_HOST_LEN+1)))
2137 +      my_snprintf((char *) client_host, LIST_PROCESS_HOST_LEN,
2138 +                  "%s:%u", client_sctx->host_or_ip, client->peer_port);
2139 +  }
2140 +  else
2141 +    client_host= this->strdup(client_sctx->host_or_ip[0] ?
2142 +                              client_sctx->host_or_ip :
2143 +                              client_sctx->host ? client_sctx->host : "");
2144 +
2145 +  return client_host;
2146 +}
2147 +
2148 +const char *get_client_host(THD *client)
2149 +{
2150 +  return client->security_ctx->host_or_ip[0] ?
2151 +      client->security_ctx->host_or_ip :
2152 +      client->security_ctx->host ? client->security_ctx->host : "";
2153 +}
2154 +
2155  
2156  struct Item_change_record: public ilink
2157  {
2158 @@ -1082,6 +1198,7 @@
2159      buffer.set(buff, sizeof(buff), &my_charset_bin);
2160    }
2161    thd->sent_row_count++;
2162 +  thd->sent_row_count_2++;
2163    if (!thd->vio_ok())
2164      DBUG_RETURN(0);
2165    if (!thd->net.report_error)
2166 @@ -1174,6 +1291,7 @@
2167  select_export::~select_export()
2168  {
2169    thd->sent_row_count=row_count;
2170 +  thd->sent_row_count_2=row_count;
2171  }
2172  
2173  
2174 @@ -2108,6 +2226,7 @@
2175    if (likely(thd != 0))
2176    { /* current_thd==0 when close_connection() calls net_send_error() */
2177      thd->status_var.bytes_sent+= length;
2178 +    thd->bytes_sent+= length;
2179    }
2180  }
2181  
2182 @@ -2115,6 +2234,7 @@
2183  void thd_increment_bytes_received(ulong length)
2184  {
2185    current_thd->status_var.bytes_received+= length;
2186 +  current_thd->bytes_received+= length;
2187  }
2188  
2189  
2190 diff -r 1ac0113deff5 sql/sql_class.h
2191 --- a/sql/sql_class.h   Mon Jun 01 00:35:44 2009 -0700
2192 +++ b/sql/sql_class.h   Mon Jun 01 00:36:01 2009 -0700
2193 @@ -1302,6 +1302,8 @@
2194      first byte of the packet in do_command()
2195    */
2196    enum enum_server_command command;
2197 +  // Used to save the command, before it is set to COM_SLEEP.
2198 +  enum enum_server_command old_command;
2199    uint32     server_id;
2200    uint32     file_id;                  // for LOAD DATA INFILE
2201    /*
2202 @@ -1498,6 +1500,8 @@
2203    /* variables.transaction_isolation is reset to this after each commit */
2204    enum_tx_isolation session_tx_isolation;
2205    enum_check_fields count_cuted_fields;
2206 +  ha_rows    updated_row_count;
2207 +  ha_rows    sent_row_count_2; /* for userstat */
2208  
2209    DYNAMIC_ARRAY user_var_events;        /* For user variables replication */
2210    MEM_ROOT      *user_var_events_alloc; /* Allocate above array elements here */
2211 @@ -1607,6 +1611,49 @@
2212    */
2213    LOG_INFO*  current_linfo;
2214    NET*       slave_net;                        // network connection from slave -> m.
2215 +
2216 +  /*
2217 +    Used to update global user stats.  The global user stats are updated
2218 +    occasionally with the 'diff' variables.  After the update, the 'diff'
2219 +    variables are reset to 0.
2220 +   */
2221 +  // Time when the current thread connected to MySQL.
2222 +  time_t current_connect_time;
2223 +  // Last time when THD stats were updated in global_user_stats.
2224 +  time_t last_global_update_time;
2225 +  // Busy (non-idle) time for just one command.
2226 +  double busy_time;
2227 +  // Busy time not updated in global_user_stats yet.
2228 +  double diff_total_busy_time;
2229 +  // Cpu (non-idle) time for just one thread.
2230 +  double cpu_time;
2231 +  // Cpu time not updated in global_user_stats yet.
2232 +  double diff_total_cpu_time;
2233 +  /* bytes counting */
2234 +  ulonglong bytes_received;
2235 +  ulonglong diff_total_bytes_received;
2236 +  ulonglong bytes_sent;
2237 +  ulonglong diff_total_bytes_sent;
2238 +  ulonglong binlog_bytes_written;
2239 +  ulonglong diff_total_binlog_bytes_written;
2240 +
2241 +  // Number of rows not reflected in global_user_stats yet.
2242 +  ha_rows diff_total_sent_rows, diff_total_updated_rows, diff_total_read_rows;
2243 +  // Number of commands not reflected in global_user_stats yet.
2244 +  ulonglong diff_select_commands, diff_update_commands, diff_other_commands;
2245 +  // Number of transactions not reflected in global_user_stats yet.
2246 +  ulonglong diff_commit_trans, diff_rollback_trans;
2247 +  // Number of connection errors not reflected in global_user_stats yet.
2248 +  ulonglong diff_denied_connections, diff_lost_connections;
2249 +  // Number of db access denied, not reflected in global_user_stats yet.
2250 +  ulonglong diff_access_denied_errors;
2251 +  // Number of queries that return 0 rows
2252 +  ulonglong diff_empty_queries;
2253 +
2254 +  // Per account query delay in miliseconds. When not 0, sleep this number of
2255 +  // milliseconds before every SQL command.
2256 +  ulonglong query_delay_millis;
2257 +
2258    /* Used by the sys_var class to store temporary values */
2259    union
2260    {
2261 @@ -1662,6 +1709,11 @@
2262      alloc_root.
2263    */
2264    void init_for_queries();
2265 +  void reset_stats(void);
2266 +  void reset_diff_stats(void);
2267 +  // ran_command is true when this is called immediately after a
2268 +  // command has been run.
2269 +  void update_stats(bool ran_command);
2270    void change_user(void);
2271    void cleanup(void);
2272    void cleanup_after_query();
2273 @@ -1891,8 +1943,14 @@
2274      if (p_db_length)
2275        *p_db_length= db_length;
2276      return FALSE;
2277 +
2278 +  // Returns string as 'IP:port' for the client-side of the connnection represented
2279 +  // by 'client' as displayed by SHOW PROCESSLIST. Allocates memory from the heap of
2280 +  // this THD and that is not reclaimed immediately, so use sparingly. May return NULL.
2281    }
2282  
2283 +  char *get_client_host_port(THD *client);
2284 +
2285  public:
2286    /**
2287      Add an internal error handler to the thread execution context.
2288 @@ -1935,6 +1993,11 @@
2289    MEM_ROOT main_mem_root;
2290  };
2291  
2292 +// Returns string as 'IP' for the client-side of the connection represented by
2293 +// 'client'. Does not allocate memory. May return "".
2294 +const char *get_client_host(THD *client);
2295 +
2296 +#define LIST_PROCESS_HOST_LEN 64
2297  
2298  #define tmp_disable_binlog(A)       \
2299    {ulonglong tmp_disable_binlog__save_options= (A)->options; \
2300 diff -r 1ac0113deff5 sql/sql_delete.cc
2301 --- a/sql/sql_delete.cc Mon Jun 01 00:35:44 2009 -0700
2302 +++ b/sql/sql_delete.cc Mon Jun 01 00:36:01 2009 -0700
2303 @@ -358,6 +358,7 @@
2304      send_ok(thd,deleted);
2305      DBUG_PRINT("info",("%ld records deleted",(long) deleted));
2306    }
2307 +  thd->updated_row_count += deleted;
2308    DBUG_RETURN(error >= 0 || thd->net.report_error);
2309  }
2310  
2311 @@ -869,6 +870,7 @@
2312      thd->row_count_func= deleted;
2313      ::send_ok(thd, deleted);
2314    }
2315 +  thd->updated_row_count += deleted;
2316    return 0;
2317  }
2318  
2319 diff -r 1ac0113deff5 sql/sql_insert.cc
2320 --- a/sql/sql_insert.cc Mon Jun 01 00:35:44 2009 -0700
2321 +++ b/sql/sql_insert.cc Mon Jun 01 00:36:01 2009 -0700
2322 @@ -989,6 +989,7 @@
2323      thd->row_count_func= info.copied + info.deleted + updated;
2324      ::send_ok(thd, (ulong) thd->row_count_func, id, buff);
2325    }
2326 +  thd->updated_row_count += thd->row_count_func;
2327    thd->abort_on_warning= 0;
2328    DBUG_RETURN(FALSE);
2329  
2330 @@ -3064,6 +3065,7 @@
2331      autoinc_value_of_first_inserted_row : thd->insert_id_used ?
2332      thd->last_insert_id : 0;
2333    ::send_ok(thd, (ulong) thd->row_count_func, id, buff);
2334 +  thd->updated_row_count += thd->row_count_func;
2335    DBUG_RETURN(0);
2336  }
2337  
2338 diff -r 1ac0113deff5 sql/sql_lex.h
2339 --- a/sql/sql_lex.h     Mon Jun 01 00:35:44 2009 -0700
2340 +++ b/sql/sql_lex.h     Mon Jun 01 00:36:01 2009 -0700
2341 @@ -101,6 +101,9 @@
2342      When a command is added here, be sure it's also added in mysqld.cc
2343      in "struct show_var_st status_vars[]= {" ...
2344    */
2345 +  // TODO(mcallaghan): update status_vars in mysqld to export these
2346 +  SQLCOM_SHOW_USER_STATS, SQLCOM_SHOW_TABLE_STATS, SQLCOM_SHOW_INDEX_STATS,
2347 +  SQLCOM_SHOW_CLIENT_STATS,
2348    /* This should be the last !!! */
2349    SQLCOM_END
2350  };
2351 diff -r 1ac0113deff5 sql/sql_parse.cc
2352 --- a/sql/sql_parse.cc  Mon Jun 01 00:35:44 2009 -0700
2353 +++ b/sql/sql_parse.cc  Mon Jun 01 00:36:01 2009 -0700
2354 @@ -78,6 +78,12 @@
2355                                const char *table_name);
2356  static bool check_show_create_table_access(THD *thd, TABLE_LIST *table);
2357  
2358 +// Increments connection count for user.
2359 +static int increment_connection_count(THD* thd, bool use_lock);
2360 +
2361 +// Uses the THD to update the global stats by user name and client IP
2362 +void update_global_user_stats(THD* thd, bool create_user, time_t now);
2363 +
2364  const char *any_db="*any*";    // Special symbol for check_access
2365  
2366  const char *command_name[]={
2367 @@ -146,6 +152,17 @@
2368  static bool do_command(THD *thd);
2369  #endif // EMBEDDED_LIBRARY
2370  
2371 +HASH global_user_stats;
2372 +HASH global_client_stats;
2373 +// Protects global_user_stats and global_client_stats
2374 +extern pthread_mutex_t LOCK_global_user_client_stats;
2375 +
2376 +HASH global_table_stats;
2377 +extern pthread_mutex_t LOCK_global_table_stats;
2378 +
2379 +HASH global_index_stats;
2380 +extern pthread_mutex_t LOCK_global_index_stats;
2381 +
2382  #ifdef __WIN__
2383  extern void win_install_sigabrt_handler(void);
2384  #endif
2385 @@ -504,6 +521,7 @@
2386      mysql_log.write(thd,COM_CONNECT,ER(ER_NOT_SUPPORTED_AUTH_MODE));
2387      DBUG_RETURN(-1);
2388    }
2389 +  thd->diff_access_denied_errors++;
2390    net_printf_error(thd, ER_ACCESS_DENIED_ERROR,
2391                     thd->main_security_ctx.user,
2392                     thd->main_security_ctx.host_or_ip,
2393 @@ -536,12 +554,190 @@
2394  void init_max_user_conn(void)
2395  {
2396  #ifndef NO_EMBEDDED_ACCESS_CHECKS
2397 -  (void) hash_init(&hash_user_connections,system_charset_info,max_connections,
2398 -                  0,0,
2399 -                  (hash_get_key) get_key_conn, (hash_free_key) free_user,
2400 -                  0);
2401 -#endif
2402 -}
2403 +  if (hash_init(&hash_user_connections,system_charset_info,max_connections,
2404 +                0,0,
2405 +                (hash_get_key) get_key_conn, (hash_free_key) free_user,
2406 +                0)) {
2407 +    sql_print_error("Initializing hash_user_connections failed.");
2408 +    exit(1);
2409 +  }
2410 +#endif
2411 +}
2412 +
2413 +byte *get_key_user_stats(USER_STATS *user_stats, uint *length,
2414 +                         my_bool not_used __attribute__((unused)))
2415 +{
2416 +  *length = strlen(user_stats->user);
2417 +  return (byte*)user_stats->user;
2418 +}
2419 +
2420 +void free_user_stats(USER_STATS* user_stats)
2421 +{
2422 +  my_free((char*)user_stats, MYF(0));
2423 +}
2424 +
2425 +void init_user_stats(USER_STATS *user_stats,
2426 +                     const char *user,
2427 +                     const char *priv_user,
2428 +                     uint total_connections,
2429 +                     uint concurrent_connections,
2430 +                     time_t connected_time,
2431 +                     double busy_time,
2432 +                     double cpu_time,
2433 +                     ulonglong bytes_received,
2434 +                     ulonglong bytes_sent,
2435 +                     ulonglong binlog_bytes_written,
2436 +                     ha_rows rows_fetched,
2437 +                     ha_rows rows_updated,
2438 +                     ha_rows rows_read,
2439 +                     ulonglong select_commands,
2440 +                     ulonglong update_commands,
2441 +                     ulonglong other_commands,
2442 +                     ulonglong commit_trans,
2443 +                     ulonglong rollback_trans,
2444 +                     ulonglong denied_connections,
2445 +                     ulonglong lost_connections,
2446 +                     ulonglong access_denied_errors,
2447 +                     ulonglong empty_queries)
2448 +{
2449 +  DBUG_ENTER("init_user_stats");
2450 +  DBUG_PRINT("info",
2451 +             ("Add user_stats entry for user %s - priv_user %s",
2452 +              user, priv_user));
2453 +  strncpy(user_stats->user, user, sizeof(user_stats->user));
2454 +  strncpy(user_stats->priv_user, priv_user, sizeof(user_stats->priv_user));
2455 +
2456 +  user_stats->total_connections = total_connections;
2457 +  user_stats->concurrent_connections = concurrent_connections;
2458 +  user_stats->connected_time = connected_time;
2459 +  user_stats->busy_time = busy_time;
2460 +  user_stats->cpu_time = cpu_time;
2461 +  user_stats->bytes_received = bytes_received;
2462 +  user_stats->bytes_sent = bytes_sent;
2463 +  user_stats->binlog_bytes_written = binlog_bytes_written;
2464 +  user_stats->rows_fetched = rows_fetched;
2465 +  user_stats->rows_updated = rows_updated;
2466 +  user_stats->rows_read = rows_read;
2467 +  user_stats->select_commands = select_commands;
2468 +  user_stats->update_commands = update_commands;
2469 +  user_stats->other_commands = other_commands;
2470 +  user_stats->commit_trans = commit_trans;
2471 +  user_stats->rollback_trans = rollback_trans;
2472 +  user_stats->denied_connections = denied_connections;
2473 +  user_stats->lost_connections = lost_connections;
2474 +  user_stats->access_denied_errors = access_denied_errors;
2475 +  user_stats->empty_queries = empty_queries;
2476 +  DBUG_VOID_RETURN;
2477 +}
2478 +
2479 +void add_user_stats(USER_STATS *user_stats,
2480 +                    uint total_connections,
2481 +                    uint concurrent_connections,
2482 +                    time_t connected_time,
2483 +                    double busy_time,
2484 +                    double cpu_time,
2485 +                    ulonglong bytes_received,
2486 +                    ulonglong bytes_sent,
2487 +                    ulonglong binlog_bytes_written,
2488 +                    ha_rows rows_fetched,
2489 +                    ha_rows rows_updated,
2490 +                    ha_rows rows_read,
2491 +                    ulonglong select_commands,
2492 +                    ulonglong update_commands,
2493 +                    ulonglong other_commands,
2494 +                    ulonglong commit_trans,
2495 +                    ulonglong rollback_trans,
2496 +                    ulonglong denied_connections,
2497 +                    ulonglong lost_connections,
2498 +                    ulonglong access_denied_errors,
2499 +                    ulonglong empty_queries)
2500 +{
2501 +  user_stats->total_connections += total_connections;
2502 +  user_stats->concurrent_connections += concurrent_connections;
2503 +  user_stats->connected_time += connected_time;
2504 +  user_stats->busy_time += busy_time;
2505 +  user_stats->cpu_time += cpu_time;
2506 +  user_stats->bytes_received += bytes_received;
2507 +  user_stats->bytes_sent += bytes_sent;
2508 +  user_stats->binlog_bytes_written += binlog_bytes_written;
2509 +  user_stats->rows_fetched += rows_fetched;
2510 +  user_stats->rows_updated += rows_updated;
2511 +  user_stats->rows_read += rows_read;
2512 +  user_stats->select_commands += select_commands;
2513 +  user_stats->update_commands += update_commands;
2514 +  user_stats->other_commands += other_commands;
2515 +  user_stats->commit_trans += commit_trans;
2516 +  user_stats->rollback_trans += rollback_trans;
2517 +  user_stats->denied_connections += denied_connections;
2518 +  user_stats->lost_connections += lost_connections;
2519 +  user_stats->access_denied_errors += access_denied_errors;
2520 +  user_stats->empty_queries += empty_queries;
2521 +}
2522 +
2523 +void init_global_user_stats(void)
2524 +{
2525 +  if (hash_init(&global_user_stats, system_charset_info, max_connections,
2526 +                0, 0, (hash_get_key)get_key_user_stats,
2527 +                (hash_free_key)free_user_stats, 0)) {
2528 +    sql_print_error("Initializing global_user_stats failed.");
2529 +    exit(1);
2530 +  }
2531 +}
2532 +
2533 +void init_global_client_stats(void)
2534 +{
2535 +  if (hash_init(&global_client_stats, system_charset_info, max_connections,
2536 +                0, 0, (hash_get_key)get_key_user_stats,
2537 +                (hash_free_key)free_user_stats, 0)) {
2538 +    sql_print_error("Initializing global_client_stats failed.");
2539 +    exit(1);
2540 +  }
2541 +}
2542 +
2543 +extern "C" byte *get_key_table_stats(TABLE_STATS *table_stats, uint *length,
2544 +                                     my_bool not_used __attribute__((unused)))
2545 +{
2546 +  *length = strlen(table_stats->table);
2547 +  return (byte*)table_stats->table;
2548 +}
2549 +
2550 +extern "C" void free_table_stats(TABLE_STATS* table_stats)
2551 +{
2552 +  my_free((char*)table_stats, MYF(0));
2553 +}
2554 +
2555 +void init_global_table_stats(void)
2556 +{
2557 +  if (hash_init(&global_table_stats, system_charset_info, max_connections,
2558 +                0, 0, (hash_get_key)get_key_table_stats,
2559 +                (hash_free_key)free_table_stats, 0)) {
2560 +    sql_print_error("Initializing global_table_stats failed.");
2561 +    exit(1);
2562 +  }
2563 +}
2564 +
2565 +extern "C" byte *get_key_index_stats(INDEX_STATS *index_stats, uint *length,
2566 +                                     my_bool not_used __attribute__((unused)))
2567 +{
2568 +  *length = strlen(index_stats->index);
2569 +  return (byte*)index_stats->index;
2570 +}
2571 +
2572 +extern "C" void free_index_stats(INDEX_STATS* index_stats)
2573 +{
2574 +  my_free((char*)index_stats, MYF(0));
2575 +}
2576 +
2577 +void init_global_index_stats(void)
2578 +{
2579 +  if (hash_init(&global_index_stats, system_charset_info, max_connections,
2580 +                0, 0, (hash_get_key)get_key_index_stats,
2581 +                (hash_free_key)free_index_stats, 0)) {
2582 +    sql_print_error("Initializing global_index_stats failed.");
2583 +    exit(1);
2584 +  }
2585 +}
2586 +
2587  
2588  
2589  /*
2590 @@ -599,7 +795,10 @@
2591  
2592    end:
2593    if (error)
2594 +  {
2595 +    statistic_increment(denied_connections, &LOCK_status);
2596      uc->connections--; // no need for decrease_user_connections() here
2597 +  }
2598    (void) pthread_mutex_unlock(&LOCK_user_conn);
2599    DBUG_RETURN(error);
2600  }
2601 @@ -646,6 +845,25 @@
2602  #endif /* NO_EMBEDDED_ACCESS_CHECKS */
2603  }
2604  
2605 +void free_global_user_stats(void)
2606 +{
2607 +  hash_free(&global_user_stats);
2608 +}
2609 +
2610 +void free_global_table_stats(void)
2611 +{
2612 +  hash_free(&global_table_stats);
2613 +}
2614 +
2615 +void free_global_index_stats(void)
2616 +{
2617 +  hash_free(&global_index_stats);
2618 +}
2619 +
2620 +void free_global_client_stats(void)
2621 +{
2622 +  hash_free(&global_client_stats);
2623 +}
2624  
2625  
2626  /*
2627 @@ -698,6 +916,214 @@
2628    return uc_update_queries[command] != 0;
2629  }
2630  
2631 +// 'mysql_system_user' is used for when the user is not defined for a THD.
2632 +static char mysql_system_user[] = "#mysql_system#";
2633 +
2634 +// Returns 'user' if it's not NULL.  Returns 'mysql_system_user' otherwise.
2635 +static char* get_valid_user_string(char* user) {
2636 +  return user ? user : mysql_system_user;
2637 +}
2638 +
2639 +// Increments the global stats connection count for an entry from
2640 +// global_client_stats or global_user_stats. Returns 0 on success
2641 +// and 1 on error.
2642 +static int increment_count_by_name(const char *name, const char *role_name,
2643 +                                   HASH *users_or_clients, THD *thd)
2644 +{
2645 +  USER_STATS* user_stats;
2646 +
2647 +  if (!(user_stats = (USER_STATS*)hash_search(users_or_clients, name,
2648 +                                              strlen(name))))
2649 +  {
2650 +    // First connection for this user or client
2651 +    if (!(user_stats = ((USER_STATS*)
2652 +                        my_malloc(sizeof(USER_STATS), MYF(MY_WME | MY_ZEROFILL)))))
2653 +    {
2654 +      return 1; // Out of memory
2655 +    }
2656 +
2657 +    init_user_stats(user_stats, name, role_name,
2658 +                    0, 0,      // connections
2659 +                    0, 0, 0,   // time
2660 +                    0, 0, 0,   // bytes sent, received and written
2661 +                    0, 0, 0,   // rows fetched, updated and read
2662 +                    0, 0, 0,   // select, update and other commands
2663 +                    0, 0,      // commit and rollback trans
2664 +                    thd->diff_denied_connections,
2665 +                    0,         // lost connections
2666 +                    0,         // access denied errors
2667 +                    0);        // empty queries
2668 +
2669 +    if (my_hash_insert(users_or_clients, (byte*)user_stats))
2670 +    {
2671 +      my_free((char*)user_stats, 0);
2672 +      return 1; // Out of memory
2673 +    }
2674 +  }
2675 +  user_stats->total_connections++;
2676 +  return 0;
2677 +}
2678 +
2679 +// Increments the global user and client stats connection count.  If 'use_lock'
2680 +// is true, LOCK_global_user_client_stats will be locked/unlocked.  Returns
2681 +// 0 on success, 1 on error.
2682 +static int increment_connection_count(THD* thd, bool use_lock)
2683 +{
2684 +  char* user_string = get_valid_user_string(thd->main_security_ctx.user);
2685 +  const char* client_string = get_client_host(thd);
2686 +  int return_value = 0;
2687 +
2688 +  if (!opt_userstat_running)
2689 +    return return_value;
2690 +
2691 +  if (use_lock) pthread_mutex_lock(&LOCK_global_user_client_stats);
2692 +
2693 +  if (increment_count_by_name(user_string, user_string,
2694 +                              &global_user_stats, thd))
2695 +  {
2696 +    return_value = 1;
2697 +    goto end;
2698 +  }
2699 +  if (increment_count_by_name(client_string,
2700 +                              user_string,
2701 +                              &global_client_stats, thd))
2702 +  {
2703 +    return_value = 1;
2704 +    goto end;
2705 +  }
2706 +
2707 +end:
2708 +  if (use_lock) pthread_mutex_unlock(&LOCK_global_user_client_stats);
2709 +  return return_value;
2710 +}
2711 +
2712 +// Used to update the global user and client stats.
2713 +static void update_global_user_stats_with_user(THD* thd,
2714 +                                               USER_STATS* user_stats,
2715 +                                               time_t now)
2716 +{
2717 +  user_stats->connected_time += now - thd->last_global_update_time;
2718 +  thd->last_global_update_time = now;
2719 +  user_stats->busy_time += thd->diff_total_busy_time;
2720 +  user_stats->cpu_time += thd->diff_total_cpu_time;
2721 +  user_stats->bytes_received += thd->diff_total_bytes_received;
2722 +  user_stats->bytes_sent += thd->diff_total_bytes_sent;
2723 +  user_stats->binlog_bytes_written += thd->diff_total_binlog_bytes_written;
2724 +  user_stats->rows_fetched += thd->diff_total_sent_rows;
2725 +  user_stats->rows_updated += thd->diff_total_updated_rows;
2726 +  user_stats->rows_read += thd->diff_total_read_rows;
2727 +  user_stats->select_commands += thd->diff_select_commands;
2728 +  user_stats->update_commands += thd->diff_update_commands;
2729 +  user_stats->other_commands += thd->diff_other_commands;
2730 +  user_stats->commit_trans += thd->diff_commit_trans;
2731 +  user_stats->rollback_trans += thd->diff_rollback_trans;
2732 +  user_stats->denied_connections += thd->diff_denied_connections;
2733 +  user_stats->lost_connections += thd->diff_lost_connections;
2734 +  user_stats->access_denied_errors += thd->diff_access_denied_errors;
2735 +  user_stats->empty_queries += thd->diff_empty_queries;
2736 +}
2737 +
2738 +// Updates the global stats of a user or client
2739 +void update_global_user_stats(THD* thd, bool create_user, time_t now)
2740 +{
2741 +  if (opt_userstat_running) {
2742 +  char* user_string = get_valid_user_string(thd->main_security_ctx.user);
2743 +  const char* client_string = get_client_host(thd);
2744 +
2745 +  USER_STATS* user_stats;
2746 +  pthread_mutex_lock(&LOCK_global_user_client_stats);
2747 +
2748 +  // Update by user name
2749 +  if ((user_stats = (USER_STATS*)hash_search(&global_user_stats,
2750 +                                             (byte*)user_string,
2751 +                                             strlen(user_string)))) {
2752 +    // Found user.
2753 +    update_global_user_stats_with_user(thd, user_stats, now);
2754 +  } else {
2755 +    // Create the entry
2756 +    if (create_user) {
2757 +      increment_count_by_name(user_string, user_string,
2758 +                              &global_user_stats, thd);
2759 +    }
2760 +  }
2761 +
2762 +  // Update by client IP
2763 +  if ((user_stats = (USER_STATS*)hash_search(&global_client_stats,
2764 +                                             (byte*)client_string,
2765 +                                             strlen(client_string)))) {
2766 +    // Found by client IP
2767 +    update_global_user_stats_with_user(thd, user_stats, now);
2768 +  } else {
2769 +    // Create the entry
2770 +    if (create_user) {
2771 +      increment_count_by_name(client_string,
2772 +                              user_string,
2773 +                              &global_client_stats, thd);
2774 +    }
2775 +  }
2776 +  thd->reset_diff_stats();
2777 +
2778 +  pthread_mutex_unlock(&LOCK_global_user_client_stats);
2779 +  } else {
2780 +  thd->reset_diff_stats();
2781 +  }
2782 +}
2783 +
2784 +// Determines the concurrent number of connections of current threads.
2785 +static void set_connections_stats()
2786 +{
2787 +  USER_STATS* user_stats;
2788 +
2789 +  pthread_mutex_lock(&LOCK_global_user_client_stats);
2790 +  pthread_mutex_lock(&LOCK_thread_count);
2791 +
2792 +  // Resets all concurrent connections to 0.
2793 +  for (int i = 0; i < global_user_stats.records; ++i) {
2794 +    user_stats = (USER_STATS*)hash_element(&global_user_stats, i);
2795 +    user_stats->concurrent_connections = 0;
2796 +  }
2797 +  for (int i = 0; i < global_client_stats.records; ++i) {
2798 +    user_stats = (USER_STATS*)hash_element(&global_client_stats, i);
2799 +    user_stats->concurrent_connections = 0;
2800 +  }
2801 +
2802 +  I_List_iterator<THD> it(threads);
2803 +  THD* thd;
2804 +  time_t now = time(NULL);
2805 +  // Iterates through the current threads.
2806 +  while ((thd = it++)) {
2807 +    char* user_string = get_valid_user_string(thd->main_security_ctx.user);
2808 +    if ((user_stats = (USER_STATS*)hash_search(&global_user_stats,
2809 +                                               (byte*)user_string,
2810 +                                               strlen(user_string)))) {
2811 +      // Found user.
2812 +      user_stats->concurrent_connections++;
2813 +      update_global_user_stats_with_user(thd, user_stats, now);
2814 +    } else {
2815 +      // The user name should exist.
2816 +      if (user_string == mysql_system_user) {
2817 +        // Only create the user if it is the mysql_system_user
2818 +        increment_count_by_name(user_string, user_string,
2819 +                                &global_user_stats, thd);
2820 +      }
2821 +    }
2822 +
2823 +    const char* client_string = get_client_host(thd);
2824 +    if ((user_stats = (USER_STATS*)hash_search(&global_client_stats,
2825 +                                               (byte*)client_string,
2826 +                                               strlen(client_string)))) {
2827 +      // Found user.
2828 +      user_stats->concurrent_connections++;
2829 +      update_global_user_stats_with_user(thd, user_stats, now);
2830 +    } else {
2831 +      // Do nothing, unlike what is done for global_user_stats
2832 +    }
2833 +    thd->reset_diff_stats();
2834 +  }
2835 +  pthread_mutex_unlock(&LOCK_thread_count);
2836 +  pthread_mutex_unlock(&LOCK_global_user_client_stats);
2837 +}
2838 +
2839  /*
2840    Reset per-hour user resource limits when it has been more than
2841    an hour since they were last checked
2842 @@ -1184,6 +1610,8 @@
2843      my_net_set_read_timeout(net, connect_timeout);
2844      my_net_set_write_timeout(net, connect_timeout);
2845  
2846 +    bool create_user = true;
2847 +
2848      if ((error=check_connection(thd)))
2849      {                                          // Wrong permissions
2850        if (error > 0)
2851 @@ -1193,8 +1621,22 @@
2852         my_sleep(1000);                         /* must wait after eof() */
2853  #endif
2854        statistic_increment(aborted_connects,&LOCK_status);
2855 +      thd->diff_denied_connections++;
2856 +      if (error == -2) {
2857 +        // Do not create statistics for a user who does not exist, or failed
2858 +        // to authenticate.
2859 +        create_user = false;
2860 +      }
2861        goto end_thread;
2862      }
2863 +
2864 +    thd->reset_stats();
2865 +    // Updates global user connection stats.
2866 +    if (increment_connection_count(thd, true)) {
2867 +      net_send_error(thd, ER_OUTOFMEMORY);  // Out of memory
2868 +      goto end_thread;
2869 +    }
2870 +
2871  #ifdef __NETWARE__
2872      netware_reg_user(sctx->ip, sctx->user, "MySQL");
2873  #endif
2874 @@ -1251,6 +1693,7 @@
2875          net->vio && net->error && net->report_error)
2876      {
2877        statistic_increment(aborted_threads, &LOCK_status);
2878 +      thd->diff_lost_connections++;
2879      }
2880  
2881      if (net->error && net->vio != 0 && net->report_error)
2882 @@ -1270,6 +1713,8 @@
2883  
2884  end_thread:
2885      close_connection(thd, 0, 1);
2886 +    thd->update_stats(false);
2887 +    update_global_user_stats(thd, create_user, time(NULL));
2888      end_thread(thd,1);
2889      /*
2890        If end_thread returns, we are either running with --one-thread
2891 @@ -1601,6 +2046,13 @@
2892  
2893    thd->clear_error();                          // Clear error message
2894  
2895 +  thd->updated_row_count=0;
2896 +  thd->busy_time=0;
2897 +  thd->cpu_time=0;
2898 +  thd->bytes_received=0;
2899 +  thd->bytes_sent=0;
2900 +  thd->binlog_bytes_written=0;
2901 +
2902    net_new_transaction(net);
2903  
2904    packet_length= my_net_read(net);
2905 @@ -1759,6 +2211,9 @@
2906    }
2907  
2908    thd->command=command;
2909 +  // To increment the corrent command counter for user stats, 'command' must
2910 +  // be saved because it is set to COM_SLEEP at the end of this function.
2911 +  thd->old_command = command;
2912    /*
2913      Commands which always take a long time are logged into
2914      the slow log only if opt_log_slow_admin_statements is set.
2915 @@ -4540,6 +4995,15 @@
2916      if (check_global_access(thd,RELOAD_ACL))
2917        goto error;
2918  
2919 +    if(lex->type & REFRESH_SLOW_QUERY_LOG) {
2920 +        /* We are only flushing slow query log */
2921 +        mysql_slow_log.new_file(1);
2922 +    
2923 +        send_ok(thd);
2924 +        break;
2925 +    }
2926 +
2927 +
2928      /*
2929        reload_acl_and_cache() will tell us if we are allowed to write to the
2930        binlog or not.
2931 @@ -4848,6 +5312,7 @@
2932      {
2933        if (check_global_access(thd, SUPER_ACL))
2934        {
2935 +        thd->diff_access_denied_errors++;
2936          my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
2937          goto create_sp_error;
2938        }
2939 @@ -5692,6 +6157,7 @@
2940        if (!no_errors)
2941        {
2942          const char *db_name= db ? db : thd->db;
2943 +        thd->diff_access_denied_errors++;
2944          my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
2945                   sctx->priv_user, sctx->priv_host, db_name);
2946        }
2947 @@ -5727,6 +6193,7 @@
2948    {                                            // We can never grant this
2949      DBUG_PRINT("error",("No possible access"));
2950      if (!no_errors)
2951 +      thd->diff_access_denied_errors++;
2952        my_error(ER_ACCESS_DENIED_ERROR, MYF(0),
2953                 sctx->priv_user,
2954                 sctx->priv_host,
2955 @@ -5759,11 +6226,15 @@
2956  
2957    DBUG_PRINT("error",("Access denied"));
2958    if (!no_errors)
2959 +  {
2960 +    // increment needs !no_errors condition, otherwise double counting.
2961 +    thd->diff_access_denied_errors++;
2962      my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
2963               sctx->priv_user, sctx->priv_host,
2964               (db ? db : (thd->db ?
2965                           thd->db :
2966                           "unknown")));          /* purecov: tested */
2967 +  }
2968    DBUG_RETURN(TRUE);                           /* purecov: tested */
2969  #endif /* NO_EMBEDDED_ACCESS_CHECKS */
2970  }
2971 @@ -5797,6 +6268,7 @@
2972    if ((thd->security_ctx->master_access & want_access))
2973      return 0;
2974    get_privilege_desc(command, sizeof(command), want_access);
2975 +  thd->diff_access_denied_errors++;
2976    my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
2977    return 1;
2978  #endif /* NO_EMBEDDED_ACCESS_CHECKS */
2979 @@ -5829,6 +6301,7 @@
2980  
2981        if (!thd->col_access && check_grant_db(thd, dst_db_name))
2982        {
2983 +        thd->diff_access_denied_errors++;
2984          my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
2985                   thd->security_ctx->priv_user,
2986                   thd->security_ctx->priv_host,
2987 @@ -5860,6 +6333,12 @@
2988               check_grant(thd, SELECT_ACL, dst_table, 2, UINT_MAX, FALSE);
2989      }
2990  
2991
2992 +  case SCH_USER_STATS:
2993 +  case SCH_CLIENT_STATS:
2994 +     return check_global_access(thd, SUPER_ACL | PROCESS_ACL);
2995 +  case SCH_TABLE_STATS:
2996 +  case SCH_INDEX_STATS:
2997    case SCH_OPEN_TABLES:
2998    case SCH_VARIABLES:
2999    case SCH_STATUS:
3000 @@ -5913,8 +6392,8 @@
3001  #ifndef NO_EMBEDDED_ACCESS_CHECKS
3002    TABLE_LIST *org_tables= tables;
3003  #endif
3004 +  Security_context *sctx= thd->security_ctx, *backup_ctx= thd->security_ctx;
3005    TABLE_LIST *first_not_own_table= thd->lex->first_not_own_table();
3006 -  Security_context *sctx= thd->security_ctx, *backup_ctx= thd->security_ctx;
3007    /*
3008      The check that first_not_own_table is not reached is for the case when
3009      the given table list refers to the list for prelocking (contains tables
3010 @@ -5931,9 +6410,12 @@
3011          (want_access & ~(SELECT_ACL | EXTRA_ACL | FILE_ACL)))
3012      {
3013        if (!no_errors)
3014 +      {
3015 +        thd->diff_access_denied_errors++;
3016          my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
3017                   sctx->priv_user, sctx->priv_host,
3018                   INFORMATION_SCHEMA_NAME.str);
3019 +      }
3020        return TRUE;
3021      }
3022      /*
3023 @@ -6443,6 +6925,30 @@
3024    lex_start(thd);
3025    mysql_reset_thd_for_next_command(thd);
3026  
3027 +  int start_time_error = 0;
3028 +  int end_time_error = 0;
3029 +  struct timeval start_time, end_time;
3030 +  double start_usecs = 0;
3031 +  double end_usecs = 0;
3032 +  /* cpu time */
3033 +  int cputime_error = 0;
3034 +  struct timespec tp;
3035 +  double start_cpu_nsecs = 0;
3036 +  double end_cpu_nsecs = 0;
3037 +
3038 +  if (opt_userstat_running) {
3039 +#ifdef HAVE_CLOCK_GETTIME
3040 +    /* get start cputime */ 
3041 +    if (!(cputime_error = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tp)))
3042 +      start_cpu_nsecs = tp.tv_sec*1000000000.0+tp.tv_nsec;
3043 +#endif
3044 +
3045 +    // Gets the start time, in order to measure how long this command takes.
3046 +    if (!(start_time_error = gettimeofday(&start_time, NULL))) {
3047 +      start_usecs = start_time.tv_sec * 1000000.0 + start_time.tv_usec;
3048 +    }
3049 +  }
3050 +
3051    if (query_cache_send_result_to_client(thd, (char*) inBuf, length) <= 0)
3052    {
3053      LEX *lex= thd->lex;
3054 @@ -6521,6 +7027,43 @@
3055      *found_semicolon= NULL;
3056    }
3057  
3058 +  if (opt_userstat_running) {
3059 +    // Gets the end time.
3060 +    if (!(end_time_error = gettimeofday(&end_time, NULL))) {
3061 +      end_usecs = end_time.tv_sec * 1000000.0 + end_time.tv_usec;
3062 +    }
3063 +
3064 +    // Calculates the difference between the end and start times.
3065 +    if (start_usecs && end_usecs >= start_usecs && !start_time_error && !end_time_error) {
3066 +      thd->busy_time = (end_usecs - start_usecs) / 1000000;
3067 +      // In case there are bad values, 2629743 is the #seconds in a month.
3068 +      if (thd->busy_time > 2629743) {
3069 +        thd->busy_time = 0;
3070 +      }
3071 +    } else {
3072 +      // end time went back in time, or gettimeofday() failed.
3073 +      thd->busy_time = 0;
3074 +    }
3075 +
3076 +#ifdef HAVE_CLOCK_GETTIME
3077 +    /* get end cputime */
3078 +    if (!cputime_error &&
3079 +        !(cputime_error = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tp)))
3080 +      end_cpu_nsecs = tp.tv_sec*1000000000.0+tp.tv_nsec;
3081 +#endif
3082 +    if (start_cpu_nsecs && !cputime_error) {
3083 +      thd->cpu_time = (end_cpu_nsecs - start_cpu_nsecs) / 1000000000;
3084 +      // In case there are bad values, 2629743 is the #seconds in a month.
3085 +      if (thd->cpu_time > 2629743) {
3086 +        thd->cpu_time = 0;
3087 +      }
3088 +    } else
3089 +      thd->cpu_time = 0;
3090 +  }
3091 +  // Updates THD stats and the global user stats.
3092 +  thd->update_stats(true);
3093 +  update_global_user_stats(thd, true, time(NULL));
3094 +
3095    DBUG_VOID_RETURN;
3096  }
3097  
3098 @@ -7532,8 +8075,35 @@
3099     pthread_mutex_unlock(&LOCK_active_mi);
3100   }
3101  #endif
3102 - if (options & REFRESH_USER_RESOURCES)
3103 -   reset_mqh((LEX_USER *) NULL);
3104 +  if (options & REFRESH_TABLE_STATS)
3105 +  {
3106 +    pthread_mutex_lock(&LOCK_global_table_stats);
3107 +    free_global_table_stats();
3108 +    init_global_table_stats();
3109 +    pthread_mutex_unlock(&LOCK_global_table_stats);
3110 +  }
3111 +  if (options & REFRESH_INDEX_STATS)
3112 +  {
3113 +    pthread_mutex_lock(&LOCK_global_index_stats);
3114 +    free_global_index_stats();
3115 +    init_global_index_stats();
3116 +    pthread_mutex_unlock(&LOCK_global_index_stats);
3117 +  }
3118 +  if (options & (REFRESH_USER_STATS | REFRESH_CLIENT_STATS))
3119 +  {
3120 +    pthread_mutex_lock(&LOCK_global_user_client_stats);
3121 +    if (options & REFRESH_USER_STATS)
3122 +    {
3123 +      free_global_user_stats();
3124 +      init_global_user_stats();
3125 +    }
3126 +    if (options & REFRESH_CLIENT_STATS)
3127 +    {
3128 +      free_global_client_stats();
3129 +      init_global_client_stats();
3130 +    }
3131 +    pthread_mutex_unlock(&LOCK_global_user_client_stats);
3132 +  }
3133   *write_to_binlog= tmp_write_to_binlog;
3134   return result;
3135  }
3136 diff -r 1ac0113deff5 sql/sql_prepare.cc
3137 --- a/sql/sql_prepare.cc        Mon Jun 01 00:35:44 2009 -0700
3138 +++ b/sql/sql_prepare.cc        Mon Jun 01 00:36:01 2009 -0700
3139 @@ -81,6 +81,9 @@
3140  #include <mysql_com.h>
3141  #endif
3142  
3143 +// Uses the THD to update the global stats by user name and client IP
3144 +void update_global_user_stats(THD* thd, bool create_user, time_t now);
3145 +
3146  /* A result class used to send cursor rows using the binary protocol. */
3147  
3148  class Select_fetch_protocol_prep: public select_send
3149 @@ -1910,8 +1913,32 @@
3150    /* First of all clear possible warnings from the previous command */
3151    mysql_reset_thd_for_next_command(thd);
3152  
3153 +  int start_time_error = 0;
3154 +  int end_time_error = 0;
3155 +  struct timeval start_time, end_time;
3156 +  double start_usecs = 0;
3157 +  double end_usecs = 0;
3158 +  /* cpu time */
3159 +  int cputime_error = 0;
3160 +  struct timespec tp;
3161 +  double start_cpu_nsecs = 0;
3162 +  double end_cpu_nsecs = 0;
3163 +
3164 +  if (opt_userstat_running) {
3165 +#ifdef HAVE_CLOCK_GETTIME
3166 +    /* get start cputime */
3167 +    if (!(cputime_error = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tp)))
3168 +      start_cpu_nsecs = tp.tv_sec*1000000000.0+tp.tv_nsec;
3169 +#endif
3170 +
3171 +    // Gets the start time, in order to measure how long this command takes.
3172 +    if (!(start_time_error = gettimeofday(&start_time, NULL))) {
3173 +      start_usecs = start_time.tv_sec * 1000000.0 + start_time.tv_usec;
3174 +    }
3175 +  }
3176 +
3177    if (! (stmt= new Prepared_statement(thd, &thd->protocol_prep)))
3178 -    DBUG_VOID_RETURN; /* out of memory: error is set in Sql_alloc */
3179 +    goto end; /* out of memory: error is set in Sql_alloc */
3180  
3181    if (thd->stmt_map.insert(thd, stmt))
3182    {
3183 @@ -1919,7 +1946,7 @@
3184        The error is set in the insert. The statement itself
3185        will be also deleted there (this is how the hash works).
3186      */
3187 -    DBUG_VOID_RETURN;
3188 +    goto end;
3189    }
3190  
3191    /* Reset warnings from previous command */
3192 @@ -1941,6 +1968,44 @@
3193      thd->stmt_map.erase(stmt);
3194    }
3195    /* check_prepared_statemnt sends the metadata packet in case of success */
3196 +end:
3197 +  if (opt_userstat_running) {
3198 +    // Gets the end time.
3199 +    if (!(end_time_error = gettimeofday(&end_time, NULL))) {
3200 +      end_usecs = end_time.tv_sec * 1000000.0 + end_time.tv_usec;
3201 +    }
3202 +
3203 +    // Calculates the difference between the end and start times.
3204 +    if (start_usecs && end_usecs >= start_usecs && !start_time_error && !end_time_error) {
3205 +      thd->busy_time = (end_usecs - start_usecs) / 1000000;
3206 +      // In case there are bad values, 2629743 is the #seconds in a month.
3207 +      if (thd->busy_time > 2629743) {
3208 +        thd->busy_time = 0;
3209 +      }
3210 +    } else {
3211 +      // end time went back in time, or gettimeofday() failed.
3212 +      thd->busy_time = 0;
3213 +    }
3214 +
3215 +#ifdef HAVE_CLOCK_GETTIME
3216 +    /* get end cputime */
3217 +    if (!cputime_error &&
3218 +        !(cputime_error = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tp)))
3219 +      end_cpu_nsecs = tp.tv_sec*1000000000.0+tp.tv_nsec;
3220 +#endif
3221 +    if (start_cpu_nsecs && !cputime_error) {
3222 +      thd->cpu_time = (end_cpu_nsecs - start_cpu_nsecs) / 1000000000;
3223 +      // In case there are bad values, 2629743 is the #seconds in a month.
3224 +      if (thd->cpu_time > 2629743) {
3225 +        thd->cpu_time = 0;
3226 +      }
3227 +    } else
3228 +      thd->cpu_time = 0;
3229 +  }
3230 +  // Updates THD stats and the global user stats.
3231 +  thd->update_stats(true);
3232 +  update_global_user_stats(thd, true, time(NULL));
3233 +
3234    DBUG_VOID_RETURN;
3235  }
3236  
3237 @@ -2281,8 +2346,32 @@
3238    /* First of all clear possible warnings from the previous command */
3239    mysql_reset_thd_for_next_command(thd);
3240  
3241 +  int start_time_error = 0;
3242 +  int end_time_error = 0;
3243 +  struct timeval start_time, end_time;
3244 +  double start_usecs = 0;
3245 +  double end_usecs = 0;
3246 +  /* cpu time */
3247 +  int cputime_error = 0;
3248 +  struct timespec tp;
3249 +  double start_cpu_nsecs = 0;
3250 +  double end_cpu_nsecs = 0;
3251 +
3252 +  if (opt_userstat_running) {
3253 +#ifdef HAVE_CLOCK_GETTIME
3254 +    /* get start cputime */
3255 +    if (!(cputime_error = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tp)))
3256 +      start_cpu_nsecs = tp.tv_sec*1000000000.0+tp.tv_nsec;
3257 +#endif
3258 +
3259 +    // Gets the start time, in order to measure how long this command takes.
3260 +    if (!(start_time_error = gettimeofday(&start_time, NULL))) {
3261 +      start_usecs = start_time.tv_sec * 1000000.0 + start_time.tv_usec;
3262 +    }
3263 +  }
3264 +
3265    if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_execute")))
3266 -    DBUG_VOID_RETURN;
3267 +    goto end;
3268  
3269  #if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
3270    thd->profiling.set_query_source(stmt->query, stmt->query_length);
3271 @@ -2325,11 +2414,50 @@
3272                         test(flags & (ulong) CURSOR_TYPE_READ_ONLY));
3273    if (!(specialflag & SPECIAL_NO_PRIOR))
3274      my_pthread_setprio(pthread_self(), WAIT_PRIOR);
3275 -  DBUG_VOID_RETURN;
3276 +  goto end;
3277  
3278  set_params_data_err:
3279    my_error(ER_WRONG_ARGUMENTS, MYF(0), "mysql_stmt_execute");
3280    reset_stmt_params(stmt);
3281 +
3282 +end:
3283 +  if (opt_userstat_running) {
3284 +    // Gets the end time.
3285 +    if (!(end_time_error = gettimeofday(&end_time, NULL))) {
3286 +      end_usecs = end_time.tv_sec * 1000000.0 + end_time.tv_usec;
3287 +    }
3288 +
3289 +    // Calculates the difference between the end and start times.
3290 +    if (start_usecs && end_usecs >= start_usecs && !start_time_error && !end_time_error) {
3291 +      thd->busy_time = (end_usecs - start_usecs) / 1000000;
3292 +      // In case there are bad values, 2629743 is the #seconds in a month.
3293 +      if (thd->busy_time > 2629743) {
3294 +        thd->busy_time = 0;
3295 +      }
3296 +    } else {
3297 +      // end time went back in time, or gettimeofday() failed.
3298 +      thd->busy_time = 0;
3299 +    }
3300 +
3301 +#ifdef HAVE_CLOCK_GETTIME
3302 +    /* get end cputime */
3303 +    if (!cputime_error &&
3304 +        !(cputime_error = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tp)))
3305 +      end_cpu_nsecs = tp.tv_sec*1000000000.0+tp.tv_nsec;
3306 +#endif
3307 +    if (start_cpu_nsecs && !cputime_error) {
3308 +      thd->cpu_time = (end_cpu_nsecs - start_cpu_nsecs) / 1000000000;
3309 +      // In case there are bad values, 2629743 is the #seconds in a month.
3310 +      if (thd->cpu_time > 2629743) {
3311 +        thd->cpu_time = 0;
3312 +      }
3313 +    } else
3314 +      thd->cpu_time = 0;
3315 +  }
3316 +  // Updates THD stats and the global user stats.
3317 +  thd->update_stats(true);
3318 +  update_global_user_stats(thd, true, time(NULL));
3319 +
3320    DBUG_VOID_RETURN;
3321  }
3322  
3323 @@ -2423,6 +2551,31 @@
3324  
3325    /* First of all clear possible warnings from the previous command */
3326    mysql_reset_thd_for_next_command(thd);
3327 +
3328 +  int start_time_error = 0;
3329 +  int end_time_error = 0;
3330 +  struct timeval start_time, end_time;
3331 +  double start_usecs = 0;
3332 +  double end_usecs = 0;
3333 +  /* cpu time */
3334 +  int cputime_error = 0;
3335 +  struct timespec tp;
3336 +  double start_cpu_nsecs = 0;
3337 +  double end_cpu_nsecs = 0;
3338 +
3339 +  if (opt_userstat_running) {
3340 +#ifdef HAVE_CLOCK_GETTIME
3341 +    /* get start cputime */
3342 +    if (!(cputime_error = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tp)))
3343 +      start_cpu_nsecs = tp.tv_sec*1000000000.0+tp.tv_nsec;
3344 +#endif
3345 +
3346 +    // Gets the start time, in order to measure how long this command takes.
3347 +    if (!(start_time_error = gettimeofday(&start_time, NULL))) {
3348 +      start_usecs = start_time.tv_sec * 1000000.0 + start_time.tv_usec;
3349 +    }
3350 +  }
3351 +
3352    statistic_increment(thd->status_var.com_stmt_fetch, &LOCK_status);
3353    if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_fetch")))
3354      DBUG_VOID_RETURN;
3355 @@ -2455,6 +2608,43 @@
3356    thd->restore_backup_statement(stmt, &stmt_backup);
3357    thd->stmt_arena= thd;
3358  
3359 +  if (opt_userstat_running) {
3360 +    // Gets the end time.
3361 +    if (!(end_time_error = gettimeofday(&end_time, NULL))) {
3362 +      end_usecs = end_time.tv_sec * 1000000.0 + end_time.tv_usec;
3363 +    }
3364 +
3365 +    // Calculates the difference between the end and start times.
3366 +    if (start_usecs && end_usecs >= start_usecs && !start_time_error && !end_time_error) {
3367 +      thd->busy_time = (end_usecs - start_usecs) / 1000000;
3368 +      // In case there are bad values, 2629743 is the #seconds in a month.
3369 +      if (thd->busy_time > 2629743) {
3370 +        thd->busy_time = 0;
3371 +      }
3372 +    } else {
3373 +      // end time went back in time, or gettimeofday() failed.
3374 +      thd->busy_time = 0;
3375 +    }
3376 +
3377 +#ifdef HAVE_CLOCK_GETTIME
3378 +    /* get end cputime */
3379 +    if (!cputime_error &&
3380 +        !(cputime_error = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tp)))
3381 +      end_cpu_nsecs = tp.tv_sec*1000000000.0+tp.tv_nsec;
3382 +#endif
3383 +    if (start_cpu_nsecs && !cputime_error) {
3384 +      thd->cpu_time = (end_cpu_nsecs - start_cpu_nsecs) / 1000000000;
3385 +      // In case there are bad values, 2629743 is the #seconds in a month.
3386 +      if (thd->cpu_time > 2629743) {
3387 +        thd->cpu_time = 0;
3388 +      }
3389 +    } else
3390 +      thd->cpu_time = 0;
3391 +  }
3392 +  // Updates THD stats and the global user stats.
3393 +  thd->update_stats(true);
3394 +  update_global_user_stats(thd, true, time(NULL));
3395 +
3396    DBUG_VOID_RETURN;
3397  }
3398  
3399 @@ -2487,6 +2677,30 @@
3400    /* First of all clear possible warnings from the previous command */
3401    mysql_reset_thd_for_next_command(thd);
3402  
3403 +  int start_time_error = 0;
3404 +  int end_time_error = 0;
3405 +  struct timeval start_time, end_time;
3406 +  double start_usecs = 0;
3407 +  double end_usecs = 0;
3408 +  /* cpu time */
3409 +  int cputime_error = 0;
3410 +  struct timespec tp;
3411 +  double start_cpu_nsecs = 0;
3412 +  double end_cpu_nsecs = 0;
3413 +
3414 +  if (opt_userstat_running) {
3415 +#ifdef HAVE_CLOCK_GETTIME
3416 +    /* get start cputime */
3417 +    if (!(cputime_error = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tp)))
3418 +      start_cpu_nsecs = tp.tv_sec*1000000000.0+tp.tv_nsec;
3419 +#endif
3420 +
3421 +    // Gets the start time, in order to measure how long this command takes.
3422 +    if (!(start_time_error = gettimeofday(&start_time, NULL))) {
3423 +      start_usecs = start_time.tv_sec * 1000000.0 + start_time.tv_usec;
3424 +    }
3425 +  }
3426 +
3427    statistic_increment(thd->status_var.com_stmt_reset, &LOCK_status);
3428    if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_reset")))
3429      DBUG_VOID_RETURN;
3430 @@ -2503,6 +2717,43 @@
3431  
3432    send_ok(thd);
3433  
3434 +  if (opt_userstat_running) {
3435 +    // Gets the end time.
3436 +    if (!(end_time_error = gettimeofday(&end_time, NULL))) {
3437 +      end_usecs = end_time.tv_sec * 1000000.0 + end_time.tv_usec;
3438 +    }
3439 +
3440 +    // Calculates the difference between the end and start times.
3441 +    if (start_usecs && end_usecs >= start_usecs && !start_time_error && !end_time_error) {
3442 +      thd->busy_time = (end_usecs - start_usecs) / 1000000;
3443 +      // In case there are bad values, 2629743 is the #seconds in a month.
3444 +      if (thd->busy_time > 2629743) {
3445 +        thd->busy_time = 0;
3446 +      }
3447 +    } else {
3448 +      // end time went back in time, or gettimeofday() failed.
3449 +      thd->busy_time = 0;
3450 +    }
3451 +
3452 +#ifdef HAVE_CLOCK_GETTIME
3453 +    /* get end cputime */
3454 +    if (!cputime_error &&
3455 +        !(cputime_error = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tp)))
3456 +      end_cpu_nsecs = tp.tv_sec*1000000000.0+tp.tv_nsec;
3457 +#endif
3458 +    if (start_cpu_nsecs && !cputime_error) {
3459 +      thd->cpu_time = (end_cpu_nsecs - start_cpu_nsecs) / 1000000000;
3460 +      // In case there are bad values, 2629743 is the #seconds in a month.
3461 +      if (thd->cpu_time > 2629743) {
3462 +        thd->cpu_time = 0;
3463 +      }
3464 +    } else
3465 +      thd->cpu_time = 0;
3466 +  }
3467 +  // Updates THD stats and the global user stats.
3468 +  thd->update_stats(true);
3469 +  update_global_user_stats(thd, true, time(NULL));
3470 +
3471    DBUG_VOID_RETURN;
3472  }
3473  
3474 diff -r 1ac0113deff5 sql/sql_show.cc
3475 --- a/sql/sql_show.cc   Mon Jun 01 00:35:44 2009 -0700
3476 +++ b/sql/sql_show.cc   Mon Jun 01 00:36:01 2009 -0700
3477 @@ -540,6 +540,7 @@
3478                 sctx->master_access);
3479    if (!(db_access & DB_ACLS) && (!grant_option || check_grant_db(thd,dbname)))
3480    {
3481 +    thd->diff_access_denied_errors++;
3482      my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
3483               sctx->priv_user, sctx->host_or_ip, dbname);
3484      mysql_log.write(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR),
3485 @@ -1890,6 +1891,300 @@
3486    DBUG_RETURN(FALSE);
3487  }
3488  
3489 +/*
3490 +   Aggregate values for mapped_user entries by their role.
3491 +
3492 +   SYNOPSIS
3493 +     aggregate_user_stats
3494 +       all_user_stats - input to aggregate
3495 +       agg_user_stats - returns aggregated values
3496 +
3497 +   RETURN
3498 +     0 - OK
3499 +     1 - error
3500 + */
3501 +static int
3502 +aggregate_user_stats(HASH *all_user_stats, HASH *agg_user_stats)
3503 +{
3504 +  DBUG_ENTER("aggregate_user_stats");
3505 +  if (hash_init(agg_user_stats, system_charset_info,
3506 +                max(all_user_stats->records, 1),
3507 +                0, 0, (hash_get_key)get_key_user_stats,
3508 +                (hash_free_key)free_user_stats, 0))
3509 +  {
3510 +    sql_print_error("Malloc in aggregate_user_stats failed");
3511 +    DBUG_RETURN(1);
3512 +  }
3513 +
3514 +  for (int i = 0; i < all_user_stats->records; ++i) {
3515 +    USER_STATS *user = (USER_STATS*)hash_element(all_user_stats, i);
3516 +    USER_STATS *agg_user;
3517 +    if (!(agg_user = (USER_STATS*)hash_search(agg_user_stats,
3518 +                                              (byte*)user->priv_user,
3519 +                                              strlen(user->priv_user))))
3520 +    {
3521 +      // First entry for this role.
3522 +      if (!(agg_user =
3523 +            (USER_STATS*) my_malloc(sizeof(USER_STATS), MYF(MY_WME | MY_ZEROFILL))))
3524 +      {
3525 +        sql_print_error("Malloc in aggregate_user_stats failed");
3526 +        DBUG_RETURN(1);
3527 +      }
3528 +
3529 +      init_user_stats(agg_user, user->priv_user, user->priv_user,
3530 +                      user->total_connections, user->concurrent_connections,
3531 +                      user->connected_time, user->busy_time, user->cpu_time,
3532 +                      user->bytes_received, user->bytes_sent,
3533 +                      user->binlog_bytes_written,
3534 +                      user->rows_fetched, user->rows_updated, user->rows_read,
3535 +                      user->select_commands, user->update_commands,
3536 +                      user->other_commands,
3537 +                      user->commit_trans, user->rollback_trans,
3538 +                      user->denied_connections, user->lost_connections,
3539 +                      user->access_denied_errors, user->empty_queries);
3540 +
3541 +      if (my_hash_insert(agg_user_stats, (byte*)agg_user))
3542 +      {
3543 +        // Out of memory.
3544 +        my_free((char*)agg_user, 0);
3545 +        sql_print_error("Malloc in aggregate_user_stats failed");
3546 +        DBUG_RETURN(1);
3547 +      }
3548 +    }
3549 +    else
3550 +    {
3551 +      // Aggregate with existing values for this role.
3552 +      add_user_stats(agg_user,
3553 +                     user->total_connections, user->concurrent_connections,
3554 +                     user->connected_time, user->busy_time, user->cpu_time,
3555 +                     user->bytes_received, user->bytes_sent,
3556 +                     user->binlog_bytes_written,
3557 +                     user->rows_fetched, user->rows_updated, user->rows_read,
3558 +                     user->select_commands, user->update_commands,
3559 +                     user->other_commands,
3560 +                     user->commit_trans, user->rollback_trans,
3561 +                     user->denied_connections, user->lost_connections,
3562 +                     user->access_denied_errors, user->empty_queries);
3563 +    }
3564 +  }
3565 +  DBUG_PRINT("exit", ("aggregated %d input into %d output entries",
3566 +                      all_user_stats->records, agg_user_stats->records));
3567 +  DBUG_RETURN(0);
3568 +}
3569 +
3570 +/*
3571 +   Write result to network for SHOW USER_STATISTICS
3572 +
3573 +   SYNOPSIS
3574 +     send_user_stats
3575 +       all_user_stats - values to return
3576 +       table - I_S table
3577 +
3578 +   RETURN
3579 +     0 - OK
3580 +     1 - error
3581 + */
3582 +int send_user_stats(THD* thd, HASH *all_user_stats, TABLE *table)
3583 +{
3584 +  DBUG_ENTER("send_user_stats");
3585 +  for (int i = 0; i < all_user_stats->records; ++i) {
3586 +    restore_record(table, s->default_values);
3587 +    USER_STATS *user_stats = (USER_STATS*)hash_element(all_user_stats, i);
3588 +      table->field[0]->store(user_stats->user, strlen(user_stats->user), system_charset_info);
3589 +      table->field[1]->store((longlong)user_stats->total_connections);
3590 +      table->field[2]->store((longlong)user_stats->concurrent_connections);
3591 +      table->field[3]->store((longlong)user_stats->connected_time);
3592 +      table->field[4]->store((longlong)user_stats->busy_time);
3593 +      table->field[5]->store((longlong)user_stats->cpu_time);
3594 +      table->field[6]->store((longlong)user_stats->bytes_received);
3595 +      table->field[7]->store((longlong)user_stats->bytes_sent);
3596 +      table->field[8]->store((longlong)user_stats->binlog_bytes_written);
3597 +      table->field[9]->store((longlong)user_stats->rows_fetched);
3598 +      table->field[10]->store((longlong)user_stats->rows_updated);
3599 +      table->field[11]->store((longlong)user_stats->rows_read);
3600 +      table->field[12]->store((longlong)user_stats->select_commands);
3601 +      table->field[13]->store((longlong)user_stats->update_commands);
3602 +      table->field[14]->store((longlong)user_stats->other_commands);
3603 +      table->field[15]->store((longlong)user_stats->commit_trans);
3604 +      table->field[16]->store((longlong)user_stats->rollback_trans);
3605 +      table->field[17]->store((longlong)user_stats->denied_connections);
3606 +      table->field[18]->store((longlong)user_stats->lost_connections);
3607 +      table->field[19]->store((longlong)user_stats->access_denied_errors);
3608 +      table->field[20]->store((longlong)user_stats->empty_queries);
3609 +      if (schema_table_store_record(thd, table))
3610 +      {
3611 +             DBUG_PRINT("error", ("store record error"));
3612 +             DBUG_RETURN(1);
3613 +      }
3614 +  }
3615 +  DBUG_RETURN(0);
3616 +}
3617 +
3618 +/*
3619 +   Process SHOW USER_STATISTICS
3620 +
3621 +   SYNOPSIS
3622 +     mysqld_show_user_stats
3623 +       thd - current thread
3624 +       wild - limit results to the entry for this user
3625 +       with_roles - when true, display role for mapped users
3626 +
3627 +   RETURN
3628 +     0 - OK
3629 +     1 - error
3630 + */
3631 +
3632 +
3633 +int fill_schema_user_stats(THD* thd, TABLE_LIST* tables, COND* cond)
3634 +{
3635 +  TABLE *table= tables->table;
3636 +  DBUG_ENTER("fill_schema_user_stats");
3637 +
3638 +  if (check_global_access(thd, SUPER_ACL | PROCESS_ACL))
3639 +          DBUG_RETURN(1);
3640 +
3641 +  // Iterates through all the global stats and sends them to the client.
3642 +  // Pattern matching on the client IP is supported.
3643 +
3644 +  pthread_mutex_lock(&LOCK_global_user_client_stats);
3645 +  int result= send_user_stats(thd, &global_user_stats, table);
3646 +  pthread_mutex_unlock(&LOCK_global_user_client_stats);
3647 +  if (result)
3648 +    goto err;
3649 +
3650 +  DBUG_PRINT("exit", ("fill_schema_user_stats result is 0"));
3651 +  DBUG_RETURN(0);
3652 +
3653 + err:
3654 +  DBUG_PRINT("exit", ("fill_schema_user_stats result is 1"));
3655 +  DBUG_RETURN(1);
3656 +}
3657 +
3658 +/*
3659 +   Process SHOW CLIENT_STATISTICS
3660 +
3661 +   SYNOPSIS
3662 +     mysqld_show_client_stats
3663 +       thd - current thread
3664 +       wild - limit results to the entry for this client
3665 +
3666 +   RETURN
3667 +     0 - OK
3668 +     1 - error
3669 + */
3670 +
3671 +
3672 +int fill_schema_client_stats(THD* thd, TABLE_LIST* tables, COND* cond)
3673 +{
3674 +  TABLE *table= tables->table;
3675 +  DBUG_ENTER("fill_schema_client_stats");
3676 +
3677 +  if (check_global_access(thd, SUPER_ACL | PROCESS_ACL))
3678 +          DBUG_RETURN(1);
3679 +
3680 +  // Iterates through all the global stats and sends them to the client.
3681 +  // Pattern matching on the client IP is supported.
3682 +
3683 +  pthread_mutex_lock(&LOCK_global_user_client_stats);
3684 +  int result= send_user_stats(thd, &global_client_stats, table);
3685 +  pthread_mutex_unlock(&LOCK_global_user_client_stats);
3686 +  if (result)
3687 +    goto err;
3688 +
3689 +  DBUG_PRINT("exit", ("mysqld_show_client_stats result is 0"));
3690 +  DBUG_RETURN(0);
3691 +
3692 + err:
3693 +  DBUG_PRINT("exit", ("mysqld_show_client_stats result is 1"));
3694 +  DBUG_RETURN(1);
3695 +}
3696 +
3697 +
3698 +// Sends the global table stats back to the client.
3699 +int fill_schema_table_stats(THD* thd, TABLE_LIST* tables, COND* cond)
3700 +{
3701 +  TABLE *table= tables->table;
3702 +  DBUG_ENTER("fill_schema_table_stats");
3703 +  char *table_full_name, *table_schema;
3704 +
3705 +  pthread_mutex_lock(&LOCK_global_table_stats);
3706 +  for (int i = 0; i < global_table_stats.records; ++i) {
3707 +    restore_record(table, s->default_values);
3708 +    TABLE_STATS *table_stats = 
3709 +      (TABLE_STATS*)hash_element(&global_table_stats, i);
3710 +
3711 +    table_full_name= thd->strdup(table_stats->table);
3712 +    table_schema= strsep(&table_full_name, ".");
3713 +
3714 +    TABLE_LIST tmp_table;
3715 +    bzero((char*) &tmp_table,sizeof(tmp_table));
3716 +    tmp_table.table_name= table_full_name;
3717 +    tmp_table.db= table_schema;
3718 +    tmp_table.grant.privilege= 0;
3719 +    if (check_access(thd, SELECT_ACL | EXTRA_ACL, tmp_table.db,
3720 +                      &tmp_table.grant.privilege, 0, 0,
3721 +                      is_schema_db(table_schema)) ||
3722 +         grant_option && check_grant(thd, SELECT_ACL, &tmp_table, 1, UINT_MAX, 1))
3723 +        continue;
3724 +
3725 +    table->field[0]->store(table_schema, strlen(table_schema), system_charset_info);
3726 +    table->field[1]->store(table_full_name, strlen(table_full_name), system_charset_info);
3727 +    table->field[2]->store((longlong)table_stats->rows_read, TRUE);
3728 +    table->field[3]->store((longlong)table_stats->rows_changed, TRUE);
3729 +    table->field[4]->store((longlong)table_stats->rows_changed_x_indexes, TRUE);
3730 +
3731 +    if (schema_table_store_record(thd, table))
3732 +    {
3733 +      VOID(pthread_mutex_unlock(&LOCK_global_table_stats));
3734 +      DBUG_RETURN(1);
3735 +    }
3736 +  }
3737 +  pthread_mutex_unlock(&LOCK_global_table_stats);
3738 +  DBUG_RETURN(0);
3739 +}
3740 +
3741 +// Sends the global index stats back to the client.
3742 +int fill_schema_index_stats(THD* thd, TABLE_LIST* tables, COND* cond)
3743 +{
3744 +  TABLE *table= tables->table;
3745 +  DBUG_ENTER("fill_schema_index_stats");
3746 +  char *index_full_name, *table_schema, *table_name;
3747 +
3748 +  pthread_mutex_lock(&LOCK_global_index_stats);
3749 +  for (int i = 0; i < global_index_stats.records; ++i) {
3750 +    restore_record(table, s->default_values);
3751 +    INDEX_STATS *index_stats =
3752 +      (INDEX_STATS*)hash_element(&global_index_stats, i);
3753 +
3754 +    index_full_name= thd->strdup(index_stats->index);
3755 +    table_schema= strsep(&index_full_name, ".");
3756 +    table_name= strsep(&index_full_name, ".");
3757 +
3758 +    TABLE_LIST tmp_table;
3759 +    bzero((char*) &tmp_table,sizeof(tmp_table));
3760 +    tmp_table.table_name= table_name;
3761 +    tmp_table.db= table_schema;
3762 +    tmp_table.grant.privilege= 0;
3763 +    if (check_access(thd, SELECT_ACL | EXTRA_ACL, tmp_table.db,
3764 +                      &tmp_table.grant.privilege, 0, 0,
3765 +                      is_schema_db(table_schema)) ||
3766 +         grant_option && check_grant(thd, SELECT_ACL, &tmp_table, 1, UINT_MAX, 1))
3767 +        continue;
3768 +
3769 +    table->field[0]->store(table_schema, strlen(table_schema), system_charset_info);
3770 +    table->field[1]->store(table_name, strlen(table_name), system_charset_info);
3771 +    table->field[2]->store(index_full_name, strlen(index_full_name), system_charset_info);
3772 +    table->field[3]->store((longlong)index_stats->rows_read, TRUE);
3773 +
3774 +    if (schema_table_store_record(thd, table))
3775 +    { 
3776 +      VOID(pthread_mutex_unlock(&LOCK_global_index_stats));
3777 +      DBUG_RETURN(1);
3778 +    }
3779 +  }
3780 +  pthread_mutex_unlock(&LOCK_global_index_stats);
3781 +  DBUG_RETURN(0);
3782 +}
3783  
3784  /* collect status for all running threads */
3785  
3786 @@ -4500,6 +4795,77 @@
3787    {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
3788  };
3789  
3790 +ST_FIELD_INFO user_stats_fields_info[]=
3791 +{
3792 +  {"USER", 16, MYSQL_TYPE_STRING, 0, 0, "User"},
3793 +  {"TOTAL_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Total_connections"},
3794 +  {"CONCURRENT_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Concurrent_connections"},
3795 +  {"CONNECTED_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Connected_time"},
3796 +  {"BUSY_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Busy_time"},
3797 +  {"CPU_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Cpu_time"},
3798 +  {"BYTES_RECEIVED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Bytes_received"},
3799 +  {"BYTES_SENT", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Bytes_sent"},
3800 +  {"BINLOG_BYTES_WRITTEN", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Binlog_bytes_written"},
3801 +  {"ROWS_FETCHED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Rows_fetched"},
3802 +  {"ROWS_UPDATED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Rows_updated"},
3803 +  {"TABLE_ROWS_READ", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Table_rows_read"},
3804 +  {"SELECT_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Select_commands"},
3805 +  {"UPDATE_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Update_commands"},
3806 +  {"OTHER_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Other_commands"},
3807 +  {"COMMIT_TRANSACTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Commit_transactions"},
3808 +  {"ROLLBACK_TRANSACTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Rollback_transactions"},
3809 +  {"DENIED_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Denied_connections"},
3810 +  {"LOST_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Lost_connections"},
3811 +  {"ACCESS_DENIED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Access_denied"},
3812 +  {"EMPTY_QUERIES", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Empty_queries"},
3813 +  {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
3814 +};
3815 +
3816 +ST_FIELD_INFO client_stats_fields_info[]=
3817 +{
3818 +  {"CLIENT", 16, MYSQL_TYPE_STRING, 0, 0, "Client"},
3819 +  {"TOTAL_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Total_connections"},
3820 +  {"CONCURRENT_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Concurrent_connections"},
3821 +  {"CONNECTED_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Connected_time"},
3822 +  {"BUSY_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Busy_time"},
3823 +  {"CPU_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Cpu_time"},
3824 +  {"BYTES_RECEIVED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Bytes_received"},
3825 +  {"BYTES_SENT", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Bytes_sent"},
3826 +  {"BINLOG_BYTES_WRITTEN", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Binlog_bytes_written"},
3827 +  {"ROWS_FETCHED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Rows_fetched"},
3828 +  {"ROWS_UPDATED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Rows_updated"},
3829 +  {"TABLE_ROWS_READ", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Table_rows_read"},
3830 +  {"SELECT_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Select_commands"},
3831 +  {"UPDATE_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Update_commands"},
3832 +  {"OTHER_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Other_commands"},
3833 +  {"COMMIT_TRANSACTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Commit_transactions"},
3834 +  {"ROLLBACK_TRANSACTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Rollback_transactions"},
3835 +  {"DENIED_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Denied_connections"},
3836 +  {"LOST_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Lost_connections"},
3837 +  {"ACCESS_DENIED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Access_denied"},
3838 +  {"EMPTY_QUERIES", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Empty_queries"},
3839 +  {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
3840 +};
3841 +
3842 +
3843 +ST_FIELD_INFO table_stats_fields_info[]=
3844 +{
3845 +  {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_schema"},
3846 +  {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_name"},
3847 +  {"ROWS_READ", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Rows_read"},
3848 +  {"ROWS_CHANGED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Rows_changed"},
3849 +  {"ROWS_CHANGED_X_INDEXES", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Rows_changed_x_#indexes"},
3850 +  {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
3851 +};
3852 +
3853 +ST_FIELD_INFO index_stats_fields_info[]=
3854 +{
3855 +  {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_schema"},
3856 +  {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_name"},
3857 +  {"INDEX_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Index_name"},
3858 +  {"ROWS_READ", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Rows_read"},
3859 +  {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
3860 +};
3861  
3862  /*
3863    Description of ST_FIELD_INFO in table.h
3864 @@ -4509,6 +4875,8 @@
3865  {
3866    {"CHARACTER_SETS", charsets_fields_info, create_schema_table, 
3867     fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0},
3868 +  {"CLIENT_STATISTICS", client_stats_fields_info, create_schema_table, 
3869 +    fill_schema_client_stats, make_old_format, 0, -1, -1, 0},
3870    {"COLLATIONS", collation_fields_info, create_schema_table, 
3871     fill_schema_collation, make_old_format, 0, -1, -1, 0},
3872    {"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info,
3873 @@ -4517,6 +4885,8 @@
3874     get_all_tables, make_columns_old_format, get_schema_column_record, 1, 2, 0},
3875    {"COLUMN_PRIVILEGES", column_privileges_fields_info, create_schema_table,
3876      fill_schema_column_privileges, 0, 0, -1, -1, 0},
3877 +  {"INDEX_STATISTICS", index_stats_fields_info, create_schema_table,
3878 +   fill_schema_index_stats, make_old_format, 0, -1, -1, 0},
3879    {"KEY_COLUMN_USAGE", key_column_usage_fields_info, create_schema_table,
3880      get_all_tables, 0, get_schema_key_column_usage_record, 4, 5, 0},
3881    {"OPEN_TABLES", open_tables_fields_info, create_schema_table,
3882 @@ -4542,10 +4912,14 @@
3883     get_all_tables, make_table_names_old_format, 0, 1, 2, 1},
3884    {"TABLE_PRIVILEGES", table_privileges_fields_info, create_schema_table,
3885      fill_schema_table_privileges, 0, 0, -1, -1, 0},
3886 +  {"TABLE_STATISTICS", table_stats_fields_info, create_schema_table,
3887 +    fill_schema_table_stats, make_old_format, 0, -1, -1, 0},
3888    {"TRIGGERS", triggers_fields_info, create_schema_table,
3889     get_all_tables, make_old_format, get_schema_triggers_record, 5, 6, 0},
3890    {"USER_PRIVILEGES", user_privileges_fields_info, create_schema_table, 
3891      fill_schema_user_privileges, 0, 0, -1, -1, 0},
3892 +  {"USER_STATISTICS", user_stats_fields_info, create_schema_table, 
3893 +    fill_schema_user_stats, make_old_format, 0, -1, -1, 0},
3894    {"VARIABLES", variables_fields_info, create_schema_table, fill_variables,
3895     make_old_format, 0, -1, -1, 1},
3896    {"VIEWS", view_fields_info, create_schema_table, 
3897 diff -r 1ac0113deff5 sql/sql_update.cc
3898 --- a/sql/sql_update.cc Mon Jun 01 00:35:44 2009 -0700
3899 +++ b/sql/sql_update.cc Mon Jun 01 00:36:01 2009 -0700
3900 @@ -604,7 +604,8 @@
3901        (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated;
3902      send_ok(thd, (ulong) thd->row_count_func,
3903             thd->insert_id_used ? thd->last_insert_id : 0L,buff);
3904 -    DBUG_PRINT("info",("%ld records updated", (long) updated));
3905 +    thd->updated_row_count += thd->row_count_func;
3906 +    DBUG_PRINT("info",("%d records updated",updated));
3907    }
3908    thd->count_cuted_fields= CHECK_FIELD_IGNORE;         /* calc cuted fields */
3909    thd->abort_on_warning= 0;
3910 @@ -1835,5 +1836,6 @@
3911      (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated;
3912    ::send_ok(thd, (ulong) thd->row_count_func,
3913             thd->insert_id_used ? thd->last_insert_id : 0L,buff);
3914 +  thd->updated_row_count += thd->row_count_func;
3915    return FALSE;
3916  }
3917 diff -r 1ac0113deff5 sql/sql_yacc.yy
3918 --- a/sql/sql_yacc.yy   Mon Jun 01 00:35:44 2009 -0700
3919 +++ b/sql/sql_yacc.yy   Mon Jun 01 00:36:01 2009 -0700
3920 @@ -523,6 +523,7 @@
3921  %token  CHECK_SYM
3922  %token  CIPHER_SYM
3923  %token  CLIENT_SYM
3924 +%token CLIENT_STATS_SYM
3925  %token  CLOSE_SYM
3926  %token  COALESCE
3927  %token  CODE_SYM
3928 @@ -680,6 +681,7 @@
3929  %token  IMPORT
3930  %token  INDEXES
3931  %token  INDEX_SYM
3932 +%token INDEX_STATS_SYM
3933  %token  INFILE
3934  %token  INNER_SYM
3935  %token  INNOBASE_SYM
3936 @@ -909,6 +911,7 @@
3937  %token  SIGNED_SYM
3938  %token  SIMPLE_SYM
3939  %token  SLAVE
3940 +%token  SLOW_SYM
3941  %token  SMALLINT
3942  %token  SNAPSHOT_SYM
3943  %token  SOUNDS_SYM
3944 @@ -949,6 +952,7 @@
3945  %token  TABLES
3946  %token  TABLESPACE
3947  %token  TABLE_SYM
3948 +%token TABLE_STATS_SYM
3949  %token  TEMPORARY
3950  %token  TEMPTABLE_SYM
3951  %token  TERMINATED
3952 @@ -991,6 +995,7 @@
3953  %token  UPGRADE_SYM
3954  %token  USAGE
3955  %token  USER
3956 +%token USER_STATS_SYM
3957  %token  USE_FRM
3958  %token  USE_SYM
3959  %token  USING
3960 @@ -8255,6 +8260,38 @@
3961            {
3962             Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT;
3963            }
3964 +        | CLIENT_STATS_SYM wild_and_where 
3965 +          {
3966 +           LEX *lex= Lex;
3967 +          Lex->sql_command = SQLCOM_SELECT;
3968 +           lex->orig_sql_command= SQLCOM_SHOW_CLIENT_STATS;
3969 +           if (prepare_schema_table(YYTHD, lex, 0, SCH_CLIENT_STATS))
3970 +             MYSQL_YYABORT;
3971 +          }
3972 +        | USER_STATS_SYM wild_and_where 
3973 +          {
3974 +           LEX *lex= Lex;
3975 +          lex->sql_command = SQLCOM_SELECT;
3976 +           lex->orig_sql_command= SQLCOM_SHOW_USER_STATS;
3977 +           if (prepare_schema_table(YYTHD, lex, 0, SCH_USER_STATS))
3978 +             MYSQL_YYABORT;
3979 +          }
3980 +        | TABLE_STATS_SYM wild_and_where
3981 +          {
3982 +           LEX *lex= Lex;
3983 +           lex->sql_command= SQLCOM_SELECT;
3984 +           lex->orig_sql_command= SQLCOM_SHOW_TABLE_STATS;
3985 +           if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLE_STATS))
3986 +             MYSQL_YYABORT;
3987 +          }
3988 +        | INDEX_STATS_SYM wild_and_where
3989 +          {
3990 +           LEX *lex= Lex;
3991 +           lex->sql_command= SQLCOM_SELECT;
3992 +           lex->orig_sql_command= SQLCOM_SHOW_INDEX_STATS;
3993 +           if (prepare_schema_table(YYTHD, lex, 0, SCH_INDEX_STATS))
3994 +             MYSQL_YYABORT;
3995 +          }
3996         | CREATE PROCEDURE sp_name
3997           {
3998             LEX *lex= Lex;
3999 @@ -8459,9 +8496,14 @@
4000         | LOGS_SYM      { Lex->type|= REFRESH_LOG; }
4001         | STATUS_SYM    { Lex->type|= REFRESH_STATUS; }
4002          | SLAVE         { Lex->type|= REFRESH_SLAVE; }
4003 +       | SLOW_SYM QUERY_SYM LOGS_SYM { Lex->type |= REFRESH_SLOW_QUERY_LOG; }
4004          | MASTER_SYM    { Lex->type|= REFRESH_MASTER; }
4005         | DES_KEY_FILE  { Lex->type|= REFRESH_DES_KEY_FILE; }
4006 -       | RESOURCES     { Lex->type|= REFRESH_USER_RESOURCES; };
4007 +       | RESOURCES     { Lex->type|= REFRESH_USER_RESOURCES; }
4008 +       | CLIENT_STATS_SYM { Lex->type|= REFRESH_CLIENT_STATS; }
4009 +       | USER_STATS_SYM { Lex->type|= REFRESH_USER_STATS; }
4010 +       | TABLE_STATS_SYM { Lex->type|= REFRESH_TABLE_STATS; }
4011 +       | INDEX_STATS_SYM { Lex->type|= REFRESH_INDEX_STATS; };
4012  
4013  opt_table_list:
4014         /* empty */  {;}
4015 @@ -9450,6 +9492,7 @@
4016         | CHAIN_SYM             {}
4017         | CHANGED               {}
4018         | CIPHER_SYM            {}
4019 +       | CLIENT_STATS_SYM      {}
4020         | CLIENT_SYM            {}
4021          | CODE_SYM              {}
4022         | COLLATION_SYM         {}
4023 @@ -9502,6 +9545,7 @@
4024         | HOSTS_SYM             {}
4025         | HOUR_SYM              {}
4026         | IDENTIFIED_SYM        {}
4027 +       | INDEX_STATS_SYM       {}
4028         | INVOKER_SYM           {}
4029         | IMPORT                {}
4030         | INDEXES               {}
4031 @@ -9611,6 +9655,7 @@
4032         | SIMPLE_SYM            {}
4033         | SHARE_SYM             {}
4034         | SHUTDOWN              {}
4035 +       | SLOW_SYM              {}
4036         | SNAPSHOT_SYM          {}
4037         | SOUNDS_SYM            {}
4038         | SOURCE_SYM            {}
4039 @@ -9627,6 +9672,7 @@
4040          | SUSPEND_SYM           {}
4041          | SWAPS_SYM             {}
4042         | SWITCHES_SYM          {}
4043 +       | TABLE_STATS_SYM       {}
4044          | TABLES                {}
4045         | TABLESPACE            {}
4046         | TEMPORARY             {}
4047 @@ -9647,6 +9693,7 @@
4048         | UNKNOWN_SYM           {}
4049         | UNTIL_SYM             {}
4050         | USER                  {}
4051 +       | USER_STATS_SYM        {}
4052         | USE_FRM               {}
4053         | VARIABLES             {}
4054         | VIEW_SYM              {}
4055 diff -r 1ac0113deff5 sql/structs.h
4056 --- a/sql/structs.h     Mon Jun 01 00:35:44 2009 -0700
4057 +++ b/sql/structs.h     Mon Jun 01 00:36:01 2009 -0700
4058 @@ -273,6 +273,98 @@
4059    time_t intime;
4060  } USER_CONN;
4061  
4062 +typedef struct st_user_stats {
4063 +  char user[USERNAME_LENGTH + 1];
4064 +  // Account name the user is mapped to when this is a user from mapped_user.
4065 +  // Otherwise, the same value as user.
4066 +  char priv_user[USERNAME_LENGTH + 1];
4067 +  uint total_connections;
4068 +  uint concurrent_connections;
4069 +  time_t connected_time;  // in seconds
4070 +  double busy_time;       // in seconds
4071 +  double cpu_time;        // in seconds
4072 +  ulonglong bytes_received;
4073 +  ulonglong bytes_sent;
4074 +  ulonglong binlog_bytes_written;
4075 +  ha_rows rows_fetched, rows_updated, rows_read;
4076 +  ulonglong select_commands, update_commands, other_commands;
4077 +  ulonglong commit_trans, rollback_trans;
4078 +  ulonglong denied_connections, lost_connections;
4079 +  ulonglong access_denied_errors;
4080 +  ulonglong empty_queries;
4081 +} USER_STATS;
4082 +
4083 +/* Lookup function for hash tables with USER_STATS entries */
4084 +extern byte *get_key_user_stats(USER_STATS *user_stats, uint *length,
4085 +                                my_bool not_used __attribute__((unused)));
4086 +
4087 +/* Free all memory for a hash table with USER_STATS entries */
4088 +extern void free_user_stats(USER_STATS* user_stats);
4089 +
4090 +/* Intialize an instance of USER_STATS */
4091 +extern void
4092 +init_user_stats(USER_STATS *user_stats,
4093 +                const char *user,
4094 +                const char *priv_user,
4095 +                uint total_connections,
4096 +                uint concurrent_connections,
4097 +                time_t connected_time,
4098 +                double busy_time,
4099 +                double cpu_time,
4100 +                ulonglong bytes_received,
4101 +                ulonglong bytes_sent,
4102 +                ulonglong binlog_bytes_written,
4103 +                ha_rows rows_fetched,
4104 +                ha_rows rows_updated,
4105 +                ha_rows rows_read,
4106 +                ulonglong select_commands,
4107 +                ulonglong update_commands,
4108 +                ulonglong other_commands,
4109 +                ulonglong commit_trans,
4110 +                ulonglong rollback_trans,
4111 +                ulonglong denied_connections,
4112 +                ulonglong lost_connections,
4113 +                ulonglong access_denied_errors,
4114 +                ulonglong empty_queries);
4115 +
4116 +/* Increment values of an instance of USER_STATS */
4117 +extern void
4118 +add_user_stats(USER_STATS *user_stats,
4119 +               uint total_connections,
4120 +               uint concurrent_connections,
4121 +               time_t connected_time,
4122 +               double busy_time,
4123 +               double cpu_time,
4124 +               ulonglong bytes_received,
4125 +               ulonglong bytes_sent,
4126 +               ulonglong binlog_bytes_written,
4127 +               ha_rows rows_fetched,
4128 +               ha_rows rows_updated,
4129 +               ha_rows rows_read,
4130 +               ulonglong select_commands,
4131 +               ulonglong update_commands,
4132 +               ulonglong other_commands,
4133 +               ulonglong commit_trans,
4134 +               ulonglong rollback_trans,
4135 +               ulonglong denied_connections,
4136 +               ulonglong lost_connections,
4137 +               ulonglong access_denied_errors,
4138 +               ulonglong empty_queries);
4139 +
4140 +typedef struct st_table_stats {
4141 +  char table[NAME_LEN * 2 + 2];  // [db] + '.' + [table] + '\0'
4142 +  ulonglong rows_read, rows_changed;
4143 +  ulonglong rows_changed_x_indexes;
4144 +  /* Stores enum db_type, but forward declarations cannot be done */
4145 +  int engine_type;
4146 +} TABLE_STATS;
4147 +
4148 +typedef struct st_index_stats {
4149 +  char index[NAME_LEN * 3 + 3];  // [db] + '.' + [table] + '.' + [index] + '\0'
4150 +  ulonglong rows_read;
4151 +} INDEX_STATS;
4152 +
4153 +
4154         /* Bits in form->update */
4155  #define REG_MAKE_DUPP          1       /* Make a copy of record when read */
4156  #define REG_NEW_RECORD         2       /* Write a new record if not found */
4157 diff -r 1ac0113deff5 sql/table.h
4158 --- a/sql/table.h       Mon Jun 01 00:35:44 2009 -0700
4159 +++ b/sql/table.h       Mon Jun 01 00:36:01 2009 -0700
4160 @@ -371,10 +371,12 @@
4161  enum enum_schema_tables
4162  {
4163    SCH_CHARSETS= 0,
4164 +  SCH_CLIENT_STATS,
4165    SCH_COLLATIONS,
4166    SCH_COLLATION_CHARACTER_SET_APPLICABILITY,
4167    SCH_COLUMNS,
4168    SCH_COLUMN_PRIVILEGES,
4169 +  SCH_INDEX_STATS,
4170    SCH_KEY_COLUMN_USAGE,
4171    SCH_OPEN_TABLES,
4172    SCH_PROFILES,
4173 @@ -387,8 +389,10 @@
4174    SCH_TABLE_CONSTRAINTS,
4175    SCH_TABLE_NAMES,
4176    SCH_TABLE_PRIVILEGES,
4177 +  SCH_TABLE_STATS,
4178    SCH_TRIGGERS,
4179    SCH_USER_PRIVILEGES,
4180 +  SCH_USER_STATS,
4181    SCH_VARIABLES,
4182    SCH_VIEWS
4183  };
4184 diff -r 1ac0113deff5 strings/Makefile.in
4185 --- a/strings/Makefile.in       Mon Jun 01 00:35:44 2009 -0700
4186 +++ b/strings/Makefile.in       Mon Jun 01 00:36:01 2009 -0700
4187 @@ -342,6 +342,7 @@
4188  LIBDL = @LIBDL@
4189  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
4190  LIBOBJS = @LIBOBJS@
4191 +LIBRT = @LIBRT@
4192  LIBS = @LIBS@
4193  LIBTOOL = @LIBTOOL@
4194  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
4195 diff -r 1ac0113deff5 support-files/MacOSX/Makefile.in
4196 --- a/support-files/MacOSX/Makefile.in  Mon Jun 01 00:35:44 2009 -0700
4197 +++ b/support-files/MacOSX/Makefile.in  Mon Jun 01 00:36:01 2009 -0700
4198 @@ -148,6 +148,7 @@
4199  LIBDL = @LIBDL@
4200  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
4201  LIBOBJS = @LIBOBJS@
4202 +LIBRT = @LIBRT@
4203  LIBS = @LIBS@
4204  LIBTOOL = @LIBTOOL@
4205  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
4206 diff -r 1ac0113deff5 support-files/Makefile.in
4207 --- a/support-files/Makefile.in Mon Jun 01 00:35:44 2009 -0700
4208 +++ b/support-files/Makefile.in Mon Jun 01 00:36:01 2009 -0700
4209 @@ -171,6 +171,7 @@
4210  LIBDL = @LIBDL@
4211  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
4212  LIBOBJS = @LIBOBJS@
4213 +LIBRT = @LIBRT@
4214  LIBS = @LIBS@
4215  LIBTOOL = @LIBTOOL@
4216  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
4217 diff -r 1ac0113deff5 support-files/RHEL4-SElinux/Makefile.in
4218 --- a/support-files/RHEL4-SElinux/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
4219 +++ b/support-files/RHEL4-SElinux/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
4220 @@ -146,6 +146,7 @@
4221  LIBDL = @LIBDL@
4222  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
4223  LIBOBJS = @LIBOBJS@
4224 +LIBRT = @LIBRT@
4225  LIBS = @LIBS@
4226  LIBTOOL = @LIBTOOL@
4227  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
4228 diff -r 1ac0113deff5 tests/Makefile.in
4229 --- a/tests/Makefile.in Mon Jun 01 00:35:44 2009 -0700
4230 +++ b/tests/Makefile.in Mon Jun 01 00:36:01 2009 -0700
4231 @@ -193,6 +193,7 @@
4232  LIBDL = @LIBDL@
4233  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
4234  LIBOBJS = @LIBOBJS@
4235 +LIBRT = @LIBRT@
4236  LIBS = @CLIENT_LIBS@
4237  LIBTOOL = @LIBTOOL@
4238  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
4239 diff -r 1ac0113deff5 tools/Makefile.in
4240 --- a/tools/Makefile.in Mon Jun 01 00:35:44 2009 -0700
4241 +++ b/tools/Makefile.in Mon Jun 01 00:36:01 2009 -0700
4242 @@ -167,6 +167,7 @@
4243  LIBDL = @LIBDL@
4244  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
4245  LIBOBJS = @LIBOBJS@
4246 +LIBRT = @LIBRT@
4247  LIBS = @LIBS@
4248  LIBTOOL = @LIBTOOL@
4249  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
4250 diff -r 1ac0113deff5 vio/Makefile.in
4251 --- a/vio/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
4252 +++ b/vio/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
4253 @@ -176,6 +176,7 @@
4254  LIBDL = @LIBDL@
4255  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
4256  LIBOBJS = @LIBOBJS@
4257 +LIBRT = @LIBRT@
4258  LIBS = @LIBS@
4259  LIBTOOL = @LIBTOOL@
4260  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
4261 diff -r 1ac0113deff5 win/Makefile.in
4262 --- a/win/Makefile.in   Mon Jun 01 00:35:44 2009 -0700
4263 +++ b/win/Makefile.in   Mon Jun 01 00:36:01 2009 -0700
4264 @@ -144,6 +144,7 @@
4265  LIBDL = @LIBDL@
4266  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
4267  LIBOBJS = @LIBOBJS@
4268 +LIBRT = @LIBRT@
4269  LIBS = @LIBS@
4270  LIBTOOL = @LIBTOOL@
4271  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
4272 diff -r 1ac0113deff5 zlib/Makefile.in
4273 --- a/zlib/Makefile.in  Mon Jun 01 00:35:44 2009 -0700
4274 +++ b/zlib/Makefile.in  Mon Jun 01 00:36:01 2009 -0700
4275 @@ -187,6 +187,7 @@
4276  LIBDL = @LIBDL@
4277  LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@
4278  LIBOBJS = @LIBOBJS@
4279 +LIBRT = @LIBRT@
4280  LIBS = $(NON_THREADED_LIBS)
4281  LIBTOOL = @LIBTOOL@
4282  LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@
This page took 0.40356 seconds and 4 git commands to generate.