summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMikael Ronstrom <mikael@mysql.com>2008-12-20 11:01:41 +0100
committerMikael Ronstrom <mikael@mysql.com>2008-12-20 11:01:41 +0100
commitcc958a18dd9554870edd3b1c6119edf72b661879 (patch)
tree36aa1edfd94289934ffa3aa66af64b899e9a9e77 /storage
parent602f612af09c3ccb6db19286291ae0bca403db5c (diff)
downloadmariadb-git-cc958a18dd9554870edd3b1c6119edf72b661879.tar.gz
Backport of DTrace patches from 6.0
Diffstat (limited to 'storage')
-rw-r--r--storage/archive/Makefile.am17
-rw-r--r--storage/archive/ha_archive.cc31
-rw-r--r--storage/blackhole/Makefile.am17
-rw-r--r--storage/blackhole/ha_blackhole.cc52
-rw-r--r--storage/csv/Makefile.am17
-rw-r--r--storage/csv/ha_tina.cc27
-rw-r--r--storage/example/Makefile.am17
-rw-r--r--storage/example/ha_example.cc45
-rw-r--r--storage/federated/Makefile.am17
-rw-r--r--storage/federated/ha_federated.cc38
-rw-r--r--storage/federated/ha_federated.h1
-rw-r--r--storage/heap/Makefile.am16
-rw-r--r--storage/heap/ha_heap.cc21
-rw-r--r--storage/myisam/Makefile.am16
-rw-r--r--storage/myisam/ha_myisam.cc23
-rw-r--r--storage/myisammrg/Makefile.am16
-rw-r--r--storage/myisammrg/ha_myisammrg.cc23
17 files changed, 366 insertions, 28 deletions
diff --git a/storage/archive/Makefile.am b/storage/archive/Makefile.am
index d092f091798..aa2ba58ce25 100644
--- a/storage/archive/Makefile.am
+++ b/storage/archive/Makefile.am
@@ -66,5 +66,22 @@ archive_reader_LDFLAGS = @NOINST_LDFLAGS@
EXTRA_DIST = CMakeLists.txt plug.in
+
+if HAVE_DTRACE_DASH_G
+abs_top_srcdir = @abs_top_srcdir@
+libarchive_a_LIBADD = probes_mysql.o
+libarchive_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers
+CLEANFILES = probes_mysql.o dtrace_files dtrace_providers
+DTRACEFILES = libarchive_a-ha_archive.o
+DTRACEPROVIDER = $(abs_top_srcdir)/sql/probes_mysql.d
+
+dtrace_files:
+ echo $(DTRACEFILES) > $@
+dtrace_providers:
+ echo $(DTRACEPROVIDER) > $@
+probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
+ $(DTRACE) $(DTRACEFLAGS) -G -s $< $(DTRACEFILES) -o $@
+endif
+
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index 967e315d4a4..7dc02e95c62 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -18,6 +18,7 @@
#endif
#include "mysql_priv.h"
+#include "probes_mysql.h"
#include <myisam.h>
#include "ha_archive.h"
@@ -917,7 +918,9 @@ int ha_archive::index_read(uchar *buf, const uchar *key,
{
int rc;
DBUG_ENTER("ha_archive::index_read");
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
rc= index_read_idx(buf, active_index, key, key_len, find_flag);
+ MYSQL_INDEX_READ_ROW_DONE(rc);
DBUG_RETURN(rc);
}
@@ -960,8 +963,10 @@ error:
int ha_archive::index_next(uchar * buf)
{
bool found= 0;
+ int rc;
DBUG_ENTER("ha_archive::index_next");
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
while (!(get_row(&archive, buf)))
{
@@ -972,7 +977,9 @@ int ha_archive::index_next(uchar * buf)
}
}
- DBUG_RETURN(found ? 0 : HA_ERR_END_OF_FILE);
+ rc= found ? 0 : HA_ERR_END_OF_FILE;
+ MYSQL_INDEX_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
}
/*
@@ -1196,12 +1203,17 @@ int ha_archive::rnd_next(uchar *buf)
{
int rc;
DBUG_ENTER("ha_archive::rnd_next");
+ MYSQL_READ_ROW_START(table_share->db.str,
+ table_share->table_name.str, TRUE);
if (share->crashed)
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
if (!scan_rows)
- DBUG_RETURN(HA_ERR_END_OF_FILE);
+ {
+ rc= HA_ERR_END_OF_FILE;
+ goto end;
+ }
scan_rows--;
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
@@ -1210,6 +1222,8 @@ int ha_archive::rnd_next(uchar *buf)
table->status=rc ? STATUS_NOT_FOUND: 0;
+end:
+ MYSQL_READ_ROW_DONE(rc);
DBUG_RETURN(rc);
}
@@ -1237,12 +1251,21 @@ void ha_archive::position(const uchar *record)
int ha_archive::rnd_pos(uchar * buf, uchar *pos)
{
+ int rc;
DBUG_ENTER("ha_archive::rnd_pos");
+ MYSQL_READ_ROW_START(table_share->db.str,
+ table_share->table_name.str, FALSE);
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
current_position= (my_off_t)my_get_ptr(pos, ref_length);
if (azseek(&archive, current_position, SEEK_SET) == (my_off_t)(-1L))
- DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
- DBUG_RETURN(get_row(&archive, buf));
+ {
+ rc= HA_ERR_CRASHED_ON_USAGE;
+ goto end;
+ }
+ rc= get_row(&archive, buf);
+end:
+ MYSQL_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
}
/*
diff --git a/storage/blackhole/Makefile.am b/storage/blackhole/Makefile.am
index db4f67cf847..71776b01639 100644
--- a/storage/blackhole/Makefile.am
+++ b/storage/blackhole/Makefile.am
@@ -48,5 +48,22 @@ libblackhole_a_SOURCES= ha_blackhole.cc
EXTRA_DIST = CMakeLists.txt plug.in
+
+if HAVE_DTRACE_DASH_G
+abs_top_srcdir = @abs_top_srcdir@
+libblackhole_a_LIBADD = probes_mysql.o
+libblackhole_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers
+CLEANFILES = probes_mysql.o dtrace_files dtrace_providers
+DTRACEFILES = libblackhole_a-ha_blackhole.o
+DTRACEPROVIDER = $(abs_top_srcdir)/sql/probes_mysql.d
+
+dtrace_files:
+ echo $(DTRACEFILES) > $@
+dtrace_providers:
+ echo $(DTRACEPROVIDER) > $@
+probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
+ $(DTRACE) $(DTRACEFLAGS) -G -s $< $(DTRACEFILES) -o $@
+endif
+
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc
index 85b8117e501..6ca3b8d3ab0 100644
--- a/storage/blackhole/ha_blackhole.cc
+++ b/storage/blackhole/ha_blackhole.cc
@@ -19,6 +19,7 @@
#endif
#include "mysql_priv.h"
+#include "probes_mysql.h"
#include "ha_blackhole.h"
/* Static declarations for handlerton */
@@ -109,15 +110,23 @@ int ha_blackhole::rnd_init(bool scan)
int ha_blackhole::rnd_next(uchar *buf)
{
+ int rc;
DBUG_ENTER("ha_blackhole::rnd_next");
- DBUG_RETURN(HA_ERR_END_OF_FILE);
+ MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
+ TRUE);
+ rc= HA_ERR_END_OF_FILE;
+ MYSQL_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
}
int ha_blackhole::rnd_pos(uchar * buf, uchar *pos)
{
DBUG_ENTER("ha_blackhole::rnd_pos");
+ MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
+ FALSE);
DBUG_ASSERT(0);
+ MYSQL_READ_ROW_DONE(0);
DBUG_RETURN(0);
}
@@ -188,8 +197,12 @@ int ha_blackhole::index_read_map(uchar * buf, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
+ int rc;
DBUG_ENTER("ha_blackhole::index_read");
- DBUG_RETURN(HA_ERR_END_OF_FILE);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
+ rc= HA_ERR_END_OF_FILE;
+ MYSQL_INDEX_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
}
@@ -197,44 +210,69 @@ int ha_blackhole::index_read_idx_map(uchar * buf, uint idx, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
+ int rc;
DBUG_ENTER("ha_blackhole::index_read_idx");
- DBUG_RETURN(HA_ERR_END_OF_FILE);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
+ rc= HA_ERR_END_OF_FILE;
+ MYSQL_INDEX_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
}
int ha_blackhole::index_read_last_map(uchar * buf, const uchar * key,
key_part_map keypart_map)
{
+ int rc;
DBUG_ENTER("ha_blackhole::index_read_last");
- DBUG_RETURN(HA_ERR_END_OF_FILE);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
+ rc= HA_ERR_END_OF_FILE;
+ MYSQL_INDEX_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
}
int ha_blackhole::index_next(uchar * buf)
{
+ int rc;
DBUG_ENTER("ha_blackhole::index_next");
- DBUG_RETURN(HA_ERR_END_OF_FILE);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
+ rc= HA_ERR_END_OF_FILE;
+ MYSQL_INDEX_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
}
int ha_blackhole::index_prev(uchar * buf)
{
+ int rc;
DBUG_ENTER("ha_blackhole::index_prev");
- DBUG_RETURN(HA_ERR_END_OF_FILE);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
+ rc= HA_ERR_END_OF_FILE;
+ MYSQL_INDEX_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
}
int ha_blackhole::index_first(uchar * buf)
{
+ int rc;
DBUG_ENTER("ha_blackhole::index_first");
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
+ rc= HA_ERR_END_OF_FILE;
+ MYSQL_INDEX_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
int ha_blackhole::index_last(uchar * buf)
{
+ int rc;
DBUG_ENTER("ha_blackhole::index_last");
- DBUG_RETURN(HA_ERR_END_OF_FILE);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
+ rc= HA_ERR_END_OF_FILE;
+ MYSQL_INDEX_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
}
diff --git a/storage/csv/Makefile.am b/storage/csv/Makefile.am
index 07ffac88a96..e4d90334d64 100644
--- a/storage/csv/Makefile.am
+++ b/storage/csv/Makefile.am
@@ -41,5 +41,22 @@ libcsv_a_CXXFLAGS = $(AM_CFLAGS)
libcsv_a_SOURCES = transparent_file.cc ha_tina.cc
EXTRA_DIST = CMakeLists.txt plug.in
+
+if HAVE_DTRACE_DASH_G
+abs_top_srcdir = @abs_top_srcdir@
+libcsv_a_LIBADD = probes_mysql.o
+libcsv_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers
+CLEANFILES = probes_mysql.o dtrace_files dtrace_providers
+DTRACEFILES = libcsv_a-ha_tina.o
+DTRACEPROVIDER = $(abs_top_srcdir)/sql/probes_mysql.d
+
+dtrace_files:
+ echo $(DTRACEFILES) > $@
+dtrace_providers:
+ echo $(DTRACEPROVIDER) > $@
+probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
+ $(DTRACE) $(DTRACEFLAGS) -G -s $< $(DTRACEFILES) -o $@
+endif
+
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index a1ff0e29ad1..cc801b33955 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -48,6 +48,7 @@ TODO:
#include "mysql_priv.h"
#include <mysql/plugin.h>
#include "ha_tina.h"
+#include "probes_mysql.h"
/*
@@ -1095,9 +1096,14 @@ int ha_tina::rnd_next(uchar *buf)
{
int rc;
DBUG_ENTER("ha_tina::rnd_next");
+ MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
+ TRUE);
if (share->crashed)
- DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
+ {
+ rc= HA_ERR_CRASHED_ON_USAGE;
+ goto end;
+ }
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
@@ -1105,13 +1111,19 @@ int ha_tina::rnd_next(uchar *buf)
/* don't scan an empty file */
if (!local_saved_data_file_length)
- DBUG_RETURN(HA_ERR_END_OF_FILE);
+ {
+ rc= HA_ERR_END_OF_FILE;
+ goto end;
+ }
if ((rc= find_current_row(buf)))
- DBUG_RETURN(rc);
+ goto end;
stats.records++;
- DBUG_RETURN(0);
+ rc= 0;
+end:
+ MYSQL_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
}
/*
@@ -1138,10 +1150,15 @@ void ha_tina::position(const uchar *record)
int ha_tina::rnd_pos(uchar * buf, uchar *pos)
{
+ int rc;
DBUG_ENTER("ha_tina::rnd_pos");
+ MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
+ FALSE);
ha_statistic_increment(&SSV::ha_read_rnd_count);
current_position= (off_t)my_get_ptr(pos,ref_length);
- DBUG_RETURN(find_current_row(buf));
+ rc= find_current_row(buf);
+ MYSQL_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
}
/*
diff --git a/storage/example/Makefile.am b/storage/example/Makefile.am
index 4b2f165377c..bb350dc3639 100644
--- a/storage/example/Makefile.am
+++ b/storage/example/Makefile.am
@@ -48,5 +48,22 @@ libexample_a_SOURCES= ha_example.cc
EXTRA_DIST = CMakeLists.txt plug.in
+
+if HAVE_DTRACE_DASH_G
+libexample_a_LIBADD = probes_mysql.o
+libexample_a_DEPENDENCIES = probes_mysql.o
+CLEANFILES =
+BUILT_SOURCES =
+DTRACEFILES = libexample_a-ha_example.o
+DTRACEPROVIDER = $(abs_top_srcdir)/sql/probes_mysql.d
+
+dtrace_files:
+ echo $(DTRACEFILES) > $@
+dtrace_providers:
+ echo $(DTRACEPROVIDER) > $@
+probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
+ $(DTRACE) $(DTRACEFLAGS) -G -s $< $(DTRACEFILES) -o $@
+endif
+
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index 604722c3c8c..30fc82c82d2 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -94,6 +94,7 @@
#define MYSQL_SERVER 1
#include "mysql_priv.h"
#include "ha_example.h"
+#include "probes_mysql.h"
#include <mysql/plugin.h>
static handler *example_create_handler(handlerton *hton,
@@ -428,8 +429,12 @@ int ha_example::index_read_map(uchar *buf, const uchar *key,
enum ha_rkey_function find_flag
__attribute__((unused)))
{
+ int rc;
DBUG_ENTER("ha_example::index_read");
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
+ rc= HA_ERR_WRONG_COMMAND;
+ MYSQL_INDEX_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
}
@@ -440,8 +445,12 @@ int ha_example::index_read_map(uchar *buf, const uchar *key,
int ha_example::index_next(uchar *buf)
{
+ int rc;
DBUG_ENTER("ha_example::index_next");
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
+ rc= HA_ERR_WRONG_COMMAND;
+ MYSQL_INDEX_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
}
@@ -452,8 +461,12 @@ int ha_example::index_next(uchar *buf)
int ha_example::index_prev(uchar *buf)
{
+ int rc;
DBUG_ENTER("ha_example::index_prev");
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
+ rc= HA_ERR_WRONG_COMMAND;
+ MYSQL_INDEX_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
}
@@ -469,8 +482,12 @@ int ha_example::index_prev(uchar *buf)
*/
int ha_example::index_first(uchar *buf)
{
+ int rc;
DBUG_ENTER("ha_example::index_first");
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
+ rc= HA_ERR_WRONG_COMMAND;
+ MYSQL_INDEX_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
}
@@ -486,8 +503,12 @@ int ha_example::index_first(uchar *buf)
*/
int ha_example::index_last(uchar *buf)
{
+ int rc;
DBUG_ENTER("ha_example::index_last");
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
+ rc= HA_ERR_WRONG_COMMAND;
+ MYSQL_INDEX_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
}
@@ -533,8 +554,13 @@ int ha_example::rnd_end()
*/
int ha_example::rnd_next(uchar *buf)
{
+ int rc;
DBUG_ENTER("ha_example::rnd_next");
- DBUG_RETURN(HA_ERR_END_OF_FILE);
+ MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
+ TRUE);
+ rc= HA_ERR_END_OF_FILE;
+ MYSQL_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
}
@@ -581,8 +607,13 @@ void ha_example::position(const uchar *record)
*/
int ha_example::rnd_pos(uchar *buf, uchar *pos)
{
+ int rc;
DBUG_ENTER("ha_example::rnd_pos");
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
+ MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
+ TRUE);
+ rc= HA_ERR_WRONG_COMMAND;
+ MYSQL_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
}
diff --git a/storage/federated/Makefile.am b/storage/federated/Makefile.am
index 64ea0207017..221b30092d2 100644
--- a/storage/federated/Makefile.am
+++ b/storage/federated/Makefile.am
@@ -48,5 +48,22 @@ libfederated_a_SOURCES= ha_federated.cc
EXTRA_DIST = CMakeLists.txt plug.in
+
+if HAVE_DTRACE_DASH_G
+abs_top_srcdir = @abs_top_srcdir@
+libfederated_a_LIBADD = probes_mysql.o
+libfederated_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers
+CLEANFILES = probes_mysql.o dtrace_files dtrace_providers
+DTRACEFILES = libfederated_a-ha_federated.o
+DTRACEPROVIDER = $(abs_top_srcdir)/sql/probes_mysql.d
+
+dtrace_files:
+ echo $(DTRACEFILES) > $@
+dtrace_providers:
+ echo $(DTRACEPROVIDER) > $@
+probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
+ $(DTRACE) $(DTRACEFLAGS) -G -s $< $(DTRACEFILES) -o $@
+endif
+
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc
index 2f1c5e51caa..69cb2599740 100644
--- a/storage/federated/ha_federated.cc
+++ b/storage/federated/ha_federated.cc
@@ -380,6 +380,7 @@
#endif
#include "ha_federated.h"
+#include "probes_mysql.h"
#include "m_string.h"
@@ -2324,13 +2325,17 @@ int ha_federated::delete_row(const uchar *buf)
int ha_federated::index_read(uchar *buf, const uchar *key,
uint key_len, ha_rkey_function find_flag)
{
+ int rc;
DBUG_ENTER("ha_federated::index_read");
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
if (stored_result)
mysql_free_result(stored_result);
- DBUG_RETURN(index_read_idx_with_result_set(buf, active_index, key,
- key_len, find_flag,
- &stored_result));
+ rc= index_read_idx_with_result_set(buf, active_index, key,
+ key_len, find_flag,
+ &stored_result);
+ MYSQL_INDEX_READ_ROW_DONE(retval);
+ DBUG_RETURN(rc);
}
@@ -2478,6 +2483,7 @@ int ha_federated::read_range_first(const key_range *start_key,
sizeof(sql_query_buffer),
&my_charset_bin);
DBUG_ENTER("ha_federated::read_range_first");
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
DBUG_ASSERT(!(start_key == NULL && end_key == NULL));
@@ -2506,10 +2512,12 @@ int ha_federated::read_range_first(const key_range *start_key,
}
retval= read_next(table->record[0], stored_result);
+ MYSQL_INDEX_READ_ROW_DONE(retval);
DBUG_RETURN(retval);
error:
table->status= STATUS_NOT_FOUND;
+ MYSQL_INDEX_READ_ROW_DONE(retval);
DBUG_RETURN(retval);
}
@@ -2518,7 +2526,9 @@ int ha_federated::read_range_next()
{
int retval;
DBUG_ENTER("ha_federated::read_range_next");
- retval= rnd_next(table->record[0]);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
+ retval= rnd_next_int(table->record[0]);
+ MYSQL_INDEX_READ_ROW_DONE(retval);
DBUG_RETURN(retval);
}
@@ -2526,9 +2536,13 @@ int ha_federated::read_range_next()
/* Used to read forward through the index. */
int ha_federated::index_next(uchar *buf)
{
+ int retval;
DBUG_ENTER("ha_federated::index_next");
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
ha_statistic_increment(&SSV::ha_read_next_count);
- DBUG_RETURN(read_next(buf, stored_result));
+ retval= read_next(buf, stored_result);
+ MYSQL_INDEX_READ_ROW_DONE(retval);
+ DBUG_RETURN(retval);
}
@@ -2637,7 +2651,18 @@ int ha_federated::index_end(void)
int ha_federated::rnd_next(uchar *buf)
{
+ int rc;
DBUG_ENTER("ha_federated::rnd_next");
+ MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
+ TRUE);
+ rc= rnd_next_int(buf);
+ MYSQL_READ_ROW_DONE(rc);
+ DBUG_RETURN(rc);
+}
+
+int ha_federated::rnd_next_int(uchar *buf)
+{
+ DBUG_ENTER("ha_federated::rnd_next_int");
if (stored_result == 0)
{
@@ -2726,6 +2751,8 @@ int ha_federated::rnd_pos(uchar *buf, uchar *pos)
{
int result;
DBUG_ENTER("ha_federated::rnd_pos");
+ MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
+ FALSE);
ha_statistic_increment(&SSV::ha_read_rnd_count);
if (table->s->primary_key != MAX_KEY)
{
@@ -2740,6 +2767,7 @@ int ha_federated::rnd_pos(uchar *buf, uchar *pos)
result= 0;
}
table->status= result ? STATUS_NOT_FOUND : 0;
+ MYSQL_READ_ROW_DONE(result);
DBUG_RETURN(result);
}
diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h
index 1974f9936fc..552676b6ae8 100644
--- a/storage/federated/ha_federated.h
+++ b/storage/federated/ha_federated.h
@@ -232,6 +232,7 @@ public:
int rnd_init(bool scan); //required
int rnd_end();
int rnd_next(uchar *buf); //required
+ int rnd_next_int(uchar *buf);
int rnd_pos(uchar *buf, uchar *pos); //required
void position(const uchar *record); //required
int info(uint); //required
diff --git a/storage/heap/Makefile.am b/storage/heap/Makefile.am
index ec1445dea67..d5fd952b4bd 100644
--- a/storage/heap/Makefile.am
+++ b/storage/heap/Makefile.am
@@ -51,5 +51,21 @@ libheap_a_SOURCES = hp_open.c hp_extra.c hp_close.c hp_panic.c hp_info.c \
EXTRA_DIST = CMakeLists.txt plug.in
+if HAVE_DTRACE_DASH_G
+abs_top_srcdir = @abs_top_srcdir@
+libheap_a_LIBADD = probes_mysql.o
+libheap_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers
+CLEANFILES = probes_mysql.o dtrace_files dtrace_providers
+DTRACEFILES = ha_heap.o
+DTRACEPROVIDER = $(abs_top_srcdir)/sql/probes_mysql.d
+
+dtrace_files:
+ echo $(DTRACEFILES) > $@
+dtrace_providers:
+ echo $(DTRACEPROVIDER) > $@
+probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
+ $(DTRACE) $(DTRACEFLAGS) -G -s $< $(DTRACEFILES) -o $@
+endif
+
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc
index be2914adac4..2cadfa1c24d 100644
--- a/storage/heap/ha_heap.cc
+++ b/storage/heap/ha_heap.cc
@@ -20,6 +20,7 @@
#define MYSQL_SERVER 1
#include "mysql_priv.h"
+#include "probes_mysql.h"
#include <mysql/plugin.h>
#include "ha_heap.h"
#include "heapdef.h"
@@ -274,21 +275,25 @@ int ha_heap::index_read_map(uchar *buf, const uchar *key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_key_count);
int error = heap_rkey(file,buf,active_index, key, keypart_map, find_flag);
table->status = error ? STATUS_NOT_FOUND : 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
int ha_heap::index_read_last_map(uchar *buf, const uchar *key,
key_part_map keypart_map)
{
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_key_count);
int error= heap_rkey(file, buf, active_index, key, keypart_map,
HA_READ_PREFIX_LAST);
table->status= error ? STATUS_NOT_FOUND : 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
@@ -296,45 +301,55 @@ int ha_heap::index_read_idx_map(uchar *buf, uint index, const uchar *key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
ha_statistic_increment(&SSV::ha_read_key_count);
int error = heap_rkey(file, buf, index, key, keypart_map, find_flag);
table->status = error ? STATUS_NOT_FOUND : 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
int ha_heap::index_next(uchar * buf)
{
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_next_count);
int error=heap_rnext(file,buf);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
int ha_heap::index_prev(uchar * buf)
{
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_prev_count);
int error=heap_rprev(file,buf);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
int ha_heap::index_first(uchar * buf)
{
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_first_count);
int error=heap_rfirst(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
int ha_heap::index_last(uchar * buf)
{
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_last_count);
int error=heap_rlast(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
@@ -345,9 +360,12 @@ int ha_heap::rnd_init(bool scan)
int ha_heap::rnd_next(uchar *buf)
{
+ MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
+ TRUE);
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
int error=heap_scan(file, buf);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_READ_ROW_DONE(error);
return error;
}
@@ -355,10 +373,13 @@ int ha_heap::rnd_pos(uchar * buf, uchar *pos)
{
int error;
HEAP_PTR heap_position;
+ MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
+ FALSE);
ha_statistic_increment(&SSV::ha_read_rnd_count);
memcpy_fixed((char*) &heap_position, pos, sizeof(HEAP_PTR));
error=heap_rrnd(file, buf, heap_position);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_READ_ROW_DONE(error);
return error;
}
diff --git a/storage/myisam/Makefile.am b/storage/myisam/Makefile.am
index f50c312b8e4..c79fc2e0f03 100644
--- a/storage/myisam/Makefile.am
+++ b/storage/myisam/Makefile.am
@@ -150,5 +150,21 @@ SUFFIXES = .sh
@CHMOD@ +x $@-t
@MV@ $@-t $@
+if HAVE_DTRACE_DASH_G
+abs_top_srcdir = @abs_top_srcdir@
+libmyisam_a_LIBADD = probes_mysql.o
+libmyisam_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers
+CLEANFILES += probes_mysql.o dtrace_files dtrace_providers
+DTRACEFILES = ha_myisam.o
+DTRACEPROVIDER = $(abs_top_srcdir)/sql/probes_mysql.d
+
+dtrace_files:
+ echo $(DTRACEFILES) > $@
+dtrace_providers:
+ echo $(DTRACEPROVIDER) > $@
+probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
+ $(DTRACE) $(DTRACEFLAGS) -G -s $< $(DTRACEFILES) -o $@
+endif
+
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index b8d5a9af8d2..a32519653ef 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -20,6 +20,7 @@
#define MYSQL_SERVER 1
#include "mysql_priv.h"
+#include "probes_mysql.h"
#include <mysql/plugin.h>
#include <m_ctype.h>
#include <my_bit.h>
@@ -1602,10 +1603,12 @@ int ha_myisam::index_read_map(uchar *buf, const uchar *key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_key_count);
int error=mi_rkey(file, buf, active_index, key, keypart_map, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
@@ -1613,57 +1616,69 @@ int ha_myisam::index_read_idx_map(uchar *buf, uint index, const uchar *key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
ha_statistic_increment(&SSV::ha_read_key_count);
int error=mi_rkey(file, buf, index, key, keypart_map, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
int ha_myisam::index_read_last_map(uchar *buf, const uchar *key,
key_part_map keypart_map)
{
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
DBUG_ENTER("ha_myisam::index_read_last");
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_key_count);
int error=mi_rkey(file, buf, active_index, key, keypart_map,
HA_READ_PREFIX_LAST);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
DBUG_RETURN(error);
}
int ha_myisam::index_next(uchar *buf)
{
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_next_count);
int error=mi_rnext(file,buf,active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
int ha_myisam::index_prev(uchar *buf)
{
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_prev_count);
int error=mi_rprev(file,buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
int ha_myisam::index_first(uchar *buf)
{
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_first_count);
int error=mi_rfirst(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
int ha_myisam::index_last(uchar *buf)
{
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
DBUG_ASSERT(inited==INDEX);
ha_statistic_increment(&SSV::ha_read_last_count);
int error=mi_rlast(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
@@ -1673,12 +1688,14 @@ int ha_myisam::index_next_same(uchar *buf,
{
int error;
DBUG_ASSERT(inited==INDEX);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
ha_statistic_increment(&SSV::ha_read_next_count);
do
{
error= mi_rnext_same(file,buf);
} while (error == HA_ERR_RECORD_DELETED);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
@@ -1692,9 +1709,12 @@ int ha_myisam::rnd_init(bool scan)
int ha_myisam::rnd_next(uchar *buf)
{
+ MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
+ TRUE);
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
int error=mi_scan(file, buf);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_READ_ROW_DONE(error);
return error;
}
@@ -1705,9 +1725,12 @@ int ha_myisam::restart_rnd_next(uchar *buf, uchar *pos)
int ha_myisam::rnd_pos(uchar *buf, uchar *pos)
{
+ MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
+ FALSE);
ha_statistic_increment(&SSV::ha_read_rnd_count);
int error=mi_rrnd(file, buf, my_get_ptr(pos,ref_length));
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_READ_ROW_DONE(error);
return error;
}
diff --git a/storage/myisammrg/Makefile.am b/storage/myisammrg/Makefile.am
index 1ca51bc9d03..267ce71f8d1 100644
--- a/storage/myisammrg/Makefile.am
+++ b/storage/myisammrg/Makefile.am
@@ -40,5 +40,21 @@ libmyisammrg_a_SOURCES = myrg_open.c myrg_extra.c myrg_info.c myrg_locking.c \
EXTRA_DIST = CMakeLists.txt plug.in
+if HAVE_DTRACE_DASH_G
+abs_top_srcdir = @abs_top_srcdir@
+libmyisammrg_a_LIBADD = probes_mysql.o
+libmyisammrg_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers
+CLEANFILES = probes_mysql.o dtrace_files dtrace_providers
+DTRACEFILES = ha_myisammrg.o
+DTRACEPROVIDER = $(abs_top_srcdir)/sql/probes_mysql.d
+
+dtrace_files:
+ echo $(DTRACEFILES) > $@
+dtrace_providers:
+ echo $(DTRACEPROVIDER) > $@
+probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
+ $(DTRACE) $(DTRACEFLAGS) -G -s $< $(DTRACEFILES) -o $@
+endif
+
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index 956f0e421cc..999dcf00b93 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -96,6 +96,7 @@
#define MYSQL_SERVER 1
#include "mysql_priv.h"
+#include "probes_mysql.h"
#include <mysql/plugin.h>
#include <m_ctype.h>
#include "../myisam/ha_myisam.h"
@@ -662,9 +663,11 @@ int ha_myisammrg::index_read_map(uchar * buf, const uchar * key,
enum ha_rkey_function find_flag)
{
DBUG_ASSERT(this->file->children_attached);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
ha_statistic_increment(&SSV::ha_read_key_count);
int error=myrg_rkey(file,buf,active_index, key, keypart_map, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
@@ -673,9 +676,11 @@ int ha_myisammrg::index_read_idx_map(uchar * buf, uint index, const uchar * key,
enum ha_rkey_function find_flag)
{
DBUG_ASSERT(this->file->children_attached);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
ha_statistic_increment(&SSV::ha_read_key_count);
int error=myrg_rkey(file,buf,index, key, keypart_map, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
@@ -683,46 +688,56 @@ int ha_myisammrg::index_read_last_map(uchar *buf, const uchar *key,
key_part_map keypart_map)
{
DBUG_ASSERT(this->file->children_attached);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
ha_statistic_increment(&SSV::ha_read_key_count);
int error=myrg_rkey(file,buf,active_index, key, keypart_map,
HA_READ_PREFIX_LAST);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
int ha_myisammrg::index_next(uchar * buf)
{
DBUG_ASSERT(this->file->children_attached);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
ha_statistic_increment(&SSV::ha_read_next_count);
int error=myrg_rnext(file,buf,active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
int ha_myisammrg::index_prev(uchar * buf)
{
DBUG_ASSERT(this->file->children_attached);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
ha_statistic_increment(&SSV::ha_read_prev_count);
int error=myrg_rprev(file,buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
int ha_myisammrg::index_first(uchar * buf)
{
DBUG_ASSERT(this->file->children_attached);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
ha_statistic_increment(&SSV::ha_read_first_count);
int error=myrg_rfirst(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
int ha_myisammrg::index_last(uchar * buf)
{
DBUG_ASSERT(this->file->children_attached);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
ha_statistic_increment(&SSV::ha_read_last_count);
int error=myrg_rlast(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
@@ -732,12 +747,14 @@ int ha_myisammrg::index_next_same(uchar * buf,
{
int error;
DBUG_ASSERT(this->file->children_attached);
+ MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
ha_statistic_increment(&SSV::ha_read_next_count);
do
{
error= myrg_rnext_same(file,buf);
} while (error == HA_ERR_RECORD_DELETED);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
@@ -752,9 +769,12 @@ int ha_myisammrg::rnd_init(bool scan)
int ha_myisammrg::rnd_next(uchar *buf)
{
DBUG_ASSERT(this->file->children_attached);
+ MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
+ TRUE);
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
int error=myrg_rrnd(file, buf, HA_OFFSET_ERROR);
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_READ_ROW_DONE(error);
return error;
}
@@ -762,9 +782,12 @@ int ha_myisammrg::rnd_next(uchar *buf)
int ha_myisammrg::rnd_pos(uchar * buf, uchar *pos)
{
DBUG_ASSERT(this->file->children_attached);
+ MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
+ TRUE);
ha_statistic_increment(&SSV::ha_read_rnd_count);
int error=myrg_rrnd(file, buf, my_get_ptr(pos,ref_length));
table->status=error ? STATUS_NOT_FOUND: 0;
+ MYSQL_READ_ROW_DONE(error);
return error;
}