Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-6767

mysqladmin returns success and doesnt output an error message when a logs flushing query fails

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 5.5.39, 10.0.13
    • 5.5
    • None
    • Debian Wheezy amd64

    Description

      The logs flushing commands of mysqladmin are issuing queries on the server such as "FLUSH LOGS;" but only display an error message on STDOUT/STDERR and return an error code if the query cannot be issued, not if the query itself returns an error.

      The problem could also be present for other commands of mysqladmin.

      –
      Trying to run "FLUSH SLOW LOGS;" from the CLI returns an error telling that the file is not found :

      # mysql -e 'SET GLOBAL slow_query_log_file = "/var/log/mysql/mariadb-slow.log";'
      # lsof -n |grep -m1 mariadb-slow\.log
      mysqld    26457            mysql  534w      REG              254,0       2467    8636193 /var/log/mysql/mariadb-slow.log
      # chmod 000 /var/log/mysql/mariadb-slow.log
      # mysql -e 'FLUSH SLOW LOGS;'
      ERROR 29 (HY000) at line 1: File '/var/log/mysql/mariadb-slow.log' not found (Errcode: 13)
      # echo $?
      1
      # tail /var/log/syslog |tac |grep -m1 mariadb-slow\.log
      Sep 22 22:24:54 hostname mysqld: 140422 22:24:54 [ERROR] Could not use /var/log/mysql/mariadb-slow.log for logging (error 13). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.

      Running "mysqladmin flush-slow-log" doesnt return an error code and no error message on STDOUT or STDERR, the only way to know that something went wrong is to check what mysqld logged :

      # chmod 600 /var/log/mysql/mariadb-slow.log
      # mysql -e 'SET GLOBAL slow_query_log_file = "/var/log/mysql/mariadb-slow.log";'
      # lsof -n |grep -m1 mariadb-slow\.log
      mysqld    26457            mysql  534w      REG              254,0        205    8636193 /var/log/mysql/mariadb-slow.log
      # chmod 000 /var/log/mysql/mariadb-slow.log
      # mysqladmin flush-slow-log
      # echo $?
      0
      # tail /var/log/syslog |tac |grep -m1 mariadb-slow\.log
      Sep 22 22:40:32 hostname mysqld: 140422 22:40:32 [ERROR] Could not use /var/log/mysql/mariadb-slow.log for logging (error 13). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.

      Expected result :
      When mysqladmin has an error returned on one of the query it executed, print the error message on STDERR and issue a return code <> 0 so the user or script that ran mysqladmin can be aware that something didnt work as expected without having to manually check the error_log.

      nb: the error log is set to syslog on the example server.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jb-boin Jean Weisbuch
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.