1
by brian
clean slate |
1 |
#
|
2 |
# Test of auto_increment
|
|
3 |
# BUG#11932
|
|
4 |
#
|
|
5 |
# Bug reported that master and slave get out of sync after TRUNCATE
|
|
6 |
# TABLE.
|
|
7 |
#
|
|
8 |
# Test supplied by Are Casilla
|
|
9 |
||
10 |
source include/master-slave.inc; |
|
11 |
--disable_warnings |
|
12 |
connection master; |
|
13 |
drop database if exists test1; |
|
14 |
--enable_warnings |
|
15 |
create database test1; |
|
16 |
use test1; |
|
17 |
||
18 |
CREATE TABLE `t1` ( |
|
19 |
`id` int(10) unsigned NOT NULL auto_increment, |
|
20 |
`fname` varchar(100) default NULL, |
|
21 |
PRIMARY KEY (`id`) |
|
22 |
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; |
|
23 |
||
24 |
INSERT INTO `t1` VALUES (1, 'blablabla'); |
|
25 |
||
26 |
CREATE TABLE `t2` ( |
|
27 |
`id` int(10) NOT NULL auto_increment, |
|
28 |
`comment` varchar(255) NOT NULL default '', |
|
29 |
PRIMARY KEY (`id`) |
|
30 |
) ENGINE=MyISAM AUTO_INCREMENT=3 ; |
|
31 |
||
32 |
INSERT INTO `t2` VALUES (1, 'testtest 1'); |
|
33 |
INSERT INTO `t2` VALUES (2, 'test 2'); |
|
34 |
||
35 |
DELIMITER $; |
|
36 |
CREATE PROCEDURE simpleproc3 () |
|
37 |
NOT DETERMINISTIC |
|
38 |
BEGIN
|
|
39 |
INSERT INTO t1 (fname) (SELECT t2.comment FROM t2 WHERE t2.id = '1'); |
|
40 |
INSERT INTO t1 (fname) VALUES('test'); |
|
41 |
END
|
|
42 |
$
|
|
43 |
DELIMITER ;$ |
|
44 |
||
45 |
CALL simpleproc3(); |
|
46 |
||
47 |
select * from t2; |
|
48 |
||
49 |
TRUNCATE TABLE `t1`; |
|
50 |
CALL simpleproc3(); |
|
51 |
||
52 |
select * from t1; |
|
53 |
||
54 |
save_master_pos; |
|
55 |
connection slave; |
|
56 |
sync_with_master; |
|
57 |
||
58 |
use test1; |
|
59 |
select * from t1; |
|
60 |
||
61 |
drop database test1; |
|
62 |
connection master; |
|
63 |
drop database test1; |