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

mariadb-binlog --convert-engine-binlog prints a "File ... not found" for next file

    XMLWordPrintable

Details

    Description

      After converting an InnoDB-format binlog file (.ibb), the tool looks for the next numbered file in the same folder. If that file isn't there, it prints an error-looking "not found" line. The conversion is correct and the exit code is 0, so the message is misleading.

      Steps:

      Convert binlog-000003.ibb from a folder that doesn't contain binlog-000004.ibb, and you see:

      File './binlog-000004.ibb' not found (Errcode: 2 "No such file or directory")
      Generated output file: out.000001

      Nothing is wrong:

      • The output file is complete.
      • The exit code is 0.
      • If binlog-000004.ibb is put in the same folder, the message goes away. It doesn't matter whether that file is empty, and it doesn't matter that it isn't passed on the command line. The output is identical.
      • The tool doesn't convert the next file. It only checks that it exists.

      # MDEV-37605
      #
      # Purpose:
      #   Converting an InnoDB-format binlog file (.ibb) with --convert-engine-binlog
      #   must not report an error-looking "File ... not found" message for the
      #   next numbered .ibb file when that file is not in the same directory as
      #   the input file.
      #   The conversion is correct and exits with 0, so the message is misleading.
      #
      # Methodology:
      #   Generate a small workload, rotate, and copy ONLY the completed
      #   binlog-000000.ibb into a private directory (binlog-000001.ibb absent).
      #   Convert it and check stderr. As a control, copy the (empty, preallocated)
      #   binlog-000001.ibb into the same directory, WITHOUT passing it on the
      #   command line, and convert again: stderr must be clean, the output must be
      #   identical, and the next file must not be converted.
       
      --source include/have_innodb_binlog.inc
       
      --let $datadir= `SELECT @@datadir`
      --let $dir= $MYSQL_TMP_DIR/next_file
       
      --source include/reset_master.inc
       
      CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
      INSERT INTO t1 VALUES (1, 0), (2, 0), (3, 0);
      UPDATE t1 SET b=1 WHERE a=1;
       
      FLUSH BINARY LOGS;
      # Wait for binlog-000002.ibb to guarantee that all data in binlog-000000.ibb
      # is available to read from disk
      --let $binlog_name= binlog-000002.ibb
      --let $binlog_size= 262144
      --source include/wait_for_engine_binlog.inc
       
      --mkdir $dir
      --copy_file $datadir/binlog-000000.ibb $dir/binlog-000000.ibb
       
      --echo *** Convert binlog-000000.ibb with binlog-000001.ibb absent (must exit 0)
      --exec $MYSQL_BINLOG --convert-engine-binlog --result-file=$dir/conv $dir/binlog-000000.ibb > $dir/stdout.txt 2> $dir/stderr_absent.txt
       
      --echo *** The conversion is correct
      --exec $MYSQL_BINLOG $dir/conv.000001 > $dir/listing_absent.txt
      --let $assert_text= All three transactions are in the converted file
      --let $assert_file= $dir/listing_absent.txt
      --let $assert_select= GTID 0-1-
      --let $assert_count= 3
      --source include/assert_grep.inc
       
      --echo *** Control: same conversion with the next (empty) file present
      --remove_file $dir/conv.000001
      --copy_file $datadir/binlog-000001.ibb $dir/binlog-000001.ibb
      --exec $MYSQL_BINLOG --convert-engine-binlog --result-file=$dir/conv $dir/binlog-000000.ibb > $dir/stdout.txt 2> $dir/stderr_present.txt
      --let $assert_text= stderr has no "not found" message
      --let $assert_file= $dir/stderr_present.txt
      --let $assert_select= not found
      --let $assert_count= 0
      --source include/assert_grep.inc
       
      --echo *** With the next file present, the output is identical and the next file is not converted
      --exec $MYSQL_BINLOG $dir/conv.000001 > $dir/listing_present.txt
      --let $assert_text= Still only the three transactions of binlog-000000.ibb
      --let $assert_file= $dir/listing_present.txt
      --let $assert_select= GTID 0-1-
      --let $assert_count= 3
      --source include/assert_grep.inc
      --diff_files $dir/listing_absent.txt $dir/listing_present.txt
       
      --echo *** No misleading "not found" message when the next file is absent
      --let $assert_text= stderr has no "not found" message for the next .ibb file
      --let $assert_file= $dir/stderr_absent.txt
      --let $assert_select= not found
      --let $assert_count= 0
      --source include/assert_grep.inc
       
      # Cleanup
      --remove_files_wildcard $dir
      --rmdir $dir
      DROP TABLE t1;
      
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Deepthi ES Deepthi Eranti Sreenivas
              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.