18 changed files with 406 additions and 8 deletions
-
36mysql-test/suite/rpl/r/rpl_auto_increment_bug45679.result
-
21mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result
-
62mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test
-
60mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test
-
36sql/log_event.cc
-
9sql/log_event.h
-
4sql/rpl_rli.cc
-
35sql/rpl_rli.h
-
63sql/rpl_utility.cc
-
20sql/rpl_utility.h
-
3sql/share/errmsg-utf8.txt
-
9sql/slave.cc
-
33sql/sql_base.cc
-
8sql/sql_class.cc
-
2sql/sql_class.h
-
3sql/sql_lex.cc
-
5sql/sql_lex.h
-
5sql/sql_parse.cc
@ -0,0 +1,36 @@ |
|||
include/master-slave.inc |
|||
[connection master] |
|||
call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.'); |
|||
create table tm (b int auto_increment, a int, primary key (a,b)) engine= myisam; |
|||
create table ti (b int auto_increment, a int, primary key (a,b)) engine= innodb; |
|||
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key |
|||
create table ti (b int auto_increment, a int, primary key (b,a)) engine= innodb; |
|||
set @@binlog_format=statement; |
|||
*** autoincrement field is not the first in PK warning must be there: *** |
|||
insert into tm set b=null, a=1; |
|||
Warnings: |
|||
Note 1592 Statement may not be safe to log in statement format. |
|||
show warnings; |
|||
Level Code Message |
|||
Note 1592 Statement may not be safe to log in statement format. |
|||
*** no warning when autoincrement is the first in PK |
|||
insert into ti set b=null, a=1; |
|||
show warnings; |
|||
Level Code Message |
|||
create function multi_part_pk_with_autoinc (arg int) |
|||
returns int |
|||
begin |
|||
insert into tm set b=null, a=arg; |
|||
return arg; |
|||
end// |
|||
select multi_part_pk_with_autoinc (3); |
|||
multi_part_pk_with_autoinc (3) |
|||
3 |
|||
*** autoincrement field is not the first in PK warning must be there: *** |
|||
show warnings; |
|||
Level Code Message |
|||
set @@binlog_format=mixed; |
|||
insert into tm set b=null, a=2; |
|||
drop table tm, ti; |
|||
drop function multi_part_pk_with_autoinc; |
|||
include/rpl_end.inc |
|||
@ -0,0 +1,62 @@ |
|||
# Test of auto-increment. |
|||
# |
|||
# BUG#11754117-45670 |
|||
# Multipart primary key with the autoincrement part not first in it |
|||
# is replication unsafe. |
|||
# |
|||
|
|||
source include/master-slave.inc; |
|||
source include/have_binlog_format_mixed.inc; |
|||
source include/have_innodb.inc; |
|||
|
|||
call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.'); |
|||
|
|||
--connection master |
|||
create table tm (b int auto_increment, a int, primary key (a,b)) engine= myisam; |
|||
--error ER_WRONG_AUTO_KEY |
|||
create table ti (b int auto_increment, a int, primary key (a,b)) engine= innodb; |
|||
create table ti (b int auto_increment, a int, primary key (b,a)) engine= innodb; |
|||
|
|||
set @@binlog_format=statement; |
|||
--echo *** autoincrement field is not the first in PK warning must be there: *** |
|||
insert into tm set b=null, a=1; |
|||
show warnings; |
|||
--echo *** no warning when autoincrement is the first in PK |
|||
insert into ti set b=null, a=1; |
|||
show warnings; |
|||
|
|||
delimiter //; |
|||
create function multi_part_pk_with_autoinc (arg int) |
|||
returns int |
|||
begin |
|||
insert into tm set b=null, a=arg; |
|||
return arg; |
|||
end// |
|||
delimiter ;// |
|||
|
|||
select multi_part_pk_with_autoinc (3); |
|||
--echo *** autoincrement field is not the first in PK warning must be there: *** |
|||
show warnings; |
|||
|
|||
set @@binlog_format=mixed; |
|||
insert into tm set b=null, a=2; |
|||
|
|||
sync_slave_with_master; |
|||
|
|||
if (`select count(*) <> 3 from tm`) |
|||
{ |
|||
--echo Wrong result from SELECT on the slave side. |
|||
select * from tm; |
|||
--die |
|||
} |
|||
|
|||
# cleanup |
|||
|
|||
--connection master |
|||
|
|||
drop table tm, ti; |
|||
drop function multi_part_pk_with_autoinc; |
|||
|
|||
sync_slave_with_master; |
|||
|
|||
--source include/rpl_end.inc |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue