Merge lp:~posulliv/drizzle/dtrace-probes into lp:~drizzle-trunk/drizzle/development
- dtrace-probes
- Merge into development
Status: | Merged |
---|---|
Approved by: | Jay Pipes |
Approved revision: | 1152 |
Merged at revision: | not available |
Proposed branch: | lp:~posulliv/drizzle/dtrace-probes |
Merge into: | lp:~drizzle-trunk/drizzle/development |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~posulliv/drizzle/dtrace-probes |
Related bugs: | |
Related blueprints: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jay Pipes (community) | Approve | ||
Review via email: mp+11984@code.launchpad.net |
This proposal supersedes a proposal from 2009-09-17.
Commit message
Description of the change
Padraig O'Sullivan (posulliv) wrote : Posted in a previous version of this proposal | # |
Jay Pipes (jaypipes) wrote : Posted in a previous version of this proposal | # |
I was going to approve, but then I just couldn't...
I know it's not your fault, because you did not write the original code, but I have real problems with stuff like this:
539 +#define DRIZZLE_
540 + __dtrace_
What is arg0 and arg1? From looking at this, I have no clue what this does. Is it general arguments? Is it specific to the row being deleted? Are these the arguments to which you refer with "all *-done probes should have a status argument wherever applicable" in the header comment?
Please advise :)
I very much appreciate you putting the nice, instructive comment at the top of probes.h for future developers to get assistance in adding new probes, though! Well done. :)
Padraig O'Sullivan (posulliv) wrote : Posted in a previous version of this proposal | # |
Hey Jay,
Thanks for the comments. So the issue here is that the probes.h file is generated automatically by dtrace during the build process from the probes.d file. So unfortunately, as much as I agree with you, I can't do anything about it :)
In fact, I don't think we even need to have the probes.h header file in our bzr repository but I need to double check that.
-Padraig
Monty Taylor (mordred) wrote : Posted in a previous version of this proposal | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Padraig O'Sullivan wrote:
> Hey Jay,
>
> Thanks for the comments. So the issue here is that the probes.h file
> is generated automatically by dtrace during the build process from
> the probes.d file. So unfortunately, as much as I agree with you, I
> can't do anything about it :)
>
> In fact, I don't think we even need to have the probes.h header file
> in our bzr repository but I need to double check that.
If we can not have it in bzr, that would be great.
Monty
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAkq
/38AnRtKjRUqIa3
=+sqw
-----END PGP SIGNATURE-----
Jay Pipes (jaypipes) wrote : Posted in a previous version of this proposal | # |
Hi! Nice cleanup and organization of the .h and generated stuff.
I have one question, though.
880 + if (DRIZZLE_
881 + {
882 + if (command == COM_QUERY)
883 + {
884 + DRIZZLE_
885 + }
886 + DRIZZLE_
887 + }
888 +
889 + return error;
Did you mean to do this? In the case when DRIZZLE_
Padraig O'Sullivan (posulliv) wrote : Posted in a previous version of this proposal | # |
Hey Jay,
Yeah, I had intended that. The idea is that there is different levels of tracing; you could think of the probes being organized in a hierarchy like:
command-start
query-start
query-parse
query-exec
query-done
command-done
So that if the query execution is being traced, we should indicated that the query has finished as well as the command. However, if query tracing was not enabled, there is no need to call DRIZZLE_QUERY_DONE as it was not enabled.
Does that make any sense? Cheers for the review comments!
-Padraig
Jay Pipes (jaypipes) wrote : Posted in a previous version of this proposal | # |
OK, sounds good. Was just making sure. :)
Merging into lp:~jaypipes/drizzle/captain-20090915-01 along with Joe's conversion cleanups.
Jay Pipes (jaypipes) wrote : | # |
Looks good. Merging into my captain branches now.
Preview Diff
1 | === modified file 'drizzled/Makefile.am' |
2 | --- drizzled/Makefile.am 2009-08-27 00:39:15 +0000 |
3 | +++ drizzled/Makefile.am 2009-09-16 13:51:30 +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,29 @@ |
43 | $(PCHHEADERS) \ |
44 | $(nodist_drizzled_SOURCES) |
45 | |
46 | +if DTRACE_NEEDS_OBJECTS |
47 | +drizzled_SOURCES += probes.d |
48 | +endif |
49 | + |
50 | +if HAVE_DTRACE |
51 | +BUILT_SOURCES += generated_probes.h |
52 | +CLEANFILES += generated_probes.h |
53 | +endif |
54 | + |
55 | + |
56 | DISTCLEANFILES = $(EXTRA_PROGRAMS) \ |
57 | $(BUILT_MAINT_SRC) |
58 | |
59 | MAINTAINERCLEANFILES = $(BUILT_MAINT_SRC) |
60 | |
61 | -probes.h: probes.d |
62 | - $(DTRACE) $(DTRACEFLAGS) -h -s probes.d |
63 | - mv probes.h probes.h.bak |
64 | - sed "s/#include <unistd.h>//g" probes.h.bak > probes.h |
65 | - rm probes.h.bak |
66 | +generated_probes.h : probes.d |
67 | + $(DTRACE) $(DTRACEFLAGS) -h -s probes.d -o generated_probes.h |
68 | + mv generated_probes.h generated_probes.h.bak |
69 | + sed "s/#include <unistd.h>//g" generated_probes.h.bak > generated_probes.h |
70 | + rm generated_probes.h.bak |
71 | + sed -e 's,void \*,const void \*,g' generated_probes.h | \ |
72 | + sed -e 's,char \*,const char \*,g' | tr '\t' ' ' > dtrace_probes.tmp |
73 | + mv dtrace_probes.tmp generated_probes.h |
74 | |
75 | |
76 | SUFFIXES = .d .gch .gperf .stamp-h |
77 | |
78 | === modified file 'drizzled/drizzled.cc' |
79 | --- drizzled/drizzled.cc 2009-08-24 14:57:56 +0000 |
80 | +++ drizzled/drizzled.cc 2009-09-13 04:30:14 +0000 |
81 | @@ -45,6 +45,7 @@ |
82 | #include <drizzled/scheduling.h> |
83 | #include "drizzled/temporal_format.h" /* For init_temporal_formats() */ |
84 | #include "drizzled/slot/listen.h" |
85 | +#include "drizzled/probes.h" |
86 | |
87 | #include <google/protobuf/stubs/common.h> |
88 | |
89 | @@ -456,6 +457,7 @@ |
90 | tmp= *it; |
91 | tmp->killed= Session::KILL_CONNECTION; |
92 | tmp->scheduler->killSession(tmp); |
93 | + DRIZZLE_CONNECTION_DONE(tmp->thread_id); |
94 | if (tmp->mysys_var) |
95 | { |
96 | tmp->mysys_var->abort=1; |
97 | @@ -766,6 +768,7 @@ |
98 | { |
99 | statistic_increment(killed_threads, &LOCK_status); |
100 | session->scheduler->killSessionNow(session); |
101 | + DRIZZLE_CONNECTION_DONE(session->thread_id); |
102 | } |
103 | return; |
104 | } |
105 | |
106 | === modified file 'drizzled/filesort.cc' |
107 | --- drizzled/filesort.cc 2009-08-20 20:29:18 +0000 |
108 | +++ drizzled/filesort.cc 2009-09-13 01:09:19 +0000 |
109 | @@ -114,7 +114,7 @@ |
110 | TableList *tab= table->pos_in_table_list; |
111 | Item_subselect *subselect= tab ? tab->containing_subselect() : 0; |
112 | |
113 | - DRIZZLE_FILESORT_START(); |
114 | + DRIZZLE_FILESORT_START(table->s->db.str, table->s->table_name.str); |
115 | |
116 | /* |
117 | Release InnoDB's adaptive hash index latch (if holding) before |
118 | @@ -324,8 +324,8 @@ |
119 | (uint32_t) records, &LOCK_status); |
120 | *examined_rows= param.examined_rows; |
121 | memcpy(&table->sort, &table_sort, sizeof(filesort_info_st)); |
122 | - DRIZZLE_FILESORT_END(); |
123 | - return(error ? HA_POS_ERROR : records); |
124 | + DRIZZLE_FILESORT_DONE(error, records); |
125 | + return (error ? HA_POS_ERROR : records); |
126 | } /* filesort */ |
127 | |
128 | |
129 | |
130 | === modified file 'drizzled/handler.cc' |
131 | --- drizzled/handler.cc 2009-08-23 01:10:19 +0000 |
132 | +++ drizzled/handler.cc 2009-09-14 01:25:59 +0000 |
133 | @@ -2696,9 +2696,9 @@ |
134 | We cache the table flags if the locking succeeded. Otherwise, we |
135 | keep them as they were when they were fetched in ha_open(). |
136 | */ |
137 | - DRIZZLE_EXTERNAL_LOCK(lock_type); |
138 | |
139 | int error= external_lock(session, lock_type); |
140 | + |
141 | if (error == 0) |
142 | cached_table_flags= table_flags(); |
143 | return error; |
144 | @@ -2729,7 +2729,6 @@ |
145 | int handler::ha_write_row(unsigned char *buf) |
146 | { |
147 | int error; |
148 | - DRIZZLE_INSERT_ROW_START(); |
149 | |
150 | /* |
151 | * If we have a timestamp column, update it to the current time |
152 | @@ -2743,12 +2742,13 @@ |
153 | mark_trx_read_write(); |
154 | |
155 | if (unlikely(error= write_row(buf))) |
156 | + { |
157 | return error; |
158 | + } |
159 | |
160 | if (unlikely(log_row_for_replication(table, 0, buf))) |
161 | return HA_ERR_RBR_LOGGING_FAILED; /* purecov: inspected */ |
162 | |
163 | - DRIZZLE_INSERT_ROW_END(); |
164 | return 0; |
165 | } |
166 | |
167 | @@ -2766,7 +2766,9 @@ |
168 | mark_trx_read_write(); |
169 | |
170 | if (unlikely(error= update_row(old_data, new_data))) |
171 | + { |
172 | return error; |
173 | + } |
174 | |
175 | if (unlikely(log_row_for_replication(table, old_data, new_data))) |
176 | return HA_ERR_RBR_LOGGING_FAILED; |
177 | |
178 | === modified file 'drizzled/probes.d' |
179 | --- drizzled/probes.d 2008-11-01 00:46:20 +0000 |
180 | +++ drizzled/probes.d 2009-09-14 20:44:27 +0000 |
181 | @@ -1,7 +1,7 @@ |
182 | /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
183 | * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
184 | * |
185 | - * Copyright (C) 2008 Sun Microsystems |
186 | + * Copyright (C) 2009 Sun Microsystems |
187 | * |
188 | * This program is free software; you can redistribute it and/or modify |
189 | * it under the terms of the GNU General Public License as published by |
190 | @@ -17,18 +17,107 @@ |
191 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
192 | */ |
193 | |
194 | +/* |
195 | + The actual probe names in DTrace scripts will replace '__' by '-'. Thus |
196 | + insert__row__start will be insert-row-start. |
197 | + |
198 | + Recommendations for adding new probes: |
199 | + |
200 | + - each probe should have the minimal set of arguments required to |
201 | + unambiguously identify the context in which the probe fires. Redundant |
202 | + probes (i.e. the ones that can be obtained in user scripts from previous |
203 | + probes' arguments or otherwise) may be added for convenience. |
204 | + |
205 | + - try to avoid computationally expensive probe arguments. If impossible, |
206 | + use *_ENABLED() macros to check if the probe is activated before |
207 | + performing expensive calculations for a probe argument. |
208 | + |
209 | + - all *-done probes should have a status argument wherever applicable to make |
210 | + it possible for user scripts to figure out whether the completed operation |
211 | + was successful or not. |
212 | + |
213 | + - for all status arguments, a non-zero value should be returned on error or |
214 | + failure, 0 should be returned on success. |
215 | +*/ |
216 | + |
217 | provider drizzle { |
218 | -probe external_lock(int); |
219 | -probe insert_row_start(); |
220 | -probe insert_row_end(); |
221 | -probe filesort_start(); |
222 | -probe filesort_end(); |
223 | -probe delete_start(); |
224 | -probe delete_end(); |
225 | -probe insert_start(); |
226 | -probe insert_end(); |
227 | -probe select_start(); |
228 | -probe select_end(); |
229 | -probe update_start(); |
230 | -probe update_end(); |
231 | + |
232 | + /* The following ones fire when creating or closing a client connection */ |
233 | + probe connection__start(unsigned long conn_id); |
234 | + probe connection__done(unsigned long conn_id); |
235 | + |
236 | + /* |
237 | + * Fire at the start/end of any client command processing (including SQL |
238 | + * queries). |
239 | + */ |
240 | + probe command__start(unsigned long conn_id, int command); |
241 | + probe command__done(int status); |
242 | + |
243 | + /* |
244 | + * The following probes fire at the start/end of any SQL query processing, |
245 | + * respectively. |
246 | + * |
247 | + * query_start() has a lot of parameters that can be used to pick up |
248 | + * parameters for a lot of other probes here. For simplicity reasons we also |
249 | + * add the query string to most other DTrace probes as well. Hostname is |
250 | + * either the hostname or the IP address of the Drizzle client. |
251 | + */ |
252 | + probe query__start(const char *query, |
253 | + unsigned long conn_id, |
254 | + const char *db_name); |
255 | + probe query__done(int status); |
256 | + |
257 | + /* Fire at the start/end of SQL query parsing */ |
258 | + probe query__parse__start(const char *query); |
259 | + probe query__parse__done(int status); |
260 | + |
261 | + /* |
262 | + * This probe fires when the actual query execution starts |
263 | + */ |
264 | + probe query__exec__start(const char *query, |
265 | + unsigned long connid, |
266 | + const char *db_name); |
267 | + probe query__exec__done(int status); |
268 | + |
269 | + /* These probes fire when performing write operations towards any handler */ |
270 | + probe insert__row__start(const char *db, const char *table); |
271 | + probe insert__row__done(int status); |
272 | + probe update__row__start(const char *db, const char *table); |
273 | + probe update__row__done(int status); |
274 | + probe delete__row__start(const char *db, const char *table); |
275 | + probe delete__row__done(int status); |
276 | + |
277 | + /* |
278 | + * These probes fire when calling external_lock for any handler |
279 | + * depending on the lock type being acquired or released. |
280 | + */ |
281 | + probe handler__rdlock__start(const char *db, const char *table); |
282 | + probe handler__wrlock__start(const char *db, const char *table); |
283 | + probe handler__unlock__start(const char *db, const char *table); |
284 | + probe handler__rdlock__done(int status); |
285 | + probe handler__wrlock__done(int status); |
286 | + probe handler__unlock__done(int status); |
287 | + |
288 | + /* |
289 | + * These probes fire when a filesort activity happens in a query. |
290 | + */ |
291 | + probe filesort__start(const char *db, const char *table); |
292 | + probe filesort__done(int status, unsigned long rows); |
293 | + /* |
294 | + * The query types SELECT, INSERT, INSERT AS SELECT, UPDATE, DELETE |
295 | + * are all probed. |
296 | + * The start probe always contains the query text. |
297 | + */ |
298 | + probe select__start(const char *query); |
299 | + probe select__done(int status, unsigned long rows); |
300 | + probe insert__start(const char *query); |
301 | + probe insert__done(int status, unsigned long rows); |
302 | + probe insert__select__start(const char *query); |
303 | + probe insert__select__done(int status, unsigned long rows); |
304 | + probe update__start(const char *query); |
305 | + probe update__done(int status, |
306 | + unsigned long rowsmatches, unsigned long rowschanged); |
307 | + probe delete__start(const char *query); |
308 | + probe delete__done(int status, unsigned long rows); |
309 | + |
310 | }; |
311 | |
312 | === added file 'drizzled/probes.h' |
313 | --- drizzled/probes.h 1970-01-01 00:00:00 +0000 |
314 | +++ drizzled/probes.h 2009-09-14 20:12:21 +0000 |
315 | @@ -0,0 +1,97 @@ |
316 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
317 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
318 | + * |
319 | + * Copyright (C) 2009 Sun Microsystems |
320 | + * |
321 | + * This program is free software; you can redistribute it and/or modify |
322 | + * it under the terms of the GNU General Public License as published by |
323 | + * the Free Software Foundation; either version 2 of the License, or |
324 | + * (at your option) any later version. |
325 | + * |
326 | + * This program is distributed in the hope that it will be useful, |
327 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
328 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
329 | + * GNU General Public License for more details. |
330 | + * |
331 | + * You should have received a copy of the GNU General Public License |
332 | + * along with this program; if not, write to the Free Software |
333 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
334 | + */ |
335 | + |
336 | +#ifndef DRIZZLED_PROBES_H |
337 | +#define DRIZZLED_PROBES_H |
338 | + |
339 | +#ifdef HAVE_DTRACE |
340 | +#include "drizzled/generated_probes.h" |
341 | +#else |
342 | +#define DRIZZLE_COMMAND_DONE(arg0) |
343 | +#define DRIZZLE_COMMAND_DONE_ENABLED() (0) |
344 | +#define DRIZZLE_COMMAND_START(arg0, arg1) |
345 | +#define DRIZZLE_COMMAND_START_ENABLED() (0) |
346 | +#define DRIZZLE_CONNECTION_DONE(arg0) |
347 | +#define DRIZZLE_CONNECTION_DONE_ENABLED() (0) |
348 | +#define DRIZZLE_CONNECTION_START(arg0) |
349 | +#define DRIZZLE_CONNECTION_START_ENABLED() (0) |
350 | +#define DRIZZLE_DELETE_DONE(arg0, arg1) |
351 | +#define DRIZZLE_DELETE_DONE_ENABLED() (0) |
352 | +#define DRIZZLE_DELETE_ROW_DONE(arg0) |
353 | +#define DRIZZLE_DELETE_ROW_DONE_ENABLED() (0) |
354 | +#define DRIZZLE_DELETE_ROW_START(arg0, arg1) |
355 | +#define DRIZZLE_DELETE_ROW_START_ENABLED() (0) |
356 | +#define DRIZZLE_DELETE_START(arg0) |
357 | +#define DRIZZLE_DELETE_START_ENABLED() (0) |
358 | +#define DRIZZLE_FILESORT_DONE(arg0, arg1) |
359 | +#define DRIZZLE_FILESORT_DONE_ENABLED() (0) |
360 | +#define DRIZZLE_FILESORT_START(arg0, arg1) |
361 | +#define DRIZZLE_FILESORT_START_ENABLED() (0) |
362 | +#define DRIZZLE_HANDLER_RDLOCK_DONE(arg0) |
363 | +#define DRIZZLE_HANDLER_RDLOCK_DONE_ENABLED() (0) |
364 | +#define DRIZZLE_HANDLER_RDLOCK_START(arg0, arg1) |
365 | +#define DRIZZLE_HANDLER_RDLOCK_START_ENABLED() (0) |
366 | +#define DRIZZLE_HANDLER_UNLOCK_DONE(arg0) |
367 | +#define DRIZZLE_HANDLER_UNLOCK_DONE_ENABLED() (0) |
368 | +#define DRIZZLE_HANDLER_UNLOCK_START(arg0, arg1) |
369 | +#define DRIZZLE_HANDLER_UNLOCK_START_ENABLED() (0) |
370 | +#define DRIZZLE_HANDLER_WRLOCK_DONE(arg0) |
371 | +#define DRIZZLE_HANDLER_WRLOCK_DONE_ENABLED() (0) |
372 | +#define DRIZZLE_HANDLER_WRLOCK_START(arg0, arg1) |
373 | +#define DRIZZLE_HANDLER_WRLOCK_START_ENABLED() (0) |
374 | +#define DRIZZLE_INSERT_DONE(arg0, arg1) |
375 | +#define DRIZZLE_INSERT_DONE_ENABLED() (0) |
376 | +#define DRIZZLE_INSERT_ROW_DONE(arg0) |
377 | +#define DRIZZLE_INSERT_ROW_DONE_ENABLED() (0) |
378 | +#define DRIZZLE_INSERT_ROW_START(arg0, arg1) |
379 | +#define DRIZZLE_INSERT_ROW_START_ENABLED() (0) |
380 | +#define DRIZZLE_INSERT_SELECT_DONE(arg0, arg1) |
381 | +#define DRIZZLE_INSERT_SELECT_DONE_ENABLED() (0) |
382 | +#define DRIZZLE_INSERT_SELECT_START(arg0) |
383 | +#define DRIZZLE_INSERT_SELECT_START_ENABLED() (0) |
384 | +#define DRIZZLE_INSERT_START(arg0) |
385 | +#define DRIZZLE_INSERT_START_ENABLED() (0) |
386 | +#define DRIZZLE_QUERY_DONE(arg0) |
387 | +#define DRIZZLE_QUERY_DONE_ENABLED() (0) |
388 | +#define DRIZZLE_QUERY_EXEC_DONE(arg0) |
389 | +#define DRIZZLE_QUERY_EXEC_DONE_ENABLED() (0) |
390 | +#define DRIZZLE_QUERY_EXEC_START(arg0, arg1, arg2) |
391 | +#define DRIZZLE_QUERY_EXEC_START_ENABLED() (0) |
392 | +#define DRIZZLE_QUERY_PARSE_DONE(arg0) |
393 | +#define DRIZZLE_QUERY_PARSE_DONE_ENABLED() (0) |
394 | +#define DRIZZLE_QUERY_PARSE_START(arg0) |
395 | +#define DRIZZLE_QUERY_PARSE_START_ENABLED() (0) |
396 | +#define DRIZZLE_QUERY_START(arg0, arg1, arg2) |
397 | +#define DRIZZLE_QUERY_START_ENABLED() (0) |
398 | +#define DRIZZLE_SELECT_DONE(arg0, arg1) |
399 | +#define DRIZZLE_SELECT_DONE_ENABLED() (0) |
400 | +#define DRIZZLE_SELECT_START(arg0) |
401 | +#define DRIZZLE_SELECT_START_ENABLED() (0) |
402 | +#define DRIZZLE_UPDATE_DONE(arg0, arg1, arg2) |
403 | +#define DRIZZLE_UPDATE_DONE_ENABLED() (0) |
404 | +#define DRIZZLE_UPDATE_ROW_DONE(arg0) |
405 | +#define DRIZZLE_UPDATE_ROW_DONE_ENABLED() (0) |
406 | +#define DRIZZLE_UPDATE_ROW_START(arg0, arg1) |
407 | +#define DRIZZLE_UPDATE_ROW_START_ENABLED() (0) |
408 | +#define DRIZZLE_UPDATE_START(arg0) |
409 | +#define DRIZZLE_UPDATE_START_ENABLED() (0) |
410 | +#endif |
411 | + |
412 | +#endif /* DRIZZLED_PROBES_H */ |
413 | |
414 | === removed file 'drizzled/probes.h' |
415 | --- drizzled/probes.h 2009-05-21 17:05:14 +0000 |
416 | +++ drizzled/probes.h 1970-01-01 00:00:00 +0000 |
417 | @@ -1,250 +0,0 @@ |
418 | -/* |
419 | - * Generated by dtrace(1M). |
420 | - */ |
421 | - |
422 | -#ifndef _PROBES_H |
423 | -#define _PROBES_H |
424 | - |
425 | - |
426 | - |
427 | -#ifdef __cplusplus |
428 | -extern "C" { |
429 | -#endif |
430 | - |
431 | -#if _DTRACE_VERSION |
432 | - |
433 | -#define DRIZZLE_DELETE_END() \ |
434 | - __dtrace_drizzle___delete_end() |
435 | -#ifndef __sparc |
436 | -#define DRIZZLE_DELETE_END_ENABLED() \ |
437 | - __dtraceenabled_drizzle___delete_end() |
438 | -#else |
439 | -#define DRIZZLE_DELETE_END_ENABLED() \ |
440 | - __dtraceenabled_drizzle___delete_end(0) |
441 | -#endif |
442 | -#define DRIZZLE_DELETE_START() \ |
443 | - __dtrace_drizzle___delete_start() |
444 | -#ifndef __sparc |
445 | -#define DRIZZLE_DELETE_START_ENABLED() \ |
446 | - __dtraceenabled_drizzle___delete_start() |
447 | -#else |
448 | -#define DRIZZLE_DELETE_START_ENABLED() \ |
449 | - __dtraceenabled_drizzle___delete_start(0) |
450 | -#endif |
451 | -#define DRIZZLE_EXTERNAL_LOCK(arg0) \ |
452 | - __dtrace_drizzle___external_lock(arg0) |
453 | -#ifndef __sparc |
454 | -#define DRIZZLE_EXTERNAL_LOCK_ENABLED() \ |
455 | - __dtraceenabled_drizzle___external_lock() |
456 | -#else |
457 | -#define DRIZZLE_EXTERNAL_LOCK_ENABLED() \ |
458 | - __dtraceenabled_drizzle___external_lock(0) |
459 | -#endif |
460 | -#define DRIZZLE_FILESORT_END() \ |
461 | - __dtrace_drizzle___filesort_end() |
462 | -#ifndef __sparc |
463 | -#define DRIZZLE_FILESORT_END_ENABLED() \ |
464 | - __dtraceenabled_drizzle___filesort_end() |
465 | -#else |
466 | -#define DRIZZLE_FILESORT_END_ENABLED() \ |
467 | - __dtraceenabled_drizzle___filesort_end(0) |
468 | -#endif |
469 | -#define DRIZZLE_FILESORT_START() \ |
470 | - __dtrace_drizzle___filesort_start() |
471 | -#ifndef __sparc |
472 | -#define DRIZZLE_FILESORT_START_ENABLED() \ |
473 | - __dtraceenabled_drizzle___filesort_start() |
474 | -#else |
475 | -#define DRIZZLE_FILESORT_START_ENABLED() \ |
476 | - __dtraceenabled_drizzle___filesort_start(0) |
477 | -#endif |
478 | -#define DRIZZLE_INSERT_END() \ |
479 | - __dtrace_drizzle___insert_end() |
480 | -#ifndef __sparc |
481 | -#define DRIZZLE_INSERT_END_ENABLED() \ |
482 | - __dtraceenabled_drizzle___insert_end() |
483 | -#else |
484 | -#define DRIZZLE_INSERT_END_ENABLED() \ |
485 | - __dtraceenabled_drizzle___insert_end(0) |
486 | -#endif |
487 | -#define DRIZZLE_INSERT_ROW_END() \ |
488 | - __dtrace_drizzle___insert_row_end() |
489 | -#ifndef __sparc |
490 | -#define DRIZZLE_INSERT_ROW_END_ENABLED() \ |
491 | - __dtraceenabled_drizzle___insert_row_end() |
492 | -#else |
493 | -#define DRIZZLE_INSERT_ROW_END_ENABLED() \ |
494 | - __dtraceenabled_drizzle___insert_row_end(0) |
495 | -#endif |
496 | -#define DRIZZLE_INSERT_ROW_START() \ |
497 | - __dtrace_drizzle___insert_row_start() |
498 | -#ifndef __sparc |
499 | -#define DRIZZLE_INSERT_ROW_START_ENABLED() \ |
500 | - __dtraceenabled_drizzle___insert_row_start() |
501 | -#else |
502 | -#define DRIZZLE_INSERT_ROW_START_ENABLED() \ |
503 | - __dtraceenabled_drizzle___insert_row_start(0) |
504 | -#endif |
505 | -#define DRIZZLE_INSERT_START() \ |
506 | - __dtrace_drizzle___insert_start() |
507 | -#ifndef __sparc |
508 | -#define DRIZZLE_INSERT_START_ENABLED() \ |
509 | - __dtraceenabled_drizzle___insert_start() |
510 | -#else |
511 | -#define DRIZZLE_INSERT_START_ENABLED() \ |
512 | - __dtraceenabled_drizzle___insert_start(0) |
513 | -#endif |
514 | -#define DRIZZLE_SELECT_END() \ |
515 | - __dtrace_drizzle___select_end() |
516 | -#ifndef __sparc |
517 | -#define DRIZZLE_SELECT_END_ENABLED() \ |
518 | - __dtraceenabled_drizzle___select_end() |
519 | -#else |
520 | -#define DRIZZLE_SELECT_END_ENABLED() \ |
521 | - __dtraceenabled_drizzle___select_end(0) |
522 | -#endif |
523 | -#define DRIZZLE_SELECT_START() \ |
524 | - __dtrace_drizzle___select_start() |
525 | -#ifndef __sparc |
526 | -#define DRIZZLE_SELECT_START_ENABLED() \ |
527 | - __dtraceenabled_drizzle___select_start() |
528 | -#else |
529 | -#define DRIZZLE_SELECT_START_ENABLED() \ |
530 | - __dtraceenabled_drizzle___select_start(0) |
531 | -#endif |
532 | -#define DRIZZLE_UPDATE_END() \ |
533 | - __dtrace_drizzle___update_end() |
534 | -#ifndef __sparc |
535 | -#define DRIZZLE_UPDATE_END_ENABLED() \ |
536 | - __dtraceenabled_drizzle___update_end() |
537 | -#else |
538 | -#define DRIZZLE_UPDATE_END_ENABLED() \ |
539 | - __dtraceenabled_drizzle___update_end(0) |
540 | -#endif |
541 | -#define DRIZZLE_UPDATE_START() \ |
542 | - __dtrace_drizzle___update_start() |
543 | -#ifndef __sparc |
544 | -#define DRIZZLE_UPDATE_START_ENABLED() \ |
545 | - __dtraceenabled_drizzle___update_start() |
546 | -#else |
547 | -#define DRIZZLE_UPDATE_START_ENABLED() \ |
548 | - __dtraceenabled_drizzle___update_start(0) |
549 | -#endif |
550 | - |
551 | - |
552 | -extern void __dtrace_drizzle___delete_end(void); |
553 | -#ifndef __sparc |
554 | -extern int __dtraceenabled_drizzle___delete_end(void); |
555 | -#else |
556 | -extern int __dtraceenabled_drizzle___delete_end(long); |
557 | -#endif |
558 | -extern void __dtrace_drizzle___delete_start(void); |
559 | -#ifndef __sparc |
560 | -extern int __dtraceenabled_drizzle___delete_start(void); |
561 | -#else |
562 | -extern int __dtraceenabled_drizzle___delete_start(long); |
563 | -#endif |
564 | -extern void __dtrace_drizzle___external_lock(int); |
565 | -#ifndef __sparc |
566 | -extern int __dtraceenabled_drizzle___external_lock(void); |
567 | -#else |
568 | -extern int __dtraceenabled_drizzle___external_lock(long); |
569 | -#endif |
570 | -extern void __dtrace_drizzle___filesort_end(void); |
571 | -#ifndef __sparc |
572 | -extern int __dtraceenabled_drizzle___filesort_end(void); |
573 | -#else |
574 | -extern int __dtraceenabled_drizzle___filesort_end(long); |
575 | -#endif |
576 | -extern void __dtrace_drizzle___filesort_start(void); |
577 | -#ifndef __sparc |
578 | -extern int __dtraceenabled_drizzle___filesort_start(void); |
579 | -#else |
580 | -extern int __dtraceenabled_drizzle___filesort_start(long); |
581 | -#endif |
582 | -extern void __dtrace_drizzle___insert_end(void); |
583 | -#ifndef __sparc |
584 | -extern int __dtraceenabled_drizzle___insert_end(void); |
585 | -#else |
586 | -extern int __dtraceenabled_drizzle___insert_end(long); |
587 | -#endif |
588 | -extern void __dtrace_drizzle___insert_row_end(void); |
589 | -#ifndef __sparc |
590 | -extern int __dtraceenabled_drizzle___insert_row_end(void); |
591 | -#else |
592 | -extern int __dtraceenabled_drizzle___insert_row_end(long); |
593 | -#endif |
594 | -extern void __dtrace_drizzle___insert_row_start(void); |
595 | -#ifndef __sparc |
596 | -extern int __dtraceenabled_drizzle___insert_row_start(void); |
597 | -#else |
598 | -extern int __dtraceenabled_drizzle___insert_row_start(long); |
599 | -#endif |
600 | -extern void __dtrace_drizzle___insert_start(void); |
601 | -#ifndef __sparc |
602 | -extern int __dtraceenabled_drizzle___insert_start(void); |
603 | -#else |
604 | -extern int __dtraceenabled_drizzle___insert_start(long); |
605 | -#endif |
606 | -extern void __dtrace_drizzle___select_end(void); |
607 | -#ifndef __sparc |
608 | -extern int __dtraceenabled_drizzle___select_end(void); |
609 | -#else |
610 | -extern int __dtraceenabled_drizzle___select_end(long); |
611 | -#endif |
612 | -extern void __dtrace_drizzle___select_start(void); |
613 | -#ifndef __sparc |
614 | -extern int __dtraceenabled_drizzle___select_start(void); |
615 | -#else |
616 | -extern int __dtraceenabled_drizzle___select_start(long); |
617 | -#endif |
618 | -extern void __dtrace_drizzle___update_end(void); |
619 | -#ifndef __sparc |
620 | -extern int __dtraceenabled_drizzle___update_end(void); |
621 | -#else |
622 | -extern int __dtraceenabled_drizzle___update_end(long); |
623 | -#endif |
624 | -extern void __dtrace_drizzle___update_start(void); |
625 | -#ifndef __sparc |
626 | -extern int __dtraceenabled_drizzle___update_start(void); |
627 | -#else |
628 | -extern int __dtraceenabled_drizzle___update_start(long); |
629 | -#endif |
630 | - |
631 | -#else |
632 | - |
633 | -#define DRIZZLE_DELETE_END() |
634 | -#define DRIZZLE_DELETE_END_ENABLED() (0) |
635 | -#define DRIZZLE_DELETE_START() |
636 | -#define DRIZZLE_DELETE_START_ENABLED() (0) |
637 | -#define DRIZZLE_EXTERNAL_LOCK(arg0) |
638 | -#define DRIZZLE_EXTERNAL_LOCK_ENABLED() (0) |
639 | -#define DRIZZLE_FILESORT_END() |
640 | -#define DRIZZLE_FILESORT_END_ENABLED() (0) |
641 | -#define DRIZZLE_FILESORT_START() |
642 | -#define DRIZZLE_FILESORT_START_ENABLED() (0) |
643 | -#define DRIZZLE_INSERT_END() |
644 | -#define DRIZZLE_INSERT_END_ENABLED() (0) |
645 | -#define DRIZZLE_INSERT_ROW_END() |
646 | -#define DRIZZLE_INSERT_ROW_END_ENABLED() (0) |
647 | -#define DRIZZLE_INSERT_ROW_START() |
648 | -#define DRIZZLE_INSERT_ROW_START_ENABLED() (0) |
649 | -#define DRIZZLE_INSERT_START() |
650 | -#define DRIZZLE_INSERT_START_ENABLED() (0) |
651 | -#define DRIZZLE_SELECT_END() |
652 | -#define DRIZZLE_SELECT_END_ENABLED() (0) |
653 | -#define DRIZZLE_SELECT_START() |
654 | -#define DRIZZLE_SELECT_START_ENABLED() (0) |
655 | -#define DRIZZLE_UPDATE_END() |
656 | -#define DRIZZLE_UPDATE_END_ENABLED() (0) |
657 | -#define DRIZZLE_UPDATE_START() |
658 | -#define DRIZZLE_UPDATE_START_ENABLED() (0) |
659 | - |
660 | -#endif |
661 | - |
662 | - |
663 | -#ifdef __cplusplus |
664 | -} |
665 | -#endif |
666 | - |
667 | -#endif /* _PROBES_H */ |
668 | |
669 | === modified file 'drizzled/session.cc' |
670 | --- drizzled/session.cc 2009-08-16 14:14:39 +0000 |
671 | +++ drizzled/session.cc 2009-09-13 04:30:14 +0000 |
672 | @@ -37,6 +37,7 @@ |
673 | #include <drizzled/item/empty_string.h> |
674 | #include <drizzled/show.h> |
675 | #include <drizzled/scheduling.h> |
676 | +#include "drizzled/probes.h" |
677 | |
678 | #include <algorithm> |
679 | |
680 | @@ -481,6 +482,7 @@ |
681 | if (state_to_set != Session::KILL_QUERY) |
682 | { |
683 | scheduler->killSession(this); |
684 | + DRIZZLE_CONNECTION_DONE(thread_id); |
685 | } |
686 | if (mysys_var) |
687 | { |
688 | @@ -620,6 +622,7 @@ |
689 | |
690 | if (scheduler->addSession(this)) |
691 | { |
692 | + DRIZZLE_CONNECTION_START(thread_id); |
693 | char error_message_buff[DRIZZLE_ERRMSG_SIZE]; |
694 | |
695 | killed= Session::KILL_CONNECTION; |
696 | |
697 | === modified file 'drizzled/sql_delete.cc' |
698 | --- drizzled/sql_delete.cc 2009-08-06 16:51:53 +0000 |
699 | +++ drizzled/sql_delete.cc 2009-09-17 00:08:20 +0000 |
700 | @@ -25,6 +25,7 @@ |
701 | #include <drizzled/sql_parse.h> |
702 | #include <drizzled/sql_base.h> |
703 | #include <drizzled/lock.h> |
704 | +#include "drizzled/probes.h" |
705 | |
706 | /** |
707 | Implement DELETE SQL word. |
708 | @@ -51,9 +52,11 @@ |
709 | Select_Lex *select_lex= &session->lex->select_lex; |
710 | Session::killed_state killed_status= Session::NOT_KILLED; |
711 | |
712 | - |
713 | if (session->openTablesLock(table_list)) |
714 | + { |
715 | + DRIZZLE_DELETE_DONE(1, 0); |
716 | return true; |
717 | + } |
718 | |
719 | table= table_list->table; |
720 | assert(table); |
721 | @@ -162,14 +165,14 @@ |
722 | delete select; |
723 | free_underlaid_joins(session, select_lex); |
724 | session->row_count_func= 0; |
725 | - DRIZZLE_DELETE_END(); |
726 | + DRIZZLE_DELETE_DONE(0, 0); |
727 | session->my_ok((ha_rows) session->row_count_func); |
728 | /* |
729 | We don't need to call reset_auto_increment in this case, because |
730 | mysql_truncate always gives a NULL conds argument, hence we never |
731 | get here. |
732 | */ |
733 | - return(0); // Nothing to delete |
734 | + return 0; // Nothing to delete |
735 | } |
736 | |
737 | /* If running in safe sql mode, don't allow updates without keys */ |
738 | @@ -322,17 +325,17 @@ |
739 | assert(transactional_table || !deleted || session->transaction.stmt.modified_non_trans_table); |
740 | free_underlaid_joins(session, select_lex); |
741 | |
742 | - DRIZZLE_DELETE_END(); |
743 | + DRIZZLE_DELETE_DONE((error >= 0 || session->is_error()), 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-17 00:08:20 +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 | + const_cast<const 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 | + const_cast<const 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-17 00:08:20 +0000 |
952 | @@ -139,9 +139,12 @@ |
953 | List<Item> all_fields; |
954 | Session::killed_state killed_status= Session::NOT_KILLED; |
955 | |
956 | - DRIZZLE_UPDATE_START(); |
957 | + DRIZZLE_UPDATE_START(session->query); |
958 | if (session->openTablesLock(table_list)) |
959 | + { |
960 | + DRIZZLE_UPDATE_DONE(1, 0, 0); |
961 | return 1; |
962 | + } |
963 | |
964 | session->set_proc_info("init"); |
965 | table= table_list->table; |
966 | @@ -179,8 +182,8 @@ |
967 | if (select_lex->inner_refs_list.elements && |
968 | fix_inner_refs(session, all_fields, select_lex, select_lex->ref_pointer_array)) |
969 | { |
970 | - DRIZZLE_UPDATE_END(); |
971 | - return(-1); |
972 | + DRIZZLE_UPDATE_DONE(1, 0, 0); |
973 | + return -1; |
974 | } |
975 | |
976 | if (conds) |
977 | @@ -215,9 +218,9 @@ |
978 | free_underlaid_joins(session, select_lex); |
979 | if (error) |
980 | goto abort; // Error in where |
981 | - DRIZZLE_UPDATE_END(); |
982 | + DRIZZLE_UPDATE_DONE(0, 0, 0); |
983 | session->my_ok(); // No matching records |
984 | - return(0); |
985 | + return 0; |
986 | } |
987 | if (!select && limit != HA_POS_ERROR) |
988 | { |
989 | @@ -627,7 +630,6 @@ |
990 | id= session->arg_of_last_insert_id_function ? |
991 | session->first_successful_insert_id_in_prev_stmt : 0; |
992 | |
993 | - DRIZZLE_UPDATE_END(); |
994 | if (error < 0) |
995 | { |
996 | char buff[STRING_BUFFER_USUAL_SIZE]; |
997 | @@ -638,7 +640,8 @@ |
998 | } |
999 | session->count_cuted_fields= CHECK_FIELD_IGNORE; /* calc cuted fields */ |
1000 | session->abort_on_warning= 0; |
1001 | - return((error >= 0 || session->is_error()) ? 1 : 0); |
1002 | + DRIZZLE_UPDATE_DONE((error >= 0 || session->is_error()), found, updated); |
1003 | + return ((error >= 0 || session->is_error()) ? 1 : 0); |
1004 | |
1005 | err: |
1006 | delete select; |
1007 | @@ -651,8 +654,8 @@ |
1008 | session->abort_on_warning= 0; |
1009 | |
1010 | abort: |
1011 | - DRIZZLE_UPDATE_END(); |
1012 | - return(1); |
1013 | + DRIZZLE_UPDATE_DONE(1, 0, 0); |
1014 | + return 1; |
1015 | } |
1016 | |
1017 | /* |
1018 | |
1019 | === modified file 'drizzled/statement/delete.cc' |
1020 | --- drizzled/statement/delete.cc 2009-08-10 18:03:39 +0000 |
1021 | +++ drizzled/statement/delete.cc 2009-09-13 04:30:14 +0000 |
1022 | @@ -22,12 +22,14 @@ |
1023 | #include <drizzled/show.h> |
1024 | #include <drizzled/session.h> |
1025 | #include <drizzled/lock.h> |
1026 | +#include <drizzled/probes.h> |
1027 | #include <drizzled/statement/delete.h> |
1028 | |
1029 | using namespace drizzled; |
1030 | |
1031 | bool statement::Delete::execute() |
1032 | { |
1033 | + DRIZZLE_DELETE_START(session->query); |
1034 | TableList *first_table= (TableList *) session->lex->select_lex.table_list.first; |
1035 | TableList *all_tables= session->lex->query_tables; |
1036 | Select_Lex *select_lex= &session->lex->select_lex; |
1037 | |
1038 | === modified file 'drizzled/statement/insert.cc' |
1039 | --- drizzled/statement/insert.cc 2009-08-26 23:47:28 +0000 |
1040 | +++ drizzled/statement/insert.cc 2009-09-13 04:30:14 +0000 |
1041 | @@ -22,6 +22,7 @@ |
1042 | #include <drizzled/show.h> |
1043 | #include <drizzled/lock.h> |
1044 | #include <drizzled/session.h> |
1045 | +#include <drizzled/probes.h> |
1046 | #include <drizzled/statement/insert.h> |
1047 | |
1048 | using namespace drizzled; |
1049 | @@ -43,6 +44,8 @@ |
1050 | return true; |
1051 | } |
1052 | |
1053 | + DRIZZLE_INSERT_START(session->query); |
1054 | + |
1055 | bool res= mysql_insert(session, |
1056 | all_tables, |
1057 | session->lex->field_list, |
1058 | |
1059 | === modified file 'drizzled/statement/insert_select.cc' |
1060 | --- drizzled/statement/insert_select.cc 2009-08-27 00:39:15 +0000 |
1061 | +++ drizzled/statement/insert_select.cc 2009-09-13 04:30:14 +0000 |
1062 | @@ -22,6 +22,7 @@ |
1063 | #include <drizzled/show.h> |
1064 | #include <drizzled/lock.h> |
1065 | #include <drizzled/session.h> |
1066 | +#include <drizzled/probes.h> |
1067 | #include <drizzled/statement/insert_select.h> |
1068 | |
1069 | using namespace drizzled; |
1070 | @@ -54,6 +55,7 @@ |
1071 | |
1072 | if (! (res= session->openTablesLock(all_tables))) |
1073 | { |
1074 | + DRIZZLE_INSERT_SELECT_START(session->query); |
1075 | /* Skip first table, which is the table we are inserting in */ |
1076 | TableList *second_table= first_table->next_local; |
1077 | select_lex->table_list.first= (unsigned char*) second_table; |
1078 | |
1079 | === modified file 'm4/pandora_64bit.m4' |
1080 | --- m4/pandora_64bit.m4 2009-08-04 17:58:31 +0000 |
1081 | +++ m4/pandora_64bit.m4 2009-09-14 18:37:34 +0000 |
1082 | @@ -23,7 +23,7 @@ |
1083 | AS_IF([test "$isainfo_b" != "x"],[ |
1084 | |
1085 | isainfo_k=`${ISAINFO} -k` |
1086 | - DTRACEFLAGS="${DTRACEFLAGS} -${isainfo_k}" |
1087 | + DTRACEFLAGS="${DTRACEFLAGS} -${isainfo_b}" |
1088 | |
1089 | AS_IF([test "x$ac_enable_64bit" = "xyes"],[ |
1090 |
This branch contains a port of the latest dtrace probes from mysql 6.0. I updated the pandora build 64-bit file also to ensure that these probes are actually enabled (before dtrace support did not work correctly in drizzle on 64-bit platforms).
I added some calls in various places to these dtrace probes. I'll continue to work on identifying areas where probes can be inserted and also think about new probes that we could come up with that would be useful.
In the future, I'd also like to be able to let plugins provide their own dtrace probes if they so wish but I think we are a bit away from that for the moment.
I've tested that these probes work on solaris but not on OSX yet. I'll write up an article with some examples of using these probes this week.
-Padraig