• Sujatha's avatar
    MDEV-23846: O_TMPFILE error in mysqlbinlog stream output breaks restore · 7effcb8e
    Sujatha authored
    Problem:
    ========
    When O_TMPFILE is not supported mysqlbinlog outputs the error to standard
    stream as a warning which breaks PITR:
    
    ERROR 1064 (42000) at line 382: You have an error in your SQL syntax; check
    the manual that corresponds to your MariaDB server version for the right
    syntax to use near 'mysqlbinlog: O_TMPFILE is not supported on /tmp (disabling
        future attempts)
    
    Analysis:
    =========
    'mysqlbinlog' utility is used to perform point-in-time-recovery based on binary
    log. It converts the events in the binary log files, from binary format to text
    so that they can be viewed or applied. This output can be saved to a file and
    it can be sourced back to mysql client. The mysqlbinlog utility stores the
    text output into IO_CACHE and when it is full the data is written to a temp
    file.  The temporary file creation is attempted using 'O_TMPFILE' flag. If the
    underlying filesystem doesn't support this operation, a note is printed on to
    standard error and file creation is done without O_TMPFILE' flag. If standard
    error is redirected to standard output the note gets written to the sql file
    as shown below.
    
    /bld/client/mysqlbinlog: O_TMPFILE is not supported on /tmp (disabling future
        attempts)
    table id 32
    
    When the sql file is used for PITR, it leads to a syntax error as it is not a
    valid sql command.
    
    Fix:
    ====
    Make 'my_message_stderr' to ignore messages which are flagged as ME_NOTE and
    ME_ERROR_LOG_ONLY. ME_ERROR_LOG_ONLY flag is applicable to server. In order to
    print an informational note to stderr stream, ME_NOTE flag without
    ME_ERROR_LOG_ONLY flag should be specified. 'my_message_stderr' should print
    messages flagged with ME_WARNING or ME_FATAL to stderr stream.
    7effcb8e
binlog_mysqlbinlog_suppress_O_TMPFILE.result 528 Bytes