mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-23846: O_TMPFILE error in mysqlbinlog stream output breaks restore
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.
This commit is contained in:
parent
031e1427ed
commit
7effcb8ed6
3 changed files with 74 additions and 0 deletions
|
@ -0,0 +1,21 @@
|
|||
RESET MASTER;
|
||||
CREATE TABLE t(f text);
|
||||
INSERT INTO t VALUES (repeat('x',4096));
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
SELECT COUNT(*) FROM t;
|
||||
COUNT(*)
|
||||
512
|
||||
FLUSH LOGS;
|
||||
DROP TABLE t;
|
||||
# 512- Rows must be present
|
||||
include/assert.inc [Table t should have 512 rows.]
|
||||
DROP TABLE t;
|
||||
RESET MASTER;
|
|
@ -0,0 +1,51 @@
|
|||
# ==== Purpose ====
|
||||
#
|
||||
# Suppress the following informational note that gets printed to standard
|
||||
# error when O_TMPFILE flag is not supported by underlying operating system.
|
||||
#
|
||||
# Note: ../client/mysqlbinlog: O_TMPFILE is not supported on /tmp (disabling
|
||||
# future attempts)
|
||||
#
|
||||
# Step 1: Generate a binarylog file with a size greater than 1MB.
|
||||
# Step 2: Use mysqlbinlog tool to generate sql file and redirect the standard
|
||||
# error to standard output (2>&1)
|
||||
# Step 3: Source the generated sql file as inpurt to mysql client, observe no
|
||||
# syntax error is reported.
|
||||
#
|
||||
# ==== References ====
|
||||
#
|
||||
# MDEV-23846: O_TMPFILE error in mysqlbinlog stream output breaks restore
|
||||
#
|
||||
--source include/have_binlog_format_row.inc
|
||||
|
||||
RESET MASTER;
|
||||
CREATE TABLE t(f text);
|
||||
INSERT INTO t VALUES (repeat('x',4096));
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
SELECT COUNT(*) FROM t;
|
||||
FLUSH LOGS;
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
|
||||
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql 2>&1
|
||||
#
|
||||
# Clear database and restore from binlog
|
||||
#
|
||||
DROP TABLE t;
|
||||
|
||||
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
|
||||
|
||||
--echo # 512- Rows must be present
|
||||
--let $assert_cond= COUNT(*) = 512 FROM t
|
||||
--let $assert_text= Table t should have 512 rows.
|
||||
--source include/assert.inc
|
||||
|
||||
DROP TABLE t;
|
||||
RESET MASTER;
|
|
@ -21,6 +21,8 @@ void my_message_stderr(uint error __attribute__((unused)),
|
|||
DBUG_ENTER("my_message_stderr");
|
||||
DBUG_PRINT("enter",("message: %s",str));
|
||||
(void) fflush(stdout);
|
||||
if (MyFlags & (ME_NOTE | ME_ERROR_LOG_ONLY))
|
||||
DBUG_VOID_RETURN;
|
||||
if (MyFlags & ME_BELL)
|
||||
(void) fputc('\007', stderr);
|
||||
if (my_progname)
|
||||
|
|
Loading…
Reference in a new issue