mariadb/mysql-test/r/rpl_loaddata.result
unknown 20c59f9c4b fixes after merge. Updates to test's results.
We now reset the THD members related to auto_increment+binlog in
MYSQL_LOG::write(). This is better than in THD::cleanup_after_query(),
which was not able to distinguish between SELECT myfunc1(),myfunc2()
and INSERT INTO t SELECT myfunc1(),myfunc2() from a binlogging point
of view.
Rows_log_event::exec_event() now calls lex_start() instead of
mysql_init_query() because the latter now does too much (it resets
the binlog format).


mysql-test/extra/rpl_tests/rpl_insert_id.test:
  fix after merge
mysql-test/mysql-test-run.pl:
  -v does not bring useful information when running valgrind; I remove it;
  if you think it's useful add it back.
mysql-test/r/binlog_stm_mix_innodb_myisam.result:
  Position columns of SHOW BINLOG EVENTS are replaced by # (more robust
  if the size of an event changes).
mysql-test/r/rpl_insert_id.result:
  fix after merge
mysql-test/r/rpl_loaddata.result:
  The binlog positions change, because one event disappeared; indeed there
  was this in the binlog (in the current 5.1!):
  SET INSERT_ID=2;
  SET INSERT_ID=1;
  SET TIMESTAMP=1152540671;
  load data LOCAL INFILE '/tmp/SQL_LOAD_MB-1-2' INTO table t1;
  Two INSERT_ID events, useless and a bug. Goes away afer cleaning up
  auto_increment handling.
mysql-test/r/rpl_switch_stm_row_mixed.result:
  INSERT_ID=5 appears, it's a consequence of having merged the fix
  for BUG#20341
  "stored function inserting into one auto_increment puts bad data in slave".
  In mixed mode, if one substatement of a stored procedure requires row-based,
  the entire procedure uses row-based (was already true for stored functions);
  this is a consequence of not doing the resetting of binlog format inside
  lock_tables() (which didn't work with how the slave thread executes
  row-based binlog events).
mysql-test/t/rpl_switch_stm_row_mixed.test:
  removing the multi-row delayed insert because in RBR the number of events
  which it generates, is not repeatable (probably depends on how the delayed
  thread groups rows, i.e. dependent on timing).
sql/ha_partition.cc:
  update to new prototype
sql/ha_partition.h:
  update to new prototype of the handler:: method.
sql/handler.cc:
  after-merge fixes (manually merging part which was hard to merge in fmtool)
sql/log.cc:
  When we write to the binary log, THD's parameters which influenced this
  write are reset: stmt_depends_on_first_successful_insert_id_in_prev_stmt
  and auto_inc_intervals_in_cur_stmt_for_binlog. This is so that future
  writes are not influenced by those and can write their own values.
  As a consequence, when we don't write to the binlog we do not reset.
  This is to abide by the rule that in a complex statement (using triggers etc),
  the first top- or substatement to generate auto_increment ids
  wins their writing to the binlog (that writing may be done by the statement
  itself or by the caller); so for example for
  INSERT INTO t SELECT myfunc() where myfunc() inserts into auto_increment
  and INSERT INTO t does not, myfunc() will fill
  auto_inc_intervals_in_cur_stmt_for_binlog, which will not be reset when
  myfunc() ends, then INSERT INTO t will write to the binlog and thus
  write the preserved auto_inc_intervals_in_cur_stmt_for_binlog.
sql/log_event.cc:
  mysql_init_query() does too much now to be called in Rows_log_event::exec_event
  (it call mysql_reset_thd_for_next_command() which may switch
  the binlog format now).
  It's ok to call it in Table_map_log_event::exec_event() but its call must
  be before setting the binlog format to "row".
sql/sql_base.cc:
  Resetting the binlog format in lock_tables() was a bad idea of mine;
  it causes problems in execution of row-based binlog events, where
  the thread sets the binlog format by itself and does not want a next
  lock_tables() to reset the binlog format.
  It is also misleading, for a function named lock_tables(), to reset
  the binlog format.
  As a consequence of this change, in mixed binlogging mode, a routine
  is logged either entirely statement-based or entirely row-based, we
  don't switch in the middle (this was already true for prelocked routines,
  now it's also true for stored procedures).
sql/sql_class.cc:
  resetting of auto_increment variables used for binlogging is now done
  when writing to the binary log, no need to do the resetting at the end
  of the statement. It is also more correct this way; consider
  SELECT myfunc1(),myfunc2();
  where both functions insert into the same auto_increment column.
  Binlogging is done in 2 events: "SELECT myfunc1()" and "SELECT myfunc2()".
  So each of those needs to have, in binlog, the INSERT_ID which
  it inserted. But as the 2 function calls are executed under prelocked mode,
  the old code didn't reset auto_inc_intervals_in_cur_stmt_for_binlog
  after the first SELECT was binlogged, and so the INSERT_ID of the first
  SELECT was binlogged for the first SELECT and (wrong) also for the 2nd
  SELECT event.
  stmt_depends_on_first_... has the same logic.
sql/sql_class.h:
  clearer comment
sql/sql_delete.cc:
  unneeded #ifdef. As we temporarily change the binlog format to "statement"
  before calling mysql_delete(), we must restore it afterwards.
sql/sql_insert.cc:
  after-merge fixes.
  No need to reset auto_inc_intervals_in_cur_stmt_for_binlog for every
  row in the delayed insert system thread, because we already reset it
  when writing to the binlog.
sql/sql_parse.cc:
  unneeded #ifdef
2006-07-10 18:41:03 +02:00

87 lines
4.5 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
reset master;
select last_insert_id();
last_insert_id()
0
create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
select last_insert_id();
last_insert_id()
1
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
insert into t3 select * from t2;
select * from t1;
a b
1 10
2 15
select * from t3;
day id category name
2003-02-22 2461 b a a a @ %  ' " a
2003-03-22 2161 c asdf
2003-03-22 2416 a bbbbb
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
slave-bin.000001 1248
drop table t1;
drop table t2;
drop table t3;
create table t1(a int, b int, unique(b));
insert into t1 values(1,10);
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
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 1765 # # master-bin.000001 Yes Yes # 0 0 1765 # None 0 No #
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
stop slave;
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 1800 # # master-bin.000001 No No # 0 0 1800 # None 0 No #
set global sql_slave_skip_counter=1;
start slave;
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
stop slave;
reset 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 4 # # No No # 0 0 0 # None 0 No #
reset master;
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)) engine=MyISAM;
load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
select * from t2;
day id category name
2003-02-22 2461 b a a a @ %  ' " a
2003-03-22 2161 c asdf
start slave;
select * from t2;
day id category name
2003-02-22 2461 b a a a @ %  ' " a
2003-03-22 2161 c asdf
alter table t2 drop key day;
delete from t2;
load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
drop table t2;
drop table t2;