Commit 94201860 authored by unknown's avatar unknown

Manual merge of test from 5.0 (needs to be manual because the test files

were copied/split between 5.0 and 5.1).


mysql-test/extra/rpl_tests/rpl_auto_increment.test:
  manual merge of test from 5.0
mysql-test/extra/rpl_tests/rpl_insert_id.test:
  manuel merge of test from 5.0
mysql-test/r/rpl_auto_increment.result:
  error messages changed compared to 5.0
parent f85f9ac2
...@@ -104,9 +104,47 @@ select * from t1; ...@@ -104,9 +104,47 @@ select * from t1;
sync_slave_with_master; sync_slave_with_master;
select * from t1; select * from t1;
connection master;
# Test for BUG#20524 "auto_increment_* not observed when inserting
# a too large value". When an autogenerated value was bigger than the
# maximum possible value of the field, it was truncated to that max
# possible value, without being "rounded down" to still honour
# auto_increment_* variables.
connection master;
drop table t1; drop table t1;
create table t1 (a tinyint not null auto_increment primary key) engine=myisam;
insert into t1 values(103);
set auto_increment_increment=11;
set auto_increment_offset=4;
insert into t1 values(null);
insert into t1 values(null);
--error 1062
insert into t1 values(null);
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t1 order by a;
# same but with a larger value
create table t2 (a tinyint unsigned not null auto_increment primary key) engine=myisam;
set auto_increment_increment=10;
set auto_increment_offset=1;
set insert_id=1000;
insert into t2 values(null);
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t2 order by a;
# An offset so big that even first value does not fit
create table t3 like t1;
set auto_increment_increment=1000;
set auto_increment_offset=700;
insert into t3 values(null);
select * from t3 order by a;
sync_slave_with_master;
select * from t1 order by a;
select * from t2 order by a;
select * from t3 order by a;
connection master;
drop table t1,t2,t3;
# End cleanup # End cleanup
sync_slave_with_master; sync_slave_with_master;
...@@ -155,6 +155,69 @@ drop function bug15728; ...@@ -155,6 +155,69 @@ drop function bug15728;
drop function bug15728_insert; drop function bug15728_insert;
drop table t1, t2; drop table t1, t2;
# test of BUG#20188 REPLACE or ON DUPLICATE KEY UPDATE in
# auto_increment breaks binlog
create table t1 (n int primary key auto_increment not null,
b int, unique(b));
# First, test that we do not call restore_auto_increment() too early
# in write_record():
set sql_log_bin=0;
insert into t1 values(null,100);
replace into t1 values(null,50),(null,100),(null,150);
select * from t1 order by n;
truncate table t1;
set sql_log_bin=1;
insert into t1 values(null,100);
select * from t1 order by n;
sync_slave_with_master;
# make slave's table autoinc counter bigger
insert into t1 values(null,200),(null,300);
delete from t1 where b <> 100;
# check that slave's table content is identical to master
select * from t1 order by n;
# only the auto_inc counter differs.
connection master;
replace into t1 values(null,100),(null,350);
select * from t1 order by n;
sync_slave_with_master;
select * from t1 order by n;
# Same test as for REPLACE, but for ON DUPLICATE KEY UPDATE
# We first check that if we update a row using a value larger than the
# table's counter, the counter for next row is bigger than the
# after-value of the updated row.
connection master;
insert into t1 values (NULL,400),(3,500),(NULL,600) on duplicate key UPDATE n=1000;
select * from t1 order by n;
sync_slave_with_master;
select * from t1 order by n;
# and now test for the bug:
connection master;
drop table t1;
create table t1 (n int primary key auto_increment not null,
b int, unique(b));
insert into t1 values(null,100);
select * from t1 order by n;
sync_slave_with_master;
insert into t1 values(null,200),(null,300);
delete from t1 where b <> 100;
select * from t1 order by n;
connection master;
insert into t1 values(null,100),(null,350) on duplicate key update n=2;
select * from t1 order by n;
sync_slave_with_master;
select * from t1 order by n;
connection master;
drop table t1;
# End of 5.0 tests # End of 5.0 tests
sync_slave_with_master; sync_slave_with_master;
...@@ -190,7 +190,7 @@ set auto_increment_offset=4; ...@@ -190,7 +190,7 @@ set auto_increment_offset=4;
insert into t1 values(null); insert into t1 values(null);
insert into t1 values(null); insert into t1 values(null);
insert into t1 values(null); insert into t1 values(null);
ERROR 23000: Duplicate entry '125' for key 1 ERROR 23000: Duplicate entry '125' for key 'PRIMARY'
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t1 order by a; select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t1 order by a;
a mod(a-@@auto_increment_offset,@@auto_increment_increment) a mod(a-@@auto_increment_offset,@@auto_increment_increment)
103 0 103 0
...@@ -202,7 +202,7 @@ set auto_increment_offset=1; ...@@ -202,7 +202,7 @@ set auto_increment_offset=1;
set insert_id=1000; set insert_id=1000;
insert into t2 values(null); insert into t2 values(null);
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'a' at row 1 Warning 1264 Out of range value for column 'a' at row 1
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t2 order by a; select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t2 order by a;
a mod(a-@@auto_increment_offset,@@auto_increment_increment) a mod(a-@@auto_increment_offset,@@auto_increment_increment)
251 0 251 0
...@@ -211,7 +211,7 @@ set auto_increment_increment=1000; ...@@ -211,7 +211,7 @@ set auto_increment_increment=1000;
set auto_increment_offset=700; set auto_increment_offset=700;
insert into t3 values(null); insert into t3 values(null);
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'a' at row 1 Warning 1264 Out of range value for column 'a' at row 1
select * from t3 order by a; select * from t3 order by a;
a a
127 127
......
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