~drizzle-trunk/drizzle/development

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File for specialities regarding replication from or to InnoDB
# tables.

source include/master-slave.inc;
source include/have_innodb.inc;

#
# Bug#11401: Load data infile 'REPLACE INTO' fails on slave.
#
connection master;
CREATE TABLE t4 (
  id INT(5) unsigned NOT NULL auto_increment,
  name varchar(15) NOT NULL default '',
  number varchar(35) NOT NULL default 'default',
  PRIMARY KEY  (id),
  UNIQUE KEY unique_rec (name,number)
) ENGINE=InnoDB;

--disable_warnings
LOAD DATA
     INFILE '../std_data_ln/loaddata_pair.dat'  
     REPLACE INTO TABLE t4 
     (name,number);
--enable_warnings
SELECT * FROM t4;

sync_slave_with_master;
SELECT * FROM t4;

connection master;
--disable_warnings
LOAD DATA
     INFILE '../std_data_ln/loaddata_pair.dat'  
     REPLACE INTO TABLE t4
     (name,number);
--enable_warnings
SELECT * FROM t4;

sync_slave_with_master;
SELECT * FROM t4;

connection master;
--disable_query_log
DROP TABLE t4;
--enable_query_log
sync_slave_with_master;
connection master;

# End of 4.1 tests

#
# Bug #26418: Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK
# on master
#
#Note Matthias: to be merged to rpl_ddl.test

--source include/not_ndb_default.inc

FLUSH LOGS;
sync_slave_with_master;
FLUSH LOGS;
connection master;
let $engine_type= "InnoDB";

--disable_warnings
DROP DATABASE IF EXISTS mysqltest1;
--enable_warnings

CREATE DATABASE mysqltest1;
CREATE TEMPORARY TABLE mysqltest1.tmp (f1 BIGINT);
eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type;
SET AUTOCOMMIT = 0;

sync_slave_with_master;
--echo -------- switch to slave --------
connection slave;
SHOW CREATE TABLE mysqltest1.t1;

--echo -------- switch to master --------
connection master;
INSERT INTO mysqltest1.t1 SET f1= 1;
DROP TEMPORARY TABLE mysqltest1.tmp;
ROLLBACK;
--error ER_NO_SUCH_TABLE
SHOW CREATE TABLE mysqltest1.tmp;
# Must return no rows here
SELECT COUNT(*) FROM mysqltest1.t1;

INSERT INTO mysqltest1.t1 SET f1= 2;
CREATE TEMPORARY TABLE mysqltest1.tmp2(a INT);
ROLLBACK;
SHOW CREATE TABLE mysqltest1.tmp2;
# Must return no rows here
SELECT COUNT(*) FROM mysqltest1.t1;

sync_slave_with_master;
--echo -------- switch to slave --------
connection slave;
--error ER_NO_SUCH_TABLE
SHOW CREATE TABLE mysqltest1.tmp;
--error ER_NO_SUCH_TABLE
SHOW CREATE TABLE mysqltest1.tmp2;
# has two rows here : as the default is MyISAM and
# it can't be rolled back by the master's ROLLBACK.
SELECT COUNT(*) FROM mysqltest1.t1;
FLUSH LOGS;

--echo -------- switch to master --------
connection master;
FLUSH LOGS;

DROP DATABASE mysqltest1;
-- source include/master-slave-end.inc

--echo End of 5.1 tests