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

mariadb-dump creates empty backup without error message/code

Details

    Description

      Example (binary logs enabled):

      1. mariadb-dump --user=root --all-databases --flush-logs --master-data=1 --events --triggers --routines > /tmp/full_dump.sql
      2. echo $?
        0
      3. ls -lah /tmp/full_dump.sql
        rw-rr- 1 root root 1.3K May 30 14:56 /tmp/full_dump.sql

      Backup is nearly empty...

      Reason:

      SQL> FLUSH LOGS;
      ERROR 1004 (HY000): Can't create file '/var/log/mysqld_error.log' (errno: 13 "Permission denied")

      This is really ugly. I would expect a return code Unable to render embedded object: File (= 0 AND an error message) not found.

      Attachments

        1. image-2022-09-21-15-23-33-188.png
          27 kB
          kurt.ding
        2. screenshot-1.png
          34 kB
          kurt.ding
        3. screenshot-2.png
          22 kB
          kurt.ding

        Activity

          Kurt Ding kurt.ding added a comment -

          I understand what you mean , you set the log_error= /root/error.log within mysqld cnf . So I add an error message like this.

          Kurt Ding kurt.ding added a comment - I understand what you mean , you set the log_error= /root/error.log within mysqld cnf . So I add an error message like this.
          Kurt Ding kurt.ding added a comment -

          Kurt Ding kurt.ding added a comment -
          Kurt Ding kurt.ding added a comment - PR is https://github.com/MariaDB/server/pull/2276
          danblack Daniel Black added a comment - - edited

          Thanks Kurt Ding, rebased to 10.3 and added MDEV to commit.

          Tested manually:

          $ mariadblocal --log-error=/tmp/m.err
          Installing MariaDB/MySQL system tables in '/tmp/build-mariadb-server-10.3-datadir' ...
          2022-10-19 15:28:46 0 [Note] /home/dan/repos/build-mariadb-server-10.3/sql/mysqld (mysqld 10.3.37-MariaDB) starting as process 113985 ...
          2022-10-19 15:28:46 0 [Note] InnoDB: Using Linux native AIO
          2022-10-19 15:28:46 0 [Note] InnoDB: The first innodb_system data file 'ibdata1' did not exist. A new tablespace will be created!
          2022-10-19 15:28:46 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
          2022-10-19 15:28:46 0 [Note] InnoDB: Uses event mutexes
          2022-10-19 15:28:46 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
          2022-10-19 15:28:46 0 [Note] InnoDB: Number of pools: 1
          2022-10-19 15:28:46 0 [Note] InnoDB: Using SSE2 crc32 instructions
          2022-10-19 15:28:46 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
          2022-10-19 15:28:46 0 [Note] InnoDB: Completed initialization of buffer pool
          2022-10-19 15:28:46 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
          2022-10-19 15:28:46 0 [Note] InnoDB: Setting file './ibdata1' size to 12 MB. Physically writing the file full; Please wait ...
          2022-10-19 15:28:46 0 [Note] InnoDB: File './ibdata1' size is now 12 MB.
          2022-10-19 15:28:46 0 [Note] InnoDB: Setting log file ./ib_logfile101 size to 50331648 bytes
          2022-10-19 15:28:46 0 [Note] InnoDB: Setting log file ./ib_logfile1 size to 50331648 bytes
          2022-10-19 15:28:46 0 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
          2022-10-19 15:28:46 0 [Note] InnoDB: New log files created, LSN=44897
          2022-10-19 15:28:46 0 [Note] InnoDB: Doublewrite buffer not found: creating new
          2022-10-19 15:28:46 0 [Note] InnoDB: Doublewrite buffer created
          2022-10-19 15:28:46 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
          2022-10-19 15:28:46 0 [Note] InnoDB: Creating foreign key constraint system tables.
          2022-10-19 15:28:46 0 [Note] InnoDB: Creating tablespace and datafile system tables.
          2022-10-19 15:28:46 0 [Note] InnoDB: Creating sys_virtual system tables.
          2022-10-19 15:28:46 0 [Note] InnoDB: Creating shared tablespace for temporary tables
          2022-10-19 15:28:46 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
          2022-10-19 15:28:46 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
          2022-10-19 15:28:46 0 [Note] InnoDB: Waiting for purge to start
          2022-10-19 15:28:46 0 [Note] InnoDB: 10.3.37 started; log sequence number 0; transaction id 7
          OK
          2022-10-19 15:28:48 0 [Note] sql/mysqld (mysqld 10.3.37-MariaDB) starting as process 114016 ...
          ..
          

          $ ls -la /tmp/m.err
          -rw-rw----. 1 dan dan 1850 Oct 19 15:28 /tmp/m.err
           
          $ chmod 0000 /tmp/m.err
           
          $ client/mysqldump -u root --all-databases --flush-logs --master-data=1 --events --triggers --routines   -S /tmp/build-mariadb-server-10.3.sock
          -- MySQL dump 10.19  Distrib 10.3.37-MariaDB, for Linux (x86_64)
          --
          -- Host: localhost    Database: 
          -- ------------------------------------------------------
          -- Server version	10.3.37-MariaDB
           
          /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
          /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
          /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
          /*!40101 SET NAMES latin1 */;
          /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
          /*!40103 SET TIME_ZONE='+00:00' */;
          /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
          /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
          /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
          /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
          Flush logs or delete master logs failure in server 
          /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
           
          /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
          /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
          /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
          /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
          /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
          /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
          /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
           
          -- Dump completed on 2022-10-19 15:31:18
           
          $ echo $?
          2
          

          danblack Daniel Black added a comment - - edited Thanks Kurt Ding , rebased to 10.3 and added MDEV to commit. Tested manually: $ mariadblocal --log-error=/tmp/m.err Installing MariaDB/MySQL system tables in '/tmp/build-mariadb-server-10.3-datadir' ... 2022-10-19 15:28:46 0 [Note] /home/dan/repos/build-mariadb-server-10.3/sql/mysqld (mysqld 10.3.37-MariaDB) starting as process 113985 ... 2022-10-19 15:28:46 0 [Note] InnoDB: Using Linux native AIO 2022-10-19 15:28:46 0 [Note] InnoDB: The first innodb_system data file 'ibdata1' did not exist. A new tablespace will be created! 2022-10-19 15:28:46 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2022-10-19 15:28:46 0 [Note] InnoDB: Uses event mutexes 2022-10-19 15:28:46 0 [Note] InnoDB: Compressed tables use zlib 1.2.11 2022-10-19 15:28:46 0 [Note] InnoDB: Number of pools: 1 2022-10-19 15:28:46 0 [Note] InnoDB: Using SSE2 crc32 instructions 2022-10-19 15:28:46 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 2022-10-19 15:28:46 0 [Note] InnoDB: Completed initialization of buffer pool 2022-10-19 15:28:46 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). 2022-10-19 15:28:46 0 [Note] InnoDB: Setting file './ibdata1' size to 12 MB. Physically writing the file full; Please wait ... 2022-10-19 15:28:46 0 [Note] InnoDB: File './ibdata1' size is now 12 MB. 2022-10-19 15:28:46 0 [Note] InnoDB: Setting log file ./ib_logfile101 size to 50331648 bytes 2022-10-19 15:28:46 0 [Note] InnoDB: Setting log file ./ib_logfile1 size to 50331648 bytes 2022-10-19 15:28:46 0 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2022-10-19 15:28:46 0 [Note] InnoDB: New log files created, LSN=44897 2022-10-19 15:28:46 0 [Note] InnoDB: Doublewrite buffer not found: creating new 2022-10-19 15:28:46 0 [Note] InnoDB: Doublewrite buffer created 2022-10-19 15:28:46 0 [Note] InnoDB: 128 out of 128 rollback segments are active. 2022-10-19 15:28:46 0 [Note] InnoDB: Creating foreign key constraint system tables. 2022-10-19 15:28:46 0 [Note] InnoDB: Creating tablespace and datafile system tables. 2022-10-19 15:28:46 0 [Note] InnoDB: Creating sys_virtual system tables. 2022-10-19 15:28:46 0 [Note] InnoDB: Creating shared tablespace for temporary tables 2022-10-19 15:28:46 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 2022-10-19 15:28:46 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. 2022-10-19 15:28:46 0 [Note] InnoDB: Waiting for purge to start 2022-10-19 15:28:46 0 [Note] InnoDB: 10.3.37 started; log sequence number 0; transaction id 7 OK 2022-10-19 15:28:48 0 [Note] sql/mysqld (mysqld 10.3.37-MariaDB) starting as process 114016 ... .. $ ls -la /tmp/m.err -rw-rw----. 1 dan dan 1850 Oct 19 15:28 /tmp/m.err   $ chmod 0000 /tmp/m.err   $ client/mysqldump -u root --all-databases --flush-logs --master-data=1 --events --triggers --routines -S /tmp/build-mariadb-server-10.3.sock -- MySQL dump 10.19 Distrib 10.3.37-MariaDB, for Linux (x86_64) -- -- Host: localhost Database: -- ------------------------------------------------------ -- Server version 10.3.37-MariaDB   /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES latin1 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; Flush logs or delete master logs failure in server /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;   /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;   -- Dump completed on 2022-10-19 15:31:18   $ echo $? 2
          danblack Daniel Black added a comment -

          Thanks oli and Kurt Ding. Will be out next release

          danblack Daniel Black added a comment - Thanks oli and Kurt Ding . Will be out next release

          People

            danblack Daniel Black
            oli Oli Sennhauser
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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