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

« back to all changes in this revision

Viewing changes to mysql-test/suite/rpl/t/rpl_row_basic_8partition.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
############################################################
 
2
# Author: MATZ                                             #
 
3
# Date: 2006-03-22                                         #
 
4
# Purpose: See if replication of partition tables work     #
 
5
# Most of this test is copied from the rpl_xxx2yyy tests,  #
 
6
# but here we just test some simple basic replication of   #
 
7
# partition tables with same engine (MyISAM) in both ends. #
 
8
############################################################
 
9
 
 
10
--source include/have_binlog_format_row.inc
 
11
--source include/have_partition.inc
 
12
--source include/not_ndb_default.inc
 
13
--source include/master-slave.inc
 
14
connection master;
 
15
--disable_warnings
 
16
DROP TABLE IF EXISTS t1;
 
17
 
 
18
let $maybe_ro_var = @@BINLOG_FORMAT;
 
19
let $val4var = ROW;
 
20
--source include/safe_set_to_maybe_ro_var.inc
 
21
 
 
22
--echo **** Partition RANGE testing ****
 
23
 
 
24
# Create table that is partitioned by range on year i.e. year(t) and
 
25
# replicate basice operations such at insert, update delete between 2
 
26
# different storage engines Alter table and ensure table is handled
 
27
# Correctly on the slave
 
28
# Note that the storage engine should not be explicit: the default
 
29
# storage engine is used on master and slave.
 
30
 
 
31
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
 
32
                 bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
 
33
                 f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
 
34
                 y YEAR, t DATE)
 
35
                 PARTITION BY RANGE (YEAR(t)) 
 
36
                (PARTITION p0 VALUES LESS THAN (1901), 
 
37
                 PARTITION p1 VALUES LESS THAN (1946),  
 
38
                 PARTITION p2 VALUES LESS THAN (1966), 
 
39
                 PARTITION p3 VALUES LESS THAN (1986), 
 
40
                 PARTITION p4 VALUES LESS THAN (2005), 
 
41
                 PARTITION p5 VALUES LESS THAN MAXVALUE);
 
42
 
 
43
--echo --- On master ---
 
44
SHOW CREATE TABLE t1;
 
45
 
 
46
--echo --- On slave --
 
47
sync_slave_with_master;
 
48
SHOW CREATE TABLE t1;
 
49
 
 
50
--source include/rpl_multi_engine3.inc
 
51
 
 
52
connection master;
 
53
# Check that simple Alter statements are replicated correctly
 
54
ALTER TABLE t1 MODIFY vc TEXT;
 
55
 
 
56
--echo --- On master ---
 
57
SHOW CREATE TABLE t1;
 
58
 
 
59
--echo --- On slave ---
 
60
sync_slave_with_master;
 
61
SHOW CREATE TABLE t1;
 
62
 
 
63
# Perform basic operation on master and ensure replicated correctly
 
64
--source include/rpl_multi_engine3.inc
 
65
 
 
66
connection master;
 
67
DROP TABLE IF EXISTS t1;
 
68
 
 
69
########################################################
 
70
 
 
71
--echo **** Partition LIST testing ****
 
72
 
 
73
# Create table that is partitioned by list on id i.e. (2,4). Pretend
 
74
# that we missed one and alter to add. Then replicate basice
 
75
# operations such at insert, update delete between 2 different storage
 
76
# engines Alter table and ensure table is handled Correctly on the
 
77
# slave.
 
78
 
 
79
 
 
80
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
 
81
                 bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
 
82
                 f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
 
83
                 y YEAR, t DATE)
 
84
                 PARTITION BY LIST(id) 
 
85
                (PARTITION p0 VALUES IN (2, 4), 
 
86
                 PARTITION p1 VALUES IN (42, 142),
 
87
                 PARTITION p2 VALUES IN (412));
 
88
 
 
89
--echo --- On master ---
 
90
SHOW CREATE TABLE t1;
 
91
 
 
92
--echo --- On slave ---
 
93
sync_slave_with_master;
 
94
SHOW CREATE TABLE t1;
 
95
 
 
96
# Perform basic operation on master and ensure replicated correctly
 
97
--source include/rpl_multi_engine3.inc
 
98
 
 
99
connection master;
 
100
# Check that simple Alter statements are replicated correctly ---
 
101
ALTER TABLE t1 MODIFY vc TEXT;
 
102
 
 
103
--echo --- On master ---
 
104
SHOW CREATE TABLE t1;
 
105
 
 
106
--echo --- On slave ---
 
107
sync_slave_with_master;
 
108
SHOW CREATE TABLE t1;
 
109
 
 
110
# Perform basic operation on master and ensure replicated correctly
 
111
--source include/rpl_multi_engine3.inc
 
112
 
 
113
connection master;
 
114
DROP TABLE IF EXISTS t1;
 
115
 
 
116
########################################################
 
117
 
 
118
--echo **** Partition HASH testing ****
 
119
 
 
120
# Create table that is partitioned by hash on year i.e. YEAR(t). Then
 
121
# replicate basice operations such at insert, update delete between 2
 
122
# different storage engines Alter table and ensure table is handled
 
123
# Correctly on the slave
 
124
 
 
125
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
 
126
                 bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
 
127
                 f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
 
128
                 y YEAR, t DATE)
 
129
                 PARTITION BY HASH( YEAR(t) ) 
 
130
                 PARTITIONS 4; 
 
131
 
 
132
--echo --- On master ---
 
133
SHOW CREATE TABLE t1;
 
134
 
 
135
--echo --- On slave ---
 
136
sync_slave_with_master;
 
137
SHOW CREATE TABLE t1;
 
138
 
 
139
--source include/rpl_multi_engine3.inc
 
140
 
 
141
# Check that simple Alter statements are replicated correctly
 
142
ALTER TABLE t1 MODIFY vc TEXT;
 
143
 
 
144
--echo --- On master ---
 
145
SHOW CREATE TABLE t1;
 
146
 
 
147
--echo --- On slave ---
 
148
sync_slave_with_master;
 
149
SHOW CREATE TABLE t1;
 
150
 
 
151
--source include/rpl_multi_engine3.inc
 
152
 
 
153
connection master;
 
154
DROP TABLE IF EXISTS t1;
 
155
 
 
156
########################################################
 
157
 
 
158
# This part does not work
 
159
--echo **** Partition by KEY ****
 
160
 
 
161
# Create table that is partitioned by key on id with 4 parts.  Then
 
162
# replicate basice operations such at insert, update delete between 2
 
163
# different storage engines Alter table and ensure table is handled
 
164
# Correctly on the slave
 
165
 
 
166
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
 
167
                 bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
 
168
                 f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
 
169
                 y YEAR, t DATE,PRIMARY KEY(id))
 
170
                 PARTITION BY KEY() 
 
171
                 PARTITIONS 4;
 
172
 
 
173
--echo --- On master ---
 
174
SHOW CREATE TABLE t1;
 
175
 
 
176
--echo --- On slave ---
 
177
sync_slave_with_master;
 
178
SHOW CREATE TABLE t1;
 
179
 
 
180
--source include/rpl_multi_engine3.inc
 
181
 
 
182
connection master;
 
183
# Check that simple Alter statements are replicated correctly
 
184
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
 
185
 
 
186
--echo --- On master ---
 
187
SHOW CREATE TABLE t1;
 
188
 
 
189
--echo --- On slave ---
 
190
sync_slave_with_master;
 
191
SHOW CREATE TABLE t1;
 
192
 
 
193
--source include/rpl_multi_engine3.inc
 
194
 
 
195
connection master;
 
196
# Check that simple Alter statements are replicated correctly
 
197
ALTER TABLE t1 MODIFY vc TEXT;
 
198
 
 
199
--echo --- On master ---
 
200
SHOW CREATE TABLE t1;
 
201
 
 
202
--echo --- On slave ---
 
203
sync_slave_with_master;
 
204
SHOW CREATE TABLE t1;
 
205
 
 
206
--source include/rpl_multi_engine3.inc
 
207
 
 
208
DROP TABLE IF EXISTS t1;
 
209
 
 
210
# End of 5.1 test case