mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
Now merge is done.
For previous commit I had run only rpl* tests, here the other ones had a few surprises. Latest status: - all tests pass - all replication tests pass with Valgrind This is the final-final commit & push. Doc remains.
This commit is contained in:
parent
1333f636ae
commit
d67bbe72c2
8 changed files with 184 additions and 112 deletions
|
@ -449,12 +449,17 @@ static void dump_log_entries(const char* logname)
|
|||
dump_local_log_entries(logname);
|
||||
}
|
||||
|
||||
static int check_master_version(MYSQL* mysql)
|
||||
/*
|
||||
This is not as smart as check_header() (used for local log); it will not work
|
||||
for a binlog which mixes format. TODO: fix this.
|
||||
*/
|
||||
static int check_master_version(MYSQL* mysql,
|
||||
Format_description_log_event
|
||||
**description_event)
|
||||
{
|
||||
MYSQL_RES* res = 0;
|
||||
MYSQL_ROW row;
|
||||
const char* version;
|
||||
int old_format = 0;
|
||||
|
||||
if (mysql_query(mysql, "SELECT VERSION()") ||
|
||||
!(res = mysql_store_result(mysql)))
|
||||
|
@ -479,11 +484,18 @@ static int check_master_version(MYSQL* mysql)
|
|||
|
||||
switch (*version) {
|
||||
case '3':
|
||||
old_format = 1;
|
||||
*description_event= new Format_description_log_event(1);
|
||||
break;
|
||||
case '4':
|
||||
*description_event= new Format_description_log_event(3);
|
||||
case '5':
|
||||
old_format = 0;
|
||||
/*
|
||||
The server is soon going to send us its Format_description log
|
||||
event, unless it is a 5.0 server with 3.23 or 4.0 binlogs.
|
||||
So we first assume that this is 4.0 (which is enough to read the
|
||||
Format_desc event if one comes).
|
||||
*/
|
||||
*description_event= new Format_description_log_event(3);
|
||||
break;
|
||||
default:
|
||||
sql_print_error("Master reported unrecognized MySQL version '%s'",
|
||||
|
@ -493,24 +505,29 @@ static int check_master_version(MYSQL* mysql)
|
|||
return 1;
|
||||
}
|
||||
mysql_free_result(res);
|
||||
return old_format;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
TODO fix this for new format (like local log); this will be done when 4.0 is
|
||||
merged here (Victor's fixes are needed to make dump_remote_log_entries()
|
||||
work).
|
||||
I thought I'd wait for both dump_*_log_entries to be merged, but it's not
|
||||
yet, so I must update this one too.
|
||||
*/
|
||||
|
||||
static void dump_remote_log_entries(const char* logname)
|
||||
|
||||
{
|
||||
char buf[128];
|
||||
LAST_EVENT_INFO last_event_info;
|
||||
uint len;
|
||||
NET* net = &mysql->net;
|
||||
int old_format;
|
||||
old_format = check_master_version(mysql);
|
||||
Format_description_log_event* description_event;
|
||||
|
||||
if (check_master_version(mysql, &description_event))
|
||||
die("Could not find server version");
|
||||
if (!description_event || !description_event->is_valid())
|
||||
die("Invalid Format_description log event; could be out of memory");
|
||||
|
||||
if (!position)
|
||||
position = BIN_LOG_HEADER_SIZE;
|
||||
|
@ -538,18 +555,41 @@ static void dump_remote_log_entries(const char* logname)
|
|||
DBUG_PRINT("info",( "len= %u, net->read_pos[5] = %d\n",
|
||||
len, net->read_pos[5]));
|
||||
Log_event *ev = Log_event::read_log_event((const char*) net->read_pos + 1 ,
|
||||
len - 1, &error, 0);
|
||||
//TODO this ,0) : we need to store the description_event like for local_log
|
||||
len - 1, &error, description_event);
|
||||
if (ev)
|
||||
{
|
||||
ev->print(result_file, short_form, &last_event_info);
|
||||
if (ev->get_type_code() == LOAD_EVENT)
|
||||
dump_remote_file(net, ((Load_log_event*)ev)->fname);
|
||||
delete ev;
|
||||
switch (ev->get_type_code())
|
||||
{
|
||||
case FORMAT_DESCRIPTION_EVENT:
|
||||
delete description_event;
|
||||
description_event= (Format_description_log_event*) ev;
|
||||
ev->print(result_file, short_form, &last_event_info);
|
||||
break;
|
||||
case ROTATE_EVENT:
|
||||
/* see comments in sql/slave.cc:process_io_rotate() */
|
||||
if (description_event->binlog_version >= 4)
|
||||
{
|
||||
delete description_event;
|
||||
/* start from format 3 (MySQL 4.0) again */
|
||||
description_event= new Format_description_log_event(3);
|
||||
if (!description_event || !description_event->is_valid())
|
||||
die("Invalid Format_description log event; could be out of memory");
|
||||
}
|
||||
ev->print(result_file, short_form, &last_event_info);
|
||||
delete ev;
|
||||
break;
|
||||
case LOAD_EVENT:
|
||||
dump_remote_file(net, ((Load_log_event*)ev)->fname);
|
||||
/* fall through */
|
||||
default:
|
||||
ev->print(result_file, short_form, &last_event_info);
|
||||
delete ev;
|
||||
}
|
||||
}
|
||||
else
|
||||
die("Could not construct log event object");
|
||||
}
|
||||
delete description_event;
|
||||
}
|
||||
|
||||
|
||||
|
@ -694,7 +734,7 @@ static void dump_local_log_entries(const char* logname)
|
|||
file->seek_not_done=0;
|
||||
}
|
||||
|
||||
if (!description_event->is_valid())
|
||||
if (!description_event || !description_event->is_valid())
|
||||
die("Invalid Format_description log event; could be out of memory");
|
||||
|
||||
if (!position)
|
||||
|
@ -792,7 +832,19 @@ Create_file event for file_id: %u\n",exv->file_id);
|
|||
case FORMAT_DESCRIPTION_EVENT:
|
||||
delete description_event;
|
||||
description_event= (Format_description_log_event*) ev;
|
||||
ev->print(result_file, short_form, &last_event_info);
|
||||
ev->print(result_file, short_form, &last_event_info);
|
||||
break;
|
||||
case ROTATE_EVENT:
|
||||
/* see comments in sql/slave.cc:process_io_rotate() */
|
||||
if (description_event->binlog_version >= 4)
|
||||
{
|
||||
delete description_event;
|
||||
/* start from format 3 (MySQL 4.0) again */
|
||||
description_event= new Format_description_log_event(3);
|
||||
if (!description_event || !description_event->is_valid())
|
||||
die("Invalid Format_description log event; could be out of memory");
|
||||
}
|
||||
ev->print(result_file, short_form, &last_event_info);
|
||||
break;
|
||||
default:
|
||||
ev->print(result_file, short_form, &last_event_info);
|
||||
|
|
|
@ -9,10 +9,10 @@ select get_lock("a",10);
|
|||
get_lock("a",10)
|
||||
1
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
|
||||
master-bin.000001 79 Query 1 79 use `test`; create database `drop-temp+table-test`
|
||||
master-bin.000001 152 Query 1 152 use `drop-temp+table-test`; create temporary table `table:name` (a int)
|
||||
master-bin.000001 246 Query 1 246 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE `drop-temp+table-test`.`table:name`
|
||||
master-bin.000001 365 Query 1 365 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
|
||||
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 190 use `test`; create database `drop-temp+table-test`
|
||||
master-bin.000001 190 Query 1 306 use `drop-temp+table-test`; create temporary table `table:name` (a int)
|
||||
master-bin.000001 306 Query 1 447 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE `drop-temp+table-test`.`table:name`
|
||||
master-bin.000001 447 Query 1 540 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
|
||||
drop database `drop-temp+table-test`;
|
||||
|
|
|
@ -73,9 +73,9 @@ reset master;
|
|||
insert into t1 select * from t2;
|
||||
ERROR 23000: Duplicate entry '2' for key 1
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
|
||||
master-bin.000001 79 Query 1 79 use `test`; insert into t1 select * from t2
|
||||
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
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
|
|
|
@ -6,12 +6,12 @@ begin;
|
|||
insert into t1 values(1);
|
||||
insert into t2 select * from t1;
|
||||
commit;
|
||||
show binlog events from 79;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
master-bin.000001 79 Query 1 79 use `test`; BEGIN
|
||||
master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(1)
|
||||
master-bin.000001 178 Query 1 79 use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 244 Query 1 244 use `test`; COMMIT
|
||||
show binlog events from 95;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 157 use `test`; BEGIN
|
||||
master-bin.000001 157 Query 1 176 use `test`; insert into t1 values(1)
|
||||
master-bin.000001 238 Query 1 183 use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 326 Query 1 389 use `test`; COMMIT
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
|
@ -21,12 +21,12 @@ insert into t2 select * from t1;
|
|||
rollback;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
show binlog events from 79;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
master-bin.000001 79 Query 1 79 use `test`; BEGIN
|
||||
master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(2)
|
||||
master-bin.000001 178 Query 1 79 use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 244 Query 1 244 use `test`; ROLLBACK
|
||||
show binlog events from 95;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 157 use `test`; BEGIN
|
||||
master-bin.000001 157 Query 1 176 use `test`; insert into t1 values(2)
|
||||
master-bin.000001 238 Query 1 183 use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 326 Query 1 391 use `test`; ROLLBACK
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
|
@ -39,15 +39,15 @@ rollback to savepoint my_savepoint;
|
|||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
commit;
|
||||
show binlog events from 79;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
master-bin.000001 79 Query 1 79 use `test`; BEGIN
|
||||
master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(3)
|
||||
master-bin.000001 178 Query 1 79 use `test`; savepoint my_savepoint
|
||||
master-bin.000001 235 Query 1 79 use `test`; insert into t1 values(4)
|
||||
master-bin.000001 294 Query 1 79 use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 360 Query 1 79 use `test`; rollback to savepoint my_savepoint
|
||||
master-bin.000001 429 Query 1 429 use `test`; COMMIT
|
||||
show binlog events from 95;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 157 use `test`; BEGIN
|
||||
master-bin.000001 157 Query 1 176 use `test`; insert into t1 values(3)
|
||||
master-bin.000001 238 Query 1 174 use `test`; savepoint my_savepoint
|
||||
master-bin.000001 317 Query 1 176 use `test`; insert into t1 values(4)
|
||||
master-bin.000001 398 Query 1 183 use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 486 Query 1 186 use `test`; rollback to savepoint my_savepoint
|
||||
master-bin.000001 577 Query 1 640 use `test`; COMMIT
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
|
@ -65,16 +65,16 @@ select a from t1 order by a;
|
|||
a
|
||||
5
|
||||
7
|
||||
show binlog events from 79;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
master-bin.000001 79 Query 1 79 use `test`; BEGIN
|
||||
master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(5)
|
||||
master-bin.000001 178 Query 1 79 use `test`; savepoint my_savepoint
|
||||
master-bin.000001 235 Query 1 79 use `test`; insert into t1 values(6)
|
||||
master-bin.000001 294 Query 1 79 use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 360 Query 1 79 use `test`; rollback to savepoint my_savepoint
|
||||
master-bin.000001 429 Query 1 79 use `test`; insert into t1 values(7)
|
||||
master-bin.000001 488 Query 1 488 use `test`; COMMIT
|
||||
show binlog events from 95;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 157 use `test`; BEGIN
|
||||
master-bin.000001 157 Query 1 176 use `test`; insert into t1 values(5)
|
||||
master-bin.000001 238 Query 1 174 use `test`; savepoint my_savepoint
|
||||
master-bin.000001 317 Query 1 176 use `test`; insert into t1 values(6)
|
||||
master-bin.000001 398 Query 1 183 use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 486 Query 1 186 use `test`; rollback to savepoint my_savepoint
|
||||
master-bin.000001 577 Query 1 176 use `test`; insert into t1 values(7)
|
||||
master-bin.000001 658 Query 1 721 use `test`; COMMIT
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
|
@ -87,40 +87,40 @@ insert into t2 select * from t1;
|
|||
select get_lock("a",10);
|
||||
get_lock("a",10)
|
||||
1
|
||||
show binlog events from 79;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
master-bin.000001 79 Query 1 79 use `test`; BEGIN
|
||||
master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(8)
|
||||
master-bin.000001 178 Query 1 79 use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 244 Query 1 244 use `test`; ROLLBACK
|
||||
show binlog events from 95;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 157 use `test`; BEGIN
|
||||
master-bin.000001 157 Query 1 176 use `test`; insert into t1 values(8)
|
||||
master-bin.000001 238 Query 1 183 use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 326 Query 1 391 use `test`; ROLLBACK
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
insert into t1 values(9);
|
||||
insert into t2 select * from t1;
|
||||
show binlog events from 79;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
master-bin.000001 79 Query 1 79 use `test`; insert into t1 values(9)
|
||||
master-bin.000001 138 Query 1 138 use `test`; 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 176 use `test`; insert into t1 values(9)
|
||||
master-bin.000001 176 Query 1 264 use `test`; insert into t2 select * from t1
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
insert into t1 values(10);
|
||||
begin;
|
||||
insert into t2 select * from t1;
|
||||
show binlog events from 79;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
master-bin.000001 79 Query 1 79 use `test`; insert into t1 values(10)
|
||||
master-bin.000001 139 Query 1 139 use `test`; 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 177 use `test`; insert into t1 values(10)
|
||||
master-bin.000001 177 Query 1 265 use `test`; insert into t2 select * from t1
|
||||
insert into t1 values(11);
|
||||
commit;
|
||||
show binlog events from 79;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
master-bin.000001 79 Query 1 79 use `test`; insert into t1 values(10)
|
||||
master-bin.000001 139 Query 1 139 use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 205 Query 1 205 use `test`; BEGIN
|
||||
master-bin.000001 245 Query 1 205 use `test`; insert into t1 values(11)
|
||||
master-bin.000001 305 Query 1 305 use `test`; COMMIT
|
||||
show binlog events from 95;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 177 use `test`; insert into t1 values(10)
|
||||
master-bin.000001 177 Query 1 265 use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 265 Query 1 327 use `test`; BEGIN
|
||||
master-bin.000001 327 Query 1 347 use `test`; insert into t1 values(11)
|
||||
master-bin.000001 409 Query 1 472 use `test`; COMMIT
|
||||
alter table t2 engine=INNODB;
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
|
@ -129,12 +129,12 @@ begin;
|
|||
insert into t1 values(12);
|
||||
insert into t2 select * from t1;
|
||||
commit;
|
||||
show binlog events from 79;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
master-bin.000001 79 Query 1 79 use `test`; BEGIN
|
||||
master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(12)
|
||||
master-bin.000001 179 Query 1 79 use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 245 Query 1 245 use `test`; COMMIT
|
||||
show binlog events from 95;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 157 use `test`; BEGIN
|
||||
master-bin.000001 157 Query 1 177 use `test`; insert into t1 values(12)
|
||||
master-bin.000001 239 Query 1 183 use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 327 Query 1 390 use `test`; COMMIT
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
|
@ -142,8 +142,8 @@ begin;
|
|||
insert into t1 values(13);
|
||||
insert into t2 select * from t1;
|
||||
rollback;
|
||||
show binlog events from 79;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
show binlog events from 95;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
|
@ -154,11 +154,11 @@ insert into t1 values(15);
|
|||
insert into t2 select * from t1;
|
||||
rollback to savepoint my_savepoint;
|
||||
commit;
|
||||
show binlog events from 79;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
master-bin.000001 79 Query 1 79 use `test`; BEGIN
|
||||
master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(14)
|
||||
master-bin.000001 179 Query 1 179 use `test`; COMMIT
|
||||
show binlog events from 95;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 157 use `test`; BEGIN
|
||||
master-bin.000001 157 Query 1 177 use `test`; insert into t1 values(14)
|
||||
master-bin.000001 239 Query 1 302 use `test`; COMMIT
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
|
@ -174,10 +174,10 @@ select a from t1 order by a;
|
|||
a
|
||||
16
|
||||
18
|
||||
show binlog events from 79;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
master-bin.000001 79 Query 1 79 use `test`; BEGIN
|
||||
master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(16)
|
||||
master-bin.000001 179 Query 1 79 use `test`; insert into t1 values(18)
|
||||
master-bin.000001 239 Query 1 239 use `test`; COMMIT
|
||||
show binlog events from 95;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 157 use `test`; BEGIN
|
||||
master-bin.000001 157 Query 1 177 use `test`; insert into t1 values(16)
|
||||
master-bin.000001 239 Query 1 177 use `test`; insert into t1 values(18)
|
||||
master-bin.000001 321 Query 1 384 use `test`; COMMIT
|
||||
drop table t1,t2;
|
||||
|
|
|
@ -16,6 +16,8 @@ flush logs;
|
|||
--- Local --
|
||||
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;
|
||||
create table t1 (word varchar(20));
|
||||
SET TIMESTAMP=1000000000;
|
||||
create table t2 (id int auto_increment not null primary key);
|
||||
|
@ -33,6 +35,8 @@ LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-5-0' INTO TABLE t1 FIE
|
|||
--- Broken LOAD DATA --
|
||||
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;
|
||||
insert into t1 values ("Alas");
|
||||
|
||||
--- --database --
|
||||
|
@ -41,11 +45,15 @@ SET INSERT_ID=1;
|
|||
--- --position --
|
||||
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;
|
||||
insert into t1 values ("Alas");
|
||||
|
||||
--- Remote --
|
||||
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;
|
||||
create table t1 (word varchar(20));
|
||||
SET TIMESTAMP=1000000000;
|
||||
create table t2 (id int auto_increment not null primary key);
|
||||
|
@ -60,11 +68,15 @@ insert into t1 values ("Alas");
|
|||
--- Broken LOAD DATA --
|
||||
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;
|
||||
insert into t1 values ("Alas");
|
||||
|
||||
--- --database --
|
||||
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;
|
||||
create table t1 (word varchar(20));
|
||||
SET TIMESTAMP=1000000000;
|
||||
create table t2 (id int auto_increment not null primary key);
|
||||
|
@ -79,5 +91,7 @@ insert into t1 values ("Alas");
|
|||
--- --position --
|
||||
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;
|
||||
insert into t1 values ("Alas");
|
||||
drop table t1, t2;
|
||||
|
|
|
@ -25,7 +25,7 @@ insert into t1 values(1);
|
|||
insert into t2 select * from t1;
|
||||
commit;
|
||||
|
||||
show binlog events from 79;
|
||||
show binlog events from 95;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
|
@ -37,7 +37,7 @@ insert into t2 select * from t1;
|
|||
# should say some changes to non-transact1onal tables couldn't be rolled back
|
||||
rollback;
|
||||
|
||||
show binlog events from 79;
|
||||
show binlog events from 95;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
|
@ -51,7 +51,7 @@ insert into t2 select * from t1;
|
|||
rollback to savepoint my_savepoint;
|
||||
commit;
|
||||
|
||||
show binlog events from 79;
|
||||
show binlog events from 95;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
|
@ -67,7 +67,7 @@ insert into t1 values(7);
|
|||
commit;
|
||||
select a from t1 order by a; # check that savepoints work :)
|
||||
|
||||
show binlog events from 79;
|
||||
show binlog events from 95;
|
||||
|
||||
# and when ROLLBACK is not explicit?
|
||||
delete from t1;
|
||||
|
@ -87,7 +87,7 @@ connection con2;
|
|||
# so SHOW BINLOG EVENTS may come before con1 does the loggin. To be sure that
|
||||
# logging has been done, we use a user lock.
|
||||
select get_lock("a",10);
|
||||
show binlog events from 79;
|
||||
show binlog events from 95;
|
||||
|
||||
# and when not in a transact1on?
|
||||
delete from t1;
|
||||
|
@ -97,10 +97,10 @@ reset master;
|
|||
insert into t1 values(9);
|
||||
insert into t2 select * from t1;
|
||||
|
||||
show binlog events from 79;
|
||||
show binlog events from 95;
|
||||
|
||||
# Check that when the query updat1ng the MyISAM table is the first in the
|
||||
# transact1on, we log it immediately.
|
||||
# transaction, we log it immediately.
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
|
@ -108,11 +108,11 @@ reset master;
|
|||
insert into t1 values(10); # first make t1 non-empty
|
||||
begin;
|
||||
insert into t2 select * from t1;
|
||||
show binlog events from 79;
|
||||
show binlog events from 95;
|
||||
insert into t1 values(11);
|
||||
commit;
|
||||
|
||||
show binlog events from 79;
|
||||
show binlog events from 95;
|
||||
|
||||
|
||||
# Check that things work like before this BEGIN/ROLLBACK code was added,
|
||||
|
@ -129,7 +129,7 @@ insert into t1 values(12);
|
|||
insert into t2 select * from t1;
|
||||
commit;
|
||||
|
||||
show binlog events from 79;
|
||||
show binlog events from 95;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
|
@ -140,7 +140,7 @@ insert into t1 values(13);
|
|||
insert into t2 select * from t1;
|
||||
rollback;
|
||||
|
||||
show binlog events from 79;
|
||||
show binlog events from 95;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
|
@ -154,7 +154,7 @@ insert into t2 select * from t1;
|
|||
rollback to savepoint my_savepoint;
|
||||
commit;
|
||||
|
||||
show binlog events from 79;
|
||||
show binlog events from 95;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
|
@ -170,6 +170,6 @@ insert into t1 values(18);
|
|||
commit;
|
||||
select a from t1 order by a; # check that savepoints work :)
|
||||
|
||||
show binlog events from 79;
|
||||
show binlog events from 95;
|
||||
|
||||
drop table t1,t2;
|
||||
|
|
|
@ -60,7 +60,7 @@ select "--- --database --" as "";
|
|||
select "--- --position --" as "";
|
||||
--enable_query_log
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --position=27 $MYSQL_TEST_DIR/var/log/master-bin.000002
|
||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --position=118 $MYSQL_TEST_DIR/var/log/master-bin.000002
|
||||
|
||||
# These are tests for remote binlog.
|
||||
# They should return the same as previous test.
|
||||
|
@ -97,7 +97,7 @@ select "--- --database --" as "";
|
|||
select "--- --position --" as "";
|
||||
--enable_query_log
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --position=27 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
|
||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --position=118 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
|
||||
|
||||
# clean up
|
||||
drop table t1, t2;
|
||||
|
|
|
@ -865,6 +865,12 @@ void Log_event::set_log_pos(MYSQL_LOG* log)
|
|||
my_b_safe_tell().
|
||||
Note that this raises a question on the correctness of all these
|
||||
DBUG_ASSERT(my_b_tell()=rli->event_relay_log_pos).
|
||||
If in a transaction, the log_pos which we calculate below is not very good
|
||||
(because then my_b_safe_tell() returns start position of the BEGIN, so it's
|
||||
like the statement was at the BEGIN's place), but it's not a very serious
|
||||
problem (as the slave, when it is in a transaction, does not take those
|
||||
end_log_pos into account (as it calls inc_event_relay_log_pos()). To be
|
||||
fixed later, so that it looks less strange. But not bug.
|
||||
*/
|
||||
if (!log_pos)
|
||||
log_pos = my_b_safe_tell(&log->log_file)+get_event_len();
|
||||
|
|
Loading…
Reference in a new issue