Merge lp:~jaypipes/drizzle/captain-20090915-01 into lp:~drizzle-trunk/drizzle/development

Proposed by Jay Pipes
Status: Superseded
Proposed branch: lp:~jaypipes/drizzle/captain-20090915-01
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: None lines
To merge this branch: bzr merge lp:~jaypipes/drizzle/captain-20090915-01
Reviewer Review Type Date Requested Status
Brian Aker Needs Fixing
Review via email: mp+11816@code.launchpad.net

This proposal has been superseded by a proposal from 2009-09-21.

To post a comment you must log in.
Revision history for this message
Jay Pipes (jaypipes) wrote :

Contains Joe Daly's -Wconversion fixes for mysys/ files and Padraig's enhancements and port of MySQL DTrace Probes.

All tests pass on all 64-bit platforms.

Revision history for this message
Brian Aker (brianaker) wrote :

A few things:
742 + res= (error >= 0 || session->is_error());
743 + DRIZZLE_DELETE_DONE(res, deleted);

On non-dtrace systems this causes an evaluation/assign that will never be used (combine the statement) (once in the code res was the right thing to do, once it was not).

DRIZZLE_QUERY_EXEC_START() <-- why is the third param not const?

Awesome fixes on all of the conversion work.

I can just fix this stuff BTW (working with someone right now on code reviews).

review: Needs Fixing
Revision history for this message
Jay Pipes (jaypipes) wrote :

Brian Aker wrote:
> Review: Needs Fixing
> A few things:
> 742 + res= (error >= 0 || session->is_error());
> 743 + DRIZZLE_DELETE_DONE(res, deleted);
>
> On non-dtrace systems this causes an evaluation/assign that will never be used (combine the statement) (once in the code res was the right thing to do, once it was not).
>
> DRIZZLE_QUERY_EXEC_START() <-- why is the third param not const?

Hmmm...agreed. Nice catch. Padraig, can you try using a
const_cast<const char *>(session->db) for both DRIZZLE_QUERY_START() and
DRIZZLE_QUERY_EXEC_START() calls? Thanks!

> Awesome fixes on all of the conversion work.
>
> I can just fix this stuff BTW (working with someone right now on code reviews).

I'd prefer if Padraig pushed a fix to his branch and we merge in from there.

Thanks!

Jay

Revision history for this message
Padraig O'Sullivan (posulliv) wrote :

> I'd prefer if Padraig pushed a fix to his branch and we merge in from there.

Ok, I made these changes and pushed them to my branch. I'll re-submit the merge proposal now.

Thanks for the comments!
Padraig

>
> Thanks!
>
> Jay

1129. By Jay Pipes <jpipes@serialcoder>

Merge fixes from Trond and Padraig on dtrace probes.

1130. By Jay Pipes <jpipes@serialcoder>

Merge trunk

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'drizzled/Makefile.am'
2--- drizzled/Makefile.am 2009-08-27 00:39:15 +0000
3+++ drizzled/Makefile.am 2009-09-14 20:44:27 +0000
4@@ -18,10 +18,16 @@
5
6 DTRACEFILES = handler.o \
7 filesort.o \
8+ drizzled.o \
9+ session.o \
10 sql_delete.o \
11 sql_insert.o \
12 sql_select.o \
13- sql_update.o
14+ sql_update.o \
15+ sql_parse.o \
16+ statement/delete.o \
17+ statement/insert.o \
18+ statement/insert_select.o
19
20 drizzledincludedir = ${includedir}/drizzled
21 nobase_dist_drizzledinclude_HEADERS = \
22@@ -694,10 +700,6 @@
23 util/convert.cc \
24 xid.cc
25
26-if HAVE_DTRACE
27-drizzled_SOURCES += probes.d
28-endif
29-
30 libserialutil_la_SOURCES = db.cc table_proto_write.cc
31 libserialutil_la_CXXFLAGS= ${AM_CXXFLAGS} ${PROTOSKIP_WARNINGS}
32
33@@ -725,7 +727,7 @@
34 BUILT_SOURCES = $(BUILT_MAINT_SRC) \
35 symbol_hash.h \
36 function_hash.h \
37- $(PCHHEADERS)
38+ $(PCHHEADERS)
39
40 EXTRA_DIST = \
41 $(BUILT_MAINT_SRC) \
42@@ -744,16 +746,26 @@
43 $(PCHHEADERS) \
44 $(nodist_drizzled_SOURCES)
45
46+if HAVE_DTRACE
47+drizzled_SOURCES += probes.d
48+BUILT_SOURCES += generated_probes.h
49+CLEANFILES += generated_probes.h
50+endif
51+
52+
53 DISTCLEANFILES = $(EXTRA_PROGRAMS) \
54 $(BUILT_MAINT_SRC)
55
56 MAINTAINERCLEANFILES = $(BUILT_MAINT_SRC)
57
58-probes.h: probes.d
59- $(DTRACE) $(DTRACEFLAGS) -h -s probes.d
60- mv probes.h probes.h.bak
61- sed "s/#include <unistd.h>//g" probes.h.bak > probes.h
62- rm probes.h.bak
63+generated_probes.h : probes.d
64+ $(DTRACE) $(DTRACEFLAGS) -h -s probes.d -o generated_probes.h
65+ mv generated_probes.h generated_probes.h.bak
66+ sed "s/#include <unistd.h>//g" generated_probes.h.bak > generated_probes.h
67+ rm generated_probes.h.bak
68+ sed -e 's,void \*,const void \*,g' generated_probes.h | \
69+ sed -e 's,char \*,const char \*,g' | tr '\t' ' ' > dtrace_probes.tmp
70+ mv dtrace_probes.tmp generated_probes.h
71
72
73 SUFFIXES = .d .gch .gperf .stamp-h
74
75=== modified file 'drizzled/drizzled.cc'
76--- drizzled/drizzled.cc 2009-08-24 14:57:56 +0000
77+++ drizzled/drizzled.cc 2009-09-13 04:30:14 +0000
78@@ -45,6 +45,7 @@
79 #include <drizzled/scheduling.h>
80 #include "drizzled/temporal_format.h" /* For init_temporal_formats() */
81 #include "drizzled/slot/listen.h"
82+#include "drizzled/probes.h"
83
84 #include <google/protobuf/stubs/common.h>
85
86@@ -456,6 +457,7 @@
87 tmp= *it;
88 tmp->killed= Session::KILL_CONNECTION;
89 tmp->scheduler->killSession(tmp);
90+ DRIZZLE_CONNECTION_DONE(tmp->thread_id);
91 if (tmp->mysys_var)
92 {
93 tmp->mysys_var->abort=1;
94@@ -766,6 +768,7 @@
95 {
96 statistic_increment(killed_threads, &LOCK_status);
97 session->scheduler->killSessionNow(session);
98+ DRIZZLE_CONNECTION_DONE(session->thread_id);
99 }
100 return;
101 }
102
103=== modified file 'drizzled/filesort.cc'
104--- drizzled/filesort.cc 2009-08-20 20:29:18 +0000
105+++ drizzled/filesort.cc 2009-09-13 01:09:19 +0000
106@@ -114,7 +114,7 @@
107 TableList *tab= table->pos_in_table_list;
108 Item_subselect *subselect= tab ? tab->containing_subselect() : 0;
109
110- DRIZZLE_FILESORT_START();
111+ DRIZZLE_FILESORT_START(table->s->db.str, table->s->table_name.str);
112
113 /*
114 Release InnoDB's adaptive hash index latch (if holding) before
115@@ -324,8 +324,8 @@
116 (uint32_t) records, &LOCK_status);
117 *examined_rows= param.examined_rows;
118 memcpy(&table->sort, &table_sort, sizeof(filesort_info_st));
119- DRIZZLE_FILESORT_END();
120- return(error ? HA_POS_ERROR : records);
121+ DRIZZLE_FILESORT_DONE(error, records);
122+ return (error ? HA_POS_ERROR : records);
123 } /* filesort */
124
125
126
127=== modified file 'drizzled/handler.cc'
128--- drizzled/handler.cc 2009-08-23 01:10:19 +0000
129+++ drizzled/handler.cc 2009-09-14 01:25:59 +0000
130@@ -2696,9 +2696,9 @@
131 We cache the table flags if the locking succeeded. Otherwise, we
132 keep them as they were when they were fetched in ha_open().
133 */
134- DRIZZLE_EXTERNAL_LOCK(lock_type);
135
136 int error= external_lock(session, lock_type);
137+
138 if (error == 0)
139 cached_table_flags= table_flags();
140 return error;
141@@ -2729,7 +2729,6 @@
142 int handler::ha_write_row(unsigned char *buf)
143 {
144 int error;
145- DRIZZLE_INSERT_ROW_START();
146
147 /*
148 * If we have a timestamp column, update it to the current time
149@@ -2743,12 +2742,13 @@
150 mark_trx_read_write();
151
152 if (unlikely(error= write_row(buf)))
153+ {
154 return error;
155+ }
156
157 if (unlikely(log_row_for_replication(table, 0, buf)))
158 return HA_ERR_RBR_LOGGING_FAILED; /* purecov: inspected */
159
160- DRIZZLE_INSERT_ROW_END();
161 return 0;
162 }
163
164@@ -2766,7 +2766,9 @@
165 mark_trx_read_write();
166
167 if (unlikely(error= update_row(old_data, new_data)))
168+ {
169 return error;
170+ }
171
172 if (unlikely(log_row_for_replication(table, old_data, new_data)))
173 return HA_ERR_RBR_LOGGING_FAILED;
174
175=== modified file 'drizzled/probes.d'
176--- drizzled/probes.d 2008-11-01 00:46:20 +0000
177+++ drizzled/probes.d 2009-09-14 20:44:27 +0000
178@@ -1,7 +1,7 @@
179 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
180 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
181 *
182- * Copyright (C) 2008 Sun Microsystems
183+ * Copyright (C) 2009 Sun Microsystems
184 *
185 * This program is free software; you can redistribute it and/or modify
186 * it under the terms of the GNU General Public License as published by
187@@ -17,18 +17,107 @@
188 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
189 */
190
191+/*
192+ The actual probe names in DTrace scripts will replace '__' by '-'. Thus
193+ insert__row__start will be insert-row-start.
194+
195+ Recommendations for adding new probes:
196+
197+ - each probe should have the minimal set of arguments required to
198+ unambiguously identify the context in which the probe fires. Redundant
199+ probes (i.e. the ones that can be obtained in user scripts from previous
200+ probes' arguments or otherwise) may be added for convenience.
201+
202+ - try to avoid computationally expensive probe arguments. If impossible,
203+ use *_ENABLED() macros to check if the probe is activated before
204+ performing expensive calculations for a probe argument.
205+
206+ - all *-done probes should have a status argument wherever applicable to make
207+ it possible for user scripts to figure out whether the completed operation
208+ was successful or not.
209+
210+ - for all status arguments, a non-zero value should be returned on error or
211+ failure, 0 should be returned on success.
212+*/
213+
214 provider drizzle {
215-probe external_lock(int);
216-probe insert_row_start();
217-probe insert_row_end();
218-probe filesort_start();
219-probe filesort_end();
220-probe delete_start();
221-probe delete_end();
222-probe insert_start();
223-probe insert_end();
224-probe select_start();
225-probe select_end();
226-probe update_start();
227-probe update_end();
228+
229+ /* The following ones fire when creating or closing a client connection */
230+ probe connection__start(unsigned long conn_id);
231+ probe connection__done(unsigned long conn_id);
232+
233+ /*
234+ * Fire at the start/end of any client command processing (including SQL
235+ * queries).
236+ */
237+ probe command__start(unsigned long conn_id, int command);
238+ probe command__done(int status);
239+
240+ /*
241+ * The following probes fire at the start/end of any SQL query processing,
242+ * respectively.
243+ *
244+ * query_start() has a lot of parameters that can be used to pick up
245+ * parameters for a lot of other probes here. For simplicity reasons we also
246+ * add the query string to most other DTrace probes as well. Hostname is
247+ * either the hostname or the IP address of the Drizzle client.
248+ */
249+ probe query__start(const char *query,
250+ unsigned long conn_id,
251+ const char *db_name);
252+ probe query__done(int status);
253+
254+ /* Fire at the start/end of SQL query parsing */
255+ probe query__parse__start(const char *query);
256+ probe query__parse__done(int status);
257+
258+ /*
259+ * This probe fires when the actual query execution starts
260+ */
261+ probe query__exec__start(const char *query,
262+ unsigned long connid,
263+ const char *db_name);
264+ probe query__exec__done(int status);
265+
266+ /* These probes fire when performing write operations towards any handler */
267+ probe insert__row__start(const char *db, const char *table);
268+ probe insert__row__done(int status);
269+ probe update__row__start(const char *db, const char *table);
270+ probe update__row__done(int status);
271+ probe delete__row__start(const char *db, const char *table);
272+ probe delete__row__done(int status);
273+
274+ /*
275+ * These probes fire when calling external_lock for any handler
276+ * depending on the lock type being acquired or released.
277+ */
278+ probe handler__rdlock__start(const char *db, const char *table);
279+ probe handler__wrlock__start(const char *db, const char *table);
280+ probe handler__unlock__start(const char *db, const char *table);
281+ probe handler__rdlock__done(int status);
282+ probe handler__wrlock__done(int status);
283+ probe handler__unlock__done(int status);
284+
285+ /*
286+ * These probes fire when a filesort activity happens in a query.
287+ */
288+ probe filesort__start(const char *db, const char *table);
289+ probe filesort__done(int status, unsigned long rows);
290+ /*
291+ * The query types SELECT, INSERT, INSERT AS SELECT, UPDATE, DELETE
292+ * are all probed.
293+ * The start probe always contains the query text.
294+ */
295+ probe select__start(const char *query);
296+ probe select__done(int status, unsigned long rows);
297+ probe insert__start(const char *query);
298+ probe insert__done(int status, unsigned long rows);
299+ probe insert__select__start(const char *query);
300+ probe insert__select__done(int status, unsigned long rows);
301+ probe update__start(const char *query);
302+ probe update__done(int status,
303+ unsigned long rowsmatches, unsigned long rowschanged);
304+ probe delete__start(const char *query);
305+ probe delete__done(int status, unsigned long rows);
306+
307 };
308
309=== added file 'drizzled/probes.h'
310--- drizzled/probes.h 1970-01-01 00:00:00 +0000
311+++ drizzled/probes.h 2009-09-14 20:12:21 +0000
312@@ -0,0 +1,97 @@
313+/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
314+ * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
315+ *
316+ * Copyright (C) 2009 Sun Microsystems
317+ *
318+ * This program is free software; you can redistribute it and/or modify
319+ * it under the terms of the GNU General Public License as published by
320+ * the Free Software Foundation; either version 2 of the License, or
321+ * (at your option) any later version.
322+ *
323+ * This program is distributed in the hope that it will be useful,
324+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
325+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
326+ * GNU General Public License for more details.
327+ *
328+ * You should have received a copy of the GNU General Public License
329+ * along with this program; if not, write to the Free Software
330+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
331+ */
332+
333+#ifndef DRIZZLED_PROBES_H
334+#define DRIZZLED_PROBES_H
335+
336+#ifdef HAVE_DTRACE
337+#include "drizzled/generated_probes.h"
338+#else
339+#define DRIZZLE_COMMAND_DONE(arg0)
340+#define DRIZZLE_COMMAND_DONE_ENABLED() (0)
341+#define DRIZZLE_COMMAND_START(arg0, arg1)
342+#define DRIZZLE_COMMAND_START_ENABLED() (0)
343+#define DRIZZLE_CONNECTION_DONE(arg0)
344+#define DRIZZLE_CONNECTION_DONE_ENABLED() (0)
345+#define DRIZZLE_CONNECTION_START(arg0)
346+#define DRIZZLE_CONNECTION_START_ENABLED() (0)
347+#define DRIZZLE_DELETE_DONE(arg0, arg1)
348+#define DRIZZLE_DELETE_DONE_ENABLED() (0)
349+#define DRIZZLE_DELETE_ROW_DONE(arg0)
350+#define DRIZZLE_DELETE_ROW_DONE_ENABLED() (0)
351+#define DRIZZLE_DELETE_ROW_START(arg0, arg1)
352+#define DRIZZLE_DELETE_ROW_START_ENABLED() (0)
353+#define DRIZZLE_DELETE_START(arg0)
354+#define DRIZZLE_DELETE_START_ENABLED() (0)
355+#define DRIZZLE_FILESORT_DONE(arg0, arg1)
356+#define DRIZZLE_FILESORT_DONE_ENABLED() (0)
357+#define DRIZZLE_FILESORT_START(arg0, arg1)
358+#define DRIZZLE_FILESORT_START_ENABLED() (0)
359+#define DRIZZLE_HANDLER_RDLOCK_DONE(arg0)
360+#define DRIZZLE_HANDLER_RDLOCK_DONE_ENABLED() (0)
361+#define DRIZZLE_HANDLER_RDLOCK_START(arg0, arg1)
362+#define DRIZZLE_HANDLER_RDLOCK_START_ENABLED() (0)
363+#define DRIZZLE_HANDLER_UNLOCK_DONE(arg0)
364+#define DRIZZLE_HANDLER_UNLOCK_DONE_ENABLED() (0)
365+#define DRIZZLE_HANDLER_UNLOCK_START(arg0, arg1)
366+#define DRIZZLE_HANDLER_UNLOCK_START_ENABLED() (0)
367+#define DRIZZLE_HANDLER_WRLOCK_DONE(arg0)
368+#define DRIZZLE_HANDLER_WRLOCK_DONE_ENABLED() (0)
369+#define DRIZZLE_HANDLER_WRLOCK_START(arg0, arg1)
370+#define DRIZZLE_HANDLER_WRLOCK_START_ENABLED() (0)
371+#define DRIZZLE_INSERT_DONE(arg0, arg1)
372+#define DRIZZLE_INSERT_DONE_ENABLED() (0)
373+#define DRIZZLE_INSERT_ROW_DONE(arg0)
374+#define DRIZZLE_INSERT_ROW_DONE_ENABLED() (0)
375+#define DRIZZLE_INSERT_ROW_START(arg0, arg1)
376+#define DRIZZLE_INSERT_ROW_START_ENABLED() (0)
377+#define DRIZZLE_INSERT_SELECT_DONE(arg0, arg1)
378+#define DRIZZLE_INSERT_SELECT_DONE_ENABLED() (0)
379+#define DRIZZLE_INSERT_SELECT_START(arg0)
380+#define DRIZZLE_INSERT_SELECT_START_ENABLED() (0)
381+#define DRIZZLE_INSERT_START(arg0)
382+#define DRIZZLE_INSERT_START_ENABLED() (0)
383+#define DRIZZLE_QUERY_DONE(arg0)
384+#define DRIZZLE_QUERY_DONE_ENABLED() (0)
385+#define DRIZZLE_QUERY_EXEC_DONE(arg0)
386+#define DRIZZLE_QUERY_EXEC_DONE_ENABLED() (0)
387+#define DRIZZLE_QUERY_EXEC_START(arg0, arg1, arg2)
388+#define DRIZZLE_QUERY_EXEC_START_ENABLED() (0)
389+#define DRIZZLE_QUERY_PARSE_DONE(arg0)
390+#define DRIZZLE_QUERY_PARSE_DONE_ENABLED() (0)
391+#define DRIZZLE_QUERY_PARSE_START(arg0)
392+#define DRIZZLE_QUERY_PARSE_START_ENABLED() (0)
393+#define DRIZZLE_QUERY_START(arg0, arg1, arg2)
394+#define DRIZZLE_QUERY_START_ENABLED() (0)
395+#define DRIZZLE_SELECT_DONE(arg0, arg1)
396+#define DRIZZLE_SELECT_DONE_ENABLED() (0)
397+#define DRIZZLE_SELECT_START(arg0)
398+#define DRIZZLE_SELECT_START_ENABLED() (0)
399+#define DRIZZLE_UPDATE_DONE(arg0, arg1, arg2)
400+#define DRIZZLE_UPDATE_DONE_ENABLED() (0)
401+#define DRIZZLE_UPDATE_ROW_DONE(arg0)
402+#define DRIZZLE_UPDATE_ROW_DONE_ENABLED() (0)
403+#define DRIZZLE_UPDATE_ROW_START(arg0, arg1)
404+#define DRIZZLE_UPDATE_ROW_START_ENABLED() (0)
405+#define DRIZZLE_UPDATE_START(arg0)
406+#define DRIZZLE_UPDATE_START_ENABLED() (0)
407+#endif
408+
409+#endif /* DRIZZLED_PROBES_H */
410
411=== removed file 'drizzled/probes.h'
412--- drizzled/probes.h 2009-05-21 17:05:14 +0000
413+++ drizzled/probes.h 1970-01-01 00:00:00 +0000
414@@ -1,250 +0,0 @@
415-/*
416- * Generated by dtrace(1M).
417- */
418-
419-#ifndef _PROBES_H
420-#define _PROBES_H
421-
422-
423-
424-#ifdef __cplusplus
425-extern "C" {
426-#endif
427-
428-#if _DTRACE_VERSION
429-
430-#define DRIZZLE_DELETE_END() \
431- __dtrace_drizzle___delete_end()
432-#ifndef __sparc
433-#define DRIZZLE_DELETE_END_ENABLED() \
434- __dtraceenabled_drizzle___delete_end()
435-#else
436-#define DRIZZLE_DELETE_END_ENABLED() \
437- __dtraceenabled_drizzle___delete_end(0)
438-#endif
439-#define DRIZZLE_DELETE_START() \
440- __dtrace_drizzle___delete_start()
441-#ifndef __sparc
442-#define DRIZZLE_DELETE_START_ENABLED() \
443- __dtraceenabled_drizzle___delete_start()
444-#else
445-#define DRIZZLE_DELETE_START_ENABLED() \
446- __dtraceenabled_drizzle___delete_start(0)
447-#endif
448-#define DRIZZLE_EXTERNAL_LOCK(arg0) \
449- __dtrace_drizzle___external_lock(arg0)
450-#ifndef __sparc
451-#define DRIZZLE_EXTERNAL_LOCK_ENABLED() \
452- __dtraceenabled_drizzle___external_lock()
453-#else
454-#define DRIZZLE_EXTERNAL_LOCK_ENABLED() \
455- __dtraceenabled_drizzle___external_lock(0)
456-#endif
457-#define DRIZZLE_FILESORT_END() \
458- __dtrace_drizzle___filesort_end()
459-#ifndef __sparc
460-#define DRIZZLE_FILESORT_END_ENABLED() \
461- __dtraceenabled_drizzle___filesort_end()
462-#else
463-#define DRIZZLE_FILESORT_END_ENABLED() \
464- __dtraceenabled_drizzle___filesort_end(0)
465-#endif
466-#define DRIZZLE_FILESORT_START() \
467- __dtrace_drizzle___filesort_start()
468-#ifndef __sparc
469-#define DRIZZLE_FILESORT_START_ENABLED() \
470- __dtraceenabled_drizzle___filesort_start()
471-#else
472-#define DRIZZLE_FILESORT_START_ENABLED() \
473- __dtraceenabled_drizzle___filesort_start(0)
474-#endif
475-#define DRIZZLE_INSERT_END() \
476- __dtrace_drizzle___insert_end()
477-#ifndef __sparc
478-#define DRIZZLE_INSERT_END_ENABLED() \
479- __dtraceenabled_drizzle___insert_end()
480-#else
481-#define DRIZZLE_INSERT_END_ENABLED() \
482- __dtraceenabled_drizzle___insert_end(0)
483-#endif
484-#define DRIZZLE_INSERT_ROW_END() \
485- __dtrace_drizzle___insert_row_end()
486-#ifndef __sparc
487-#define DRIZZLE_INSERT_ROW_END_ENABLED() \
488- __dtraceenabled_drizzle___insert_row_end()
489-#else
490-#define DRIZZLE_INSERT_ROW_END_ENABLED() \
491- __dtraceenabled_drizzle___insert_row_end(0)
492-#endif
493-#define DRIZZLE_INSERT_ROW_START() \
494- __dtrace_drizzle___insert_row_start()
495-#ifndef __sparc
496-#define DRIZZLE_INSERT_ROW_START_ENABLED() \
497- __dtraceenabled_drizzle___insert_row_start()
498-#else
499-#define DRIZZLE_INSERT_ROW_START_ENABLED() \
500- __dtraceenabled_drizzle___insert_row_start(0)
501-#endif
502-#define DRIZZLE_INSERT_START() \
503- __dtrace_drizzle___insert_start()
504-#ifndef __sparc
505-#define DRIZZLE_INSERT_START_ENABLED() \
506- __dtraceenabled_drizzle___insert_start()
507-#else
508-#define DRIZZLE_INSERT_START_ENABLED() \
509- __dtraceenabled_drizzle___insert_start(0)
510-#endif
511-#define DRIZZLE_SELECT_END() \
512- __dtrace_drizzle___select_end()
513-#ifndef __sparc
514-#define DRIZZLE_SELECT_END_ENABLED() \
515- __dtraceenabled_drizzle___select_end()
516-#else
517-#define DRIZZLE_SELECT_END_ENABLED() \
518- __dtraceenabled_drizzle___select_end(0)
519-#endif
520-#define DRIZZLE_SELECT_START() \
521- __dtrace_drizzle___select_start()
522-#ifndef __sparc
523-#define DRIZZLE_SELECT_START_ENABLED() \
524- __dtraceenabled_drizzle___select_start()
525-#else
526-#define DRIZZLE_SELECT_START_ENABLED() \
527- __dtraceenabled_drizzle___select_start(0)
528-#endif
529-#define DRIZZLE_UPDATE_END() \
530- __dtrace_drizzle___update_end()
531-#ifndef __sparc
532-#define DRIZZLE_UPDATE_END_ENABLED() \
533- __dtraceenabled_drizzle___update_end()
534-#else
535-#define DRIZZLE_UPDATE_END_ENABLED() \
536- __dtraceenabled_drizzle___update_end(0)
537-#endif
538-#define DRIZZLE_UPDATE_START() \
539- __dtrace_drizzle___update_start()
540-#ifndef __sparc
541-#define DRIZZLE_UPDATE_START_ENABLED() \
542- __dtraceenabled_drizzle___update_start()
543-#else
544-#define DRIZZLE_UPDATE_START_ENABLED() \
545- __dtraceenabled_drizzle___update_start(0)
546-#endif
547-
548-
549-extern void __dtrace_drizzle___delete_end(void);
550-#ifndef __sparc
551-extern int __dtraceenabled_drizzle___delete_end(void);
552-#else
553-extern int __dtraceenabled_drizzle___delete_end(long);
554-#endif
555-extern void __dtrace_drizzle___delete_start(void);
556-#ifndef __sparc
557-extern int __dtraceenabled_drizzle___delete_start(void);
558-#else
559-extern int __dtraceenabled_drizzle___delete_start(long);
560-#endif
561-extern void __dtrace_drizzle___external_lock(int);
562-#ifndef __sparc
563-extern int __dtraceenabled_drizzle___external_lock(void);
564-#else
565-extern int __dtraceenabled_drizzle___external_lock(long);
566-#endif
567-extern void __dtrace_drizzle___filesort_end(void);
568-#ifndef __sparc
569-extern int __dtraceenabled_drizzle___filesort_end(void);
570-#else
571-extern int __dtraceenabled_drizzle___filesort_end(long);
572-#endif
573-extern void __dtrace_drizzle___filesort_start(void);
574-#ifndef __sparc
575-extern int __dtraceenabled_drizzle___filesort_start(void);
576-#else
577-extern int __dtraceenabled_drizzle___filesort_start(long);
578-#endif
579-extern void __dtrace_drizzle___insert_end(void);
580-#ifndef __sparc
581-extern int __dtraceenabled_drizzle___insert_end(void);
582-#else
583-extern int __dtraceenabled_drizzle___insert_end(long);
584-#endif
585-extern void __dtrace_drizzle___insert_row_end(void);
586-#ifndef __sparc
587-extern int __dtraceenabled_drizzle___insert_row_end(void);
588-#else
589-extern int __dtraceenabled_drizzle___insert_row_end(long);
590-#endif
591-extern void __dtrace_drizzle___insert_row_start(void);
592-#ifndef __sparc
593-extern int __dtraceenabled_drizzle___insert_row_start(void);
594-#else
595-extern int __dtraceenabled_drizzle___insert_row_start(long);
596-#endif
597-extern void __dtrace_drizzle___insert_start(void);
598-#ifndef __sparc
599-extern int __dtraceenabled_drizzle___insert_start(void);
600-#else
601-extern int __dtraceenabled_drizzle___insert_start(long);
602-#endif
603-extern void __dtrace_drizzle___select_end(void);
604-#ifndef __sparc
605-extern int __dtraceenabled_drizzle___select_end(void);
606-#else
607-extern int __dtraceenabled_drizzle___select_end(long);
608-#endif
609-extern void __dtrace_drizzle___select_start(void);
610-#ifndef __sparc
611-extern int __dtraceenabled_drizzle___select_start(void);
612-#else
613-extern int __dtraceenabled_drizzle___select_start(long);
614-#endif
615-extern void __dtrace_drizzle___update_end(void);
616-#ifndef __sparc
617-extern int __dtraceenabled_drizzle___update_end(void);
618-#else
619-extern int __dtraceenabled_drizzle___update_end(long);
620-#endif
621-extern void __dtrace_drizzle___update_start(void);
622-#ifndef __sparc
623-extern int __dtraceenabled_drizzle___update_start(void);
624-#else
625-extern int __dtraceenabled_drizzle___update_start(long);
626-#endif
627-
628-#else
629-
630-#define DRIZZLE_DELETE_END()
631-#define DRIZZLE_DELETE_END_ENABLED() (0)
632-#define DRIZZLE_DELETE_START()
633-#define DRIZZLE_DELETE_START_ENABLED() (0)
634-#define DRIZZLE_EXTERNAL_LOCK(arg0)
635-#define DRIZZLE_EXTERNAL_LOCK_ENABLED() (0)
636-#define DRIZZLE_FILESORT_END()
637-#define DRIZZLE_FILESORT_END_ENABLED() (0)
638-#define DRIZZLE_FILESORT_START()
639-#define DRIZZLE_FILESORT_START_ENABLED() (0)
640-#define DRIZZLE_INSERT_END()
641-#define DRIZZLE_INSERT_END_ENABLED() (0)
642-#define DRIZZLE_INSERT_ROW_END()
643-#define DRIZZLE_INSERT_ROW_END_ENABLED() (0)
644-#define DRIZZLE_INSERT_ROW_START()
645-#define DRIZZLE_INSERT_ROW_START_ENABLED() (0)
646-#define DRIZZLE_INSERT_START()
647-#define DRIZZLE_INSERT_START_ENABLED() (0)
648-#define DRIZZLE_SELECT_END()
649-#define DRIZZLE_SELECT_END_ENABLED() (0)
650-#define DRIZZLE_SELECT_START()
651-#define DRIZZLE_SELECT_START_ENABLED() (0)
652-#define DRIZZLE_UPDATE_END()
653-#define DRIZZLE_UPDATE_END_ENABLED() (0)
654-#define DRIZZLE_UPDATE_START()
655-#define DRIZZLE_UPDATE_START_ENABLED() (0)
656-
657-#endif
658-
659-
660-#ifdef __cplusplus
661-}
662-#endif
663-
664-#endif /* _PROBES_H */
665
666=== modified file 'drizzled/session.cc'
667--- drizzled/session.cc 2009-08-16 14:14:39 +0000
668+++ drizzled/session.cc 2009-09-13 04:30:14 +0000
669@@ -37,6 +37,7 @@
670 #include <drizzled/item/empty_string.h>
671 #include <drizzled/show.h>
672 #include <drizzled/scheduling.h>
673+#include "drizzled/probes.h"
674
675 #include <algorithm>
676
677@@ -481,6 +482,7 @@
678 if (state_to_set != Session::KILL_QUERY)
679 {
680 scheduler->killSession(this);
681+ DRIZZLE_CONNECTION_DONE(thread_id);
682 }
683 if (mysys_var)
684 {
685@@ -620,6 +622,7 @@
686
687 if (scheduler->addSession(this))
688 {
689+ DRIZZLE_CONNECTION_START(thread_id);
690 char error_message_buff[DRIZZLE_ERRMSG_SIZE];
691
692 killed= Session::KILL_CONNECTION;
693
694=== modified file 'drizzled/sql_delete.cc'
695--- drizzled/sql_delete.cc 2009-08-06 16:51:53 +0000
696+++ drizzled/sql_delete.cc 2009-09-13 04:30:14 +0000
697@@ -25,6 +25,7 @@
698 #include <drizzled/sql_parse.h>
699 #include <drizzled/sql_base.h>
700 #include <drizzled/lock.h>
701+#include "drizzled/probes.h"
702
703 /**
704 Implement DELETE SQL word.
705@@ -50,10 +51,14 @@
706 uint32_t usable_index= MAX_KEY;
707 Select_Lex *select_lex= &session->lex->select_lex;
708 Session::killed_state killed_status= Session::NOT_KILLED;
709+ int res= 0;
710
711
712 if (session->openTablesLock(table_list))
713+ {
714+ DRIZZLE_DELETE_DONE(1, 0);
715 return true;
716+ }
717
718 table= table_list->table;
719 assert(table);
720@@ -162,14 +167,14 @@
721 delete select;
722 free_underlaid_joins(session, select_lex);
723 session->row_count_func= 0;
724- DRIZZLE_DELETE_END();
725+ DRIZZLE_DELETE_DONE(0, 0);
726 session->my_ok((ha_rows) session->row_count_func);
727 /*
728 We don't need to call reset_auto_increment in this case, because
729 mysql_truncate always gives a NULL conds argument, hence we never
730 get here.
731 */
732- return(0); // Nothing to delete
733+ return 0; // Nothing to delete
734 }
735
736 /* If running in safe sql mode, don't allow updates without keys */
737@@ -322,17 +327,18 @@
738 assert(transactional_table || !deleted || session->transaction.stmt.modified_non_trans_table);
739 free_underlaid_joins(session, select_lex);
740
741- DRIZZLE_DELETE_END();
742+ res= (error >= 0 || session->is_error());
743+ DRIZZLE_DELETE_DONE(res, deleted);
744 if (error < 0 || (session->lex->ignore && !session->is_fatal_error))
745 {
746 session->row_count_func= deleted;
747 session->my_ok((ha_rows) session->row_count_func);
748 }
749- return(error >= 0 || session->is_error());
750+ return (error >= 0 || session->is_error());
751
752 err:
753- DRIZZLE_DELETE_END();
754- return(true);
755+ DRIZZLE_DELETE_DONE(1, 0);
756+ return true;
757 }
758
759
760
761=== modified file 'drizzled/sql_insert.cc'
762--- drizzled/sql_insert.cc 2009-08-24 14:57:56 +0000
763+++ drizzled/sql_insert.cc 2009-09-13 04:30:14 +0000
764@@ -240,7 +240,10 @@
765 values_list.elements > 1);
766
767 if (session->openTablesLock(table_list))
768+ {
769+ DRIZZLE_INSERT_DONE(1, 0);
770 return true;
771+ }
772
773 lock_type= table_list->lock_type;
774
775@@ -466,8 +469,8 @@
776 info.copied + info.deleted + info.touched, id, buff);
777 }
778 session->abort_on_warning= 0;
779- DRIZZLE_INSERT_END();
780- return(false);
781+ DRIZZLE_INSERT_DONE(0, session->row_count_func);
782+ return false;
783
784 abort:
785 if (table != NULL)
786@@ -475,8 +478,8 @@
787 if (!joins_freed)
788 free_underlaid_joins(session, &session->lex->select_lex);
789 session->abort_on_warning= 0;
790- DRIZZLE_INSERT_END();
791- return(true);
792+ DRIZZLE_INSERT_DONE(1, 0);
793+ return true;
794 }
795
796
797@@ -1336,7 +1339,8 @@
798 if (error)
799 {
800 table->file->print_error(error,MYF(0));
801- return(1);
802+ DRIZZLE_INSERT_SELECT_DONE(error, 0);
803+ return 1;
804 }
805 char buff[160];
806 if (info.ignore)
807@@ -1354,7 +1358,8 @@
808 (info.copied ? autoinc_value_of_last_inserted_row : 0));
809 session->my_ok((ulong) session->row_count_func,
810 info.copied + info.deleted + info.touched, id, buff);
811- return(0);
812+ DRIZZLE_INSERT_SELECT_DONE(0, session->row_count_func);
813+ return 0;
814 }
815
816 void select_insert::abort() {
817@@ -1393,6 +1398,11 @@
818 table->file->ha_release_auto_increment();
819 }
820
821+ if (DRIZZLE_INSERT_SELECT_DONE_ENABLED())
822+ {
823+ DRIZZLE_INSERT_SELECT_DONE(0, info.copied + info.deleted + info.updated);
824+ }
825+
826 return;
827 }
828
829
830=== modified file 'drizzled/sql_parse.cc'
831--- drizzled/sql_parse.cc 2009-08-27 01:04:45 +0000
832+++ drizzled/sql_parse.cc 2009-09-14 04:21:55 +0000
833@@ -35,6 +35,7 @@
834 #include <drizzled/lock.h>
835 #include <drizzled/select_send.h>
836 #include <drizzled/statement.h>
837+#include "drizzled/probes.h"
838
839 #include <bitset>
840 #include <algorithm>
841@@ -166,7 +167,10 @@
842 bool error= 0;
843 Query_id &query_id= Query_id::get_query_id();
844
845- session->command=command;
846+ DRIZZLE_COMMAND_START(session->thread_id,
847+ command);
848+
849+ session->command= command;
850 session->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
851 session->set_time();
852 session->query_id= query_id.value();
853@@ -204,6 +208,9 @@
854 {
855 if (! session->readAndStoreQuery(packet, packet_length))
856 break; // fatal error is set
857+ DRIZZLE_QUERY_START(session->query,
858+ session->thread_id,
859+ (char *) (session->db ? session->db : ""));
860 const char* end_of_stmt= NULL;
861
862 mysql_parse(session, session->query, session->query_length, &end_of_stmt);
863@@ -295,15 +302,25 @@
864
865 /* Store temp state for processlist */
866 session->set_proc_info("cleaning up");
867- session->command=COM_SLEEP;
868+ session->command= COM_SLEEP;
869 memset(session->process_list_info, 0, PROCESS_LIST_WIDTH);
870- session->query=0;
871- session->query_length=0;
872+ session->query= 0;
873+ session->query_length= 0;
874
875 session->set_proc_info(NULL);
876 session->packet.shrink(session->variables.net_buffer_length); // Reclaim some memory
877 free_root(session->mem_root,MYF(MY_KEEP_PREALLOC));
878- return(error);
879+
880+ if (DRIZZLE_QUERY_DONE_ENABLED() || DRIZZLE_COMMAND_DONE_ENABLED())
881+ {
882+ if (command == COM_QUERY)
883+ {
884+ DRIZZLE_QUERY_DONE(session->is_error());
885+ }
886+ DRIZZLE_COMMAND_DONE(session->is_error());
887+ }
888+
889+ return error;
890 }
891
892
893@@ -759,8 +776,12 @@
894 if (*found_semicolon &&
895 (session->query_length= (ulong)(*found_semicolon - session->query)))
896 session->query_length--;
897+ DRIZZLE_QUERY_EXEC_START(session->query,
898+ session->thread_id,
899+ (char *) (session->db ? session->db : ""));
900 /* Actually execute the query */
901 mysql_execute_command(session);
902+ DRIZZLE_QUERY_EXEC_DONE(0);
903 }
904 }
905 }
906@@ -1819,6 +1840,8 @@
907 {
908 assert(session->m_lip == NULL);
909
910+ DRIZZLE_QUERY_PARSE_START(session->query);
911+
912 /* Set Lex_input_stream. */
913
914 session->m_lip= lip;
915@@ -1835,6 +1858,8 @@
916
917 session->m_lip= NULL;
918
919+ DRIZZLE_QUERY_PARSE_DONE(mysql_parse_status || session->is_fatal_error);
920+
921 /* That's it. */
922
923 return mysql_parse_status || session->is_fatal_error;
924
925=== modified file 'drizzled/sql_select.cc'
926--- drizzled/sql_select.cc 2009-08-20 21:45:52 +0000
927+++ drizzled/sql_select.cc 2009-09-13 01:44:36 +0000
928@@ -124,7 +124,7 @@
929 {
930 bool res;
931 register Select_Lex *select_lex= &lex->select_lex;
932- DRIZZLE_SELECT_START();
933+ DRIZZLE_SELECT_START(session->query);
934
935 if (select_lex->master_unit()->is_union() ||
936 select_lex->master_unit()->fake_select_lex)
937@@ -157,8 +157,8 @@
938 if (unlikely(res))
939 result->abort();
940
941- DRIZZLE_SELECT_END();
942- return(res);
943+ DRIZZLE_SELECT_DONE(res, session->limit_found_rows);
944+ return res;
945 }
946
947 /*
948
949=== modified file 'drizzled/sql_update.cc'
950--- drizzled/sql_update.cc 2009-08-20 20:29:18 +0000
951+++ drizzled/sql_update.cc 2009-09-13 04:30:14 +0000
952@@ -138,10 +138,14 @@
953 uint64_t id;
954 List<Item> all_fields;
955 Session::killed_state killed_status= Session::NOT_KILLED;
956+ int res= 0;
957
958- DRIZZLE_UPDATE_START();
959+ DRIZZLE_UPDATE_START(session->query);
960 if (session->openTablesLock(table_list))
961+ {
962+ DRIZZLE_UPDATE_DONE(1, 0, 0);
963 return 1;
964+ }
965
966 session->set_proc_info("init");
967 table= table_list->table;
968@@ -179,8 +183,8 @@
969 if (select_lex->inner_refs_list.elements &&
970 fix_inner_refs(session, all_fields, select_lex, select_lex->ref_pointer_array))
971 {
972- DRIZZLE_UPDATE_END();
973- return(-1);
974+ DRIZZLE_UPDATE_DONE(1, 0, 0);
975+ return -1;
976 }
977
978 if (conds)
979@@ -215,9 +219,9 @@
980 free_underlaid_joins(session, select_lex);
981 if (error)
982 goto abort; // Error in where
983- DRIZZLE_UPDATE_END();
984+ DRIZZLE_UPDATE_DONE(0, 0, 0);
985 session->my_ok(); // No matching records
986- return(0);
987+ return 0;
988 }
989 if (!select && limit != HA_POS_ERROR)
990 {
991@@ -627,7 +631,6 @@
992 id= session->arg_of_last_insert_id_function ?
993 session->first_successful_insert_id_in_prev_stmt : 0;
994
995- DRIZZLE_UPDATE_END();
996 if (error < 0)
997 {
998 char buff[STRING_BUFFER_USUAL_SIZE];
999@@ -638,7 +641,9 @@
1000 }
1001 session->count_cuted_fields= CHECK_FIELD_IGNORE; /* calc cuted fields */
1002 session->abort_on_warning= 0;
1003- return((error >= 0 || session->is_error()) ? 1 : 0);
1004+ res= (error >= 0 || session->is_error()) ? 1 : 0;
1005+ DRIZZLE_UPDATE_DONE(res, found, updated);
1006+ return ((error >= 0 || session->is_error()) ? 1 : 0);
1007
1008 err:
1009 delete select;
1010@@ -651,8 +656,8 @@
1011 session->abort_on_warning= 0;
1012
1013 abort:
1014- DRIZZLE_UPDATE_END();
1015- return(1);
1016+ DRIZZLE_UPDATE_DONE(1, 0, 0);
1017+ return 1;
1018 }
1019
1020 /*
1021
1022=== modified file 'drizzled/statement/delete.cc'
1023--- drizzled/statement/delete.cc 2009-08-10 18:03:39 +0000
1024+++ drizzled/statement/delete.cc 2009-09-13 04:30:14 +0000
1025@@ -22,12 +22,14 @@
1026 #include <drizzled/show.h>
1027 #include <drizzled/session.h>
1028 #include <drizzled/lock.h>
1029+#include <drizzled/probes.h>
1030 #include <drizzled/statement/delete.h>
1031
1032 using namespace drizzled;
1033
1034 bool statement::Delete::execute()
1035 {
1036+ DRIZZLE_DELETE_START(session->query);
1037 TableList *first_table= (TableList *) session->lex->select_lex.table_list.first;
1038 TableList *all_tables= session->lex->query_tables;
1039 Select_Lex *select_lex= &session->lex->select_lex;
1040
1041=== modified file 'drizzled/statement/insert.cc'
1042--- drizzled/statement/insert.cc 2009-08-26 23:47:28 +0000
1043+++ drizzled/statement/insert.cc 2009-09-13 04:30:14 +0000
1044@@ -22,6 +22,7 @@
1045 #include <drizzled/show.h>
1046 #include <drizzled/lock.h>
1047 #include <drizzled/session.h>
1048+#include <drizzled/probes.h>
1049 #include <drizzled/statement/insert.h>
1050
1051 using namespace drizzled;
1052@@ -43,6 +44,8 @@
1053 return true;
1054 }
1055
1056+ DRIZZLE_INSERT_START(session->query);
1057+
1058 bool res= mysql_insert(session,
1059 all_tables,
1060 session->lex->field_list,
1061
1062=== modified file 'drizzled/statement/insert_select.cc'
1063--- drizzled/statement/insert_select.cc 2009-08-27 00:39:15 +0000
1064+++ drizzled/statement/insert_select.cc 2009-09-13 04:30:14 +0000
1065@@ -22,6 +22,7 @@
1066 #include <drizzled/show.h>
1067 #include <drizzled/lock.h>
1068 #include <drizzled/session.h>
1069+#include <drizzled/probes.h>
1070 #include <drizzled/statement/insert_select.h>
1071
1072 using namespace drizzled;
1073@@ -54,6 +55,7 @@
1074
1075 if (! (res= session->openTablesLock(all_tables)))
1076 {
1077+ DRIZZLE_INSERT_SELECT_START(session->query);
1078 /* Skip first table, which is the table we are inserting in */
1079 TableList *second_table= first_table->next_local;
1080 select_lex->table_list.first= (unsigned char*) second_table;
1081
1082=== modified file 'm4/pandora_64bit.m4'
1083--- m4/pandora_64bit.m4 2009-08-04 17:58:31 +0000
1084+++ m4/pandora_64bit.m4 2009-09-14 18:37:34 +0000
1085@@ -23,7 +23,7 @@
1086 AS_IF([test "$isainfo_b" != "x"],[
1087
1088 isainfo_k=`${ISAINFO} -k`
1089- DTRACEFLAGS="${DTRACEFLAGS} -${isainfo_k}"
1090+ DTRACEFLAGS="${DTRACEFLAGS} -${isainfo_b}"
1091
1092 AS_IF([test "x$ac_enable_64bit" = "xyes"],[
1093
1094
1095=== modified file 'mysys/my_bitmap.cc'
1096--- mysys/my_bitmap.cc 2009-07-30 02:39:13 +0000
1097+++ mysys/my_bitmap.cc 2009-09-15 01:32:36 +0000
1098@@ -29,7 +29,7 @@
1099 Create a mask with the upper 'unused' bits set and the lower 'used'
1100 bits clear. The bits within each byte is stored in big-endian order.
1101 */
1102- unsigned char const mask= (~((1 << used) - 1)) & 255;
1103+ unsigned char const mask= static_cast<unsigned char const>((~((1 << used) - 1)) & 255);
1104
1105 /*
1106 The first bytes are to be set to zero since they represent real bits
1107@@ -87,9 +87,9 @@
1108 bool MyBitmap::testAndSet(const uint32_t bitPos)
1109 {
1110 unsigned char *value= ((unsigned char*) bitmap) + (bitPos / 8);
1111- unsigned char bit= 1 << ((bitPos) & 7);
1112- unsigned char res= (*value) & bit;
1113- *value|= bit;
1114+ unsigned char bit= static_cast<unsigned char>(1 << ((bitPos) & 7));
1115+ unsigned char res= static_cast<unsigned char>((*value) & bit);
1116+ *value= static_cast<unsigned char>(*value | bit);
1117 return res;
1118 }
1119
1120@@ -98,9 +98,9 @@
1121 bool MyBitmap::testAndClear(const uint32_t bitPos)
1122 {
1123 unsigned char *byte= (unsigned char*) bitmap + (bitPos / 8);
1124- unsigned char bit= 1 << ((bitPos) & 7);
1125- unsigned char res= (*byte) & bit;
1126- *byte&= ~bit;
1127+ unsigned char bit= static_cast<unsigned char>(1 << ((bitPos) & 7));
1128+ unsigned char res= static_cast<unsigned char>((*byte) & bit);
1129+ *byte= static_cast<unsigned char>(*byte & ~bit);
1130 return res;
1131 }
1132
1133@@ -133,7 +133,7 @@
1134 m+= prefix_bytes;
1135 if ((prefix_bits= prefix_size & 7))
1136 {
1137- *m++= (1 << prefix_bits)-1;
1138+ *m++= static_cast<unsigned char>((1 << prefix_bits)-1);
1139 }
1140 if ((d= numOfBytesInMap() - prefix_bytes))
1141 {
1142@@ -284,7 +284,7 @@
1143
1144 void MyBitmap::setAbove(const uint32_t from_byte, const uint32_t use_bit)
1145 {
1146- unsigned char use_byte= use_bit ? 0xff : 0;
1147+ unsigned char use_byte= static_cast<unsigned char>(use_bit ? 0xff : 0);
1148 unsigned char *to= (unsigned char *) bitmap + from_byte;
1149 unsigned char *end= (unsigned char *) bitmap + (n_bits+7)/8;
1150
1151
1152=== modified file 'mysys/my_bitmap.h'
1153--- mysys/my_bitmap.h 2009-07-30 04:00:24 +0000
1154+++ mysys/my_bitmap.h 2009-09-15 01:32:36 +0000
1155@@ -171,7 +171,10 @@
1156 */
1157 void setBit(const uint32_t bit)
1158 {
1159- ((unsigned char *)bitmap)[bit / 8] |= (1 << ((bit) & 7));
1160+ reinterpret_cast<unsigned char *>(bitmap)[bit / 8]=
1161+ static_cast<unsigned char>(
1162+ (reinterpret_cast<unsigned char *>(bitmap))[bit / 8] |
1163+ (1 << ((bit) & 7)));
1164 }
1165
1166 /**
1167@@ -181,7 +184,10 @@
1168 */
1169 void flipBit(const uint32_t bit)
1170 {
1171- ((unsigned char *)bitmap)[bit / 8] ^= (1 << ((bit) & 7));
1172+ reinterpret_cast<unsigned char *>(bitmap)[bit / 8]=
1173+ static_cast<unsigned char>(
1174+ (reinterpret_cast<unsigned char *>(bitmap))[bit / 8] ^
1175+ (1 << ((bit) & 7)));
1176 }
1177
1178 /**
1179@@ -191,7 +197,10 @@
1180 */
1181 void clearBit(const uint32_t bit)
1182 {
1183- ((unsigned char *)bitmap)[bit / 8] &= ~ (1 << ((bit) & 7));
1184+ reinterpret_cast<unsigned char *>(bitmap)[bit / 8]=
1185+ static_cast<unsigned char>(
1186+ (reinterpret_cast<unsigned char *>(bitmap))[bit / 8] &
1187+ ~ (1 << ((bit) & 7)));
1188 }
1189
1190 /**
1191
1192=== modified file 'mysys/my_copy.cc'
1193--- mysys/my_copy.cc 2009-04-17 21:01:47 +0000
1194+++ mysys/my_copy.cc 2009-09-15 01:32:36 +0000
1195@@ -79,7 +79,8 @@
1196 MyFlags)) < 0)
1197 goto err;
1198
1199- while ((Count=my_read(from_file, buff, sizeof(buff), MyFlags)) != 0)
1200+ while ((Count= static_cast<uint32_t>(my_read(from_file, buff,
1201+ sizeof(buff), MyFlags))) != 0)
1202 {
1203 if (Count == (uint32_t) -1 ||
1204 my_write(to_file,buff,Count,MYF(MyFlags | MY_NABP)))
1205
1206=== modified file 'mysys/my_getopt.cc'
1207--- mysys/my_getopt.cc 2009-06-24 23:48:15 +0000
1208+++ mysys/my_getopt.cc 2009-09-15 01:32:36 +0000
1209@@ -217,7 +217,7 @@
1210 }
1211 else
1212 {
1213- length= strlen(opt_str);
1214+ length= static_cast<uint32_t>(strlen(opt_str));
1215 optend= 0;
1216 }
1217
1218
1219=== modified file 'mysys/my_init.cc'
1220--- mysys/my_init.cc 2009-05-04 18:11:56 +0000
1221+++ mysys/my_init.cc 2009-09-15 01:32:36 +0000
1222@@ -121,10 +121,10 @@
1223 Non-physical pagefaults %ld, Physical pagefaults %ld, Swaps %ld\n\
1224 Blocks in %ld out %ld, Messages in %ld out %ld, Signals %ld\n\
1225 Voluntary context switches %ld, Involuntary context switches %ld\n",
1226- (rus.ru_utime.tv_sec * SCALE_SEC +
1227- rus.ru_utime.tv_usec / SCALE_USEC) / 100.0,
1228- (rus.ru_stime.tv_sec * SCALE_SEC +
1229- rus.ru_stime.tv_usec / SCALE_USEC) / 100.0,
1230+ static_cast<double>((rus.ru_utime.tv_sec * SCALE_SEC +
1231+ rus.ru_utime.tv_usec / SCALE_USEC)) / 100.0,
1232+ static_cast<double>((rus.ru_stime.tv_sec * SCALE_SEC +
1233+ rus.ru_stime.tv_usec / SCALE_USEC)) / 100.0,
1234 rus.ru_maxrss, rus.ru_idrss,
1235 rus.ru_minflt, rus.ru_majflt,
1236 rus.ru_nswap, rus.ru_inblock, rus.ru_oublock,
1237
1238=== modified file 'mysys/my_lib.cc'
1239--- mysys/my_lib.cc 2009-05-23 16:15:00 +0000
1240+++ mysys/my_lib.cc 2009-09-15 01:32:36 +0000
1241@@ -142,7 +142,7 @@
1242 (void) closedir(dirp);
1243
1244 result->dir_entry= (FILEINFO *)dir_entries_storage->buffer;
1245- result->number_off_files= dir_entries_storage->elements;
1246+ result->number_off_files= static_cast<uint>(dir_entries_storage->elements);
1247
1248 if (!(MyFlags & MY_DONT_SORT))
1249 my_qsort((void *) result->dir_entry, result->number_off_files,
1250
1251=== modified file 'mysys/my_symlink2.cc'
1252--- mysys/my_symlink2.cc 2009-06-16 01:36:01 +0000
1253+++ mysys/my_symlink2.cc 2009-09-15 01:32:36 +0000
1254@@ -134,7 +134,8 @@
1255 char link_name[FN_REFLEN], tmp_name[FN_REFLEN];
1256 int sym_link_size= -1;
1257 int was_symlink= (!my_disable_symlinks &&
1258- (sym_link_size= readlink(from,link_name,FN_REFLEN-1)) != -1);
1259+ (sym_link_size= static_cast<int>(readlink(from,link_name,
1260+ FN_REFLEN-1))) != -1);
1261 int result=0;
1262 int name_is_different;
1263