summaryrefslogtreecommitdiff
path: root/storage/example
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/example
parent602f612af09c3ccb6db19286291ae0bca403db5c (diff)
downloadmariadb-git-cc958a18dd9554870edd3b1c6119edf72b661879.tar.gz
Backport of DTrace patches from 6.0
Diffstat (limited to 'storage/example')
-rw-r--r--storage/example/Makefile.am17
-rw-r--r--storage/example/ha_example.cc45
2 files changed, 55 insertions, 7 deletions
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);
}