Bug #49894 shifted MYSQL_REPLICATION_PLUGIN number
Submitted: 23 Dec 2009 15:21 Modified: 7 Mar 2010 1:22
Reporter: Sergei Golubchik Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.5-m2 OS:Any
Assigned to: Zhenxing He CPU Architecture:Any
Triage: Triaged: D2 (Serious)

[23 Dec 2009 15:21] Sergei Golubchik
Description:
in 6.0:

#define MYSQL_INFORMATION_SCHEMA_PLUGIN  4  /* The I_S plugin type */
#define MYSQL_AUDIT_PLUGIN           5  /* The Audit plugin type        */
#define MYSQL_REPLICATION_PLUGIN     6	/* The replication plugin type */
#define MYSQL_MAX_PLUGIN_TYPE_NUM    7  /* The number of plugin types   */

in next-mr:

#define MYSQL_INFORMATION_SCHEMA_PLUGIN  4  /* The I_S plugin type */
#define MYSQL_REPLICATION_PLUGIN     5	/* The replication plugin type */
#define MYSQL_MAX_PLUGIN_TYPE_NUM    6  /* The number of plugin types   */

that is replication plugin is number 6 in 6.0 and number 5 in next-mr.
it breaks the whole idea of plugins - one cannot load replication plugin both into 6.0 and next-mr, and audit plugin when loaded into next-mr will be wrongly recognized as replication plugin.

How to repeat:
.

Suggested fix:
Possible solutions

1. backport audit plugin into next-mr

2. backport only the define MYSQL_AUDIT_PLUGIN 5 and add few lines to sql_plugin.cc that will say "audit plugins are not supported" when one tries to load it.

3. swap plugin numbers for replication and audit in 6.0 - this is the most simple change, but, being an incompatible ABI change, it requires MYSQL_PLUGIN_INTERFACE_VERSION to be increased (to 0x2000) which automatically invalidates *all* plugins of *all* types.
[23 Dec 2009 16:27] Miguel Solorzano
Thank you for the bug report.
[15 Jan 2010 14:40] Mats Kindahl
For this particular case, I think that solution number 2 suggested by Serg has the smallest risk is the cleanest solution. It does not require invalidation of any plug-ins nor does it require extensive work to backport the audit plug-in.
[28 Jan 2010 9:29] 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/98429

3127 He Zhenxing	2010-01-28
      Bug#49894 shifted MYSQL_REPLICATION_PLUGIN number
      
      The number for MYSQL_REPLICATION_PLUGIN was shifted when backporting
      because MYSQL_AUDIT_PLUGIN was not backported.
      
      This problem is fixed by backporting only the number of audit plugin
      and print an error when trying to load audit plugins. Note that
      replication plugins compiled against old MYSQL_REPLICATION_PLUGIN
      number will also be recognized as audit plugin and be rejected. 
     @ include/mysql/plugin.h
        backporting the number of audit plugin (MYSQL_AUDIT_PLUGIN)
     @ sql/sql_plugin.cc
        backporting the number of audit plugin (MYSQL_AUDIT_PLUGIN)
        print an error when trying to load audit plugins
[28 Jan 2010 15:17] Luis Soares
Hi Zhenxing,
  Isn't this already fixed in next-mr after revision:
  svoj@sun.com-20100122083751-x2lhrzwzzqgzx6m6

Looking at include/mysql/plugin.h in revision
alik@sun.com-20100125161225-mpr7xlu4kvx45e1i

I see: 

#define MYSQL_AUDIT_PLUGIN           5  /* The Audit plugin type        */
#define MYSQL_REPLICATION_PLUGIN     6  /* The replication plugin type */
#define MYSQL_MAX_PLUGIN_TYPE_NUM    7  /* The number of plugin types   */

Looks like this has already been fixed... Can you please confirm?
[28 Jan 2010 15:20] Luis Soares
And by fixed I mean the audit plugin seems backported
(which is option #1 in the list of suggested fixes by 
Sergei).
[31 Jan 2010 0:27] Zhenxing He
as Luis said, audit plugin has been backported, so this bug will also be fixed by the backporting.
[1 Feb 2010 18:28] Andrei Elkin
The patch approved.
[4 Feb 2010 4:15] 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/99194

3127 He Zhenxing	2010-02-04
      Bug#49894 shifted MYSQL_REPLICATION_PLUGIN number
      
      The number for MYSQL_REPLICATION_PLUGIN was shifted when backporting
      because MYSQL_AUDIT_PLUGIN was not backported.
      
      This problem is fixed by backporting only the number of audit plugin
      and print an error when trying to load audit plugins. Note that
      replication plugins compiled against old MYSQL_REPLICATION_PLUGIN
      number will also be recognized as audit plugin and be rejected.
     @ include/mysql/plugin.h
        backporting the number of audit plugin (MYSQL_AUDIT_PLUGIN)
     @ sql/sql_plugin.cc
        backporting the number of audit plugin (MYSQL_AUDIT_PLUGIN)
        print an error when trying to load audit plugins
[4 Feb 2010 4:43] 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/99197

2983 He Zhenxing	2010-02-04 [merge]
      audit plugin has already backported
      Null merge the fix for Bug#49894
[12 Feb 2010 17:40] Bugs System
Pushed into 5.5.2-m2 (revid:joerg@mysql.com-20100212164100-jnurxdw5z88m472s) (version source revid:joerg@mysql.com-20100212164100-jnurxdw5z88m472s) (merge vers: 5.5.2-m2) (pib:16)
[13 Feb 2010 8:36] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100213083436-9pesg4h55w1mekxc) (version source revid:luis.soares@sun.com-20100211135109-t63avry9fqpgyh78) (merge vers: 6.0.14-alpha) (pib:16)
[13 Feb 2010 8:38] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100213083327-cee4ao3jpg33eggv) (version source revid:luis.soares@sun.com-20100211135018-1f9dbghg0itszigo) (pib:16)
[16 Feb 2010 19:19] Paul Dubois
Noted in 5.5.2 changelog.

In plugin.h, the MYSQL_REPLICATION_PLUGIN symbol was out of synchrony
with its value in MySQL 6.0 because the lower-valued
MYSQL_AUDIT_PLUGIN was not present. To correct this,
MYSQL_AUDIT_PLUGIN has been added in MySQL 5.5, changing the value of
MYSQL_REPLICATION_PLUGIN from 5 to 6. Replication plugins from
earlier 5.5.x releases must be recompiled against the current release
before they will work with the current release.
[17 Feb 2010 15:49] Paul Dubois
Revised changelog entry:

In plugin.h, the MYSQL_REPLICATION_PLUGIN symbol was out of synchrony
with its value in MySQL 6.0 because the lower-valued
MYSQL_AUDIT_PLUGIN was not present. To correct this,
MYSQL_AUDIT_PLUGIN has been added in MySQL 5.5, changing the value of
MYSQL_REPLICATION_PLUGIN from 5 to 6. Attempts to load the audit
plugin produce an error occurs because only the MYSQL_AUDIT_PLUGIN
symbol was added, not the audit plugin itself. This error will go
away when the audit plugin is added to MySQL 5.5. Replication plugins
from earlier 5.5.x releases must be recompiled against the current
release before they will work with the current release.
[6 Mar 2010 11:05] Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:vvaintroub@mysql.com-20100213160132-nx1vlocxuta76txh) (merge vers: 5.5.99-m3) (pib:16)
[7 Mar 2010 1:22] Paul Dubois
Already fixed in earlier 5.5.x.