Uploaded image for project: 'Percona Server for MySQL'
  1. Percona Server for MySQL
  2. PS-1553

LP #1382782: mysql_install_db not handling mysqld startup failure

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None

      Description

      **Reported in Launchpad by Vlad Lesin last update 20-10-2014 15:23:19

      Consider lp:mysql-server/5.6 revision 6130.

      If we look into scripts/mysql_install_db.pl.in lines 753-958 are responsible for invoking mysqld in bootstrap mode and feeding the following files to it:
      my $create_system_tables = "$pkgdatadir/mysql_system_tables.sql";
      my $fill_system_tables = "$pkgdatadir/mysql_system_tables_data.sql";

      The code use 'open(PIPE, "| $mysqld_install_cmd_line")' perl construction which allows easily work with pipes, but the return code of mysqld is not checked, so if something went wrong (for example mutually exclusive mysqld options are used) mysql_install_db will ignore the error and continue the execution.

      I would propose to check the return value of perl "close" function when the pipe is closed. Here is the description how to check error code of the child on another side of pipe with "close":

      "If the filehandle came from a piped open, close returns false if one of the other syscalls involved fails or if its program exits with non-zero status. If the only problem was that the program exited non-zero, $! will be set to 0 . Closing a pipe also waits for the process executing on the pipe to exit-in case you wish to look at the output of the pipe afterwards-and implicitly puts the exit status value of that command into $? and ${^CHILD_ERROR_NATIVE}." (http://perldoc.perl.org/functions/close.html)

      In the case of unexpected mysqld termination mysql_install_db must be stopped with corresponding error message.

      How to repeate:

      Run mysql_install_db in 5.6 with --enforce-gtid-consistency=1 --autocommit=0 options. The server terminates with the following error message:

      ERROR: 1787 When @@GLOBAL.ENFORCE_GTID_CONSISTENCY = 1, the statements CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE can be executed in a non-transactional context only, and require that AUTOCOMMIT = 1.

      But mysql_install_db continues execution. As a result system tables will not be created and filled in.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            lpjirasync lpjirasync (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Smart Checklist