Commit 864ad7da authored by bar@bar.intranet.mysql.r18.ru's avatar bar@bar.intranet.mysql.r18.ru

After merge fix

parents 19725c0b 0d4b26fa
...@@ -95,8 +95,10 @@ static bool stop_passed= 0; ...@@ -95,8 +95,10 @@ static bool stop_passed= 0;
*/ */
Format_description_log_event* description_event; Format_description_log_event* description_event;
static int dump_local_log_entries(const char* logname); static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
static int dump_remote_log_entries(const char* logname); const char* logname);
static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
const char* logname);
static int dump_log_entries(const char* logname); static int dump_log_entries(const char* logname);
static int dump_remote_file(NET* net, const char* fname); static int dump_remote_file(NET* net, const char* fname);
static void die(const char* fmt, ...); static void die(const char* fmt, ...);
...@@ -1000,8 +1002,22 @@ static MYSQL* safe_connect() ...@@ -1000,8 +1002,22 @@ static MYSQL* safe_connect()
static int dump_log_entries(const char* logname) static int dump_log_entries(const char* logname)
{ {
return (remote_opt ? dump_remote_log_entries(logname) : int rc;
dump_local_log_entries(logname)); PRINT_EVENT_INFO print_event_info;
/*
Set safe delimiter, to dump things
like CREATE PROCEDURE safely
*/
fprintf(result_file, "DELIMITER /*!*/;\n");
strcpy(print_event_info.delimiter, "/*!*/;");
rc= (remote_opt ? dump_remote_log_entries(&print_event_info, logname) :
dump_local_log_entries(&print_event_info, logname));
/* Set delimiter back to semicolon */
fprintf(result_file, "DELIMITER ;\n");
strcpy(print_event_info.delimiter, ";");
return rc;
} }
...@@ -1066,11 +1082,11 @@ static int check_master_version(MYSQL* mysql, ...@@ -1066,11 +1082,11 @@ static int check_master_version(MYSQL* mysql,
} }
static int dump_remote_log_entries(const char* logname) static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
const char* logname)
{ {
char buf[128]; char buf[128];
PRINT_EVENT_INFO print_event_info;
ulong len; ulong len;
uint logname_len; uint logname_len;
NET* net; NET* net;
...@@ -1193,7 +1209,7 @@ could be out of memory"); ...@@ -1193,7 +1209,7 @@ could be out of memory");
len= 1; // fake Rotate, so don't increment old_off len= 1; // fake Rotate, so don't increment old_off
} }
} }
if ((error= process_event(&print_event_info, ev, old_off))) if ((error= process_event(print_event_info, ev, old_off)))
{ {
error= ((error < 0) ? 0 : 1); error= ((error < 0) ? 0 : 1);
goto err; goto err;
...@@ -1212,7 +1228,7 @@ could be out of memory"); ...@@ -1212,7 +1228,7 @@ could be out of memory");
goto err; goto err;
} }
if ((error= process_event(&print_event_info, ev, old_off))) if ((error= process_event(print_event_info, ev, old_off)))
{ {
my_close(file,MYF(MY_WME)); my_close(file,MYF(MY_WME));
error= ((error < 0) ? 0 : 1); error= ((error < 0) ? 0 : 1);
...@@ -1338,11 +1354,11 @@ at offset %lu ; this could be a log format error or read error", ...@@ -1338,11 +1354,11 @@ at offset %lu ; this could be a log format error or read error",
} }
static int dump_local_log_entries(const char* logname) static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
const char* logname)
{ {
File fd = -1; File fd = -1;
IO_CACHE cache,*file= &cache; IO_CACHE cache,*file= &cache;
PRINT_EVENT_INFO print_event_info;
byte tmp_buff[BIN_LOG_HEADER_SIZE]; byte tmp_buff[BIN_LOG_HEADER_SIZE];
int error= 0; int error= 0;
...@@ -1429,7 +1445,7 @@ static int dump_local_log_entries(const char* logname) ...@@ -1429,7 +1445,7 @@ static int dump_local_log_entries(const char* logname)
// file->error == 0 means EOF, that's OK, we break in this case // file->error == 0 means EOF, that's OK, we break in this case
break; break;
} }
if ((error= process_event(&print_event_info, ev, old_off))) if ((error= process_event(print_event_info, ev, old_off)))
{ {
if (error < 0) if (error < 0)
error= 0; error= 0;
......
...@@ -374,8 +374,8 @@ is not null; ...@@ -374,8 +374,8 @@ is not null;
is not null is not null
1 1
select select
@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%", @a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%",
@a not like "%#%error_code=%error_code=%"; @a not like "%#%error_code=%error_code=%";
@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%" @a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%"
1 1 1 1
drop table t1, t2; drop table t1, t2;
This diff is collapsed.
This diff is collapsed.
...@@ -176,84 +176,86 @@ hex(c1) hex(c2) ...@@ -176,84 +176,86 @@ hex(c1) hex(c2)
CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
/*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK; DELIMITER /*!*/;
SET TIMESTAMP=1000000000; ROLLBACK/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; SET TIMESTAMP=1000000000/*!*/;
SET @@session.sql_mode=0; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
/*!\C latin1 */; SET @@session.sql_mode=0/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; /*!\C latin1 *//*!*/;
drop database if exists mysqltest2; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET TIMESTAMP=1000000000; drop database if exists mysqltest2/*!*/;
drop database if exists mysqltest3; SET TIMESTAMP=1000000000/*!*/;
SET TIMESTAMP=1000000000; drop database if exists mysqltest3/*!*/;
create database mysqltest2 character set latin2; SET TIMESTAMP=1000000000/*!*/;
SET TIMESTAMP=1000000000; create database mysqltest2 character set latin2/*!*/;
/*!\C latin1 */; SET TIMESTAMP=1000000000/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=30; /*!\C latin1 *//*!*/;
create database mysqltest3; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=30/*!*/;
SET TIMESTAMP=1000000000; create database mysqltest3/*!*/;
/*!\C latin1 */; SET TIMESTAMP=1000000000/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=64; /*!\C latin1 *//*!*/;
drop database mysqltest3; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=64/*!*/;
SET TIMESTAMP=1000000000; drop database mysqltest3/*!*/;
create database mysqltest3; SET TIMESTAMP=1000000000/*!*/;
use mysqltest2; create database mysqltest3/*!*/;
SET TIMESTAMP=1000000000; use mysqltest2/*!*/;
create table t1 (a int auto_increment primary key, b varchar(100)); SET TIMESTAMP=1000000000/*!*/;
SET INSERT_ID=1; create table t1 (a int auto_increment primary key, b varchar(100))/*!*/;
SET TIMESTAMP=1000000000; SET INSERT_ID=1/*!*/;
/*!\C cp850 */; SET TIMESTAMP=1000000000/*!*/;
SET @@session.character_set_client=4,@@session.collation_connection=27,@@session.collation_server=64; /*!\C cp850 *//*!*/;
insert into t1 (b) values(@@character_set_server); SET @@session.character_set_client=4,@@session.collation_connection=27,@@session.collation_server=64/*!*/;
SET INSERT_ID=2; insert into t1 (b) values(@@character_set_server)/*!*/;
SET TIMESTAMP=1000000000; SET INSERT_ID=2/*!*/;
insert into t1 (b) values(@@collation_server); SET TIMESTAMP=1000000000/*!*/;
SET INSERT_ID=3; insert into t1 (b) values(@@collation_server)/*!*/;
SET TIMESTAMP=1000000000; SET INSERT_ID=3/*!*/;
insert into t1 (b) values(@@character_set_client); SET TIMESTAMP=1000000000/*!*/;
SET INSERT_ID=4; insert into t1 (b) values(@@character_set_client)/*!*/;
SET TIMESTAMP=1000000000; SET INSERT_ID=4/*!*/;
insert into t1 (b) values(@@character_set_connection); SET TIMESTAMP=1000000000/*!*/;
SET INSERT_ID=5; insert into t1 (b) values(@@character_set_connection)/*!*/;
SET TIMESTAMP=1000000000; SET INSERT_ID=5/*!*/;
insert into t1 (b) values(@@collation_connection); SET TIMESTAMP=1000000000/*!*/;
SET TIMESTAMP=1000000000; insert into t1 (b) values(@@collation_connection)/*!*/;
/*!\C latin1 */; SET TIMESTAMP=1000000000/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=5,@@session.collation_server=64; /*!\C latin1 *//*!*/;
truncate table t1; SET @@session.character_set_client=8,@@session.collation_connection=5,@@session.collation_server=64/*!*/;
SET INSERT_ID=1; truncate table t1/*!*/;
SET TIMESTAMP=1000000000; SET INSERT_ID=1/*!*/;
insert into t1 (b) values(@@collation_connection); SET TIMESTAMP=1000000000/*!*/;
SET INSERT_ID=2; insert into t1 (b) values(@@collation_connection)/*!*/;
SET TIMESTAMP=1000000000; SET INSERT_ID=2/*!*/;
insert into t1 (b) values(LEAST("Mller","Muffler")); SET TIMESTAMP=1000000000/*!*/;
SET INSERT_ID=3; insert into t1 (b) values(LEAST("Mller","Muffler"))/*!*/;
SET TIMESTAMP=1000000000; SET INSERT_ID=3/*!*/;
/*!\C latin1 */; SET TIMESTAMP=1000000000/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=31,@@session.collation_server=64; /*!\C latin1 *//*!*/;
insert into t1 (b) values(@@collation_connection); SET @@session.character_set_client=8,@@session.collation_connection=31,@@session.collation_server=64/*!*/;
SET INSERT_ID=4; insert into t1 (b) values(@@collation_connection)/*!*/;
SET TIMESTAMP=1000000000; SET INSERT_ID=4/*!*/;
insert into t1 (b) values(LEAST("Mller","Muffler")); SET TIMESTAMP=1000000000/*!*/;
SET TIMESTAMP=1000000000; insert into t1 (b) values(LEAST("Mller","Muffler"))/*!*/;
truncate table t1; SET TIMESTAMP=1000000000/*!*/;
SET INSERT_ID=1; truncate table t1/*!*/;
SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`; SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1000000000; SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`/*!*/;
insert into t1 (b) values(collation(@a)); SET TIMESTAMP=1000000000/*!*/;
SET TIMESTAMP=1000000000; insert into t1 (b) values(collation(@a))/*!*/;
drop database mysqltest2; SET TIMESTAMP=1000000000/*!*/;
SET TIMESTAMP=1000000000; drop database mysqltest2/*!*/;
drop database mysqltest3; SET TIMESTAMP=1000000000/*!*/;
use test; drop database mysqltest3/*!*/;
SET TIMESTAMP=1000000000; use test/*!*/;
/*!\C latin1 */; SET TIMESTAMP=1000000000/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=30; /*!\C latin1 *//*!*/;
CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255)); SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=30/*!*/;
SET TIMESTAMP=1000000000; CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255))/*!*/;
/*!\C koi8r */; SET TIMESTAMP=1000000000/*!*/;
SET @@session.character_set_client=7,@@session.collation_connection=51,@@session.collation_server=30; /*!\C koi8r *//*!*/;
INSERT INTO t1 (c1, c2) VALUES (', ',', '); SET @@session.character_set_client=7,@@session.collation_connection=51,@@session.collation_server=30/*!*/;
INSERT INTO t1 (c1, c2) VALUES (', ',', ')/*!*/;
DELIMITER ;
# End of log file # End of log file
ROLLBACK /* added by mysqlbinlog */; ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
......
...@@ -39,6 +39,38 @@ SELECT * FROM t1 ORDER BY n; ...@@ -39,6 +39,38 @@ SELECT * FROM t1 ORDER BY n;
t n t n
2004-01-01 00:00:00 5 2004-01-01 00:00:00 5
2004-06-11 09:39:02 6 2004-06-11 09:39:02 6
select * from t1;
t
2004-01-01 00:00:00
2004-06-11 09:39:02
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=100000000/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
create table t1 (t timestamp)/*!*/;
SET TIMESTAMP=100000000/*!*/;
create table t2 (t char(32))/*!*/;
SET TIMESTAMP=100000000/*!*/;
SET @@session.time_zone='Europe/Moscow'/*!*/;
insert into t1 values ('20050101000000'), ('20050611093902')/*!*/;
SET TIMESTAMP=100000000/*!*/;
SET @@session.time_zone='UTC'/*!*/;
insert into t1 values ('20040101000000'), ('20040611093902')/*!*/;
SET TIMESTAMP=100000000/*!*/;
delete from t1/*!*/;
SET TIMESTAMP=100000000/*!*/;
SET @@session.time_zone='Europe/Moscow'/*!*/;
insert into t1 values ('20040101000000'), ('20040611093902')/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
delete from t1; delete from t1;
set time_zone='UTC'; set time_zone='UTC';
load data infile '../std_data_ln/rpl_timezone2.dat' into table t1; load data infile '../std_data_ln/rpl_timezone2.dat' into table t1;
......
...@@ -15,19 +15,21 @@ master-bin.000001 # User var 1 # @`var2`=_binary 0x61 COLLATE binary ...@@ -15,19 +15,21 @@ master-bin.000001 # User var 1 # @`var2`=_binary 0x61 COLLATE binary
master-bin.000001 # Query 1 # use `test`; insert into t1 values (@var1),(@var2) master-bin.000001 # Query 1 # use `test`; insert into t1 values (@var1),(@var2)
/*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK; DELIMITER /*!*/;
SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`; ROLLBACK/*!*/;
use test; SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`/*!*/;
SET TIMESTAMP=10000; use test/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; SET TIMESTAMP=10000/*!*/;
SET @@session.sql_mode=0; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
/*!\C latin1 */; SET @@session.sql_mode=0/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; /*!\C latin1 *//*!*/;
INSERT INTO t1 VALUES(@`a b`); SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`; INSERT INTO t1 VALUES(@`a b`)/*!*/;
SET @`var2`:=_binary 0x61 COLLATE `binary`; SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`/*!*/;
SET TIMESTAMP=10000; SET @`var2`:=_binary 0x61 COLLATE `binary`/*!*/;
insert into t1 values (@var1),(@var2); SET TIMESTAMP=10000/*!*/;
insert into t1 values (@var1),(@var2)/*!*/;
DELIMITER ;
# End of log file # End of log file
ROLLBACK /* added by mysqlbinlog */; ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
......
...@@ -136,6 +136,30 @@ flush logs; ...@@ -136,6 +136,30 @@ flush logs;
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL --exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL
select * from t5 /* must be (1),(1) */; select * from t5 /* must be (1),(1) */;
#
# Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails
#
--disable_warnings
drop procedure if exists p1;
--enable_warnings
flush logs;
delimiter //;
create procedure p1()
begin
select 1;
end;
//
delimiter ;//
flush logs;
call p1();
drop procedure p1;
--error 1305
call p1();
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007 | $MYSQL
call p1();
drop procedure p1;
# clean up # clean up
drop table t1, t2, t03, t04, t3, t4, t5; drop table t1, t2, t03, t04, t3, t4, t5;
......
...@@ -1183,7 +1183,7 @@ void Log_event::print_base64(IO_CACHE* file, ...@@ -1183,7 +1183,7 @@ void Log_event::print_base64(IO_CACHE* file,
my_b_printf(file, "%s\n", tmp_str); my_b_printf(file, "%s\n", tmp_str);
if (!more) if (!more)
my_b_printf(file, "';\n"); my_b_printf(file, "'%s\n", print_event_info->delimiter);
my_free(tmp_str, MYF(0)); my_free(tmp_str, MYF(0));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
...@@ -1708,15 +1708,16 @@ void Query_log_event::print_query_header(IO_CACHE* file, ...@@ -1708,15 +1708,16 @@ void Query_log_event::print_query_header(IO_CACHE* file,
if (different_db= memcmp(print_event_info->db, db, db_len + 1)) if (different_db= memcmp(print_event_info->db, db, db_len + 1))
memcpy(print_event_info->db, db, db_len + 1); memcpy(print_event_info->db, db, db_len + 1);
if (db[0] && different_db) if (db[0] && different_db)
my_b_printf(file, "use %s;\n", db); my_b_printf(file, "use %s%s\n", db, print_event_info->delimiter);
} }
end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10); end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10);
*end++=';'; end= strmov(end, print_event_info->delimiter);
*end++='\n'; *end++='\n';
my_b_write(file, (byte*) buff, (uint) (end-buff)); my_b_write(file, (byte*) buff, (uint) (end-buff));
if (flags & LOG_EVENT_THREAD_SPECIFIC_F) if (flags & LOG_EVENT_THREAD_SPECIFIC_F)
my_b_printf(file,"SET @@session.pseudo_thread_id=%lu;\n",(ulong)thread_id); my_b_printf(file,"SET @@session.pseudo_thread_id=%lu%s\n",
(ulong)thread_id, print_event_info->delimiter);
/* /*
If flags2_inited==0, this is an event from 3.23 or 4.0; nothing to If flags2_inited==0, this is an event from 3.23 or 4.0; nothing to
...@@ -1745,7 +1746,7 @@ void Query_log_event::print_query_header(IO_CACHE* file, ...@@ -1745,7 +1746,7 @@ void Query_log_event::print_query_header(IO_CACHE* file,
"@@session.sql_auto_is_null", &need_comma); "@@session.sql_auto_is_null", &need_comma);
print_set_option(file, tmp, OPTION_RELAXED_UNIQUE_CHECKS, ~flags2, print_set_option(file, tmp, OPTION_RELAXED_UNIQUE_CHECKS, ~flags2,
"@@session.unique_checks", &need_comma); "@@session.unique_checks", &need_comma);
my_b_printf(file,";\n"); my_b_printf(file,"%s\n", print_event_info->delimiter);
print_event_info->flags2= flags2; print_event_info->flags2= flags2;
} }
} }
...@@ -1773,15 +1774,17 @@ void Query_log_event::print_query_header(IO_CACHE* file, ...@@ -1773,15 +1774,17 @@ void Query_log_event::print_query_header(IO_CACHE* file,
} }
if (unlikely(print_event_info->sql_mode != sql_mode)) if (unlikely(print_event_info->sql_mode != sql_mode))
{ {
my_b_printf(file,"SET @@session.sql_mode=%lu;\n",(ulong)sql_mode); my_b_printf(file,"SET @@session.sql_mode=%lu%s\n",
(ulong)sql_mode, print_event_info->delimiter);
print_event_info->sql_mode= sql_mode; print_event_info->sql_mode= sql_mode;
} }
} }
if (print_event_info->auto_increment_increment != auto_increment_increment || if (print_event_info->auto_increment_increment != auto_increment_increment ||
print_event_info->auto_increment_offset != auto_increment_offset) print_event_info->auto_increment_offset != auto_increment_offset)
{ {
my_b_printf(file,"SET @@session.auto_increment_increment=%lu, @@session.auto_increment_offset=%lu;\n", my_b_printf(file,"SET @@session.auto_increment_increment=%lu, @@session.auto_increment_offset=%lu%s\n",
auto_increment_increment,auto_increment_offset); auto_increment_increment,auto_increment_offset,
print_event_info->delimiter);
print_event_info->auto_increment_increment= auto_increment_increment; print_event_info->auto_increment_increment= auto_increment_increment;
print_event_info->auto_increment_offset= auto_increment_offset; print_event_info->auto_increment_offset= auto_increment_offset;
} }
...@@ -1801,16 +1804,18 @@ void Query_log_event::print_query_header(IO_CACHE* file, ...@@ -1801,16 +1804,18 @@ void Query_log_event::print_query_header(IO_CACHE* file,
if (cs_info) if (cs_info)
{ {
/* for mysql client */ /* for mysql client */
my_b_printf(file, "/*!\\C %s */;\n", cs_info->csname); my_b_printf(file, "/*!\\C %s */%s\n",
cs_info->csname, print_event_info->delimiter);
} }
my_b_printf(file,"SET " my_b_printf(file,"SET "
"@@session.character_set_client=%d," "@@session.character_set_client=%d,"
"@@session.collation_connection=%d," "@@session.collation_connection=%d,"
"@@session.collation_server=%d" "@@session.collation_server=%d"
";\n", "%s\n",
uint2korr(charset), uint2korr(charset),
uint2korr(charset+2), uint2korr(charset+2),
uint2korr(charset+4)); uint2korr(charset+4),
print_event_info->delimiter);
memcpy(print_event_info->charset, charset, 6); memcpy(print_event_info->charset, charset, 6);
} }
} }
...@@ -1818,7 +1823,8 @@ void Query_log_event::print_query_header(IO_CACHE* file, ...@@ -1818,7 +1823,8 @@ void Query_log_event::print_query_header(IO_CACHE* file,
{ {
if (bcmp(print_event_info->time_zone_str, time_zone_str, time_zone_len+1)) if (bcmp(print_event_info->time_zone_str, time_zone_str, time_zone_len+1))
{ {
my_b_printf(file,"SET @@session.time_zone='%s';\n", time_zone_str); my_b_printf(file,"SET @@session.time_zone='%s'%s\n",
time_zone_str, print_event_info->delimiter);
memcpy(print_event_info->time_zone_str, time_zone_str, time_zone_len+1); memcpy(print_event_info->time_zone_str, time_zone_str, time_zone_len+1);
} }
} }
...@@ -1831,7 +1837,7 @@ void Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) ...@@ -1831,7 +1837,7 @@ void Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
print_query_header(&cache, print_event_info); print_query_header(&cache, print_event_info);
my_b_write(&cache, (byte*) query, q_len); my_b_write(&cache, (byte*) query, q_len);
my_b_printf(&cache, ";\n"); my_b_printf(&cache, "%s\n", print_event_info->delimiter);
} }
#endif /* MYSQL_CLIENT */ #endif /* MYSQL_CLIENT */
...@@ -2188,9 +2194,9 @@ void Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info) ...@@ -2188,9 +2194,9 @@ void Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
and rollback unfinished transaction. and rollback unfinished transaction.
Probably this can be done with RESET CONNECTION (syntax to be defined). Probably this can be done with RESET CONNECTION (syntax to be defined).
*/ */
my_b_printf(&cache,"RESET CONNECTION;\n"); my_b_printf(&cache,"RESET CONNECTION%s\n", print_event_info->delimiter);
#else #else
my_b_printf(&cache,"ROLLBACK;\n"); my_b_printf(&cache,"ROLLBACK%s\n", print_event_info->delimiter);
#endif #endif
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
...@@ -2945,13 +2951,14 @@ void Load_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info, ...@@ -2945,13 +2951,14 @@ void Load_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info,
} }
if (db && db[0] && different_db) if (db && db[0] && different_db)
my_b_printf(&cache, "%suse %s;\n", my_b_printf(&cache, "%suse %s%s\n",
commented ? "# " : "", commented ? "# " : "",
db); db, print_event_info->delimiter);
if (flags & LOG_EVENT_THREAD_SPECIFIC_F) if (flags & LOG_EVENT_THREAD_SPECIFIC_F)
my_b_printf(&cache,"%sSET @@session.pseudo_thread_id=%lu;\n", my_b_printf(&cache,"%sSET @@session.pseudo_thread_id=%lu%s\n",
commented ? "# " : "", (ulong)thread_id); commented ? "# " : "", (ulong)thread_id,
print_event_info->delimiter);
my_b_printf(&cache, "%sLOAD DATA ", my_b_printf(&cache, "%sLOAD DATA ",
commented ? "# " : ""); commented ? "# " : "");
if (check_fname_outside_temp_buf()) if (check_fname_outside_temp_buf())
...@@ -3003,7 +3010,7 @@ void Load_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info, ...@@ -3003,7 +3010,7 @@ void Load_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info,
my_b_printf(&cache, ")"); my_b_printf(&cache, ")");
} }
my_b_printf(&cache, ";\n"); my_b_printf(&cache, "%s\n", print_event_info->delimiter);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
#endif /* MYSQL_CLIENT */ #endif /* MYSQL_CLIENT */
...@@ -3582,7 +3589,8 @@ void Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) ...@@ -3582,7 +3589,8 @@ void Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
msg="INVALID_INT"; msg="INVALID_INT";
break; break;
} }
my_b_printf(&cache, "%s=%s;\n", msg, llstr(val,llbuff)); my_b_printf(&cache, "%s=%s%s\n",
msg, llstr(val,llbuff), print_event_info->delimiter);
} }
#endif #endif
...@@ -3660,8 +3668,9 @@ void Rand_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) ...@@ -3660,8 +3668,9 @@ void Rand_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
print_header(&cache, print_event_info, FALSE); print_header(&cache, print_event_info, FALSE);
my_b_printf(&cache, "\tRand\n"); my_b_printf(&cache, "\tRand\n");
} }
my_b_printf(&cache, "SET @@RAND_SEED1=%s, @@RAND_SEED2=%s;\n", my_b_printf(&cache, "SET @@RAND_SEED1=%s, @@RAND_SEED2=%s%s\n",
llstr(seed1, llbuff),llstr(seed2, llbuff2)); llstr(seed1, llbuff),llstr(seed2, llbuff2),
print_event_info->delimiter);
} }
#endif /* MYSQL_CLIENT */ #endif /* MYSQL_CLIENT */
...@@ -3734,7 +3743,7 @@ void Xid_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) ...@@ -3734,7 +3743,7 @@ void Xid_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
print_header(&cache, print_event_info, FALSE); print_header(&cache, print_event_info, FALSE);
my_b_printf(&cache, "\tXid = %s\n", buf); my_b_printf(&cache, "\tXid = %s\n", buf);
} }
my_b_printf(&cache, "COMMIT;\n"); my_b_printf(&cache, "COMMIT%s\n", print_event_info->delimiter);
} }
#endif /* MYSQL_CLIENT */ #endif /* MYSQL_CLIENT */
...@@ -3939,7 +3948,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) ...@@ -3939,7 +3948,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
if (is_null) if (is_null)
{ {
my_b_printf(&cache, ":=NULL;\n"); my_b_printf(&cache, ":=NULL%s\n", print_event_info->delimiter);
} }
else else
{ {
...@@ -3947,12 +3956,12 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) ...@@ -3947,12 +3956,12 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
case REAL_RESULT: case REAL_RESULT:
double real_val; double real_val;
float8get(real_val, val); float8get(real_val, val);
my_b_printf(&cache, ":=%.14g;\n", real_val); my_b_printf(&cache, ":=%.14g%s\n", real_val, print_event_info->delimiter);
break; break;
case INT_RESULT: case INT_RESULT:
char int_buf[22]; char int_buf[22];
longlong10_to_str(uint8korr(val), int_buf, -10); longlong10_to_str(uint8korr(val), int_buf, -10);
my_b_printf(&cache, ":=%s;\n", int_buf); my_b_printf(&cache, ":=%s%s\n", int_buf, print_event_info->delimiter);
break; break;
case DECIMAL_RESULT: case DECIMAL_RESULT:
{ {
...@@ -3968,7 +3977,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) ...@@ -3968,7 +3977,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
bin2decimal(val+2, &dec, precision, scale); bin2decimal(val+2, &dec, precision, scale);
decimal2string(&dec, str_buf, &str_len, 0, 0, 0); decimal2string(&dec, str_buf, &str_len, 0, 0, 0);
str_buf[str_len]= 0; str_buf[str_len]= 0;
my_b_printf(&cache, ":=%s;\n",str_buf); my_b_printf(&cache, ":=%s%s\n", str_buf, print_event_info->delimiter);
break; break;
} }
case STRING_RESULT: case STRING_RESULT:
...@@ -4004,9 +4013,11 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) ...@@ -4004,9 +4013,11 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
Generate an unusable command (=> syntax error) is probably the best Generate an unusable command (=> syntax error) is probably the best
thing we can do here. thing we can do here.
*/ */
my_b_printf(&cache, ":=???;\n"); my_b_printf(&cache, ":=???%s\n", print_event_info->delimiter);
else else
my_b_printf(&cache, ":=_%s %s COLLATE `%s`;\n", cs->csname, hex_str, cs->name); my_b_printf(&cache, ":=_%s %s COLLATE `%s`%s\n",
cs->csname, hex_str, cs->name,
print_event_info->delimiter);
my_afree(hex_str); my_afree(hex_str);
} }
break; break;
...@@ -5108,12 +5119,12 @@ void Execute_load_query_log_event::print(FILE* file, ...@@ -5108,12 +5119,12 @@ void Execute_load_query_log_event::print(FILE* file,
my_b_printf(&cache, " REPLACE"); my_b_printf(&cache, " REPLACE");
my_b_printf(&cache, " INTO"); my_b_printf(&cache, " INTO");
my_b_write(&cache, (byte*) query + fn_pos_end, q_len-fn_pos_end); my_b_write(&cache, (byte*) query + fn_pos_end, q_len-fn_pos_end);
my_b_printf(&cache, ";\n"); my_b_printf(&cache, "%s\n", print_event_info->delimiter);
} }
else else
{ {
my_b_write(&cache, (byte*) query, q_len); my_b_write(&cache, (byte*) query, q_len);
my_b_printf(&cache, ";\n"); my_b_printf(&cache, "%s\n", print_event_info->delimiter);
} }
if (!print_event_info->short_form) if (!print_event_info->short_form)
......
...@@ -537,6 +537,7 @@ typedef struct st_print_event_info ...@@ -537,6 +537,7 @@ typedef struct st_print_event_info
bzero(db, sizeof(db)); bzero(db, sizeof(db));
bzero(charset, sizeof(charset)); bzero(charset, sizeof(charset));
bzero(time_zone_str, sizeof(time_zone_str)); bzero(time_zone_str, sizeof(time_zone_str));
strcpy(delimiter, ";");
uint const flags = MYF(MY_WME | MY_NABP); uint const flags = MYF(MY_WME | MY_NABP);
init_io_cache(&head_cache, -1, 0, WRITE_CACHE, 0L, FALSE, flags); init_io_cache(&head_cache, -1, 0, WRITE_CACHE, 0L, FALSE, flags);
init_io_cache(&body_cache, -1, 0, WRITE_CACHE, 0L, FALSE, flags); init_io_cache(&body_cache, -1, 0, WRITE_CACHE, 0L, FALSE, flags);
...@@ -553,6 +554,7 @@ typedef struct st_print_event_info ...@@ -553,6 +554,7 @@ typedef struct st_print_event_info
bool base64_output; bool base64_output;
my_off_t hexdump_from; my_off_t hexdump_from;
uint8 common_header_len; uint8 common_header_len;
char delimiter[16];
/* /*
These two caches are used by the row-based replication events to These two caches are used by the row-based replication events to
......
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