~ubuntu-branches/ubuntu/trusty/mysql-5.6/trusty

« back to all changes in this revision

Viewing changes to mysql-test/suite/ndb_rpl/t/ndb_rpl_2multi_basic.inc

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-02-12 11:54:27 UTC
  • Revision ID: package-import@ubuntu.com-20140212115427-oq6tfsqxl1wuwehi
Tags: upstream-5.6.15
ImportĀ upstreamĀ versionĀ 5.6.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#######################################
 
2
# Author: Rafal Somla                 #
 
3
# Date: 2006-08-20                    #
 
4
# Purpose: Test replication of basic  #
 
5
# table operations in various setups  #   
 
6
#                                     #
 
7
# Based on rpl_ndb_2multi_eng.test by #
 
8
# JBM                                 #
 
9
#######################################
 
10
 
 
11
--echo --- Doing pre test cleanup --- 
 
12
 
 
13
connection master;
 
14
--disable_warnings
 
15
DROP TABLE IF EXISTS t1;
 
16
--enable_query_log
 
17
 
 
18
#################################################
 
19
--echo --- Create Table Section ---
 
20
 
 
21
CREATE TABLE t1 (id MEDIUMINT NOT NULL, 
 
22
                 b1 INT, 
 
23
                 vc VARCHAR(255), 
 
24
                 bc CHAR(255), 
 
25
                 d DECIMAL(10,4) DEFAULT 0, 
 
26
                 f FLOAT DEFAULT 0, 
 
27
                 total BIGINT UNSIGNED, 
 
28
                 y YEAR, 
 
29
                 t DATE, 
 
30
                 PRIMARY KEY(id));
 
31
 
 
32
--echo --- Show table on master ---
 
33
 
 
34
SHOW CREATE TABLE t1;
 
35
 
 
36
--echo --- Show table on slave ---
 
37
 
 
38
sync_slave_with_master;
 
39
SHOW CREATE TABLE t1;
 
40
 
 
41
--source include/rpl_multi_engine2.inc
 
42
 
 
43
#################################################
 
44
# Okay lets see how it holds up to table changes
 
45
--echo --- Check that simple Alter statements are replicated correctly --
 
46
 
 
47
ALTER TABLE t1 DROP PRIMARY KEY;
 
48
# note: table with no PK can't contain blobs if it is to be replicated.
 
49
ALTER TABLE t1 MODIFY vc char(32);  
 
50
 
 
51
--echo --- Show the new improved table on the master ---
 
52
 
 
53
SHOW CREATE TABLE t1;
 
54
 
 
55
--echo --- Make sure that our tables on slave are still same engine ---
 
56
--echo --- and that the alter statements replicated correctly ---
 
57
 
 
58
sync_slave_with_master;
 
59
SHOW CREATE TABLE t1;
 
60
 
 
61
--source include/rpl_multi_engine2.inc
 
62
 
 
63
#################################################
 
64
--echo --- Check that replication works when slave has more columns than master
 
65
connection master;
 
66
ALTER TABLE t1 ADD PRIMARY KEY(id,total);
 
67
ALTER TABLE t1 MODIFY vc TEXT;
 
68
 
 
69
INSERT INTO t1 VALUES(3,1,'Testing MySQL databases is a cool ',
 
70
                      'Must make it bug free for the customer',
 
71
                       654321.4321,15.21,0,1965,"1905-11-14");
 
72
INSERT INTO t1 VALUES(20,1,'Testing MySQL databases is a cool ',
 
73
                      'Must make it bug free for the customer',
 
74
                       654321.4321,15.21,0,1965,"1965-11-14");
 
75
INSERT INTO t1 VALUES(50,1,'Testing MySQL databases is a cool ',
 
76
                      'Must make it bug free for the customer',
 
77
                       654321.4321,15.21,0,1965,"1985-11-14");
 
78
 
 
79
--echo --- Add columns on slave ---
 
80
--sync_slave_with_master
 
81
ALTER TABLE t1 ADD (u int, v char(16) default 'default');
 
82
UPDATE t1 SET u=7 WHERE id < 50;
 
83
UPDATE t1 SET v='explicit' WHERE id >10;
 
84
 
 
85
--echo --- Show changed table on slave ---
 
86
 
 
87
SHOW CREATE TABLE t1;
 
88
SELECT * 
 
89
FROM t1
 
90
ORDER BY id;
 
91
 
 
92
--source include/rpl_multi_engine2.inc
 
93
TRUNCATE TABLE t1;
 
94
 
 
95
#################################################
 
96
--echo --- Check that replication works when master has more columns than slave
 
97
connection master;
 
98
 
 
99
--echo --- Remove columns on slave ---
 
100
--sync_slave_with_master
 
101
ALTER TABLE t1 DROP COLUMN v;
 
102
ALTER TABLE t1 DROP COLUMN u;
 
103
ALTER TABLE t1 DROP COLUMN t;
 
104
ALTER TABLE t1 DROP COLUMN y;
 
105
 
 
106
--echo --- Show changed table on slave ---
 
107
 
 
108
SHOW CREATE TABLE t1;
 
109
 
 
110
--source include/rpl_multi_engine2.inc
 
111
TRUNCATE TABLE t1;
 
112
 
 
113
#################################################
 
114
--echo --- Do Cleanup --
 
115
connection master;
 
116
DROP TABLE IF EXISTS t1;
 
117
 
 
118
sync_slave_with_master;
 
119
connection master;