Bug #59432 --autocommit=on does not work (@@global.autocommit is 0)
Submitted: 11 Jan 2011 21:55 Modified: 29 Jan 2011 23:17
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Options Severity:S3 (Non-critical)
Version:5.5 OS:Any
Assigned to: Guilhem Bichot CPU Architecture:Any

[11 Jan 2011 21:55] Guilhem Bichot
Description:
Discovered by Paul DuBois.

The fix for BUG#57316 added a boolean command-line option --autocommit=0|1 (and also --skip, --enable and --disable variants) to mysqld.
Around the same period, the fix for BUG#51631 added the ability for boolean command-line options to pass =on|off|true|false. The fix for BUG#57316 wasn't designed with that in mind (it was assuming 0|1) and thus --autocommit doesn't support those new values. Precisely,
--autocommit=on
sets autocommit off! Same for =true.
--autocommit=off and =false work.

How to repeat:
take 5.5 tree, start mysqld with --autocommit=on, do
select @@global.autocommit
it's 0!
[11 Jan 2011 22:00] 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/128467

3237 Guilhem Bichot	2011-01-11
      Fix for BUG#59432 "--autocommit=on does not work (@@global.autocommit is 0)"
     @ mysql-test/suite/sys_vars/r/autocommit_func4.result
        Before this fix, this test would have shown @@global.autocommit == 0
        in spite of --autocommit=on.
     @ mysql-test/suite/sys_vars/r/autocommit_func5.result
        result unchanged by the fix
     @ sql/mysqld.cc
        atoi(argument) was reliable for =0|1 parameters. Now that boolean options
        must support =on/off/true/false, atoi(argument) is wrong (being always 0
        for those strings). Instead, let the internal logic of my_getopt
        (in particular get_bool_argument()) set a boolean opt_autocommit
        properly, and use that to set global_system_variables.option_bits.
[12 Jan 2011 9:45] 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/128486

3237 Guilhem Bichot	2011-01-12
      Fix for BUG#59432 "--autocommit=on does not work (@@global.autocommit is 0)"
     @ mysql-test/r/mysqld--help-notwin.result
        consequence of introducing opt_autocommit and its default
     @ mysql-test/suite/sys_vars/r/autocommit_func4.result
        Before this fix, this test would have shown @@global.autocommit == 0
        in spite of --autocommit=on.
     @ mysql-test/suite/sys_vars/r/autocommit_func5.result
        result unchanged by the fix
     @ sql/mysqld.cc
        atoi(argument) was reliable for =0|1 parameters. Now that boolean options
        must support =on/off/true/false, atoi(argument) is wrong (being always 0
        for those strings). Instead, let the internal logic of my_getopt
        (in particular get_bool_argument()) set a boolean opt_autocommit
        properly, and use that to set global_system_variables.option_bits.
[14 Jan 2011 8:51] Magne Mæhre
Ok to push
[14 Jan 2011 12:49] 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/128737

3246 Guilhem Bichot	2011-01-12
      Fix for BUG#59432 "--autocommit=on does not work (@@global.autocommit is 0)"
     @ mysql-test/r/mysqld--help-notwin.result
        consequence of introducing opt_autocommit and its default
     @ mysql-test/suite/sys_vars/r/autocommit_func4.result
        Before this fix, this test would have shown @@global.autocommit == 0
        in spite of --autocommit=on.
     @ mysql-test/suite/sys_vars/r/autocommit_func5.result
        result unchanged by the fix
     @ sql/mysqld.cc
        atoi(argument) was reliable for =0|1 parameters. Now that boolean options
        must support =on/off/true/false, atoi(argument) is wrong (being always 0
        for those strings). Instead, let the internal logic of my_getopt
        (in particular get_bool_argument()) set a boolean opt_autocommit
        properly, and use that to set global_system_variables.option_bits.
[14 Jan 2011 13:17] 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/128749

3246 Guilhem Bichot	2011-01-14
      Fix for BUG#59432 "--autocommit=on does not work (@@global.autocommit is 0)"
     @ mysql-test/r/mysqld--help-notwin.result
        consequence of introducing opt_autocommit and its default
     @ mysql-test/suite/sys_vars/r/autocommit_func4.result
        Before this fix, this test would have shown @@global.autocommit == 0
        in spite of --autocommit=on.
     @ mysql-test/suite/sys_vars/r/autocommit_func5.result
        result unchanged by the fix
     @ sql/mysqld.cc
        atoi(argument) was reliable for =0|1 parameters. Now that boolean options
        must support =on/off/true/false, atoi(argument) is wrong (being always 0
        for those strings). Instead, let the internal logic of my_getopt
        (in particular get_bool_argument()) set a boolean opt_autocommit
        properly, and use that to set global_system_variables.option_bits.
[14 Jan 2011 13:22] 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/128750

3247 Guilhem Bichot	2011-01-14
      Fix for BUG#59432 "--autocommit=on does not work (@@global.autocommit is 0)"
     @ mysql-test/r/mysqld--help-notwin.result
        consequence of introducing opt_autocommit and its default
     @ mysql-test/suite/sys_vars/r/autocommit_func4.result
        Before this fix, this test would have shown @@global.autocommit == 0
        in spite of --autocommit=on.
     @ mysql-test/suite/sys_vars/r/autocommit_func5.result
        result unchanged by the fix
     @ sql/mysqld.cc
        atoi(argument) was reliable for =0|1 parameters. Now that boolean options
        must support =on/off/true/false, atoi(argument) is wrong (being always 0
        for those strings). Instead, let the internal logic of my_getopt
        (in particular get_bool_argument()) set a boolean opt_autocommit
        properly, and use that to set global_system_variables.option_bits.
[14 Jan 2011 13:43] Bugs System
Pushed into mysql-5.5 5.5.10 (revid:guilhem.bichot@oracle.com-20110114132146-1m5ypayccbxpjyzl) (version source revid:guilhem.bichot@oracle.com-20110114132146-1m5ypayccbxpjyzl) (merge vers: 5.5.10) (pib:24)
[14 Jan 2011 14:03] Bugs System
Pushed into mysql-trunk 5.6.2 (revid:guilhem.bichot@oracle.com-20110114134241-2tzzagfui2tr943x) (version source revid:guilhem.bichot@oracle.com-20110114134241-2tzzagfui2tr943x) (merge vers: 5.6.2) (pib:24)
[14 Jan 2011 14:03] Guilhem Bichot
queued to 5.5 and trunk
[15 Jan 2011 16:07] Paul Dubois
Noted in 5.5.10, 5.6.2 changelogs.

--autocommit=ON did not work (it set the global autocommit value to 0, not 1).