Merge of Bug#35996
This commit is contained in:
commit
4545c5ba3c
@ -726,7 +726,10 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
|
||||
switch (ev_type) {
|
||||
case QUERY_EVENT:
|
||||
if (shall_skip_database(((Query_log_event*)ev)->db))
|
||||
if (strncmp(((Query_log_event*)ev)->query, "BEGIN", 5) &&
|
||||
strncmp(((Query_log_event*)ev)->query, "COMMIT", 6) &&
|
||||
strncmp(((Query_log_event*)ev)->query, "ROLLBACK", 8) &&
|
||||
shall_skip_database(((Query_log_event*)ev)->db))
|
||||
goto end;
|
||||
if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
|
||||
{
|
||||
|
@ -142,6 +142,8 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
|
||||
if (!skip_check)
|
||||
result= thd->is_error() ? -1 : 0;
|
||||
|
||||
thd->mysys_var= 0;
|
||||
|
||||
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||
thd->profiling.finish_current_query();
|
||||
#endif
|
||||
@ -634,6 +636,7 @@ void *create_embedded_thd(int client_flag)
|
||||
|
||||
thread_count++;
|
||||
threads.append(thd);
|
||||
thd->mysys_var= 0;
|
||||
return thd;
|
||||
err:
|
||||
delete(thd);
|
||||
|
@ -25,8 +25,6 @@
|
||||
# new wrapper t/concurrent_innodb_safelog.test
|
||||
#
|
||||
|
||||
--source include/not_embedded.inc
|
||||
|
||||
connection default;
|
||||
#
|
||||
# Show prerequisites for this test.
|
||||
|
@ -493,6 +493,7 @@ sub collect_one_suite($)
|
||||
$lib_innodb_plugin)
|
||||
{
|
||||
my @new_cases;
|
||||
my $sep= (IS_WINDOWS) ? ';' : ':';
|
||||
|
||||
foreach my $test (@cases)
|
||||
{
|
||||
@ -520,12 +521,13 @@ sub collect_one_suite($)
|
||||
}
|
||||
}
|
||||
my $plugin_filename= basename($lib_innodb_plugin);
|
||||
my $plugin_list= "innodb=$plugin_filename" . $sep . "innodb_locks=$plugin_filename";
|
||||
push(@{$new_test->{master_opt}}, '--ignore-builtin-innodb');
|
||||
push(@{$new_test->{master_opt}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
|
||||
push(@{$new_test->{master_opt}}, "--plugin_load=innodb=$plugin_filename;innodb_locks=$plugin_filename");
|
||||
push(@{$new_test->{master_opt}}, "--plugin_load=$plugin_list");
|
||||
push(@{$new_test->{slave_opt}}, '--ignore-builtin-innodb');
|
||||
push(@{$new_test->{slave_opt}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
|
||||
push(@{$new_test->{slave_opt}}, "--plugin_load=innodb=$plugin_filename;innodb_locks=$plugin_filename");
|
||||
push(@{$new_test->{slave_opt}}, "--plugin_load=$plugin_list");
|
||||
if ($new_test->{combination})
|
||||
{
|
||||
$new_test->{combination}.= ' + InnoDB plugin';
|
||||
|
@ -1812,7 +1812,7 @@ sub environment_setup {
|
||||
($lib_example_plugin ? dirname($lib_example_plugin) : "");
|
||||
|
||||
$ENV{'HA_EXAMPLE_SO'}="'".$plugin_filename."'";
|
||||
$ENV{'EXAMPLE_PLUGIN_LOAD'}="--plugin_load=;EXAMPLE=".$plugin_filename.";";
|
||||
$ENV{'EXAMPLE_PLUGIN_LOAD'}="--plugin_load=EXAMPLE=".$plugin_filename;
|
||||
}
|
||||
|
||||
# ----------------------------------------------------
|
||||
|
@ -44,16 +44,16 @@ SET TIMESTAMP=1000000000/*!*/;
|
||||
insert into t2 values ()
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
|
||||
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
|
||||
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
|
||||
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
|
||||
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
|
||||
/*!*/;
|
||||
DELIMITER ;
|
||||
# End of log file
|
||||
@ -144,16 +144,16 @@ SET TIMESTAMP=1000000000/*!*/;
|
||||
insert into t2 values ()
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
|
||||
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
|
||||
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
|
||||
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
|
||||
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
|
||||
/*!*/;
|
||||
DELIMITER ;
|
||||
# End of log file
|
||||
@ -359,29 +359,29 @@ SET @@session.collation_database=DEFAULT/*!*/;
|
||||
create table t1 (a varchar(64) character set utf8)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
|
||||
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
SET @@session.collation_database=7/*!*/;
|
||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
|
||||
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
SET @@session.collation_database=DEFAULT/*!*/;
|
||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
|
||||
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
|
||||
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
SET @@session.collation_database=7/*!*/;
|
||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO table t1
|
||||
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
SET @@session.collation_database=DEFAULT/*!*/;
|
||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO table t1
|
||||
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r
|
||||
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO TABLE `t1` CHARACTER SET koi8r FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
drop table t1
|
||||
@ -473,5 +473,94 @@ IS NOT NULL
|
||||
SET @@global.server_id= 1;
|
||||
RESET MASTER;
|
||||
FLUSH LOGS;
|
||||
RESET MASTER;
|
||||
FLUSH LOGS;
|
||||
#
|
||||
# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified is exist
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
DELIMITER /*!*/;
|
||||
ROLLBACK/*!*/;
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=1253783037/*!*/;
|
||||
SET @@session.pseudo_thread_id=999999999/*!*/;
|
||||
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
|
||||
SET @@session.sql_mode=0/*!*/;
|
||||
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
||||
/*!\C latin1 *//*!*/;
|
||||
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||
SET @@session.lc_time_names=0/*!*/;
|
||||
SET @@session.collation_database=DEFAULT/*!*/;
|
||||
create table t1(a int) engine= innodb
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1253783037/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1253783037/*!*/;
|
||||
insert into t1 (a) values (1)
|
||||
/*!*/;
|
||||
COMMIT/*!*/;
|
||||
SET TIMESTAMP=1253783037/*!*/;
|
||||
create table t3(a int) engine= innodb
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1253783037/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1253783037/*!*/;
|
||||
insert into t3 (a) values (2)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1253783037/*!*/;
|
||||
ROLLBACK
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1253783037/*!*/;
|
||||
create table t5(a int) engine= NDB
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1253783037/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1253783037/*!*/;
|
||||
insert into t5 (a) values (3)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1253783037/*!*/;
|
||||
COMMIT
|
||||
/*!*/;
|
||||
DELIMITER ;
|
||||
# End of log file
|
||||
ROLLBACK /* added by mysqlbinlog */;
|
||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||
#
|
||||
# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified is not exist
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
DELIMITER /*!*/;
|
||||
ROLLBACK/*!*/;
|
||||
SET TIMESTAMP=1253783037/*!*/;
|
||||
SET @@session.pseudo_thread_id=999999999/*!*/;
|
||||
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
|
||||
SET @@session.sql_mode=0/*!*/;
|
||||
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
||||
/*!\C latin1 *//*!*/;
|
||||
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||
SET @@session.lc_time_names=0/*!*/;
|
||||
SET @@session.collation_database=DEFAULT/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
COMMIT/*!*/;
|
||||
SET TIMESTAMP=1253783037/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1253783037/*!*/;
|
||||
ROLLBACK
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1253783037/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1253783037/*!*/;
|
||||
COMMIT
|
||||
/*!*/;
|
||||
DELIMITER ;
|
||||
# End of log file
|
||||
ROLLBACK /* added by mysqlbinlog */;
|
||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||
End of 5.0 tests
|
||||
End of 5.1 tests
|
||||
|
BIN
mysql-test/std_data/binlog_transaction.000001
Normal file
BIN
mysql-test/std_data/binlog_transaction.000001
Normal file
Binary file not shown.
@ -19,7 +19,7 @@ ERROR 70100: Query execution was interrupted
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */ ;file_id=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a, b) ;file_id=#
|
||||
select
|
||||
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null;
|
||||
|
@ -917,7 +917,7 @@ master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
|
||||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Intvar # # INSERT_ID=10
|
||||
master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
|
||||
master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a, @b) SET b=((@b) + `bug27417`(2)) ;file_id=#
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
drop trigger trg_del_t2;
|
||||
drop table t1,t2,t3,t4,t5;
|
||||
|
@ -127,7 +127,7 @@ master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; create table t2 (a varchar(200)) engine=blackhole
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=581
|
||||
master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/words.dat' into table t2 ;file_id=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a) ;file_id=#
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; alter table t1 add b int
|
||||
master-bin.000001 # Query # # use `test`; alter table t1 drop b
|
||||
|
@ -625,7 +625,7 @@ master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Intvar # # INSERT_ID=10
|
||||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Intvar # # INSERT_ID=10
|
||||
master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a, @b) SET b=((@b) + `bug27417`(2)) ;file_id=#
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
/* the output must denote there is the query */;
|
||||
drop trigger trg_del_t2;
|
||||
@ -863,7 +863,7 @@ master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
|
||||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Intvar # # INSERT_ID=10
|
||||
master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
|
||||
master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a, @b) SET b=((@b) + `bug27417`(2)) ;file_id=#
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
drop trigger trg_del_t2;
|
||||
drop table t1,t2,t3,t4,t5;
|
||||
|
@ -112,17 +112,22 @@ while($i)
|
||||
# remove unecessary files
|
||||
-- remove_file $outfile.1
|
||||
-- remove_file $outfile.2
|
||||
|
||||
|
||||
#
|
||||
# The two tests are canceled since we introduced the patch of bug#46998,
|
||||
# which will make mydsqlbinlog output the 'BEGIN', 'COMMIT' and 'ROLLBACK'
|
||||
# in regardless of database filtering
|
||||
#
|
||||
# assertion: events for database test are filtered
|
||||
if (`SELECT INSTR(@b42941_output.1, 'test')`)
|
||||
{
|
||||
-- echo **** ERROR **** Database name 'test' FOUND in mysqlbinlog output ($flags $outfile.1).
|
||||
}
|
||||
#if (`SELECT INSTR(@b42941_output.1, 'test')`)
|
||||
#{
|
||||
#-- echo **** ERROR **** Database name 'test' FOUND in mysqlbinlog output ($flags $outfile.1).
|
||||
#}
|
||||
|
||||
if (`SELECT INSTR(@b42941_output.2, 'test')`)
|
||||
{
|
||||
-- echo **** ERROR **** Database name 'test' FOUND in mysqlbinlog output ($flags $outfile.2).
|
||||
}
|
||||
#if (`SELECT INSTR(@b42941_output.2, 'test')`)
|
||||
#{
|
||||
#-- echo **** ERROR **** Database name 'test' FOUND in mysqlbinlog output ($flags $outfile.2).
|
||||
#}
|
||||
|
||||
# assertion: events for database b42941 are not filtered
|
||||
if (!`SELECT INSTR(@b42941_output.1, 'b42941')`)
|
||||
|
@ -885,7 +885,7 @@ master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
|
||||
master-bin.000001 # Xid 1 # #
|
||||
master-bin.000001 # Query 1 # BEGIN
|
||||
master-bin.000001 # Begin_load_query 1 # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Execute_load_query 1 # use `test_rpl`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;file_id=#
|
||||
master-bin.000001 # Execute_load_query 1 # 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 # Xid 1 # #
|
||||
master-bin.000001 # Query 1 # BEGIN
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
|
||||
|
@ -36,7 +36,7 @@ set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1797 # # master-bin.000001 Yes Yes # 0 0 1797 # None 0 No # No 0 0
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 2009 # # master-bin.000001 Yes Yes # 0 0 2009 # None 0 No # No 0 0
|
||||
set sql_log_bin=0;
|
||||
delete from t1;
|
||||
set sql_log_bin=1;
|
||||
@ -46,7 +46,7 @@ change master to master_user='test';
|
||||
change master to master_user='root';
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1832 # # master-bin.000001 No No # 0 0 1832 # None 0 No # No 0 0
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 2044 # # master-bin.000001 No No # 0 0 2044 # None 0 No # No 0 0
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
set sql_log_bin=0;
|
||||
|
@ -53,7 +53,7 @@ Master_User root
|
||||
Master_Port MASTER_PORT
|
||||
Connect_Retry 1
|
||||
Master_Log_File master-bin.000001
|
||||
Read_Master_Log_Pos 465
|
||||
Read_Master_Log_Pos 556
|
||||
Relay_Log_File #
|
||||
Relay_Log_Pos #
|
||||
Relay_Master_Log_File master-bin.000001
|
||||
|
@ -20,7 +20,7 @@ master-bin.000001 # Query # # use `test`; create table t2 (id int not null prima
|
||||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Append_block # # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Append_block # # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; load data infile 'MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' into table t2 ;file_id=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (id) ;file_id=#
|
||||
==== Verify results on slave ====
|
||||
[on slave]
|
||||
select count(*) from t2 /* 5 000 */;
|
||||
|
@ -54,3 +54,31 @@ a
|
||||
[on master]
|
||||
DROP TABLE t1;
|
||||
[on slave]
|
||||
|
||||
Bug #43746:
|
||||
"return wrong query string when parse 'load data infile' sql statement"
|
||||
|
||||
[master]
|
||||
SELECT @@SESSION.sql_mode INTO @old_mode;
|
||||
SET sql_mode='ignore_space';
|
||||
CREATE TABLE t1(a int);
|
||||
INSERT INTO t1 VALUES (1), (2), (3), (4);
|
||||
SELECT * INTO OUTFILE 'MYSQLD_DATADIR/bug43746.sql' FROM t1;
|
||||
TRUNCATE TABLE t1;
|
||||
LOAD DATA LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1;
|
||||
LOAD/* look mum, with comments in weird places! */DATA/* oh hai */LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql'/* we are */INTO/* from the internets */TABLE t1;
|
||||
LOAD DATA/*!10000 LOCAL */INFILE 'MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1;
|
||||
LOAD DATA LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql' /*!10000 INTO */ TABLE t1;
|
||||
LOAD DATA LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql' /*!10000 INTO TABLE */ t1;
|
||||
LOAD DATA /*!10000 LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql' INTO TABLE */ t1;
|
||||
LOAD DATA/*!10000 LOCAL */INFILE 'MYSQLD_DATADIR/bug43746.sql'/*!10000 INTO*/TABLE t1;
|
||||
LOAD DATA/*!10000 LOCAL */INFILE 'MYSQLD_DATADIR/bug43746.sql'/* empty */INTO TABLE t1;
|
||||
LOAD DATA/*!10000 LOCAL */INFILE 'MYSQLD_DATADIR/bug43746.sql' INTO/* empty */TABLE t1;
|
||||
LOAD/*!99999 special comments that do not expand */DATA/*!99999 code from the future */LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql'/*!99999 have flux capacitor */INTO/*!99999 will travel */TABLE t1;
|
||||
SET sql_mode='PIPES_AS_CONCAT,ANSI_QUOTES,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER';
|
||||
LOAD DATA LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1;
|
||||
[slave]
|
||||
[master]
|
||||
DROP TABLE t1;
|
||||
SET SESSION sql_mode=@old_mode;
|
||||
[slave]
|
||||
|
@ -25,7 +25,7 @@ master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
|
||||
master-bin.000001 # Query 1 # use `test`; drop table t1
|
||||
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
|
||||
master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
|
||||
master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=1
|
||||
master-bin.000001 # Execute_load_query 1 # use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES (word) ;file_id=1
|
||||
show binlog events from 106 limit 1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
|
||||
@ -193,7 +193,7 @@ master-bin.000001 # Query # # use `test`; insert into t1 values (NULL)
|
||||
master-bin.000001 # Query # # use `test`; drop table t1
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
|
||||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES (word) ;file_id=#
|
||||
master-bin.000001 # Rotate # # master-bin.000002;pos=4
|
||||
show binlog events in 'master-bin.000002';
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
@ -218,7 +218,7 @@ slave-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
|
||||
slave-bin.000001 # Query 1 # use `test`; drop table t1
|
||||
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
|
||||
slave-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
|
||||
slave-bin.000001 # Execute_load_query 1 # use `test`; load data INFILE '../../tmp/SQL_LOAD-2-1-1.data' INTO table t1 ignore 1 lines ;file_id=1
|
||||
slave-bin.000001 # Execute_load_query 1 # use `test`; LOAD DATA INFILE '../../tmp/SQL_LOAD-2-1-1.data' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES (word) ;file_id=1
|
||||
slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
|
||||
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
|
||||
show binlog events in 'slave-bin.000002' from 4;
|
||||
|
@ -98,3 +98,73 @@ DROP TABLE t1;
|
||||
--echo [on slave]
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo
|
||||
--echo Bug #43746:
|
||||
--echo "return wrong query string when parse 'load data infile' sql statement"
|
||||
--echo
|
||||
|
||||
--echo [master]
|
||||
connection master;
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
SELECT @@SESSION.sql_mode INTO @old_mode;
|
||||
|
||||
SET sql_mode='ignore_space';
|
||||
|
||||
CREATE TABLE t1(a int);
|
||||
INSERT INTO t1 VALUES (1), (2), (3), (4);
|
||||
|
||||
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
||||
eval SELECT * INTO OUTFILE '$MYSQLD_DATADIR/bug43746.sql' FROM t1;
|
||||
TRUNCATE TABLE t1;
|
||||
|
||||
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
||||
eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1;
|
||||
|
||||
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
||||
eval LOAD/* look mum, with comments in weird places! */DATA/* oh hai */LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql'/* we are */INTO/* from the internets */TABLE t1;
|
||||
|
||||
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
||||
eval LOAD DATA/*!10000 LOCAL */INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1;
|
||||
|
||||
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
||||
eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' /*!10000 INTO */ TABLE t1;
|
||||
|
||||
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
||||
eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' /*!10000 INTO TABLE */ t1;
|
||||
|
||||
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
||||
eval LOAD DATA /*!10000 LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO TABLE */ t1;
|
||||
|
||||
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
||||
eval LOAD DATA/*!10000 LOCAL */INFILE '$MYSQLD_DATADIR/bug43746.sql'/*!10000 INTO*/TABLE t1;
|
||||
|
||||
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
||||
eval LOAD DATA/*!10000 LOCAL */INFILE '$MYSQLD_DATADIR/bug43746.sql'/* empty */INTO TABLE t1;
|
||||
|
||||
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
||||
eval LOAD DATA/*!10000 LOCAL */INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO/* empty */TABLE t1;
|
||||
|
||||
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
||||
eval LOAD/*!99999 special comments that do not expand */DATA/*!99999 code from the future */LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql'/*!99999 have flux capacitor */INTO/*!99999 will travel */TABLE t1;
|
||||
|
||||
SET sql_mode='PIPES_AS_CONCAT,ANSI_QUOTES,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER';
|
||||
|
||||
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
||||
eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1;
|
||||
|
||||
--echo [slave]
|
||||
sync_slave_with_master;
|
||||
|
||||
# cleanup
|
||||
|
||||
--remove_file $MYSQLD_DATADIR/bug43746.sql
|
||||
|
||||
--echo [master]
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
SET SESSION sql_mode=@old_mode;
|
||||
|
||||
--echo [slave]
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
|
@ -71,7 +71,8 @@ select "--- --position --" as "";
|
||||
--enable_query_log
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
|
||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=239 $MYSQLD_DATADIR/master-bin.000002
|
||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=330 $MYSQLD_DATADIR/master-bin.000002
|
||||
|
||||
|
||||
# These are tests for remote binlog.
|
||||
# They should return the same as previous test.
|
||||
@ -107,7 +108,7 @@ select "--- --position --" as "";
|
||||
--enable_query_log
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
|
||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=239 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
|
||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=330 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
|
||||
|
||||
# Bug#7853 mysqlbinlog does not accept input from stdin
|
||||
--disable_query_log
|
||||
@ -377,6 +378,68 @@ FLUSH LOGS;
|
||||
# We do not need the results, just make sure that mysqlbinlog does not crash
|
||||
--exec $MYSQL_BINLOG --hexdump --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 >/dev/null
|
||||
|
||||
#
|
||||
# #46998
|
||||
# This test verifies if the 'BEGIN', 'COMMIT' and 'ROLLBACK' are output
|
||||
# in regardless of database filtering
|
||||
#
|
||||
|
||||
RESET MASTER;
|
||||
FLUSH LOGS;
|
||||
|
||||
# The following three test cases were wrtten into binlog_transaction.000001
|
||||
# Test case1: Test if the 'BEGIN' and 'COMMIT' are output for the 'test' database
|
||||
# in transaction1 base on innodb engine tables
|
||||
# use test;
|
||||
# create table t1(a int) engine= innodb;
|
||||
# use mysql;
|
||||
# create table t2(a int) engine= innodb;
|
||||
# Transaction1 begin
|
||||
# begin;
|
||||
# use test;
|
||||
# insert into t1 (a) values (1);
|
||||
# use mysql;
|
||||
# insert into t2 (a) values (1);
|
||||
# commit;
|
||||
# Transaction1 end
|
||||
|
||||
# Test case2: Test if the 'BEGIN' and 'ROLLBACK' are output for the 'test' database
|
||||
# in transaction2 base on innodb and myisam engine tables
|
||||
# use test;
|
||||
# create table t3(a int) engine= innodb;
|
||||
# use mysql;
|
||||
# create table t4(a int) engine= myisam;
|
||||
# Transaction2 begin
|
||||
# begin;
|
||||
# use test;
|
||||
# insert into t3 (a) values (2);
|
||||
# use mysql;
|
||||
# insert into t4 (a) values (2);
|
||||
# rollback;
|
||||
# Transaction2 end
|
||||
|
||||
# Test case3: Test if the 'BEGIN' and 'COMMIT' are output for the 'test' database
|
||||
# in transaction3 base on NDB engine tables
|
||||
# use test;
|
||||
# create table t5(a int) engine= NDB;
|
||||
# use mysql;
|
||||
# create table t6(a int) engine= NDB;
|
||||
# Transaction3 begin
|
||||
# begin;
|
||||
# use test;
|
||||
# insert into t5 (a) values (3);
|
||||
# use mysql;
|
||||
# insert into t6 (a) values (3);
|
||||
# commit;
|
||||
# Transaction3 end
|
||||
|
||||
--echo #
|
||||
--echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified is exist
|
||||
--exec $MYSQL_BINLOG --database=test --short-form $MYSQLTEST_VARDIR/std_data/binlog_transaction.000001
|
||||
--echo #
|
||||
--echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified is not exist
|
||||
--exec $MYSQL_BINLOG --database=not_exist --short-form $MYSQLTEST_VARDIR/std_data/binlog_transaction.000001
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -4010,7 +4010,7 @@ uint Load_log_event::get_query_buffer_length()
|
||||
}
|
||||
|
||||
|
||||
void Load_log_event::print_query(bool need_db, char *buf,
|
||||
void Load_log_event::print_query(bool need_db, const char *cs, char *buf,
|
||||
char **end, char **fn_start, char **fn_end)
|
||||
{
|
||||
char *pos= buf;
|
||||
@ -4034,9 +4034,9 @@ void Load_log_event::print_query(bool need_db, char *buf,
|
||||
pos= strmov(pos+fname_len, "' ");
|
||||
|
||||
if (sql_ex.opt_flags & REPLACE_FLAG)
|
||||
pos= strmov(pos, " REPLACE ");
|
||||
pos= strmov(pos, "REPLACE ");
|
||||
else if (sql_ex.opt_flags & IGNORE_FLAG)
|
||||
pos= strmov(pos, " IGNORE ");
|
||||
pos= strmov(pos, "IGNORE ");
|
||||
|
||||
pos= strmov(pos ,"INTO");
|
||||
|
||||
@ -4047,8 +4047,16 @@ void Load_log_event::print_query(bool need_db, char *buf,
|
||||
memcpy(pos, table_name, table_name_len);
|
||||
pos+= table_name_len;
|
||||
|
||||
/* We have to create all optinal fields as the default is not empty */
|
||||
pos= strmov(pos, "` FIELDS TERMINATED BY ");
|
||||
if (cs != NULL)
|
||||
{
|
||||
pos= strmov(pos ,"` CHARACTER SET ");
|
||||
pos= strmov(pos , cs);
|
||||
}
|
||||
else
|
||||
pos= strmov(pos, "`");
|
||||
|
||||
/* We have to create all optional fields as the default is not empty */
|
||||
pos= strmov(pos, " FIELDS TERMINATED BY ");
|
||||
pos= pretty_print_str(pos, sql_ex.field_term, sql_ex.field_term_len);
|
||||
if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
|
||||
pos= strmov(pos, " OPTIONALLY ");
|
||||
@ -4102,7 +4110,7 @@ void Load_log_event::pack_info(Protocol *protocol)
|
||||
|
||||
if (!(buf= (char*) my_malloc(get_query_buffer_length(), MYF(MY_WME))))
|
||||
return;
|
||||
print_query(TRUE, buf, &end, 0, 0);
|
||||
print_query(TRUE, NULL, buf, &end, 0, 0);
|
||||
protocol->store(buf, end-buf, &my_charset_bin);
|
||||
my_free(buf, MYF(0));
|
||||
}
|
||||
@ -4367,9 +4375,9 @@ void Load_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info,
|
||||
my_b_printf(&cache, "INFILE '%-*s' ", fname_len, fname);
|
||||
|
||||
if (sql_ex.opt_flags & REPLACE_FLAG)
|
||||
my_b_printf(&cache," REPLACE ");
|
||||
my_b_printf(&cache,"REPLACE ");
|
||||
else if (sql_ex.opt_flags & IGNORE_FLAG)
|
||||
my_b_printf(&cache," IGNORE ");
|
||||
my_b_printf(&cache,"IGNORE ");
|
||||
|
||||
my_b_printf(&cache, "INTO TABLE `%s`", table_name);
|
||||
my_b_printf(&cache, " FIELDS TERMINATED BY ");
|
||||
@ -4577,8 +4585,7 @@ int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli,
|
||||
goto error;
|
||||
}
|
||||
|
||||
print_query(FALSE, load_data_query, &end, (char **)&thd->lex->fname_start,
|
||||
(char **)&thd->lex->fname_end);
|
||||
print_query(FALSE, NULL, load_data_query, &end, NULL, NULL);
|
||||
*end= 0;
|
||||
thd->set_query(load_data_query, (uint) (end - load_data_query));
|
||||
|
||||
@ -6732,7 +6739,7 @@ void Execute_load_query_log_event::print(FILE* file,
|
||||
my_b_printf(&cache, "\'");
|
||||
if (dup_handling == LOAD_DUP_REPLACE)
|
||||
my_b_printf(&cache, " REPLACE");
|
||||
my_b_printf(&cache, " INTO ");
|
||||
my_b_printf(&cache, " INTO");
|
||||
my_b_write(&cache, (uchar*) query + fn_pos_end, q_len-fn_pos_end);
|
||||
my_b_printf(&cache, "\n%s\n", print_event_info->delimiter);
|
||||
}
|
||||
|
@ -1960,15 +1960,15 @@ private:
|
||||
class Load_log_event: public Log_event
|
||||
{
|
||||
private:
|
||||
uint get_query_buffer_length();
|
||||
void print_query(bool need_db, char *buf, char **end,
|
||||
char **fn_start, char **fn_end);
|
||||
protected:
|
||||
int copy_log_event(const char *buf, ulong event_len,
|
||||
int body_offset,
|
||||
const Format_description_log_event* description_event);
|
||||
|
||||
public:
|
||||
uint get_query_buffer_length();
|
||||
void print_query(bool need_db, const char *cs, char *buf, char **end,
|
||||
char **fn_start, char **fn_end);
|
||||
ulong thread_id;
|
||||
ulong slave_proxy_id;
|
||||
uint32 table_name_len;
|
||||
|
@ -1735,13 +1735,6 @@ typedef struct st_lex : public Query_tables_list
|
||||
|
||||
const char *stmt_definition_end;
|
||||
|
||||
/*
|
||||
Pointers to part of LOAD DATA statement that should be rewritten
|
||||
during replication ("LOCAL 'filename' REPLACE INTO" part).
|
||||
*/
|
||||
const char *fname_start;
|
||||
const char *fname_end;
|
||||
|
||||
/**
|
||||
During name resolution search only in the table list given by
|
||||
Name_resolution_context::first_name_resolution_table and
|
||||
|
114
sql/sql_load.cc
114
sql/sql_load.cc
@ -83,10 +83,13 @@ static int read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
|
||||
String &enclosed, ulong skip_lines,
|
||||
bool ignore_check_option_errors);
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
static bool write_execute_load_query_log_event(THD *thd,
|
||||
bool duplicates, bool ignore,
|
||||
bool transactional_table,
|
||||
int errcode);
|
||||
static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex,
|
||||
const char* db_arg,
|
||||
const char* table_name_arg,
|
||||
enum enum_duplicates duplicates,
|
||||
bool ignore,
|
||||
bool transactional_table,
|
||||
int errocode);
|
||||
#endif /* EMBEDDED_LIBRARY */
|
||||
|
||||
/*
|
||||
@ -497,8 +500,10 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||
int errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
|
||||
|
||||
if (thd->transaction.stmt.modified_non_trans_table)
|
||||
write_execute_load_query_log_event(thd, handle_duplicates,
|
||||
ignore, transactional_table,
|
||||
write_execute_load_query_log_event(thd, ex,
|
||||
tdb, table_list->table_name,
|
||||
handle_duplicates, ignore,
|
||||
transactional_table,
|
||||
errcode);
|
||||
else
|
||||
{
|
||||
@ -542,8 +547,11 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||
if (lf_info.wrote_create_file)
|
||||
{
|
||||
int errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
|
||||
write_execute_load_query_log_event(thd, handle_duplicates, ignore,
|
||||
transactional_table, errcode);
|
||||
write_execute_load_query_log_event(thd, ex,
|
||||
tdb, table_list->table_name,
|
||||
handle_duplicates, ignore,
|
||||
transactional_table,
|
||||
errcode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -564,15 +572,95 @@ err:
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
|
||||
/* Not a very useful function; just to avoid duplication of code */
|
||||
static bool write_execute_load_query_log_event(THD *thd,
|
||||
bool duplicates, bool ignore,
|
||||
bool transactional_table,
|
||||
static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex,
|
||||
const char* db_arg,
|
||||
const char* table_name_arg,
|
||||
enum enum_duplicates duplicates,
|
||||
bool ignore,
|
||||
bool transactional_table,
|
||||
int errcode)
|
||||
{
|
||||
char *load_data_query,
|
||||
*end,
|
||||
*fname_start,
|
||||
*fname_end,
|
||||
*p= NULL;
|
||||
size_t pl= 0;
|
||||
List<Item> fv;
|
||||
Item *item, *val;
|
||||
String pfield, pfields;
|
||||
int n;
|
||||
|
||||
Load_log_event lle(thd, ex, db_arg, table_name_arg, fv, duplicates,
|
||||
ignore, transactional_table);
|
||||
|
||||
/*
|
||||
force in a LOCAL if there was one in the original.
|
||||
*/
|
||||
if (thd->lex->local_file)
|
||||
lle.set_fname_outside_temp_buf(ex->file_name, strlen(ex->file_name));
|
||||
|
||||
/*
|
||||
prepare fields-list and SET if needed; print_query won't do that for us.
|
||||
*/
|
||||
if (!thd->lex->field_list.is_empty())
|
||||
{
|
||||
List_iterator<Item> li(thd->lex->field_list);
|
||||
|
||||
pfields.append(" (");
|
||||
n= 0;
|
||||
|
||||
while ((item= li++))
|
||||
{
|
||||
if (n++)
|
||||
pfields.append(", ");
|
||||
if (item->name)
|
||||
pfields.append(item->name);
|
||||
else
|
||||
item->print(&pfields, QT_ORDINARY);
|
||||
}
|
||||
pfields.append(")");
|
||||
}
|
||||
|
||||
if (!thd->lex->update_list.is_empty())
|
||||
{
|
||||
List_iterator<Item> lu(thd->lex->update_list);
|
||||
List_iterator<Item> lv(thd->lex->value_list);
|
||||
|
||||
pfields.append(" SET ");
|
||||
n= 0;
|
||||
|
||||
while ((item= lu++))
|
||||
{
|
||||
val= lv++;
|
||||
if (n++)
|
||||
pfields.append(", ");
|
||||
pfields.append(item->name);
|
||||
pfields.append("=");
|
||||
val->print(&pfields, QT_ORDINARY);
|
||||
}
|
||||
}
|
||||
|
||||
p= pfields.c_ptr_safe();
|
||||
pl= strlen(p);
|
||||
|
||||
if (!(load_data_query= (char *)thd->alloc(lle.get_query_buffer_length() + 1 + pl)))
|
||||
return TRUE;
|
||||
|
||||
lle.print_query(FALSE, (const char *) ex->cs?ex->cs->csname:NULL,
|
||||
load_data_query, &end,
|
||||
(char **)&fname_start, (char **)&fname_end);
|
||||
|
||||
strcpy(end, p);
|
||||
end += pl;
|
||||
|
||||
thd->query_length= end - load_data_query;
|
||||
thd->query= load_data_query;
|
||||
|
||||
Execute_load_query_log_event
|
||||
e(thd, thd->query, thd->query_length,
|
||||
(uint) ((char*)thd->lex->fname_start - (char*)thd->query),
|
||||
(uint) ((char*)thd->lex->fname_end - (char*)thd->query),
|
||||
(uint) ((char*)fname_start - (char*)thd->query - 1),
|
||||
(uint) ((char*)fname_end - (char*)thd->query),
|
||||
(duplicates == DUP_REPLACE) ? LOAD_DUP_REPLACE :
|
||||
(ignore ? LOAD_DUP_IGNORE : LOAD_DUP_ERROR),
|
||||
transactional_table, FALSE, errcode);
|
||||
|
@ -1980,7 +1980,7 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
|
||||
tmp->mysys_var->current_cond ?
|
||||
"Waiting on cond" : NullS);
|
||||
#else
|
||||
val= (char *) "Writing to net";
|
||||
val= (char *) (tmp->proc_info ? tmp->proc_info : NullS);
|
||||
#endif
|
||||
if (val)
|
||||
{
|
||||
|
@ -10425,14 +10425,12 @@ load:
|
||||
{
|
||||
THD *thd= YYTHD;
|
||||
LEX *lex= thd->lex;
|
||||
Lex_input_stream *lip= YYLIP;
|
||||
|
||||
if (lex->sphead)
|
||||
{
|
||||
my_error(ER_SP_BADSTATEMENT, MYF(0), "LOAD DATA");
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
lex->fname_start= lip->get_ptr();
|
||||
}
|
||||
load_data
|
||||
{}
|
||||
@ -10464,14 +10462,10 @@ load_data:
|
||||
if (!(lex->exchange= new sql_exchange($4.str, 0)))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
opt_duplicate INTO
|
||||
{
|
||||
Lex->fname_end= YYLIP->get_ptr();
|
||||
}
|
||||
TABLE_SYM table_ident
|
||||
opt_duplicate INTO TABLE_SYM table_ident
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
if (!Select->add_table_to_list(YYTHD, $10, NULL, TL_OPTION_UPDATING,
|
||||
if (!Select->add_table_to_list(YYTHD, $9, NULL, TL_OPTION_UPDATING,
|
||||
lex->lock_option))
|
||||
MYSQL_YYABORT;
|
||||
lex->field_list.empty();
|
||||
@ -10479,7 +10473,7 @@ load_data:
|
||||
lex->value_list.empty();
|
||||
}
|
||||
opt_load_data_charset
|
||||
{ Lex->exchange->cs= $12; }
|
||||
{ Lex->exchange->cs= $11; }
|
||||
opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec
|
||||
opt_load_data_set_spec
|
||||
{}
|
||||
|
Loading…
x
Reference in New Issue
Block a user