~stewart/drizzle/embedded-innodb-create-select-transaction-arrgh

« back to all changes in this revision

Viewing changes to mysql-test/suite/rpl/t/rpl_view.test

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# NYI - row-based cannot use CREATE ... SELECT
 
2
 
 
3
source include/master-slave.inc;
 
4
--disable_warnings
 
5
drop table if exists t1,v1;
 
6
drop view if exists t1,v1;
 
7
sync_slave_with_master;
 
8
reset master;
 
9
--enable_warnings
 
10
 
 
11
#
 
12
# Check that creation drop of view is replicated, also check replication of
 
13
# updating of view
 
14
#
 
15
connection master;
 
16
create table t1 (a int);
 
17
insert into t1 values (1);
 
18
create view v1 as select a from t1;
 
19
insert into v1 values (2);
 
20
select * from v1 order by a;
 
21
sync_slave_with_master;
 
22
# view already have to be on slave
 
23
select * from v1 order by a;
 
24
connection master;
 
25
update v1 set a=3 where a=1;
 
26
select * from v1 order by a;
 
27
sync_slave_with_master;
 
28
select * from v1 order by a;
 
29
connection master;
 
30
delete from v1 where a=2;
 
31
select * from v1 order by a;
 
32
sync_slave_with_master;
 
33
select * from v1 order by a;
 
34
connection master;
 
35
# 'alter view' internally maped to creation, but still check that it works
 
36
alter view v1 as select a as b from t1;
 
37
sync_slave_with_master;
 
38
select * from v1 order by 1;
 
39
connection master;
 
40
drop view v1;
 
41
sync_slave_with_master;
 
42
#error, because view have to be removed from slave
 
43
-- error 1146
 
44
select * from v1 order by a;
 
45
connection master;
 
46
drop table t1;
 
47
sync_slave_with_master;
 
48
# Change Author: JBM
 
49
# Change Date: 2005-12-22
 
50
# Change: Commented out binlog events to work with SBR and RBR 
 
51
#--replace_column 2 # 5 #
 
52
# show binlog events limit 1,100;
 
53
 
 
54
#
 
55
# BUG#20438: CREATE statements for views, stored routines and triggers can be
 
56
# not replicable.
 
57
#
 
58
 
 
59
--echo
 
60
--echo ---> Test for BUG#20438
 
61
 
 
62
# Prepare environment.
 
63
 
 
64
--echo
 
65
--echo ---> Preparing environment...
 
66
--echo ---> connection: master
 
67
--connection master
 
68
 
 
69
--disable_warnings
 
70
DROP TABLE IF EXISTS t1;
 
71
DROP VIEW IF EXISTS v1;
 
72
--enable_warnings
 
73
 
 
74
--echo
 
75
--echo ---> Synchronizing slave with master...
 
76
 
 
77
--save_master_pos
 
78
--connection slave
 
79
--sync_with_master
 
80
 
 
81
--echo
 
82
--echo ---> connection: master
 
83
--connection master
 
84
 
 
85
# Test.
 
86
 
 
87
--echo
 
88
--echo ---> Creating objects...
 
89
 
 
90
CREATE TABLE t1(c INT);
 
91
 
 
92
/*!50003 CREATE VIEW v1 AS SELECT * FROM t1 */;
 
93
 
 
94
--echo
 
95
--echo ---> Inserting value...
 
96
 
 
97
INSERT INTO t1 VALUES(1);
 
98
 
 
99
--echo
 
100
--echo ---> Checking on master...
 
101
 
 
102
SELECT * FROM t1;
 
103
 
 
104
--echo
 
105
--echo ---> Synchronizing slave with master...
 
106
 
 
107
--save_master_pos
 
108
--connection slave
 
109
--sync_with_master
 
110
 
 
111
--echo ---> connection: master
 
112
 
 
113
--echo
 
114
--echo ---> Checking on slave...
 
115
 
 
116
SELECT * FROM t1;
 
117
 
 
118
# Cleanup.
 
119
 
 
120
--echo
 
121
--echo ---> connection: master
 
122
--connection master
 
123
 
 
124
--echo
 
125
--echo ---> Cleaning up...
 
126
 
 
127
DROP VIEW v1;
 
128
DROP TABLE t1;
 
129
 
 
130
--save_master_pos
 
131
--connection slave
 
132
--sync_with_master
 
133
--connection master
 
134
 
 
135
#
 
136
# BUG#19419: "VIEW: View that the column name is different
 
137
#             by master and slave is made".
 
138
#
 
139
connection master;
 
140
create table t1(a int, b int);
 
141
insert into t1 values (1, 1), (1, 2), (1, 3);
 
142
create view  v1(a, b) as select a, sum(b) from t1 group by a;
 
143
 
 
144
sync_slave_with_master;
 
145
explain v1;
 
146
show create table v1;
 
147
select * from v1;
 
148
 
 
149
connection master;
 
150
drop table t1;
 
151
drop view v1;
 
152
 
 
153
sync_slave_with_master;
 
154
 
 
155
#
 
156
# BUG#28244 CREATE VIEW breaks replication when view exists
 
157
#
 
158
connection master;
 
159
CREATE TABLE t1(a INT);
 
160
CREATE VIEW v1 AS SELECT * FROM t1;
 
161
--error ER_TABLE_EXISTS_ERROR
 
162
CREATE VIEW v1 AS SELECT * FROM t1;
 
163
DROP VIEW v1;
 
164
DROP TABLE t1;
 
165
sync_slave_with_master;
 
166
 
 
167
--echo End of 5.0 tests