Commit ac053d80 authored by guilhem@mysql.com's avatar guilhem@mysql.com

Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/home/mysql_src/mysql-5.0-clean
parents d8659b27 ed1696f6
......@@ -488,6 +488,15 @@ Create_file event for file_id: %u\n",exv->file_id);
static struct my_option my_long_options[] =
{
/*
mysqlbinlog needs charsets knowledge, to be able to convert a charset
number found in binlog to a charset name (to be able to print things
like this:
SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`;
*/
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DBUG_OFF
{"debug", '#', "Output debug log.", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
......
......@@ -692,7 +692,7 @@ fi
MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST --no-defaults --testcase --user=root --socket=$MASTER_MYSOCK --port=$MYSQL_TCP_PORT --silent"
MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR --character-sets-dir=$CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES
......
......@@ -526,13 +526,14 @@ insert into t2 values (@v);
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 User var 1 135 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
master-bin.000001 135 Query 1 218 use `test`; insert into t2 values (@v)
master-bin.000001 135 Query 1 225 use `test`; insert into t2 values (@v)
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`;
use test;
SET TIMESTAMP=10000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t2 values (@v);
drop table t2;
set names latin1;
......
......@@ -11,8 +11,8 @@ get_lock("a",10)
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
master-bin.000001 95 Query 1 206 create database `drop-temp+table-test`
master-bin.000001 206 Query 1 322 use `drop-temp+table-test`; create temporary table `table:name` (a int)
master-bin.000001 322 Query 1 473 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
master-bin.000001 473 Query 1 566 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
master-bin.000001 95 Query 1 213 create database `drop-temp+table-test`
master-bin.000001 213 Query 1 336 use `drop-temp+table-test`; create temporary table `table:name` (a int)
master-bin.000001 336 Query 1 494 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
master-bin.000001 494 Query 1 594 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
drop database `drop-temp+table-test`;
......@@ -75,7 +75,7 @@ ERROR 23000: Duplicate entry '2' for key 1
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
master-bin.000001 95 Query 1 183 use `test`; insert into t1 select * from t2
master-bin.000001 95 Query 1 190 use `test`; insert into t1 select * from t2
select * from t1;
a
1
......
......@@ -9,9 +9,9 @@ commit;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; BEGIN
master-bin.000001 157 Query 1 # use `test`; insert into t1 values(1)
master-bin.000001 238 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 326 Query 1 # use `test`; COMMIT
master-bin.000001 164 Query 1 # use `test`; insert into t1 values(1)
master-bin.000001 252 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 347 Query 1 # use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
......@@ -24,9 +24,9 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; BEGIN
master-bin.000001 157 Query 1 # use `test`; insert into t1 values(2)
master-bin.000001 238 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 326 Query 1 # use `test`; ROLLBACK
master-bin.000001 164 Query 1 # use `test`; insert into t1 values(2)
master-bin.000001 252 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 347 Query 1 # use `test`; ROLLBACK
delete from t1;
delete from t2;
reset master;
......@@ -42,12 +42,12 @@ commit;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; BEGIN
master-bin.000001 157 Query 1 # use `test`; insert into t1 values(3)
master-bin.000001 238 Query 1 # use `test`; savepoint my_savepoint
master-bin.000001 317 Query 1 # use `test`; insert into t1 values(4)
master-bin.000001 398 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 486 Query 1 # use `test`; rollback to savepoint my_savepoint
master-bin.000001 577 Query 1 # use `test`; COMMIT
master-bin.000001 164 Query 1 # use `test`; insert into t1 values(3)
master-bin.000001 252 Query 1 # use `test`; savepoint my_savepoint
master-bin.000001 338 Query 1 # use `test`; insert into t1 values(4)
master-bin.000001 426 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 521 Query 1 # use `test`; rollback to savepoint my_savepoint
master-bin.000001 619 Query 1 # use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
......@@ -68,13 +68,13 @@ a
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; BEGIN
master-bin.000001 157 Query 1 # use `test`; insert into t1 values(5)
master-bin.000001 238 Query 1 # use `test`; savepoint my_savepoint
master-bin.000001 317 Query 1 # use `test`; insert into t1 values(6)
master-bin.000001 398 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 486 Query 1 # use `test`; rollback to savepoint my_savepoint
master-bin.000001 577 Query 1 # use `test`; insert into t1 values(7)
master-bin.000001 658 Query 1 # use `test`; COMMIT
master-bin.000001 164 Query 1 # use `test`; insert into t1 values(5)
master-bin.000001 252 Query 1 # use `test`; savepoint my_savepoint
master-bin.000001 338 Query 1 # use `test`; insert into t1 values(6)
master-bin.000001 426 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 521 Query 1 # use `test`; rollback to savepoint my_savepoint
master-bin.000001 619 Query 1 # use `test`; insert into t1 values(7)
master-bin.000001 707 Query 1 # use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
......@@ -90,9 +90,9 @@ get_lock("a",10)
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; BEGIN
master-bin.000001 157 Query 1 # use `test`; insert into t1 values(8)
master-bin.000001 238 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 326 Query 1 # use `test`; ROLLBACK
master-bin.000001 164 Query 1 # use `test`; insert into t1 values(8)
master-bin.000001 252 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 347 Query 1 # use `test`; ROLLBACK
delete from t1;
delete from t2;
reset master;
......@@ -101,7 +101,7 @@ insert into t2 select * from t1;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; insert into t1 values(9)
master-bin.000001 176 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 183 Query 1 # use `test`; insert into t2 select * from t1
delete from t1;
delete from t2;
reset master;
......@@ -111,16 +111,16 @@ insert into t2 select * from t1;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; insert into t1 values(10)
master-bin.000001 177 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 184 Query 1 # use `test`; insert into t2 select * from t1
insert into t1 values(11);
commit;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; insert into t1 values(10)
master-bin.000001 177 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 265 Query 1 # use `test`; BEGIN
master-bin.000001 327 Query 1 # use `test`; insert into t1 values(11)
master-bin.000001 409 Query 1 # use `test`; COMMIT
master-bin.000001 184 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 279 Query 1 # use `test`; BEGIN
master-bin.000001 348 Query 1 # use `test`; insert into t1 values(11)
master-bin.000001 437 Query 1 # use `test`; COMMIT
alter table t2 engine=INNODB;
delete from t1;
delete from t2;
......@@ -132,9 +132,9 @@ commit;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; BEGIN
master-bin.000001 157 Query 1 # use `test`; insert into t1 values(12)
master-bin.000001 239 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 327 Query 1 # use `test`; COMMIT
master-bin.000001 164 Query 1 # use `test`; insert into t1 values(12)
master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 348 Query 1 # use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
......@@ -157,8 +157,8 @@ commit;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; BEGIN
master-bin.000001 157 Query 1 # use `test`; insert into t1 values(14)
master-bin.000001 239 Query 1 # use `test`; COMMIT
master-bin.000001 164 Query 1 # use `test`; insert into t1 values(14)
master-bin.000001 253 Query 1 # use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
......@@ -177,9 +177,9 @@ a
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; BEGIN
master-bin.000001 157 Query 1 # use `test`; insert into t1 values(16)
master-bin.000001 239 Query 1 # use `test`; insert into t1 values(18)
master-bin.000001 321 Query 1 # use `test`; COMMIT
master-bin.000001 164 Query 1 # use `test`; insert into t1 values(16)
master-bin.000001 253 Query 1 # use `test`; insert into t1 values(18)
master-bin.000001 342 Query 1 # use `test`; COMMIT
delete from t1;
delete from t2;
alter table t2 type=MyISAM;
......
......@@ -19,6 +19,7 @@ use test;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
drop table if exists t1,t2;
SET TIMESTAMP=1000000000;
create table t1 (word varchar(20));
......@@ -41,6 +42,7 @@ use test;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values ("Alas");
--- --database --
......@@ -53,6 +55,7 @@ use test;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values ("Alas");
--- Remote --
......@@ -61,6 +64,7 @@ use test;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
drop table if exists t1,t2;
SET TIMESTAMP=1000000000;
create table t1 (word varchar(20));
......@@ -83,6 +87,7 @@ use test;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values ("Alas");
--- --database --
......@@ -95,5 +100,6 @@ use test;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values ("Alas");
drop table t1, t2;
......@@ -20,6 +20,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
......@@ -44,6 +45,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
......@@ -60,10 +62,12 @@ insert into t1 values(null, "e");
--- start-position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET INSERT_ID=4;
use test;
SET TIMESTAMP=1579609946;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
......@@ -75,6 +79,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
......@@ -85,7 +90,6 @@ insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
--- start-datetime --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
......@@ -94,6 +98,7 @@ use test;
SET TIMESTAMP=1579609944;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
......@@ -108,6 +113,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
......@@ -122,6 +128,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
......@@ -143,6 +150,7 @@ use test;
SET TIMESTAMP=1579609943;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
--- offset --
......@@ -152,6 +160,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
......@@ -170,14 +179,17 @@ use test;
SET TIMESTAMP=1579609943;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
--- start-position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET INSERT_ID=4;
use test;
SET TIMESTAMP=1579609946;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
......@@ -187,6 +199,7 @@ use test;
SET TIMESTAMP=1579609943;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
--- stop-position --
......@@ -195,6 +208,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
......@@ -220,6 +234,7 @@ use test;
SET TIMESTAMP=1579609944;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
......@@ -232,6 +247,7 @@ use test;
SET TIMESTAMP=1579609943;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
--- stop-datetime --
......@@ -240,6 +256,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
......@@ -254,6 +271,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
......@@ -278,6 +296,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
......@@ -294,10 +313,12 @@ insert into t1 values(null, "e");
--- start-position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET INSERT_ID=4;
use test;
SET TIMESTAMP=1579609946;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
......@@ -309,6 +330,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
......@@ -319,7 +341,6 @@ insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
--- start-datetime --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
......@@ -328,6 +349,7 @@ use test;
SET TIMESTAMP=1579609944;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
......@@ -342,6 +364,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
......@@ -356,6 +379,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
......@@ -377,6 +401,7 @@ use test;
SET TIMESTAMP=1579609943;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
--- offset --
......@@ -386,6 +411,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
......@@ -404,14 +430,17 @@ use test;
SET TIMESTAMP=1579609943;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
--- start-position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET INSERT_ID=4;
use test;
SET TIMESTAMP=1579609946;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
......@@ -421,6 +450,7 @@ use test;
SET TIMESTAMP=1579609943;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
--- stop-position --
......@@ -429,6 +459,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
......@@ -454,6 +485,7 @@ use test;
SET TIMESTAMP=1579609944;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
......@@ -466,6 +498,7 @@ use test;
SET TIMESTAMP=1579609943;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
--- stop-datetime --
......@@ -474,6 +507,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
......@@ -488,6 +522,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
......
......@@ -4,6 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
set timestamp=1000000000;
drop database if exists mysqltest2;
drop database if exists mysqltest3;
create database mysqltest2 character set latin2;
......@@ -87,7 +88,6 @@ a b
2 Muffler
3 latin1_german2_ci
4 Mller
load data infile '../../std_data/words.dat' into table t1 (b);
set @a= _cp850 'Mller' collate cp850_general_ci;
truncate table t1;
insert into t1 (b) values(collation(@a));
......@@ -108,63 +108,39 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # drop database if exists mysqltest2
master-bin.000001 # Query 1 # drop database if exists mysqltest3
master-bin.000001 # Query 1 # create database mysqltest2 character set latin2
master-bin.000001 # Query 1 # use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=30
master-bin.000001 # Query 1 # create database mysqltest3
master-bin.000001 # Query 1 # use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
master-bin.000001 # Query 1 # drop database mysqltest3
master-bin.000001 # Query 1 # use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
master-bin.000001 # Query 1 # create database mysqltest3
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Query 1 # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=1
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@character_set_server)
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=2
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@collation_server)
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=3
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@character_set_client)
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=4
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@character_set_connection)
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=5
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=1
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=2
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(LEAST("Mller","Muffler"))
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=3
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=4
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(LEAST("Mller","Muffler"))
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=74
master-bin.000001 # Create_file 1 # db=mysqltest2;table=t1;file_id=1;block_len=581
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=5
master-bin.000001 # Exec_load 1 # ;file_id=1
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=1
master-bin.000001 # User var 1 # @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(collation(@a))
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Query 1 # drop database mysqltest2
master-bin.000001 # Query 1 # SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Query 1 # drop database mysqltest3
set global character_set_server=latin2;
ERROR HY000: Binary logging and replication forbid changing the global server character set, collation
set global character_set_server=latin1;
set global character_set_server=latin2;
ERROR HY000: Binary logging and replication forbid changing the global server character set, collation
set global character_set_server=latin1;
set one_shot @@character_set_server=latin5;
set @@max_join_size=1000;
select @@character_set_server;
......@@ -198,12 +174,74 @@ CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
select hex(c1), hex(c2) from t1;
hex(c1) hex(c2)
CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
stop slave;
delete from t1;
change master to master_log_pos=6809;
start slave until master_log_file='master-bin.000001', master_log_pos=6967;
start slave;
select hex(c1), hex(c2) from t1;
hex(c1) hex(c2)
CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
drop database if exists mysqltest2;
SET TIMESTAMP=1000000000;
drop database if exists mysqltest3;
SET TIMESTAMP=1000000000;
create database mysqltest2 character set latin2;
SET TIMESTAMP=1000000000;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=30;
create database mysqltest3;
SET TIMESTAMP=1000000000;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=64;
drop database mysqltest3;
SET TIMESTAMP=1000000000;
create database mysqltest3;
use mysqltest2;
SET TIMESTAMP=1000000000;
create table t1 (a int auto_increment primary key, b varchar(100));
SET INSERT_ID=1;
SET TIMESTAMP=1000000000;
SET @@session.character_set_client=4,@@session.collation_connection=27,@@session.collation_server=64;
insert into t1 (b) values(@@character_set_server);
SET INSERT_ID=2;
SET TIMESTAMP=1000000000;
insert into t1 (b) values(@@collation_server);
SET INSERT_ID=3;
SET TIMESTAMP=1000000000;
insert into t1 (b) values(@@character_set_client);
SET INSERT_ID=4;
SET TIMESTAMP=1000000000;
insert into t1 (b) values(@@character_set_connection);
SET INSERT_ID=5;
SET TIMESTAMP=1000000000;
insert into t1 (b) values(@@collation_connection);
SET TIMESTAMP=1000000000;
SET @@session.character_set_client=8,@@session.collation_connection=5,@@session.collation_server=64;
truncate table t1;
SET INSERT_ID=1;
SET TIMESTAMP=1000000000;
insert into t1 (b) values(@@collation_connection);
SET INSERT_ID=2;
SET TIMESTAMP=1000000000;
insert into t1 (b) values(LEAST("Mller","Muffler"));
SET INSERT_ID=3;
SET TIMESTAMP=1000000000;
SET @@session.character_set_client=8,@@session.collation_connection=31,@@session.collation_server=64;
insert into t1 (b) values(@@collation_connection);
SET INSERT_ID=4;
SET TIMESTAMP=1000000000;
insert into t1 (b) values(LEAST("Mller","Muffler"));
SET TIMESTAMP=1000000000;
truncate table t1;
SET INSERT_ID=1;
SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`;
SET TIMESTAMP=1000000000;
insert into t1 (b) values(collation(@a));
SET TIMESTAMP=1000000000;
drop database mysqltest2;
SET TIMESTAMP=1000000000;
drop database mysqltest3;
use test;
SET TIMESTAMP=1000000000;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=30;
CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255));
SET TIMESTAMP=1000000000;
SET @@session.character_set_client=7,@@session.collation_connection=51,@@session.collation_server=30;
INSERT INTO t1 (c1, c2) VALUES (', ',', ');
drop table t1;
......@@ -9,7 +9,7 @@ insert into t1 values (1),(1);
ERROR 23000: Duplicate entry '1' for key 1
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
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 273 # # master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 273 # None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 287 # # master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 287 # None 0 No #
show tables like 't1';
Tables_in_test (t1)
drop table t1;
......@@ -28,12 +28,12 @@ kill @id;
drop table t2,t3;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 187 use `test`; create table t1 (a int primary key)
master-bin.000001 187 Query 1 273 use `test`; insert into t1 values (1),(1)
master-bin.000001 273 Query 1 343 use `test`; drop table t1
master-bin.000001 343 Query 1 435 use `test`; create table t2 (a int primary key)
master-bin.000001 435 Query 1 516 use `test`; insert into t2 values(1)
master-bin.000001 516 Query 1 597 use `test`; create table t3 (id int)
master-bin.000001 597 Query 1 692 use `test`; insert into t3 values(connection_id())
master-bin.000001 692 Query 1 805 use `test`; update t2 set a = a + 1 + get_lock('crash_lock%20C', 10)
master-bin.000001 805 Query 1 878 use `test`; drop table t2,t3
master-bin.000001 95 Query 1 194 use `test`; create table t1 (a int primary key)
master-bin.000001 194 Query 1 287 use `test`; insert into t1 values (1),(1)
master-bin.000001 287 Query 1 364 use `test`; drop table t1
master-bin.000001 364 Query 1 463 use `test`; create table t2 (a int primary key)
master-bin.000001 463 Query 1 551 use `test`; insert into t2 values(1)
master-bin.000001 551 Query 1 639 use `test`; create table t3 (id int)
master-bin.000001 639 Query 1 741 use `test`; insert into t3 values(connection_id())
master-bin.000001 741 Query 1 861 use `test`; update t2 set a = a + 1 + get_lock('crash_lock%20C', 10)
master-bin.000001 861 Query 1 941 use `test`; drop table t2,t3
......@@ -14,4 +14,4 @@ start slave;
flush logs;
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
# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 199 # # slave-bin.000001 Yes Yes 0 0 199 # None 0 No #
# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 206 # # slave-bin.000001 Yes Yes 0 0 206 # None 0 No #
......@@ -15,26 +15,26 @@ flush no_write_to_binlog tables;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: SERVER_VERSION, Binlog ver: 4
master-bin.000001 95 Query 1 175 use `test`; create table t1 (a int)
master-bin.000001 175 Query 1 258 use `test`; insert into t1 values (10)
master-bin.000001 258 Query 1 338 use `test`; create table t2 (a int)
master-bin.000001 338 Query 1 441 use `test`; create table t3 (a int) engine=merge union(t1)
master-bin.000001 441 Query 1 521 use `test`; create table t4 (a int)
master-bin.000001 521 Query 1 609 use `test`; insert into t4 select * from t3
master-bin.000001 609 Query 1 697 use `test`; rename table t1 to t5, t2 to t1
master-bin.000001 95 Query 1 182 use `test`; create table t1 (a int)
master-bin.000001 182 Query 1 272 use `test`; insert into t1 values (10)
master-bin.000001 272 Query 1 359 use `test`; create table t2 (a int)
master-bin.000001 359 Query 1 469 use `test`; create table t3 (a int) engine=merge union(t1)
master-bin.000001 469 Query 1 556 use `test`; create table t4 (a int)
master-bin.000001 556 Query 1 651 use `test`; insert into t4 select * from t3
master-bin.000001 651 Query 1 746 use `test`; rename table t1 to t5, t2 to t1
select * from t3;
a
flush tables;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: SERVER_VERSION, Binlog ver: 4
master-bin.000001 95 Query 1 175 use `test`; create table t1 (a int)
master-bin.000001 175 Query 1 258 use `test`; insert into t1 values (10)
master-bin.000001 258 Query 1 338 use `test`; create table t2 (a int)
master-bin.000001 338 Query 1 441 use `test`; create table t3 (a int) engine=merge union(t1)
master-bin.000001 441 Query 1 521 use `test`; create table t4 (a int)
master-bin.000001 521 Query 1 609 use `test`; insert into t4 select * from t3
master-bin.000001 609 Query 1 697 use `test`; rename table t1 to t5, t2 to t1
master-bin.000001 697 Query 1 766 use `test`; flush tables
master-bin.000001 95 Query 1 182 use `test`; create table t1 (a int)
master-bin.000001 182 Query 1 272 use `test`; insert into t1 values (10)
master-bin.000001 272 Query 1 359 use `test`; create table t2 (a int)
master-bin.000001 359 Query 1 469 use `test`; create table t3 (a int) engine=merge union(t1)
master-bin.000001 469 Query 1 556 use `test`; create table t4 (a int)
master-bin.000001 556 Query 1 651 use `test`; insert into t4 select * from t3
master-bin.000001 651 Query 1 746 use `test`; rename table t1 to t5, t2 to t1
master-bin.000001 746 Query 1 822 use `test`; flush tables
select * from t3;
a
......@@ -22,7 +22,7 @@ day id category name
2003-03-22 2416 a bbbbb
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
slave-bin.000001 1068
slave-bin.000001 1096
drop table t1;
drop table t2;
drop table t3;
......@@ -33,7 +33,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
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1503 # # master-bin.000001 Yes Yes 0 0 1503 # None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1559 # # master-bin.000001 Yes Yes 0 0 1559 # None 0 No #
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
......@@ -43,7 +43,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
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1611 # # master-bin.000001 No No 0 0 1611 # None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1667 # # master-bin.000001 No No 0 0 1667 # None 0 No #
set global sql_slave_skip_counter=1;
start slave;
set sql_log_bin=0;
......@@ -64,5 +64,5 @@ terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
ERROR 23000: Duplicate entry '2003-03-22' for key 1
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 529
master-bin.000001 536
drop table t2;
......@@ -12,6 +12,6 @@ use mysqltest;
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 190 drop database if exists mysqltest
master-bin.000001 190 Query 1 277 create database mysqltest
master-bin.000001 95 Query 1 197 drop database if exists mysqltest
master-bin.000001 197 Query 1 291 create database mysqltest
drop database mysqltest;
......@@ -20,24 +20,24 @@ drop table t1;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 210 Intvar 1 238 INSERT_ID=1
master-bin.000001 238 Query 1 323 use `test`; insert into t1 values (NULL)
master-bin.000001 323 Query 1 393 use `test`; drop table t1
master-bin.000001 393 Query 1 490 use `test`; create table t1 (word char(20) not null)
master-bin.000001 490 Create_file 1 1160 db=test;table=t1;file_id=1;block_len=581
master-bin.000001 1160 Exec_load 1 1183 ;file_id=1
master-bin.000001 1183 Query 1 1253 use `test`; drop table t1
master-bin.000001 95 Query 1 217 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 217 Intvar 1 245 INSERT_ID=1
master-bin.000001 245 Query 1 337 use `test`; insert into t1 values (NULL)
master-bin.000001 337 Query 1 414 use `test`; drop table t1
master-bin.000001 414 Query 1 518 use `test`; create table t1 (word char(20) not null)
master-bin.000001 518 Create_file 1 1188 db=test;table=t1;file_id=1;block_len=581
master-bin.000001 1188 Exec_load 1 1211 ;file_id=1
master-bin.000001 1211 Query 1 1288 use `test`; drop table t1
show binlog events from 95 limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 95 Query 1 217 use `test`; create table t1(n int not null auto_increment primary key)
show binlog events from 95 limit 2;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 210 Intvar 1 238 INSERT_ID=1
master-bin.000001 95 Query 1 217 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 217 Intvar 1 245 INSERT_ID=1
show binlog events from 95 limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 238 Query 1 323 use `test`; insert into t1 values (NULL)
master-bin.000001 245 Query 1 337 use `test`; insert into t1 values (NULL)
flush logs;
create table t5 (a int);
drop table t5;
......@@ -50,23 +50,23 @@ drop table t1;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 210 Intvar 1 238 INSERT_ID=1
master-bin.000001 238 Query 1 323 use `test`; insert into t1 values (NULL)
master-bin.000001 323 Query 1 393 use `test`; drop table t1
master-bin.000001 393 Query 1 490 use `test`; create table t1 (word char(20) not null)
master-bin.000001 490 Create_file 1 1160 db=test;table=t1;file_id=1;block_len=581
master-bin.000001 1160 Exec_load 1 1183 ;file_id=1
master-bin.000001 1183 Query 1 1253 use `test`; drop table t1
master-bin.000001 1253 Rotate 1 1297 master-bin.000002;pos=4
master-bin.000001 95 Query 1 217 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 217 Intvar 1 245 INSERT_ID=1
master-bin.000001 245 Query 1 337 use `test`; insert into t1 values (NULL)
master-bin.000001 337 Query 1 414 use `test`; drop table t1
master-bin.000001 414 Query 1 518 use `test`; create table t1 (word char(20) not null)
master-bin.000001 518 Create_file 1 1188 db=test;table=t1;file_id=1;block_len=581
master-bin.000001 1188 Exec_load 1 1211 ;file_id=1
master-bin.000001 1211 Query 1 1288 use `test`; drop table t1
master-bin.000001 1288 Rotate 1 1332 master-bin.000002;pos=4
show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
master-bin.000002 95 Query 1 175 use `test`; create table t5 (a int)
master-bin.000002 175 Query 1 245 use `test`; drop table t5
master-bin.000002 245 Query 1 325 use `test`; create table t1 (n int)
master-bin.000002 325 Query 1 407 use `test`; insert into t1 values (1)
master-bin.000002 407 Query 1 477 use `test`; drop table t1
master-bin.000002 95 Query 1 182 use `test`; create table t5 (a int)
master-bin.000002 182 Query 1 259 use `test`; drop table t5
master-bin.000002 259 Query 1 346 use `test`; create table t1 (n int)
master-bin.000002 346 Query 1 435 use `test`; insert into t1 values (1)
master-bin.000002 435 Query 1 512 use `test`; drop table t1
show binary logs;
Log_name
master-bin.000001
......@@ -79,25 +79,25 @@ slave-bin.000002
show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 4 Format_desc 2 95 Server ver: VERSION, Binlog ver: 4
slave-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
slave-bin.000001 210 Intvar 1 238 INSERT_ID=1
slave-bin.000001 238 Query 1 323 use `test`; insert into t1 values (NULL)
slave-bin.000001 323 Query 1 393 use `test`; drop table t1
slave-bin.000001 393 Query 1 490 use `test`; create table t1 (word char(20) not null)
slave-bin.000001 490 Create_file 1 1169 db=test;table=t1;file_id=1;block_len=581
slave-bin.000001 1169 Exec_load 1 1192 ;file_id=1
slave-bin.000001 1192 Query 1 1262 use `test`; drop table t1
slave-bin.000001 1262 Query 1 1342 use `test`; create table t5 (a int)
slave-bin.000001 1342 Query 1 1412 use `test`; drop table t5
slave-bin.000001 1412 Rotate 2 1455 slave-bin.000002;pos=4
slave-bin.000001 95 Query 1 217 use `test`; create table t1(n int not null auto_increment primary key)
slave-bin.000001 217 Intvar 1 245 INSERT_ID=1
slave-bin.000001 245 Query 1 337 use `test`; insert into t1 values (NULL)
slave-bin.000001 337 Query 1 414 use `test`; drop table t1
slave-bin.000001 414 Query 1 518 use `test`; create table t1 (word char(20) not null)
slave-bin.000001 518 Create_file 1 1197 db=test;table=t1;file_id=1;block_len=581
slave-bin.000001 1197 Exec_load 1 1220 ;file_id=1
slave-bin.000001 1220 Query 1 1297 use `test`; drop table t1
slave-bin.000001 1297 Query 1 1384 use `test`; create table t5 (a int)
slave-bin.000001 1384 Query 1 1461 use `test`; drop table t5
slave-bin.000001 1461 Rotate 2 1504 slave-bin.000002;pos=4
show binlog events in 'slave-bin.000002' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000002 4 Format_desc 2 95 Server ver: VERSION, Binlog ver: 4
slave-bin.000002 95 Query 1 175 use `test`; create table t1 (n int)
slave-bin.000002 175 Query 1 257 use `test`; insert into t1 values (1)
slave-bin.000002 257 Query 1 327 use `test`; drop table t1
slave-bin.000002 95 Query 1 182 use `test`; create table t1 (n int)
slave-bin.000002 182 Query 1 271 use `test`; insert into t1 values (1)
slave-bin.000002 271 Query 1 348 use `test`; drop table t1
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
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 477 # # master-bin.000002 Yes Yes 0 0 477 # None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 512 # # master-bin.000002 Yes Yes 0 0 512 # None 0 No #
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
......@@ -16,7 +16,7 @@ select @@global.max_relay_log_size;
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
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68137 # # master-bin.000001 Yes Yes 0 0 68137 # None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73751 # # master-bin.000001 Yes Yes 0 0 73751 # None 0 No #
stop slave;
reset slave;
set global max_relay_log_size=(5*4096);
......@@ -26,7 +26,7 @@ select @@global.max_relay_log_size;
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
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68137 # # master-bin.000001 Yes Yes 0 0 68137 # None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73751 # # master-bin.000001 Yes Yes 0 0 73751 # None 0 No #
stop slave;
reset slave;
set global max_relay_log_size=0;
......@@ -36,7 +36,7 @@ select @@global.max_relay_log_size;
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
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68137 # # master-bin.000001 Yes Yes 0 0 68137 # None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73751 # # master-bin.000001 Yes Yes 0 0 73751 # None 0 No #
stop slave;
reset slave;
flush logs;
......@@ -49,12 +49,12 @@ flush logs;
create table t1 (a int);
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
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68217 # # master-bin.000001 Yes Yes 0 0 68217 # None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73838 # # master-bin.000001 Yes Yes 0 0 73838 # None 0 No #
flush logs;
drop table t1;
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
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68287 # # master-bin.000001 Yes Yes 0 0 68287 # None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73915 # # master-bin.000001 Yes Yes 0 0 73915 # None 0 No #
flush logs;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
......
......@@ -18,5 +18,5 @@ max(a)
8000
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
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 687207 # # master-bin.000001 Yes Yes 0 0 687207 # None 0 No #
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 743228 # # master-bin.000001 Yes Yes 0 0 743228 # None 0 No #
drop table t1;
......@@ -28,4 +28,4 @@ ERROR 42S02: Table 'test.t11' doesn't exist
drop table if exists t1,t2,t11;
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
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1554 # # master-bin.000001 Yes Yes test.t1 0 0 1554 # None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1617 # # master-bin.000001 Yes Yes test.t1 0 0 1617 # None 0 No #
......@@ -16,7 +16,7 @@ create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
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
# 127.0.0.1 root MASTER_PORT 60 master-bin.000001 521 # # master-bin.000001 Yes Yes 0 0 521 # None 0 No #
# 127.0.0.1 root MASTER_PORT 60 master-bin.000001 549 # # master-bin.000001 Yes Yes 0 0 549 # None 0 No #
select * from t1;
s
Could not break slave
......@@ -57,7 +57,7 @@ master-bin.000003
insert into t2 values (65);
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
# 127.0.0.1 root MASTER_PORT 60 master-bin.000003 469 # # master-bin.000003 Yes Yes 0 0 469 # None 0 No #
# 127.0.0.1 root MASTER_PORT 60 master-bin.000003 497 # # master-bin.000003 Yes Yes 0 0 497 # None 0 No #
select * from t2;
m
34
......@@ -79,13 +79,13 @@ master-bin.000004
master-bin.000005
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000005 1387
master-bin.000005 2050
select * from t4;
a
testing temporary tables part 2
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
# 127.0.0.1 root MASTER_PORT 60 master-bin.000005 1387 # # master-bin.000005 Yes Yes 0 0 1387 # None 0 No #
# 127.0.0.1 root MASTER_PORT 60 master-bin.000005 2050 # # master-bin.000005 Yes Yes 0 0 2050 # None 0 No #
lock tables t3 read;
select count(*) from t3 where n >= 4;
count(*)
......
......@@ -39,18 +39,18 @@ f
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
master-bin.000001 95 Query 1 178 use `test`; drop table if exists t1,t2
master-bin.000001 178 Query 1 257 use `test`; create table t1(f int)
master-bin.000001 257 Query 1 336 use `test`; create table t2(f int)
master-bin.000001 336 Query 1 455 use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)
master-bin.000001 455 Query 1 544 use `test`; create temporary table t3(f int)
master-bin.000001 544 Query 1 642 use `test`; insert into t3 select * from t1 where f<6
master-bin.000001 642 Query 1 731 use `test`; create temporary table t3(f int)
master-bin.000001 731 Query 1 826 use `test`; insert into t2 select count(*) from t3
master-bin.000001 826 Query 1 925 use `test`; insert into t3 select * from t1 where f>=4
master-bin.000001 925 Query 1 1005 use `test`; drop temporary table t3
master-bin.000001 1005 Query 1 1100 use `test`; insert into t2 select count(*) from t3
master-bin.000001 1100 Query 1 1180 use `test`; drop temporary table t3
master-bin.000001 95 Query 1 185 use `test`; drop table if exists t1,t2
master-bin.000001 185 Query 1 271 use `test`; create table t1(f int)
master-bin.000001 271 Query 1 357 use `test`; create table t2(f int)
master-bin.000001 357 Query 1 483 use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)
master-bin.000001 483 Query 1 579 use `test`; create temporary table t3(f int)
master-bin.000001 579 Query 1 684 use `test`; insert into t3 select * from t1 where f<6
master-bin.000001 684 Query 1 780 use `test`; create temporary table t3(f int)
master-bin.000001 780 Query 1 882 use `test`; insert into t2 select count(*) from t3
master-bin.000001 882 Query 1 988 use `test`; insert into t3 select * from t1 where f>=4
master-bin.000001 988 Query 1 1075 use `test`; drop temporary table t3
master-bin.000001 1075 Query 1 1177 use `test`; insert into t2 select count(*) from t3
master-bin.000001 1177 Query 1 1264 use `test`; drop temporary table t3
drop table t1, t2;
use test;
SET TIMESTAMP=1040323920;
......
......@@ -33,12 +33,12 @@ t
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
master-bin.000001 95 Query 1 181 use `test`; create table t1 (t timestamp)
master-bin.000001 181 Query 1 266 use `test`; create table t2 (t char(32))
master-bin.000001 266 Query 1 351 use `test`; SET ONE_SHOT TIME_ZONE='UTC'
master-bin.000001 351 Query 1 468 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
master-bin.000001 468 Query 1 539 use `test`; delete from t1
master-bin.000001 539 Query 1 656 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
master-bin.000001 95 Query 1 188 use `test`; create table t1 (t timestamp)
master-bin.000001 188 Query 1 280 use `test`; create table t2 (t char(32))
master-bin.000001 280 Query 1 372 use `test`; SET ONE_SHOT TIME_ZONE='UTC'
master-bin.000001 372 Query 1 496 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
master-bin.000001 496 Query 1 574 use `test`; delete from t1
master-bin.000001 574 Query 1 698 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
set time_zone='MET';
insert into t2 (select t from t1);
select * from t1;
......
......@@ -76,34 +76,35 @@ abcn1n2
NULL
NULL
NULL
show binlog events from 179;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 179 User var 2 222 @`i1`=12345678901234
slave-bin.000001 222 User var 2 265 @`i2`=-12345678901234
slave-bin.000001 265 User var 2 308 @`i3`=0
slave-bin.000001 308 User var 2 351 @`i4`=-1
slave-bin.000001 351 Query 1 456 use `test`; insert into t1 values (@i1), (@i2), (@i3), (@i4)
slave-bin.000001 456 User var 2 499 @`r1`=12.5
slave-bin.000001 499 User var 2 542 @`r2`=-12.5
slave-bin.000001 542 Query 1 633 use `test`; insert into t1 values (@r1), (@r2)
slave-bin.000001 633 User var 2 682 @`s1`=_latin1 0x5468697320697320612074657374 COLLATE latin1_swedish_ci
slave-bin.000001 682 User var 2 717 @`s2`=_latin1 "" COLLATE latin1_swedish_ci
slave-bin.000001 717 User var 2 759 @`s3`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
slave-bin.000001 759 User var 2 801 @`s4`=_latin1 0x6162635C646566 COLLATE latin1_swedish_ci
slave-bin.000001 801 User var 2 843 @`s5`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
slave-bin.000001 843 Query 1 955 use `test`; insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5)
slave-bin.000001 955 User var 2 981 @`n1`=NULL
slave-bin.000001 981 Query 1 1065 use `test`; insert into t1 values (@n1)
slave-bin.000001 1065 User var 2 1091 @`n2`=NULL
slave-bin.000001 1091 Query 1 1175 use `test`; insert into t1 values (@n2)
slave-bin.000001 1175 Query 1 1285 use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1)
slave-bin.000001 1285 User var 2 1327 @`a`=2
slave-bin.000001 1327 Query 1 1421 use `test`; insert into t1 values (@a+(@b:=@a+1))
slave-bin.000001 1421 User var 2 1458 @`q`=_latin1 0x616263 COLLATE latin1_swedish_ci
slave-bin.000001 1458 Query 1 1584 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'))
slave-bin.000001 1584 User var 2 1626 @`a`=5
slave-bin.000001 1626 Query 1 1714 use `test`; insert into t1 values (@a),(@a)
slave-bin.000001 1714 User var 2 1739 @`a`=NULL
slave-bin.000001 1739 Query 1 1834 use `test`; insert into t1 values (@a),(@a),(@a*5)
slave-bin.000001 95 Query 1 186 use `test`; create table t1(n char(30))
slave-bin.000001 186 User var 2 229 @`i1`=12345678901234
slave-bin.000001 229 User var 2 272 @`i2`=-12345678901234
slave-bin.000001 272 User var 2 315 @`i3`=0
slave-bin.000001 315 User var 2 358 @`i4`=-1
slave-bin.000001 358 Query 1 470 use `test`; insert into t1 values (@i1), (@i2), (@i3), (@i4)
slave-bin.000001 470 User var 2 513 @`r1`=12.5
slave-bin.000001 513 User var 2 556 @`r2`=-12.5
slave-bin.000001 556 Query 1 654 use `test`; insert into t1 values (@r1), (@r2)
slave-bin.000001 654 User var 2 703 @`s1`=_latin1 0x5468697320697320612074657374 COLLATE latin1_swedish_ci
slave-bin.000001 703 User var 2 738 @`s2`=_latin1 "" COLLATE latin1_swedish_ci
slave-bin.000001 738 User var 2 780 @`s3`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
slave-bin.000001 780 User var 2 822 @`s4`=_latin1 0x6162635C646566 COLLATE latin1_swedish_ci
slave-bin.000001 822 User var 2 864 @`s5`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
slave-bin.000001 864 Query 1 983 use `test`; insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5)
slave-bin.000001 983 User var 2 1009 @`n1`=NULL
slave-bin.000001 1009 Query 1 1100 use `test`; insert into t1 values (@n1)
slave-bin.000001 1100 User var 2 1126 @`n2`=NULL
slave-bin.000001 1126 Query 1 1217 use `test`; insert into t1 values (@n2)
slave-bin.000001 1217 Query 1 1334 use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1)
slave-bin.000001 1334 User var 2 1376 @`a`=2
slave-bin.000001 1376 Query 1 1477 use `test`; insert into t1 values (@a+(@b:=@a+1))
slave-bin.000001 1477 User var 2 1514 @`q`=_latin1 0x616263 COLLATE latin1_swedish_ci
slave-bin.000001 1514 Query 1 1647 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'))
slave-bin.000001 1647 User var 2 1689 @`a`=5
slave-bin.000001 1689 Query 1 1784 use `test`; insert into t1 values (@a),(@a)
slave-bin.000001 1784 User var 2 1809 @`a`=NULL
slave-bin.000001 1809 Query 1 1911 use `test`; insert into t1 values (@a),(@a),(@a*5)
drop table t1;
stop slave;
......@@ -177,16 +177,17 @@ insert into t1 values (@var1),(@var2);
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 User var 1 136 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
master-bin.000001 136 Query 1 222 use `test`; INSERT INTO t1 VALUES(@`a b`)
master-bin.000001 222 User var 1 264 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
master-bin.000001 264 User var 1 302 @`var2`=_latin1 0x61 COLLATE latin1_swedish_ci
master-bin.000001 302 Query 1 396 use `test`; insert into t1 values (@var1),(@var2)
master-bin.000001 136 Query 1 229 use `test`; INSERT INTO t1 VALUES(@`a b`)
master-bin.000001 229 User var 1 271 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
master-bin.000001 271 User var 1 309 @`var2`=_latin1 0x61 COLLATE latin1_swedish_ci
master-bin.000001 309 Query 1 410 use `test`; insert into t1 values (@var1),(@var2)
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`;
use test;
SET TIMESTAMP=10000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
INSERT INTO t1 VALUES(@`a b`);
SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`;
SET @`var2`:=_latin1 0x61 COLLATE `latin1_swedish_ci`;
......
# Replication of character sets.
# This test will fail if the server/client does not support enough charsets.
# Remember that there currently exists
# Bug #2326: Charset of table is determined by charset of db only if "USE db;"
source include/master-slave.inc;
--disable_warnings
set timestamp=1000000000;
drop database if exists mysqltest2;
drop database if exists mysqltest3;
--enable_warnings
......@@ -46,7 +44,7 @@ set character_set_client=cp850, collation_connection=latin2_croatian_ci;
insert into t1 (b) values(@@character_set_server);
insert into t1 (b) values(@@collation_server);
# character_set_database and collation_database are not tested as they
# are not replicated (Bar said that this variable may be removed shortly).
# needn't be replicated (Bar said in Jan 2005).
insert into t1 (b) values(@@character_set_client);
# collation_client does not exist
insert into t1 (b) values(@@character_set_connection);
......@@ -79,9 +77,10 @@ select "--- --slave--" as "";
--enable_query_log
select * from mysqltest2.t1 order by a;
# See if SET ONE_SHOT gets into binlog when LOAD DATA
connection master;
load data infile '../../std_data/words.dat' into table t1 (b);
# Presently charset info is not logged with LOAD DATA but it will
# change in Jan 2005 when Dmitri pushes his new LOAD DATA,
# before 5.0.3 goes out. When done, LOAD DATA INFILE should be tested
# here.
# See if user var is prefixed with collation in binlog and replicated well.
# Note: replication of user variables is broken as far as derivation is
......@@ -90,6 +89,7 @@ load data infile '../../std_data/words.dat' into table t1 (b);
# know if the collation was explicit or not, so we use DERIVATION_NONE,
# which provokes error messages (like 'Illegal mix of collation') when
# we replay the master's INSERT/etc statements.
connection master;
set @a= _cp850 'Mller' collate cp850_general_ci;
truncate table t1;
insert into t1 (b) values(collation(@a));
......@@ -110,13 +110,13 @@ drop database mysqltest3;
show binlog events from 95;
sync_slave_with_master;
# Check that we can't change global.collation_server
# Check that we can change global.collation_server (since 5.0.3)
error 1387;
set global character_set_server=latin2;
set global character_set_server=latin1; # back
connection master;
error 1387;
set global character_set_server=latin2;
set global character_set_server=latin1; # back
# Check that SET ONE_SHOT is really one shot
......@@ -150,35 +150,9 @@ select hex(c1), hex(c2) from t1;
sync_slave_with_master;
select hex(c1), hex(c2) from t1;
# Now test for BUG##5705: SET CHARACTER_SET_SERVER etc will be lost if
# STOP SLAVE before following query
stop slave;
delete from t1;
# Slave is now supposed to have stopped _after_ the INSERT
# Note that the following positions may change between MySQL versions!
# This position should be position for the SET ONE SHOT CHARACTER_SET_CLIENT
# command just before the INSERT.
# You can find it by doing:
# ../client/mysqlbinlog var/log/master-bin.000001 | grep -3 CHARACTER_SET | tail -7
change master to master_log_pos=6809;
# This position should be position of the INSERT command.
# You can find it by doing:
#
# ../client/mysqlbinlog var/log/master-bin.000001 | grep -3 INSERT | tail -4
start slave until master_log_file='master-bin.000001', master_log_pos=6967;
# Slave is supposed to stop _after_ the INSERT, even though 'master_log_pos' is
# the position of the beginning of the INSERT; after SET slave is not
# supposed to increment position.
wait_for_slave_to_stop;
start slave;
sync_with_master;
select hex(c1), hex(c2) from t1;
connection master;
# Let's have a look at generated SETs.
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
drop table t1;
sync_slave_with_master;
......@@ -46,7 +46,7 @@ save_master_pos;
connection slave;
sync_with_master;
select * from t1;
show binlog events from 179;
show binlog events from 95;
connection master;
drop table t1;
save_master_pos;
......
......@@ -1346,7 +1346,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
if (thd)
{
/* NOTE: CHARSET AND TZ REPL WILL BE REWRITTEN SHORTLY */
#if MYSQL_VERSION_ID < 50003
/*
To make replication of charsets working in 4.1 we are writing values
of charset related variables before every statement in the binlog,
......@@ -1375,9 +1375,15 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u",
if (e.write(file))
goto err;
}
#endif
/*
We use the same ONE_SHOT trick for making replication of time zones
working in 4.1. Again in 5.0 we have better means for doing this.
TODO: we should do like we now do with charsets (no more ONE_SHOT;
logging in each event in a compact format). Dmitri says we can do:
if (time_zone_used) write the timezone to binlog (in a format to be
defined).
*/
if (thd->time_zone_used &&
thd->variables.time_zone != global_system_variables.time_zone)
......
......@@ -953,7 +953,13 @@ void Query_log_event::pack_info(Protocol *protocol)
bool Query_log_event::write(IO_CACHE* file)
{
uchar buf[QUERY_HEADER_LEN+1+4+1+8+1+1+FN_REFLEN+5], *start, *start_of_status;
uchar buf[QUERY_HEADER_LEN+
1+4+ // code of flags2 and flags2
1+8+ // code of sql_mode and sql_mode
1+1+FN_REFLEN+ // code of catalog and catalog length and catalog
1+4+ // code of autoinc and the 2 autoinc variables
1+6 // code of charset and charset
], *start, *start_of_status;
ulong event_length;
if (!query)
......@@ -1048,9 +1054,15 @@ bool Query_log_event::write(IO_CACHE* file)
int2store(start+2, auto_increment_offset);
start+= 4;
}
if (charset_inited)
{
*(start++)= Q_CHARSET_CODE;
memcpy(start, charset, 6);
start+= 6;
}
/*
Here there could be code like
if (command-line-option-which-says-"log_this_variable")
if (command-line-option-which-says-"log_this_variable" && inited)
{
*(start++)= Q_THIS_VARIABLE_CODE;
int4store(start, this_variable);
......@@ -1095,7 +1107,7 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
thread_id(thd_arg->thread_id),
/* save the original thread id; we already know the server id */
slave_proxy_id(thd_arg->variables.pseudo_thread_id),
flags2_inited(1), sql_mode_inited(1), flags2(0),
flags2_inited(1), sql_mode_inited(1), charset_inited(1),
sql_mode(thd_arg->variables.sql_mode),
auto_increment_increment(thd_arg->variables.auto_increment_increment),
auto_increment_offset(thd_arg->variables.auto_increment_offset)
......@@ -1104,7 +1116,7 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
time(&end_time);
exec_time = (ulong) (end_time - thd->start_time);
catalog_len = (catalog) ? (uint32) strlen(catalog) : 0;
status_vars_len= 1+4+1+8+1+1+catalog_len+1;
/* status_vars_len is set just before writing the event */
db_len = (db) ? (uint32) strlen(db) : 0;
/*
If we don't use flags2 for anything else than options contained in
......@@ -1114,7 +1126,12 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
we will probably want to reclaim the 29 bits. So we need the &.
*/
flags2= thd_arg->options & OPTIONS_WRITTEN_TO_BIN_LOG;
DBUG_ASSERT(thd->variables.character_set_client->number < 256*256);
DBUG_ASSERT(thd->variables.collation_connection->number < 256*256);
DBUG_ASSERT(thd->variables.collation_server->number < 256*256);
int2store(charset, thd_arg->variables.character_set_client->number);
int2store(charset+2, thd_arg->variables.collation_connection->number);
int2store(charset+4, thd_arg->variables.collation_server->number);
DBUG_PRINT("info",("Query_log_event has flags2=%lu sql_mode=%lu",flags2,sql_mode));
}
#endif /* MYSQL_CLIENT */
......@@ -1129,7 +1146,8 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
const Format_description_log_event *description_event)
:Log_event(buf, description_event), data_buf(0), query(NullS), catalog(NullS),
db(NullS), catalog_len(0), status_vars_len(0),
flags2_inited(0), sql_mode_inited(0)
flags2_inited(0), sql_mode_inited(0), charset_inited(0),
auto_increment_increment(1), auto_increment_offset(1)
{
ulong data_len;
uint32 tmp;
......@@ -1156,8 +1174,6 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
exec_time = uint4korr(buf + Q_EXEC_TIME_OFFSET);
db_len = (uint)buf[Q_DB_LEN_OFFSET];
error_code = uint2korr(buf + Q_ERR_CODE_OFFSET);
/* If auto_increment is not set by query_event, they should not be used */
auto_increment_increment= auto_increment_offset= 1;
/*
5.0 format starts here.
......@@ -1216,6 +1232,13 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
auto_increment_offset= uint2korr(pos+2);
pos+= 4;
break;
case Q_CHARSET_CODE:
{
charset_inited= 1;
memcpy(charset, pos, 6);
pos+= 6;
break;
}
default:
/* That's why you must write status vars in growing order of code */
DBUG_PRINT("info",("Query_log_event has unknown status vars (first has\
......@@ -1348,6 +1371,27 @@ void Query_log_event::print(FILE* file, bool short_form,
last_event_info->auto_increment_offset= auto_increment_offset;
}
if (likely(charset_inited))
{
if (unlikely(!last_event_info->charset_inited)) /* first Query event */
{
last_event_info->charset_inited= 1;
last_event_info->charset[0]= ~charset[0]; // force a difference to force write
}
if (unlikely(bcmp(last_event_info->charset, charset, 6)))
{
fprintf(file,"SET "
"@@session.character_set_client=%d,"
"@@session.collation_connection=%d,"
"@@session.collation_server=%d"
";\n",
uint2korr(charset),
uint2korr(charset+2),
uint2korr(charset+4));
memcpy(last_event_info->charset, charset, 6);
}
}
my_fwrite(file, (byte*) query, q_len, MYF(MY_NABP | MY_WME));
fputs(";\n", file);
}
......@@ -1400,34 +1444,64 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
thd->variables.pseudo_thread_id= thread_id; // for temp tables
mysql_log.write(thd,COM_QUERY,"%s",thd->query);
DBUG_PRINT("query",("%s",thd->query));
if (flags2_inited)
/*
all bits of thd->options which are 1 in OPTIONS_WRITTEN_TO_BIN_LOG must
take their value from flags2.
*/
thd->options= flags2|(thd->options & ~(ulong)OPTIONS_WRITTEN_TO_BIN_LOG);
/*
else, we are in a 3.23/4.0 binlog; we previously received a
Rotate_log_event which reset thd->options and sql_mode, so nothing to do.
*/
/*
We do not replicate IGNORE_DIR_IN_CREATE. That is, if the master is a
slave which runs with SQL_MODE=IGNORE_DIR_IN_CREATE, this should not
force us to ignore the dir too. Imagine you are a ring of machines, and
one has a disk problem so that you temporarily need IGNORE_DIR_IN_CREATE
on this machine; you don't want it to propagate elsewhere (you don't want
all slaves to start ignoring the dirs).
*/
if (sql_mode_inited)
thd->variables.sql_mode=
(ulong) ((thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) |
(sql_mode & ~(ulong) MODE_NO_DIR_IN_CREATE));
if (ignored_error_code((expected_error= error_code)) ||
!check_expected_error(thd,rli,expected_error))
{
if (flags2_inited)
/*
all bits of thd->options which are 1 in OPTIONS_WRITTEN_TO_BIN_LOG must
take their value from flags2.
*/
thd->options= flags2|(thd->options & ~(ulong)OPTIONS_WRITTEN_TO_BIN_LOG);
/*
else, we are in a 3.23/4.0 binlog; we previously received a
Rotate_log_event which reset thd->options and sql_mode etc, so nothing to do.
*/
/*
We do not replicate IGNORE_DIR_IN_CREATE. That is, if the master is a
slave which runs with SQL_MODE=IGNORE_DIR_IN_CREATE, this should not
force us to ignore the dir too. Imagine you are a ring of machines, and
one has a disk problem so that you temporarily need IGNORE_DIR_IN_CREATE
on this machine; you don't want it to propagate elsewhere (you don't want
all slaves to start ignoring the dirs).
*/
if (sql_mode_inited)
thd->variables.sql_mode=
(ulong) ((thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) |
(sql_mode & ~(ulong) MODE_NO_DIR_IN_CREATE));
if (charset_inited)
{
if (rli->cached_charset_compare(charset))
{
/* Verify that we support the charsets found in the event. */
if (!(thd->variables.character_set_client=
get_charset(uint2korr(charset), MYF(MY_WME))) ||
!(thd->variables.collation_connection=
get_charset(uint2korr(charset+2), MYF(MY_WME))) ||
!(thd->variables.collation_server=
get_charset(uint2korr(charset+4), MYF(MY_WME))))
{
/*
We updated the thd->variables with nonsensical values (0), and the
thread is not guaranteed to terminate now (as it may be configured
to ignore EE_UNKNOWN_CHARSET);if we're going to execute a next
statement we'll have a new charset info with it, so no problem to
have stored 0 in thd->variables. But we invalidate cached
charset to force a check next time (otherwise if next time
charset is unknown again we won't detect it).
*/
rli->cached_charset_invalidate();
goto compare_errors;
}
thd->update_charset(); // for the charset change to take effect
}
}
/* Execute the query (note that we bypass dispatch_command()) */
mysql_parse(thd, thd->query, q_len);
}
else
{
/*
......@@ -1452,6 +1526,8 @@ START SLAVE; . Query: '%s'", expected_error, thd->query);
}
goto end;
}
compare_errors:
/*
If we expected a non-zero error code, and we don't get the same error
......@@ -1666,12 +1742,7 @@ bool Start_log_event_v3::write(IO_CACHE* file)
int Start_log_event_v3::exec_event(struct st_relay_log_info* rli)
{
DBUG_ENTER("Start_log_event_v3::exec_event");
/*
If the I/O thread has not started, mi->old_format is BINLOG_FORMAT_CURRENT
(that's what the MASTER_INFO constructor does), so the test below is not
perfect at all.
*/
switch (rli->relay_log.description_event_for_exec->binlog_version)
switch (binlog_version)
{
case 3:
case 4:
......@@ -2789,14 +2860,24 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
rli->group_master_log_name,
(ulong) rli->group_master_log_pos));
/*
Reset thd->options and sql_mode, because this could be the signal of a
master's downgrade from 5.0 to 4.0.
Reset thd->options and sql_mode etc, because this could be the signal of
a master's downgrade from 5.0 to 4.0.
However, no need to reset description_event_for_exec: indeed, if the next
master is 5.0 (even 5.0.1) we will soon get a Format_desc; if the next
master is 4.0 then the events are in the slave's format (conversion).
*/
set_slave_thread_options(thd);
thd->variables.sql_mode= global_system_variables.sql_mode;
thd->variables.auto_increment_increment=
thd->variables.auto_increment_offset= 1;
thd->variables.character_set_client=
global_system_variables.character_set_client;
thd->variables.collation_connection=
global_system_variables.collation_connection;
thd->variables.collation_server=
global_system_variables.collation_server;
thd->update_charset();
rli->cached_charset_invalidate();
}
pthread_mutex_unlock(&rli->data_lock);
pthread_cond_broadcast(&rli->data_cond);
......
......@@ -232,6 +232,7 @@ struct sql_ex_info
#define Q_SQL_MODE_CODE 1
#define Q_CATALOG_CODE 2
#define Q_AUTO_INCREMENT 3
#define Q_CHARSET_CODE 4
/* Intvar event post-header */
......@@ -401,11 +402,19 @@ typedef struct st_last_event_info
bool sql_mode_inited;
ulong sql_mode; /* must be same as THD.variables.sql_mode */
ulong auto_increment_increment, auto_increment_offset;
bool charset_inited;
char charset[6]; // 3 variables, each of them storable in 2 bytes
st_last_event_info()
:flags2_inited(0), flags2(0), sql_mode_inited(0), sql_mode(0),
auto_increment_increment(1),auto_increment_offset(1)
:flags2_inited(0), sql_mode_inited(0),
auto_increment_increment(1),auto_increment_offset(1), charset_inited(0)
{
db[0]= 0; /* initially, the db is unknown */
/*
Currently we only use static LAST_EVENT_INFO objects, so zeroed at
program's startup, but these explicit bzero() is for the day someone
creates dynamic instances.
*/
bzero(db, sizeof(db));
bzero(charset, sizeof(charset));
}
} LAST_EVENT_INFO;
#endif
......@@ -634,7 +643,7 @@ class Query_log_event: public Log_event
status_vars on disk is a sequence of pairs (code, value) where 'code' means
'sql_mode', 'affected' etc. Sometimes 'value' must be a short string, so
its first byte is its length. For now the order of status vars is:
flags2 - sql_mode - catalog.
flags2 - sql_mode - catalog - autoinc - charset
We should add the same thing to Load_log_event, but in fact
LOAD DATA INFILE is going to be logged with a new type of event (logging of
the plain text query), so Load_log_event would be frozen, so no need. The
......@@ -655,11 +664,13 @@ class Query_log_event: public Log_event
*/
bool flags2_inited;
bool sql_mode_inited;
bool charset_inited;
uint32 flags2;
/* In connections sql_mode is 32 bits now but will be 64 bits soon */
ulong sql_mode;
ulong auto_increment_increment, auto_increment_offset;
char charset[6];
#ifndef MYSQL_CLIENT
......
......@@ -285,6 +285,12 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
#define MODE_TRADITIONAL (MODE_ERROR_FOR_DIVISION_BY_ZERO*2)
#define MODE_NO_AUTO_CREATE_USER (MODE_TRADITIONAL*2)
#define MODE_HIGH_NOT_PRECEDENCE (MODE_NO_AUTO_CREATE_USER*2)
/*
Replication uses 8 bytes to store SQL_MODE in the binary log. The day you
use strictly more than 64 bits by adding one more define above, you should
contact the replication team because the replication code should then be
updated (to store more bytes on disk).
*/
#define RAID_BLOCK_SIZE 1024
......
......@@ -2047,9 +2047,15 @@ void sys_var_character_set_server::set_default(THD *thd, enum_var_type type)
}
}
#if defined(HAVE_REPLICATION)
#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50003)
bool sys_var_character_set_server::check(THD *thd, set_var *var)
{
/*
To be perfect we should fail even if we are a 5.0.3 slave, a 4.1 master,
and user wants to change our global character set variables. Because
replicating a 4.1 assumes those are not changed. But that's not easy to
do.
*/
if ((var->type == OPT_GLOBAL) &&
(mysql_bin_log.is_open() ||
active_mi->slave_running || active_mi->rli.slave_running))
......@@ -2154,7 +2160,7 @@ void sys_var_collation_database::set_default(THD *thd, enum_var_type type)
}
}
#if defined(HAVE_REPLICATION)
#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50003)
bool sys_var_collation_server::check(THD *thd, set_var *var)
{
if ((var->type == OPT_GLOBAL) &&
......
......@@ -564,7 +564,7 @@ class sys_var_character_set_server :public sys_var_character_set
public:
sys_var_character_set_server(const char *name_arg) :
sys_var_character_set(name_arg) {}
#if defined(HAVE_REPLICATION)
#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50003)
bool check(THD *thd, set_var *var);
#endif
void set_default(THD *thd, enum_var_type type);
......@@ -602,7 +602,7 @@ class sys_var_collation_server :public sys_var_collation
{
public:
sys_var_collation_server(const char *name_arg) :sys_var_collation(name_arg) {}
#if defined(HAVE_REPLICATION)
#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50003)
bool check(THD *thd, set_var *var);
#endif
bool update(THD *thd, set_var *var);
......
......@@ -660,13 +660,14 @@ int terminate_slave_thread(THD* thd, pthread_mutex_t* term_lock,
pthread_cond_t* term_cond,
volatile uint *slave_running)
{
DBUG_ENTER("terminate_slave_thread");
if (term_lock)
{
pthread_mutex_lock(term_lock);
if (!*slave_running)
{
pthread_mutex_unlock(term_lock);
return ER_SLAVE_NOT_RUNNING;
DBUG_RETURN(ER_SLAVE_NOT_RUNNING);
}
}
DBUG_ASSERT(thd != 0);
......@@ -678,6 +679,7 @@ int terminate_slave_thread(THD* thd, pthread_mutex_t* term_lock,
while (*slave_running) // Should always be true
{
DBUG_PRINT("loop", ("killing slave thread"));
KICK_SLAVE(thd);
/*
There is a small chance that slave thread might miss the first
......@@ -689,7 +691,7 @@ int terminate_slave_thread(THD* thd, pthread_mutex_t* term_lock,
}
if (term_lock)
pthread_mutex_unlock(term_lock);
return 0;
DBUG_RETURN(0);
}
......@@ -1418,13 +1420,20 @@ not always make sense; please check the manual before using it).";
values of these 2 are never used (new connections don't use them).
We don't test equality of global collation_database either as it's is
going to be deprecated (made read-only) in 4.1 very soon.
We don't do it for <3.23.57 because masters <3.23.50 hang on
SELECT @@unknown_var (BUG#7965 - see changelog of 3.23.50).
The test is only relevant if master < 5.0.3 (we'll test only if it's older
than the 5 branch; < 5.0.3 was alpha...), as >= 5.0.3 master stores
charset info in each binlog event.
We don't do it for 3.23 because masters <3.23.50 hang on
SELECT @@unknown_var (BUG#7965 - see changelog of 3.23.50). So finally we
test only if master is 4.x.
*/
if (strncmp(mi->rli.relay_log.description_event_for_queue->server_version,
"3.23.57",7) < 0)
/* redundant with rest of code but safer against later additions */
if (*mysql->server_version == '3')
goto err;
if (!mysql_real_query(mysql, "SELECT @@GLOBAL.COLLATION_SERVER", 32) &&
if ((*mysql->server_version == '4') &&
!mysql_real_query(mysql, "SELECT @@GLOBAL.COLLATION_SERVER", 32) &&
(master_res= mysql_store_result(mysql)))
{
if ((master_row= mysql_fetch_row(master_res)) &&
......@@ -1447,8 +1456,12 @@ be equal for replication to work";
such check will broke everything for them. (And now everything will
work for them because by default both their master and slave will have
'SYSTEM' time zone).
TODO: when the new replication of timezones is sorted out with Dmitri,
change >= '4' to == '4'.
*/
if (!mysql_real_query(mysql, "SELECT @@GLOBAL.TIME_ZONE", 25) &&
if ((*mysql->server_version >= '4') &&
!mysql_real_query(mysql, "SELECT @@GLOBAL.TIME_ZONE", 25) &&
(master_res= mysql_store_result(mysql)))
{
if ((master_row= mysql_fetch_row(master_res)) &&
......@@ -2527,6 +2540,7 @@ st_relay_log_info::st_relay_log_info()
bzero((char*) &info_file, sizeof(info_file));
bzero((char*) &cache_buf, sizeof(cache_buf));
cached_charset_invalidate();
pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&log_space_lock, MY_MUTEX_INIT_FAST);
......@@ -3078,6 +3092,24 @@ bool st_relay_log_info::is_until_satisfied()
}
void st_relay_log_info::cached_charset_invalidate()
{
/* Full of zeroes means uninitialized. */
bzero(cached_charset, sizeof(cached_charset));
}
bool st_relay_log_info::cached_charset_compare(char *charset)
{
if (bcmp(cached_charset, charset, sizeof(cached_charset)))
{
memcpy(cached_charset, charset, sizeof(cached_charset));
return 1;
}
return 0;
}
static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
{
/*
......@@ -3722,6 +3754,8 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
DBUG_PRINT("info",("Signaling possibly waiting master_pos_wait() functions"));
pthread_cond_broadcast(&rli->data_cond);
rli->ignore_log_space_limit= 0; /* don't need any lock */
/* we die so won't remember charset - re-update them on next thread start */
rli->cached_charset_invalidate();
rli->save_temporary_tables = thd->temporary_tables;
/*
......
......@@ -291,6 +291,8 @@ typedef struct st_relay_log_info
UNTIL_LOG_NAMES_CMP_UNKNOWN= -2, UNTIL_LOG_NAMES_CMP_LESS= -1,
UNTIL_LOG_NAMES_CMP_EQUAL= 0, UNTIL_LOG_NAMES_CMP_GREATER= 1
} until_log_names_cmp_result;
char cached_charset[6];
st_relay_log_info();
~st_relay_log_info();
......@@ -334,6 +336,14 @@ typedef struct st_relay_log_info
return ((until_condition == UNTIL_MASTER_POS) ? group_master_log_pos :
group_relay_log_pos);
}
/*
Last charset (6 bytes) seen by slave SQL thread is cached here; it helps
the thread save 3 get_charset() per Query_log_event if the charset is not
changing from event to event (common situation).
When the 6 bytes are equal to 0 is used to mean "cache is invalidated".
*/
void cached_charset_invalidate();
bool cached_charset_compare(char *charset);
} RELAY_LOG_INFO;
......
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