Commit 3ac02654 authored by unknown's avatar unknown

Bug #34283 mysqlbinlog leaves tmpfile after termination if binlog contains load data infile

      
With statement- or mixed-mode logging, "LOAD DATA INFILE" queries
are written to the binlog using special types of log events.
When mysqlbinlog reads such events, it re-creates the file in a
temporary directory with a generated filename and outputs a
"LOAD DATA INFILE" query where the filename is replaced by the
generated file. The temporary file is not deleted by mysqlbinlog
after termination.
      
To fix the problem, in mixed mode we go to row-based. In SBR, we
document it to remind user the tmpfile is left in a temporary
directory.


mysql-test/suite/binlog/r/binlog_mixed_load_data.result:
  Test result for BUG#34283.
mysql-test/suite/binlog/t/binlog_killed_simulate.test:
  Updated for BUg#34283
mysql-test/suite/binlog/t/binlog_mixed_load_data.test:
  Added the test file to verify that 'load data infile...' statement
  will go to row-based in mixed mode.
mysql-test/suite/binlog/t/binlog_stm_blackhole.test:
  Updated for BUg#34283
mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result:
  Updated for Bug#34283
mysql-test/suite/rpl/t/rpl_loaddata.test:
  Updated for Bug#34283
mysql-test/suite/rpl/t/rpl_loaddata_fatal.test:
  Updated for Bug#34283
mysql-test/suite/rpl/t/rpl_loaddata_map.test:
  Updated for Bug#34283
mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test:
  Updated for Bug#34283
mysql-test/suite/rpl/t/rpl_stm_log.test:
  Updated for B
mysys/stacktrace.c:
  Auto merge
sql/sql_lex.cc:
  Auto merg
sql/sql_load.cc:
  Added code to go to row-based in mixed mode for
  'load data infile ...' statement
parents 6710830b bcb3170c
RESET MASTER;
CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=MYISAM;
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP TABLE t1;
-- source include/have_debug.inc
-- source include/have_binlog_format_mixed_or_statement.inc
-- source include/have_binlog_format_statement.inc
#
# bug#27571 asynchronous setting mysql_$query()'s local error and
# Query_log_event::error_code
......
#
# Bug #34283 mysqlbinlog leaves tmpfile after termination
# if binlog contains load data infile, so in mixed mode we
# go to row-based for avoiding the problem.
#
--source include/have_binlog_format_mixed.inc
--source include/have_log_bin.inc
RESET MASTER;
CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=MYISAM;
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
--source include/show_binlog_events.inc
DROP TABLE t1;
......@@ -2,5 +2,5 @@
# For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/not_embedded.inc
-- source include/have_binlog_format_mixed_or_statement.inc
-- source include/have_binlog_format_statement.inc
-- source extra/binlog_tests/blackhole.test
......@@ -883,8 +883,8 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t2
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Execute_load_query # # use `test_rpl`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE `t1` FIELDS TERMINATED BY '|' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, `b`) ;file_id=#
master-bin.000001 # Table_map # # table_id: # (test_rpl.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1
......
......@@ -3,7 +3,7 @@
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
-- source include/have_binlog_format_mixed_or_statement.inc
-- source include/have_binlog_format_statement.inc
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_loaddata.test
source include/have_binlog_format_mixed_or_statement.inc;
source include/have_binlog_format_statement.inc;
source include/have_debug.inc;
source include/master-slave.inc;
......
......@@ -16,7 +16,7 @@
# BUG#33413 show binlog events fails if binlog has event size of close
# to max_allowed_packet
source include/have_binlog_format_mixed_or_statement.inc;
source include/have_binlog_format_statement.inc;
source include/master-slave.inc;
......
......@@ -8,7 +8,7 @@
# 2 - Catches error.
##########################################################################
--source include/have_binlog_format_mixed_or_statement.inc
--source include/have_binlog_format_statement.inc
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/master-slave.inc
......
# Requires statement logging
-- source include/have_binlog_format_mixed_or_statement.inc
-- source include/have_binlog_format_statement.inc
-- source include/master-slave.inc
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_log.test
......
......@@ -83,7 +83,9 @@ void my_print_stacktrace(uchar* stack_bottom __attribute__((unused)),
#if BACKTRACE_DEMANGLE
char __attribute__ ((weak)) *my_demangle(const char *mangled_name, int *status)
char __attribute__ ((weak)) *
my_demangle(const char *mangled_name __attribute__((unused)),
int *status __attribute__((unused)))
{
return NULL;
}
......
......@@ -1436,8 +1436,6 @@ int lex_one_token(void *arg, void *yythd)
}
else
{
const char* version_mark= lip->get_ptr() - 1;
DBUG_ASSERT(*version_mark == '!');
/*
Patch and skip the conditional comment to avoid it
being propagated infinitely (eg. to a slave).
......@@ -1446,7 +1444,6 @@ int lex_one_token(void *arg, void *yythd)
comment_closed= ! consume_comment(lip, 1);
if (! comment_closed)
{
DBUG_ASSERT(pcom == version_mark);
*pcom= '!';
}
/* version allowed to have one level of comment inside. */
......
......@@ -189,6 +189,14 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
bool is_concurrent;
DBUG_ENTER("mysql_load");
/*
Bug #34283
mysqlbinlog leaves tmpfile after termination if binlog contains
load data infile, so in mixed mode we go to row-based for
avoiding the problem.
*/
thd->set_current_stmt_binlog_format_row_if_mixed();
#ifdef EMBEDDED_LIBRARY
read_file_from_client = 0; //server is always in the same process
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment