Bug #47146 Linking problem with example plugin when dtrace enabled
Submitted: 4 Sep 2009 19:44 Modified: 4 Aug 2010 22:54
Reporter: Bjørn Munch Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.4 OS:Solaris
Assigned to: Horst Hunger CPU Architecture:Any
Tags: DTrace, experimental, plugin

[4 Sep 2009 19:44] Bjørn Munch
Description:
Tests main.plugin and rpl.rpl_plugin_load fail on Solaris in -trunk where dtrace is enabled by default in configure:

mysqltest: At line 7: query 'INSTALL PLUGIN example SONAME $HA_EXAMPLE_SO' failed: 1126: Can't open shared library '/tmp/t/storage/example/.libs/ha_example.so' (errno: 2 ld.so.1: mysqld: fatal: relocation error: file /tmp/t/storage/example/.libs/ha_example.so: symbol __dtrace_mysql___index__read__)

(Part of the symbol name has been cut off)

How to repeat:
Run either of these tests on Solaris when built with dtrace, also seen in PB2.

It has not been seen before in PB2 because those tests have been incorrectly skipped, but after Bug #45298 was fixed, they surface.  I will set them to 'experimental' on Solaris in mysql-trunk-mtr before merging this to mysql-trunk.
[7 Sep 2009 7:31] Philip Stoev
Horst, you are our Dtrace/plugin guy :-) So please take a look at this. Thank you.
[16 Sep 2009 9:59] Horst Hunger
Would you, please, show me the configure call with parameters?
[16 Sep 2009 10:16] Bjørn Munch
Settings ang config line from PB2 where this bug is seen. I cannot add it as comment since the lines get wrapped.

Attachment: conf (application/octet-stream, text), 1.21 KiB.

[16 Sep 2009 10:54] Horst Hunger
It seems so, as if the example plugin will not be generated to be dynamically linkable, see configure parameter for plugins.
[24 Sep 2009 14:33] James Grinter
[Bug #42144 (which has the symptoms I am experiencing when building 5.1 on Solaris 10/SPARC), refers over to this bug.]

Can someone confirm whether this is just a test-case bug, or whether I need to disable DTrace support in order to build a clean MySQL?
[29 Sep 2009 14:35] 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/85044

2880 Horst Hunger	2009-09-29
      Patch for Bug#47146. The dtrace was never executed due to wrong dependencies and the wrong .o was used when linking the shared library. Now dtrace will be executed and .libs/ha_example_la-ha_example.o will be used in the shared library.
[29 Sep 2009 16:05] Joerg Bruehe
Wrote a review and mailed it.

To me, it doesn't yet look correct, especially when comparing with how it is done for other handlers.
Maybe they got it wrong, too - this should be checked.

In any case, the patch has some inconsistencies which should be fixed.
[30 Sep 2009 14:38] Bjørn Munch
Some tests in mysql-test/collections/default.experimantal have been tagged with this bug number, please remove these as part of any fix.
[26 Oct 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/88159

2915 Horst.Hunger	2009-10-26
      Patch for bug#47146: Patch after first review. Taken from the Makefile.am for archive and changed for example.
[27 Oct 2009 10:55] 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/88313

2915 Horst.Hunger	2009-10-27
      Patch for bug#47146: Patch after first review. Taken from the Makefile.am for archive and changed for example. Copyright line has been changed.
[27 Oct 2009 13:20] Bjørn Munch
I commented that the entries in mysql-test/collections/default.experimantal that were tagged with this test should be removed, but the patch does not do so. Please fix that before pushing.
[30 Oct 2009 13:07] Alexey Kopytov
The 'dtrace_shared_files' target is not required, it's not used anywhere. Please remove it.

The same applies to the patch for bug #47739, I had overlooked that when reviewing it, sorry about that.
[4 Nov 2009 11:41] Joerg Bruehe
I do not agree to Alexey's comment:
AIUI, neither "dtrace_files" nor "dtrace_shared_files" nor "dtrace_providers" nor "dtrace_sources" are required technically, so they might all be removed.

However, I think they serve documentation purposes during the build, so I really see merit in their existence - provided they all get removed during cleanup.

Because of this, I would like to see "dtrace_sources" added to "CLEANFILES".
With this addition and Horst's tests that it works, I approve of the change.
[4 Nov 2009 13:23] Alexey Kopytov
I added 'dtrace_files' targets because sql/Makefile.am needs to process all object files in one step, so it has to know names of all object files containing probes from all libraries (or storage engines). 

Similarly, 'dtrace_providers' targets are required by sql/Makefile.am to track all providers defined by libraries/storage engines, since storage engines will not necessarily put their probes into the 'mysql' provider, they are free to define their own ones.

And we need to track all object files and providers to work around a well know DTrace limitation in processing static archives. See sql/Makefile.am for details. 

Shared libraries are not affected by that problem, we don't need to track object files containing probes that are linked into a shared library to process them in sql/Makefile.am. Therefore, we don't need the 'dtrace_shared_files' targets.

'dtrace_sources' wasn't added by me. It is not actually used anywhere and its purpose eludes me. It seems like someone just copy-pasted the code for 'link_sources' in client/Makefile.am.
[5 Nov 2009 9:13] Horst Hunger
My conclusion is: Remove "dtrace_shared_files" as target as I completely agree with Alexeys explanation. Alexey agrees in considering the review as done.
[5 Nov 2009 15:13] 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/89488

2915 Horst.Hunger	2009-11-05
      Patch for bug#47146: Patch after review. Taken from the Makefile.am for archive and changed for example. Copyright line has been changed. The target "dtrace_shared_file" has been removed.
[5 Nov 2009 15:34] 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/89494

2940 Horst.Hunger	2009-11-05
      Patch for bug#47146: Patch after review. Taken from the Makefile.am for archive and changed for example. Copyright line has been changed. The target "dtrace_shared_file" has been removed.
[5 Nov 2009 15:36] Horst Hunger
pushed to mysql-next-mr-bugfixing.
[11 Nov 2009 10:01] 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/90069

2945 Philip Stoev	2009-11-11
      revert patch for bug #47146 because it breaks Solaris builds
[11 Nov 2009 10:05] 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/90071

3703 Philip Stoev	2009-11-11 [merge]
      merge: revert patch for bug #47146 because it breaks Solaris builds
[11 Nov 2009 21:28] MC Brown
Patch for Bug 47146

Attachment: 47146.patch (application/octet-stream, text), 1001 bytes.

[20 Nov 2009 12:57] Bugs System
Pushed into 6.0.14-alpha (revid:kostja@sun.com-20091120124947-yi6h2jbgw0kbciwm) (version source revid:pstoev@mysql.com-20091111100316-9dumrv0rxrl8g67j) (merge vers: 6.0.14-alpha) (pib:13)
[20 Nov 2009 13:09] John Embretsen
Since the patch committed by the assignee was reverted, I am setting status back to Verified. MC has suggested/attached an alternative patch, but it does not look like it has been committed yet, so status Documenting would be wrong.
[11 Dec 2009 6:03] Bugs System
Pushed into 5.6.0-beta (revid:alik@sun.com-20091211055628-ltr7fero363uev7r) (version source revid:alik@sun.com-20091211055453-717czhtezc74u8db) (merge vers: 5.6.0-beta) (pib:13)
[16 Dec 2009 12:06] 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/94475

2934 Horst.Hunger	2009-12-16
      This is a the same patch that MC committed ago to bug#47146. I need it for a further push. This patch has been tested with cc and gcc on Solaris.
[21 Dec 2009 10:21] Alexander Nozdrin
See also Bug#42144.
[3 Mar 2010 9:12] 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/102150

2985 Horst.Hunger	2010-03-03
      Bug#47146 : Patch based on "mysql-next-mr-bugfixing". Includes MC's patch and the changes of the first review.
[4 Mar 2010 14:27] Olav Sandstå
Tested patch on Solaris 10 on AMD and SPARC using Sun Studio compiler. Comments sent by email to the commits list.

Summary: it is necessary to produce position independent code (PIC) for the storage engine plug-ins. To ensure this is done when using the Sun Studio compiler the -Kpic or -KPIC option must be given to the compiler.
[5 Mar 2010 18:01] 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/102462

2985 Horst.Hunger	2010-03-05
      Bug#47146 : Patch based on "mysql-next-mr-bugfixing". Includes MC's patch and the changes required by the reviews.
[6 Mar 2010 10:52] Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:vvaintroub@mysql.com-20091211201717-03qf8ckwiw0np80p) (merge vers: 5.6.0-beta) (pib:16)
[23 Mar 2010 9:08] Daniel Fischer
Bug#52211 has been marked as a duplicate of this bug.
[23 Mar 2010 20:34] 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/104124

2992 Alexey Kopytov	2010-03-23
      Mark all main.plugin* tests as experimental on Solaris
      as done in 6.0 due to bug #47146.
[26 Mar 2010 8:21] Bugs System
Pushed into 5.5.4-m3 (revid:alik@sun.com-20100326080914-2pz8ns984e0spu03) (version source revid:alexey.kopytov@sun.com-20100323203412-xr3vul0peew7jioc) (merge vers: 5.5.3-m2) (pib:16)
[26 Mar 2010 8:25] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100326081116-m3v4l34yhr43mtsv) (version source revid:alik@sun.com-20100325072612-4sds00ix8ajo1e84) (pib:16)
[26 Mar 2010 8:30] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100326081944-qja07qklw1p2w7jb) (version source revid:alik@sun.com-20100325090207-0462f2l8qhgy9qfa) (merge vers: 6.0.14-alpha) (pib:16)
[21 Apr 2010 11:25] 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/106244

3145 Horst.Hunger	2010-04-21
      This patch for bug#47146 needs the patch "http://lists.mysql.com/commits/102462" from 2010-03-05 as base.
[21 Apr 2010 12:49] Horst Hunger
Pushed the last patch to next-mr-bugfixing and 6.0-codebase-bugfixing.
[26 Apr 2010 14:09] Alexander Nozdrin
rpl_ndb_binlog_format_errors fails in mysql-trunk
on OpenSolaris due to this bug.

Should not the patch be pushed into mysql-trunk-bugfixing?
[27 Apr 2010 9:45] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100427094135-5s49ecp3ckson6e2) (version source revid:alik@sun.com-20100427093843-uekr85qkd7orx12t) (merge vers: 6.0.14-alpha) (pib:16)
[27 Apr 2010 9:50] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100427094036-38frbg3famdlvjup) (version source revid:alik@sun.com-20100427093825-92wc8b22d4yg34ju) (pib:16)
[2 Jun 2010 7:59] MC Brown
A note has been added to the 5.5.4, 6.0.14 changelogs: 

        When using the <literal>EXAMPLE</literal> storage engine, when                                                                                     
        the engine had been built as a plugin (instead of built-in), and                                                                                   
        DTrace probes had been enabled during the build, loading the                                                                                       
        storage engine library would fail due to a missing object table                                                                                    
        entry.
[4 Aug 2010 8:05] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804080001-bny5271e65xo34ig) (version source revid:alik@sun.com-20100427095914-pzlxbqjjtnngxmf0) (merge vers: 5.6.99-m4) (pib:18)
[4 Aug 2010 8:21] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804081533-c1d3rbipo9e8rt1s) (version source revid:alik@sun.com-20100427095914-pzlxbqjjtnngxmf0) (merge vers: 5.6.99-m4) (pib:18)
[4 Aug 2010 22:54] Paul DuBois
Bug does not appear in any released 5.6.x version.