2001-06-21 21:19:24 +02:00
|
|
|
source include/master-slave.inc;
|
|
|
|
|
2003-02-21 23:38:56 +01:00
|
|
|
# Clean up old slave's binlogs.
|
|
|
|
# The slave is started with --log-slave-updates
|
|
|
|
# and this test does SHOW BINLOG EVENTS on the slave's
|
|
|
|
# binlog. But previous tests can influence the current test's
|
|
|
|
# binlog (e.g. a temporary table in the previous test has not
|
|
|
|
# been explicitly deleted, and at the beginning of the current
|
|
|
|
# test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
|
|
|
|
# We wait for the slave to have written all he wants to the binlog
|
|
|
|
# (otherwise RESET MASTER may come too early).
|
|
|
|
save_master_pos;
|
2001-06-21 21:19:24 +02:00
|
|
|
connection slave;
|
2003-02-21 23:38:56 +01:00
|
|
|
sync_with_master;
|
2002-10-25 01:46:14 +02:00
|
|
|
stop slave;
|
2008-04-03 23:16:55 +02:00
|
|
|
--source include/wait_for_slave_to_stop.inc
|
2001-06-21 21:19:24 +02:00
|
|
|
reset master;
|
2001-06-22 16:35:18 +02:00
|
|
|
reset slave;
|
2008-04-03 23:16:55 +02:00
|
|
|
start slave;
|
|
|
|
--source include/wait_for_slave_to_start.inc
|
Result updates after Dmitri's and my changes to logging with --log-slave-updates.
Since my changes, rpl_log.test, whose result file depends on file_id, became
non-repeatable, i.e. file_id on slave in SHOW BINLOG EVENTS
changed depending on the order of tests (sometimes 1, sometimes 5).
Which is logical: as now the slave does not copy Create_file and Exec_load from
the relay log (i.e from the master's binlog) to the slave's binlog, but
instead lets mysql_load() do the logging, the file_id is now the one whic
was used on the slave. Before it was the one which was used on the master,
and by chance the master was always restarted for this test because there's
a -master.opt file, so file_id on the master is always 1. But now file_id is
from the slave so we need to restart the slave. That's why I add an (empty)
-slave.opt file. I could have used 'server_stop/start slave', but this
would have required the manager, so most of the time mysql-test-run silently
skip the test which makes it useless. And I want this test to be run !
mysql-test/r/rpl_loaddata.result:
Orig_log_pos is like Pos since Dmitri's good change for BUG#1086
mysql-test/r/rpl_log.result:
Orig_log_pos is like Pos now, because Exec_load events are not directly copied
by the slave from the relay log to the slave's binary log (these events
are written by mysql_load() now).
mysql-test/t/rpl_log.test:
A comment
2003-08-21 00:23:39 +02:00
|
|
|
|
2001-12-15 03:41:20 +01:00
|
|
|
let $VERSION=`select version()`;
|
2001-06-21 21:19:24 +02:00
|
|
|
|
|
|
|
connection master;
|
|
|
|
create table t1(n int not null auto_increment primary key);
|
|
|
|
insert into t1 values (NULL);
|
|
|
|
drop table t1;
|
|
|
|
create table t1 (word char(20) not null);
|
2006-01-24 08:30:54 +01:00
|
|
|
load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
|
2003-08-10 04:14:16 +02:00
|
|
|
select count(*) from t1;
|
2001-06-21 21:19:24 +02:00
|
|
|
drop table t1;
|
2001-12-15 03:41:20 +01:00
|
|
|
--replace_result $VERSION VERSION
|
2008-04-03 23:16:55 +02:00
|
|
|
--replace_regex /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /infile '.+'/infile 'words.dat'/
|
2001-06-21 21:19:24 +02:00
|
|
|
show binlog events;
|
2005-03-16 02:32:47 +01:00
|
|
|
show binlog events from 98 limit 1;
|
|
|
|
show binlog events from 98 limit 2;
|
|
|
|
show binlog events from 98 limit 2,1;
|
2001-06-21 21:19:24 +02:00
|
|
|
flush logs;
|
2002-09-11 05:40:08 +02:00
|
|
|
|
2003-05-27 23:07:32 +02:00
|
|
|
# We need an extra update before doing save_master_pos.
|
|
|
|
# Otherwise, an unlikely scenario may occur:
|
|
|
|
# * When the master's binlog_dump thread reads the end of master-bin.001,
|
|
|
|
# it send the rotate event which is at this end, plus a fake rotate event
|
|
|
|
# because it's starting to read a new binlog.
|
|
|
|
# save_master_pos will record the position of the first of the two rotate
|
|
|
|
# (because the fake one is not in the master's binlog anyway).
|
|
|
|
# * Later the slave waits for the position of the first rotate event,
|
|
|
|
# and it may quickly stop (in 'slave stop') without having received the fake
|
|
|
|
# one.
|
|
|
|
# So, depending on a few milliseconds, we end up with 2 rotate events in the
|
|
|
|
# relay log or one, which influences the output of SHOW SLAVE STATUS, making
|
|
|
|
# it not predictable and causing random test failures.
|
2003-08-10 04:14:16 +02:00
|
|
|
# To make it predictable, we do a useless update now, but which has the
|
|
|
|
# interest of making the slave catch both rotate events.
|
2003-05-27 23:07:32 +02:00
|
|
|
|
|
|
|
create table t5 (a int);
|
|
|
|
drop table t5;
|
|
|
|
|
2002-09-11 05:40:08 +02:00
|
|
|
# Sync slave and force it to start on another binary log
|
|
|
|
|
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
2003-05-27 23:07:32 +02:00
|
|
|
# Note that the above 'slave start' will cause a 3rd rotate event (a fake one)
|
|
|
|
# to go into the relay log (the master always sends a fake one when replication
|
|
|
|
# starts).
|
2002-09-11 05:40:08 +02:00
|
|
|
sync_with_master;
|
|
|
|
flush logs;
|
2002-10-25 01:46:14 +02:00
|
|
|
stop slave;
|
2008-04-03 23:16:55 +02:00
|
|
|
--source include/wait_for_slave_to_stop.inc
|
2002-09-11 05:40:08 +02:00
|
|
|
connection master;
|
|
|
|
|
|
|
|
# Create some entries for second log
|
|
|
|
|
2001-06-24 03:37:24 +02:00
|
|
|
create table t1 (n int);
|
|
|
|
insert into t1 values (1);
|
|
|
|
drop table t1;
|
2001-12-15 03:41:20 +01:00
|
|
|
--replace_result $VERSION VERSION
|
2008-04-03 23:16:55 +02:00
|
|
|
--replace_regex /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /infile '.+'/infile 'words.dat'/
|
2001-06-21 21:19:24 +02:00
|
|
|
show binlog events;
|
This is the final commit for Worklog tasks:
* A more dynamic binlog format which allows small changes (1064)
* Log session variables in Query_log_event (1063)
It contains a few bugfixes (which I made when running the testsuite).
I carefully updated the results of the testsuite (i.e. I checked for every one,
if the difference between .reject and .result could be explained).
Apparently mysql-test-run --manager is broken in 4.1 and 5.0 currently,
so I could neither run the few tests which require --manager, nor check
that they pass nor modify their .result. But for builds, we don't run
with --manager.
Apart from --manager, the full testsuite passes, with Valgrind too (no errors).
I'm going to push in the next minutes. Remains: update the manual.
Note: by chance I saw that (in 4.1, in 5.0) rpl_get_lock fails when run alone;
this is normal at it makes assumptions on thread ids. I will fix this one day
in 4.1.
mysql-test/r/rpl000015.result:
result update
mysql-test/r/rpl_change_master.result:
result update
mysql-test/r/rpl_error_ignored_table.result:
result update
mysql-test/r/rpl_flush_log_loop.result:
result update
mysql-test/r/rpl_flush_tables.result:
result update
mysql-test/r/rpl_loaddata.result:
result update
mysql-test/r/rpl_loaddata_rule_m.result:
result update
mysql-test/r/rpl_loaddata_rule_s.result:
result update
mysql-test/r/rpl_log.result:
result update
mysql-test/r/rpl_log_pos.result:
result update
mysql-test/r/rpl_max_relay_size.result:
result update
mysql-test/r/rpl_relayrotate.result:
result update
mysql-test/r/rpl_replicate_do.result:
result update
mysql-test/r/rpl_reset_slave.result:
result update
mysql-test/r/rpl_rotate_logs.result:
result update
mysql-test/r/rpl_session_var.result:
result update
mysql-test/r/rpl_temporary.result:
result update
mysql-test/r/rpl_trunc_binlog.result:
result update
mysql-test/r/rpl_until.result:
result update
mysql-test/r/rpl_user_variables.result:
result update
mysql-test/t/rpl000010-slave.opt:
need to wait 2 events, because now we receive a Format_desc on top of the Rotate,
when replication starts.
mysql-test/t/rpl000015.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_change_master.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_empty_master_crash.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_error_ignored_table.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_flush_log_loop.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_loaddata.test:
position update
mysql-test/t/rpl_loaddata_rule_m.test:
position update
mysql-test/t/rpl_loaddata_rule_s.test:
position update
mysql-test/t/rpl_log.test:
position update
mysql-test/t/rpl_log_pos.test:
position update
mysql-test/t/rpl_max_relay_size.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_openssl.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_redirect.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_relayrotate-slave.opt:
better options for this test
mysql-test/t/rpl_relayrotate.test:
using max() is better for debugging (it shows at which place the slave
SQL thread resumed)
mysql-test/t/rpl_replicate_do.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_reset_slave.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_rotate_logs.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_session_var.test:
100 because password() is longer than 10 chars
mysql-test/t/rpl_trunc_binlog.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_until.test:
position update
mysql-test/t/rpl_user_variables.test:
position update
sql/log.cc:
Ensure that the Format_desc propagated on next relay logs does not trigger
undue actions (like incrementing some positions or clearing some files).
sql/log_event.cc:
* When the slave SQL thread finds a Rotate/Format_desc/Stop in the middle of
a transaction (then these were written by the slave itself to its relay log),
it should not increment rli->group* variables, but only rli->event* ones.
* When the slave SQL thread finds a Format_desc not to be ignored (not
the same server id as the slave's), if it has log_pos==0 it must not trigger
"unfinished transaction in master's binlog" (log_pos==0 is always a marker
in the relay log to mean "this event was not at this place in the master's
binlog": it's for fake Rotate events, and for Format_description events which the master had
to send us for replication to start).
* In the Query_log_event on disk, catalog is now terminated by '\0'.
* thd->catalog must be set to 0 when some exec_event() terminate (otherwise
double free).
sql/slave.cc:
* Fixes for a few bugs when ignoring events in the slave SQL thread:
- do not decrement rli->slave_skip_counter if the event is an event
related to the binlog or relay log itself (FORMAT_DESCRIPTION,
ROTATE, STOP) because these events should never be skipped (or the slave
will be confused). Usually the user wants to skip a query, not a Rotate...
- when we (re)connect to the master, we must free description_event_for_queue
(otherwise memory leak when we reconnect).
* Changed a bit the code where we change description_event_for_queue,
to make it look "safer".
* Moved 'created=0' to log.cc where it is safer.
* When the slave SQL thread finds a Rotate/Format_desc/Stop in the middle of
a transaction (then these were written by the slave itself to its relay log),
it should not increment rli->group* variables, but only rli->event* ones.
sql/sql_class.h:
a warning comment
sql/sql_repl.cc:
A mistake: I had passed a char* instead of char**
2003-12-19 22:40:23 +01:00
|
|
|
--replace_result $VERSION VERSION
|
2002-10-29 23:11:13 +01:00
|
|
|
show binlog events in 'master-bin.000002';
|
2002-10-25 02:32:42 +02:00
|
|
|
show binary logs;
|
2001-06-21 21:19:24 +02:00
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
2002-10-25 01:46:14 +02:00
|
|
|
start slave;
|
2008-04-03 23:16:55 +02:00
|
|
|
--source include/wait_for_slave_to_start.inc
|
2001-06-21 21:19:24 +02:00
|
|
|
sync_with_master;
|
2002-10-25 02:32:42 +02:00
|
|
|
show binary logs;
|
2004-05-10 12:15:40 +02:00
|
|
|
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
|
2008-04-03 23:16:55 +02:00
|
|
|
--replace_regex /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /INFILE '.+'/INFILE 'words.dat'/
|
2002-10-29 23:11:13 +01:00
|
|
|
show binlog events in 'slave-bin.000001' from 4;
|
2004-05-10 12:15:40 +02:00
|
|
|
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
|
2002-10-29 23:11:13 +01:00
|
|
|
show binlog events in 'slave-bin.000002' from 4;
|
2004-05-10 12:15:40 +02:00
|
|
|
--replace_result $MASTER_MYPORT MASTER_PORT
|
This is the final commit for Worklog tasks:
* A more dynamic binlog format which allows small changes (1064)
* Log session variables in Query_log_event (1063)
It contains a few bugfixes (which I made when running the testsuite).
I carefully updated the results of the testsuite (i.e. I checked for every one,
if the difference between .reject and .result could be explained).
Apparently mysql-test-run --manager is broken in 4.1 and 5.0 currently,
so I could neither run the few tests which require --manager, nor check
that they pass nor modify their .result. But for builds, we don't run
with --manager.
Apart from --manager, the full testsuite passes, with Valgrind too (no errors).
I'm going to push in the next minutes. Remains: update the manual.
Note: by chance I saw that (in 4.1, in 5.0) rpl_get_lock fails when run alone;
this is normal at it makes assumptions on thread ids. I will fix this one day
in 4.1.
mysql-test/r/rpl000015.result:
result update
mysql-test/r/rpl_change_master.result:
result update
mysql-test/r/rpl_error_ignored_table.result:
result update
mysql-test/r/rpl_flush_log_loop.result:
result update
mysql-test/r/rpl_flush_tables.result:
result update
mysql-test/r/rpl_loaddata.result:
result update
mysql-test/r/rpl_loaddata_rule_m.result:
result update
mysql-test/r/rpl_loaddata_rule_s.result:
result update
mysql-test/r/rpl_log.result:
result update
mysql-test/r/rpl_log_pos.result:
result update
mysql-test/r/rpl_max_relay_size.result:
result update
mysql-test/r/rpl_relayrotate.result:
result update
mysql-test/r/rpl_replicate_do.result:
result update
mysql-test/r/rpl_reset_slave.result:
result update
mysql-test/r/rpl_rotate_logs.result:
result update
mysql-test/r/rpl_session_var.result:
result update
mysql-test/r/rpl_temporary.result:
result update
mysql-test/r/rpl_trunc_binlog.result:
result update
mysql-test/r/rpl_until.result:
result update
mysql-test/r/rpl_user_variables.result:
result update
mysql-test/t/rpl000010-slave.opt:
need to wait 2 events, because now we receive a Format_desc on top of the Rotate,
when replication starts.
mysql-test/t/rpl000015.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_change_master.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_empty_master_crash.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_error_ignored_table.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_flush_log_loop.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_loaddata.test:
position update
mysql-test/t/rpl_loaddata_rule_m.test:
position update
mysql-test/t/rpl_loaddata_rule_s.test:
position update
mysql-test/t/rpl_log.test:
position update
mysql-test/t/rpl_log_pos.test:
position update
mysql-test/t/rpl_max_relay_size.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_openssl.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_redirect.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_relayrotate-slave.opt:
better options for this test
mysql-test/t/rpl_relayrotate.test:
using max() is better for debugging (it shows at which place the slave
SQL thread resumed)
mysql-test/t/rpl_replicate_do.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_reset_slave.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_rotate_logs.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_session_var.test:
100 because password() is longer than 10 chars
mysql-test/t/rpl_trunc_binlog.test:
relay log information is not repeatable in general (if a reconnection
happens because --sleep=10 for example), so we hide these columns.
mysql-test/t/rpl_until.test:
position update
mysql-test/t/rpl_user_variables.test:
position update
sql/log.cc:
Ensure that the Format_desc propagated on next relay logs does not trigger
undue actions (like incrementing some positions or clearing some files).
sql/log_event.cc:
* When the slave SQL thread finds a Rotate/Format_desc/Stop in the middle of
a transaction (then these were written by the slave itself to its relay log),
it should not increment rli->group* variables, but only rli->event* ones.
* When the slave SQL thread finds a Format_desc not to be ignored (not
the same server id as the slave's), if it has log_pos==0 it must not trigger
"unfinished transaction in master's binlog" (log_pos==0 is always a marker
in the relay log to mean "this event was not at this place in the master's
binlog": it's for fake Rotate events, and for Format_description events which the master had
to send us for replication to start).
* In the Query_log_event on disk, catalog is now terminated by '\0'.
* thd->catalog must be set to 0 when some exec_event() terminate (otherwise
double free).
sql/slave.cc:
* Fixes for a few bugs when ignoring events in the slave SQL thread:
- do not decrement rli->slave_skip_counter if the event is an event
related to the binlog or relay log itself (FORMAT_DESCRIPTION,
ROTATE, STOP) because these events should never be skipped (or the slave
will be confused). Usually the user wants to skip a query, not a Rotate...
- when we (re)connect to the master, we must free description_event_for_queue
(otherwise memory leak when we reconnect).
* Changed a bit the code where we change description_event_for_queue,
to make it look "safer".
* Moved 'created=0' to log.cc where it is safer.
* When the slave SQL thread finds a Rotate/Format_desc/Stop in the middle of
a transaction (then these were written by the slave itself to its relay log),
it should not increment rli->group* variables, but only rli->event* ones.
sql/sql_class.h:
a warning comment
sql/sql_repl.cc:
A mistake: I had passed a char* instead of char**
2003-12-19 22:40:23 +01:00
|
|
|
--replace_column 1 # 8 # 9 # 23 # 33 #
|
2001-06-24 03:37:24 +02:00
|
|
|
show slave status;
|
2002-09-11 05:40:08 +02:00
|
|
|
|
|
|
|
# Need to recode the following
|
|
|
|
|
2002-10-29 23:11:13 +01:00
|
|
|
#show new master for slave with master_log_file='master-bin.000001' and master_log_pos=4 and master_server_id=1;
|
|
|
|
#show new master for slave with master_log_file='master-bin.000001' and master_log_pos=79 and master_server_id=1;
|
|
|
|
#show new master for slave with master_log_file='master-bin.000001' and master_log_pos=311 and master_server_id=1;
|
|
|
|
#show new master for slave with master_log_file='master-bin.000002' and master_log_pos=4 and master_server_id=1;
|
|
|
|
#show new master for slave with master_log_file='master-bin.000002' and master_log_pos=122 and master_server_id=1;
|
2002-09-11 05:40:08 +02:00
|
|
|
|
|
|
|
--error 1220
|
2002-10-29 23:11:13 +01:00
|
|
|
show binlog events in 'slave-bin.000005' from 4;
|
2005-07-28 02:22:47 +02:00
|
|
|
|
2006-06-07 11:01:10 +02:00
|
|
|
#
|
|
|
|
# Bug #6880: LAST_INSERT_ID() within a statement
|
|
|
|
#
|
|
|
|
|
|
|
|
create table t1(a int auto_increment primary key, b int);
|
|
|
|
insert into t1 values (NULL, 1);
|
|
|
|
reset master;
|
|
|
|
set insert_id=5;
|
|
|
|
insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
|
|
|
|
--replace_result $VERSION VERSION
|
|
|
|
show binlog events;
|
|
|
|
select * from t1;
|
|
|
|
drop table t1;
|
|
|
|
|
2005-07-28 02:22:47 +02:00
|
|
|
# End of 4.1 tests
|
2005-09-12 22:47:15 +02:00
|
|
|
# Adding comment for force manual merge 5.0 -> wl1012: Delete me
|