Bug #40468 Storage engines code cannot be instrumented with DTrace probes
Submitted: 1 Nov 2008 13:48 Modified: 27 Feb 2019 9:25
Reporter: Alexey Kopytov Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Compiling Severity:S4 (Feature request)
Version:6.0-dtrace OS:Solaris
Assigned to: Assigned Account CPU Architecture:Any

[1 Nov 2008 13:48] Alexey Kopytov
Description:
Currently DTrace probes can be only located in the sql/ source directory, any probes inserted in libraries (such as mysys) or storage engines will not be visible in the resulting binary. This is a result of the way we build the server by linking helper libraries and storage engines as static archives, and a known problem with DTrace probes in static libraries described in this thread: http://www.opensolaris.org/jive/message.jspa?messageID=7480

Unfortunately, the suggested workaround cannot be used in a case when a program has DTrace probes in multiple static libraries and/or in the main application as well. This seems to be another known problem discussed here: http://opensolaris.org/jive/thread.jspa?messageID=283456

How to repeat:
Try to insert a DTrace probe to mysys or a storage engine. Depending on how the server is built, it will either be not visible in the server binary, or replace all the existing probes.

Suggested fix:
Changing mysys and storage engines to link as shared libraries is not an option for us due to various reasons.

So the only possible solution for us here is apparently processing all object files from the sql/ directory and all libraries/storage engines with a single 'dtrace -G' step as a part of the build process, and linking the resulting .o file into the binary.
[27 Mar 2009 8:07] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/70633

2742 Alexey Kopytov	2009-03-27
      Bug #40468: Storage engines code cannot be instrumented with   
                  DTrace probes  
            
      This patch changes the way we build DTrace-enabled binary to 
      allow inserting probes into code outside of sql/, namely mysys 
      and storage engines. A few additional probes were added to test 
      the idea.  
                    
      As a side effect of this build system overhaul, DTrace-enabled 
      binary can now be built on Mac OS X. 
       
      This patch also enables DTrace support by default on those 
      platforms that have it. 
      removed:
        storage/falcon/falcon_probes.d
        storage/falcon/falcon_probes.h
      added:
        include/probes_mysql_nodtrace.h
        scripts/dheadgen.pl
        storage/falcon/probes_falcon.d
        storage/falcon/probes_falcon.h
        storage/falcon/probes_falcon_nodtrace.h
      renamed:
        sql/probes.d => sql/probes_mysql.d
        sql/probes.h => include/probes_mysql.h
      modified:
        config/ac-macros/dtrace.m4
        include/Makefile.am
        libmysql/Makefile.am
        libmysql/Makefile.shared
        libmysqld/Makefile.am
        mysys/Makefile.am
        mysys/mf_keycache.c
        scripts/Makefile.am
        sql/Makefile.am
        sql/backup/Makefile.am
        sql/backup/kernel.cc
        sql/filesort.cc
        sql/ha_ndbcluster.cc
        sql/handler.cc
        sql/mysql_priv.h
        sql/mysqld.cc
        sql/net_serv.cc
        sql/scheduler.cc
        sql/sp_head.cc
        sql/sql_cache.cc
        sql/sql_connect.cc
        sql/sql_cursor.cc
        sql/sql_delete.cc
        sql/sql_insert.cc
        sql/sql_parse.cc
        sql/sql_prepare.cc
        sql/sql_select.cc
        sql/sql_update.cc
        storage/archive/Makefile.am
        storage/archive/ha_archive.cc
        storage/blackhole/Makefile.am
        storage/blackhole/ha_blackhole.cc
        storage/csv/Makefile.am
        storage/csv/ha_tina.cc
        storage/example/Makefile.am
        storage/example/ha_example.cc
        storage/falcon/Makefile.am
        storage/falcon/ha_falcon.cpp
        storage/falcon/ha_falcon.h
        storage/federated/Makefile.am
        storage/federated/ha_federated.cc
        storage/federated/ha_federated.h
        storage/heap/Makefile.am
        storage/heap/ha_heap.cc
        storage/maria/Makefile.am
        storage/maria/ha_maria.cc
        storage/myisam/Makefile.am
        storage/myisam/ha_myisam.cc
        storage/myisammrg/Makefile.am
        storage/myisammrg/ha_myisammrg.cc
        sql/probes_mysql.d
        include/probes_mysql.h
[27 Mar 2009 13:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/70706

2742 Alexey Kopytov	2009-03-27
      Bug #40468: Storage engines code cannot be instrumented with   
                  DTrace probes  
                  
      This patch changes the way we build DTrace-enabled binary to 
      allow inserting probes into code outside of sql/, namely mysys 
      and storage engines. A few additional probes were added to test 
      the idea.  
         
      As a side effect of this build system overhaul, DTrace-enabled 
      binary can now be built on Mac OS X. 
      
      This patch also enables DTrace support by default on those 
      platforms that have it. 
      removed:
      removed:
        storage/falcon/falcon_probes.d
        storage/falcon/falcon_probes.h
      added:
        include/probes_mysql_nodtrace.h
        scripts/dheadgen.pl
        storage/falcon/probes_falcon.d
        storage/falcon/probes_falcon.h
        storage/falcon/probes_falcon_nodtrace.h
      renamed:
        sql/probes.d => sql/probes_mysql.d
        sql/probes.h => include/probes_mysql.h
      modified:
        config/ac-macros/dtrace.m4
        include/Makefile.am
        libmysql/Makefile.am
        libmysql/Makefile.shared
        libmysqld/Makefile.am
        mysys/Makefile.am
        mysys/mf_keycache.c
        scripts/Makefile.am
        sql/Makefile.am
        sql/backup/Makefile.am
        sql/backup/kernel.cc
        sql/filesort.cc
        sql/ha_ndbcluster.cc
        sql/handler.cc
        sql/mysql_priv.h
        sql/mysqld.cc
        sql/net_serv.cc
        sql/scheduler.cc
        sql/sp_head.cc
        sql/sql_cache.cc
        sql/sql_connect.cc
        sql/sql_cursor.cc
        sql/sql_delete.cc
        sql/sql_insert.cc
        sql/sql_parse.cc
        sql/sql_prepare.cc
        sql/sql_select.cc
        sql/sql_update.cc
        storage/archive/Makefile.am
        storage/archive/ha_archive.cc
        storage/blackhole/Makefile.am
        storage/blackhole/ha_blackhole.cc
        storage/csv/Makefile.am
        storage/csv/ha_tina.cc
        storage/example/Makefile.am
        storage/example/ha_example.cc
        storage/falcon/Makefile.am
        storage/falcon/ha_falcon.cpp
        storage/falcon/ha_falcon.h
        storage/federated/Makefile.am
        storage/federated/ha_federated.cc
        storage/federated/ha_federated.h
        storage/heap/Makefile.am
        storage/heap/ha_heap.cc
        storage/maria/Makefile.am
        storage/maria/ha_maria.cc
        storage/myisam/Makefile.am
        storage/myisam/ha_myisam.cc
        storage/myisammrg/Makefile.am
        storage/myisammrg/ha_myisammrg.cc
        sql/probes_mysql.d
        include/probes_mysql.h
[27 Feb 2019 9:25] Jon Olav Hauglid
Posted by developer:
 
As of 8.0.1, support for DTrace probes has been removed from MySQL.