Bug #42144 plugin_load fails
Submitted: 16 Jan 2009 0:46 Modified: 14 Oct 2010 13:26
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.30, azalea OS:Any
Assigned to: Georgi Kodinov
Tags: disabled
Triage: Triaged: D3 (Medium)

[16 Jan 2009 0:46] [ name withheld ]
Description:
The plugin_load regression test expects the variable global.example_enum_var to still have the value that was assigned to it midway through the previous regression test (plugin).  However, since plugin.test ends with 
UNINSTALL PLUGIN example;
it seems to me that the correct response would be
Unknown system variable 'example_enum_var'
... at least that's what I get when I do the same sequence of operations manually.

I think that the results shown in plugin.result are an artifact of a race condition (ie, the plugin isn't unloaded quite yet).  The reason my attention got drawn to this is that the plugin_load regression test
is showing a platform-dependent failure in my testing on Fedora (F10 and rawhide) --- on PPC64 it
seems to usually yield 0 (ie equality failure) rather than 1 (equality).  The best hypothesis I can think of is that the timing is a bit different on that hardware and we are seeing the value of the variable after it's been reset to zero, but still before the plugin is completely unloaded.  Manual execution of the test
produces the results I expect on both this platform and others.

If you think the regression tests are actually showing sane results, please explain why manual execution produces a different result.

How to repeat:
Here's the manual behavior:

mysql> INSTALL PLUGIN example SONAME 'ha_example.so';
Query OK, 0 rows affected (0.00 sec)

mysql> SET GLOBAL example_enum_var= e2;
Query OK, 0 rows affected (0.00 sec)

mysql> UNINSTALL PLUGIN example;
Query OK, 0 rows affected (0.01 sec)

mysql> SELECT @@global.example_enum_var = 'e2';
ERROR 1193 (HY000): Unknown system variable 'example_enum_var'

Why doesn't this match the regression test results?

Suggested fix:
For the moment I'm just diking the plugin_load test out of the Fedora package.  If it is a race condition and you don't intend to get rid of it, maybe inserting a small delay into this test would be appropriate.
[16 Jan 2009 6:58] Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Test plugin_load contains option file plugin_load-master.opt which forces mysql-test-run.pl re-locad EXAMPLE plugin and additional check if plugin EXAMPLE is installed.
[16 Jan 2009 7:12] [ name withheld ]
okay ... so why does it fail on ppc64?
[16 Jan 2009 7:20] Sveta Smirnova
Thank you for the feedback.

Test should not fail. Please provide error message you get and log files: content of MYSQL_PATH/mysql-test/var/log directory. Also please confirm you run Fedora on ppc64.
[16 Jan 2009 7:31] [ name withheld ]
There's no error message, it just delivers an unexpected result:

--- /home/tgl/rpmwork/BUILD/mysql-5.1.30/mysql-test/r/plugin_load.result	2008-11-14 20:30:54.000000000 +0300
+++ /home/tgl/rpmwork/BUILD/mysql-5.1.30/mysql-test/r/plugin_load.reject	2009-01-16 02:34:06.000000000 +0300
@@ -1,3 +1,3 @@
 SELECT @@global.example_enum_var = 'e2';
 @@global.example_enum_var = 'e2'
-1
+0

mysqltest: Result content mismatch

I do not have access to any additional log files right at this moment, but can probably get them for you tomorrow if you specify what you're interested in.

Also, this happens on released Fedora 10 as well as Fedora rawhide (ie F11-to-be).  It might happen on older versions too, but those are the only releases I've tried to test mysql 5.1 on.  As stated, I see it consistently on PPC64 but not PPC, x64, or x86_64 ... cannot say about other architectures.
[16 Jan 2009 8:56] Sveta Smirnova
Thank you for the feedback.

I changed description of the bug, so it reflects correct situation. Please send us log files if you can. Also is interesting if this test fails when run not after plugin test, i.e. ./mysql-test-run.pl plugin_load
[16 Jan 2009 18:27] [ name withheld ]
var/log/ contents after running  /usr/bin/perl ./mysql-test-run.pl plugin_load

Attachment: plugin_load_test.tar.gz (application/x-gzip, text), 1.68 KiB.

[16 Jan 2009 18:30] [ name withheld ]
Yes, it fails just the same way if I run only that one regression test, which knocks out my theory about a race condition with the previous test.  (And makes it even more questionable why the test doesn't result in an error message...)  I have uploaded the var/log/ files --- is that what you wanted? --- for a run with just that single test selected.  I also have the log files for the full regression tests up to the point of the failure, but that's a couple megabytes so I won't upload unless specifically asked for.
[16 Jan 2009 20:40] Sveta Smirnova
Thank you for the update.

Yes, var/log content is what I asked for.
[22 Jan 2009 16:58] Sveta Smirnova
Thank you for the feedback.

Verified as described on AIX 5.3 on PPC64 machine.
[21 Jul 2009 10:16] Bjørn Munch
The test also fails on Sparc. Due to Bug #45298, the test has been incorrectly skipped, but after this was fixed in 5.1-mtr and azalea-mtr, the test fails every time:

CURRENT_TEST: main.plugin_load
--- /export/home/pb2/test/sb_1-588409-1245188639.34/mysql-5.1.36-solaris10-sparc-test/mysql-test/r/plugin_load.result	2009-06-17 00:35:54.000000000 +0300
+++ /export/home/pb2/test/sb_1-588409-1245188639.34/mysql-5.1.36-solaris10-sparc-test/mysql-test/r/plugin_load.reject	2009-06-17 00:48:45.533348000 +0300
@@ -1,3 +1,3 @@
 SELECT @@global.example_enum_var = 'e2';
 @@global.example_enum_var = 'e2'
-1
+0

If I modiy the SELECT to actually select the variable in stead of testing that its value is 'e2' (that's probably how the test should have been in the first place), the test shows that the value is 'e1'.

This is in PB2, also veryfied my manually running only the plugin_load test on the PB2 binaries. *However*, if I run the test on the same host with binaries I've built myself, it succeeds!  The configure command for this build is simplistic:

./configure CC=/opt/studio12/SUNWspro/bin/cc CXX=/opt/studio12/SUNWspro/bin/CC --prefix=/home/bm136801/install/51mtr --with-plugins=myisam,innobase
[18 Sep 2009 7:45] Bjørn Munch
I am sending this back, it was assigned to me with a suggestion (sent me by email) about a change in MTR which could fix this.

But this was a red herring, the failure on Sparc is in fact Bug #47146, it just results in a symptom identical to what this report said. Mea culpa for not seeing this when I added to this report. If I build with --disable-dtrace, the test succeeds.

I know nothing about the original failure in PPC64 so can't close this as a duplicate, but I remove "and Sparc" from the synopsis and set OS to Linux.
[21 Dec 2009 10:19] Alexander Nozdrin
This bug should be fixed after Bug#47146.

Assign to Horst/Philip as it was discussed on IRC.

plugin_load.test was disabled starting from trunk due to this bug.
[21 Dec 2009 10:21] 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/95190

2927 Alexander Nozdrin	2009-12-21
      Disable plugin_load.test due to Bug#42144.
[21 Dec 2009 15:39] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091221153807-80nxoli1tw1z9bxn) (version source revid:alik@sun.com-20091221102716-m2ftjbpwzka3vy1n) (merge vers: 6.0.14-alpha) (pib:15)
[21 Dec 2009 15:40] Bugs System
Pushed into 5.5.1-m2 (revid:alik@sun.com-20091221153538-ifi3mxf3y10ozxin) (version source revid:alik@sun.com-20091221102043-q6owslhuzb62o6we) (merge vers: 5.5.1-m2) (pib:15)
[21 Dec 2009 15:41] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20091221153659-d7bt0fh6mhhclxuf) (version source revid:alik@sun.com-20091221102341-ds4ofsawv5ceil3n) (pib:15)
[8 Jul 2010 13: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/113142

3470 Georgi Kodinov	2010-07-08
      Bug #42144: plugin_load fails
      
      enum plugin system variables are ulong internally, not int.
      On systems where long is not the same as an int it causes
      problems. 
      Fixed by correct typecasting. Removed the test from the 
      experimental list.
[14 Jul 2010 9:39] 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/113526

3470 Georgi Kodinov	2010-07-14
      Bug #42144: plugin_load fails
      
      enum plugin system variables are ulong internally, not int.
      On systems where long is not the same as an int it causes
      problems. 
      Fixed by correct typecasting. Removed the test from the 
      experimental list.
[30 Jul 2010 13: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/114745

3470 Georgi Kodinov	2010-07-30
      Bug #42144: plugin_load fails
      
      enum plugin system variables are ulong internally, not int.
      On systems where long is not the same as an int it causes
      problems. 
      Fixed by correct typecasting. Removed the test from the 
      experimental list.
[3 Aug 2010 12:20] 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/114930

3472 Georgi Kodinov	2010-07-30
      Bug #42144: plugin_load fails
      
      enum plugin system variables are ulong internally, not int.
      On systems where long is not the same as an int it causes
      problems. 
      Fixed by correct typecasting. Removed the test from the 
      experimental list.
[3 Aug 2010 16: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/114952

3472 Georgi Kodinov	2010-08-03
      Bug #42144: plugin_load fails
      
      The enum system variables were handled inconsistently 
      as ints, unsigned int and unsigned long on various places.
      This caused problems on platforms on which 
      sizeof(int) != sizeof(long).
      Fixed by homogenizing the type of the enum variables
      to unsigned int, since it's size compatible with the C enum
      type. 
      Removed the test from the experimental list.
[4 Aug 2010 12:59] 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/115012

3473 Georgi Kodinov	2010-08-04
      Bug #42144: plugin_load fails
      
      Reverted the ulong->uint diff
      Re-applied the first diff.
      The original commit message follows:
      
      enum plugin system variables are ulong internally, not int.
      On systems where long is not the same as an int it causes
      problems. 
      Fixed by correct typecasting. Removed the test from the 
      experimental list.
[4 Aug 2010 16:58] 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/115044

3176 Georgi Kodinov	2010-08-04 [merge]
      Merge of bug #42144 to mysql-trunk-merge.
      Fix extended to update all the enum variables and options to ulong to
      be compliant with the plugin code.
[5 Aug 2010 12:11] 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/115091

3474 Georgi Kodinov	2010-08-05
      Addendum to bug #42144 : fixed a wrong type conversation causing plugin tests
      failures on sparc64.
[5 Aug 2010 12: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/115092

3475 Georgi Kodinov	2010-08-05
      Addendum to bug #42144 : fixed a wrong type conversation causing plugin tests
      failures on sparc64.
[13 Aug 2010 10:03] Alexander Nozdrin
See also Bug#55966.
[18 Aug 2010 7:21] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@sun.com-20100818071819-2lu46b0mm3cs34rf) (version source revid:alik@sun.com-20100818071732-g682fg1v0nnrrutx) (merge vers: 5.6.1-m4) (pib:20)
[18 Aug 2010 7:22] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100818071923-4ounwbhiium2met1) (version source revid:alik@sun.com-20100818071743-lrzordai06i2crty) (pib:20)
[18 Aug 2010 7:23] Bugs System
Pushed into mysql-5.5 5.5.6-m3 (revid:alik@sun.com-20100818071719-dktnkvt8zvidj0sy) (version source revid:alik@sun.com-20100818071719-dktnkvt8zvidj0sy) (merge vers: 5.5.6-m3) (pib:20)
[18 Aug 2010 15:04] Paul Dubois
Noted in 5.5.6, 5.6.1 changelogs.

Enumeration plugin variables were subject to a type casting error,
causing inconsistent results between different platforms. 

Setting report to Need Merge pending push to 5.1.x.
[21 Aug 2010 1:24] Paul Dubois
Noted in 5.1.51 changelog.
[28 Sep 2010 8:49] Bugs System
Pushed into mysql-5.1 5.1.52 (revid:sunanda.menon@sun.com-20100928083322-wangbv97uobu7g66) (version source revid:sunanda.menon@sun.com-20100928083322-wangbv97uobu7g66) (merge vers: 5.1.52) (pib:21)
[14 Oct 2010 8:37] Bugs System
Pushed into mysql-5.1-telco-7.0 5.1.51-ndb-7.0.20 (revid:martin.skold@mysql.com-20101014082627-jrmy9xbfbtrebw3c) (version source revid:martin.skold@mysql.com-20101014082627-jrmy9xbfbtrebw3c) (merge vers: 5.1.51-ndb-7.0.20) (pib:21)
[14 Oct 2010 8:53] Bugs System
Pushed into mysql-5.1-telco-6.3 5.1.51-ndb-6.3.39 (revid:martin.skold@mysql.com-20101014083757-5qo48b86d69zjvzj) (version source revid:martin.skold@mysql.com-20101014083757-5qo48b86d69zjvzj) (merge vers: 5.1.51-ndb-6.3.39) (pib:21)
[14 Oct 2010 9:08] Bugs System
Pushed into mysql-5.1-telco-6.2 5.1.51-ndb-6.2.19 (revid:martin.skold@mysql.com-20101014084420-y54ecj85j5we27oa) (version source revid:martin.skold@mysql.com-20101014084420-y54ecj85j5we27oa) (merge vers: 5.1.51-ndb-6.2.19) (pib:21)
[14 Oct 2010 13:26] Jon Stephens
Already documented in the 5.1.51 changelog; no additional changelog entries required. Set back to Closed state.