Bug #36072 Two constants having same value in THD::options
Submitted: 14 Apr 2008 21:12 Modified: 26 Oct 2008 0:35
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:6.0-bk OS:Any
Assigned to: Konstantin Osipov CPU Architecture:Any
Triage: Triaged: D2 (Serious)

[14 Apr 2008 21:12] Guilhem Bichot
Description:
I saw this in 6.0, file sql/mysql_priv.h:

#define OPTION_PROFILING                (ULL(1) << 33)

/*
  Dont report errors for individual rows,
  But just report error on commit (or read ofcourse)
*/
#define OPTION_ALLOW_BATCH              (ULL(1) << 33) // THD, intern (slave)
This looks like the product of a merge (OPTION_ALLOW_BATCH was added to 6.0, OPTION_PROFILING was added to 5.1, with both same value, and then 5.1 was merged into 6.0??).
Anyway this is an issue: any code which sets OPTION_ALLOW_BATCH will mislead some other code which wants to know if OPTION_PROFILING is on.
Though I don't have a bug testcase, this looks very bad so please don't burry this with a low priority, especially as the fix is changing one 33 to 34. Thanks.

How to repeat:
look at code.

Suggested fix:
change one 33 to 34. Check that 5.1 is not affected.
[15 Apr 2008 9:54] Valeriy Kravchuk
Thank you for a bug report. Vertified by code review. Current 6.0-BK has these lines in sql/mysql_priv.h:

/**
  Force the used temporary table to be a MyISAM table (because we will use
  fulltext functions when reading from it.
*/
#define TMP_TABLE_FORCE_MYISAM          (ULL(1) << 32)
#define OPTION_PROFILING                (ULL(1) << 33)

/*
  Dont report errors for individual rows,
  But just report error on commit (or read ofcourse)
*/
#define OPTION_ALLOW_BATCH              (ULL(1) << 33) // THD, intern (slave)
[2 Oct 2008 19:52] 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/55143

2720 Konstantin Osipov	2008-10-02
      Bug #36072 Two constants having same value in THD::options
      Change OPTION_ALLOW_BATCH to bit 34.
[2 Oct 2008 19: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/55144

2720 Konstantin Osipov	2008-10-02
      Bug #36072 Two constants having same value in THD::options
      Change OPTION_ALLOW_BATCH to bit 34.
[2 Oct 2008 20:01] Konstantin Osipov
Queued into 6.0-runtime.
[24 Oct 2008 1:18] Bugs System
Pushed into 6.0.8-alpha  (revid:kostja@sun.com-20081002195219-tluh332s3b6yjyzv) (version source revid:kostja@sun.com-20081002195219-tluh332s3b6yjyzv) (pib:5)
[26 Oct 2008 0:35] Paul Dubois
Cosmetic fix. No changelog entry needed.