| 1 |
############################################################################# |
| 2 |
# Original Author: JBM # |
| 3 |
# Original Date: Aug/19/2005 # |
| 4 |
# Updated: 08/29/2005 Remove sleeps # |
| 5 |
############################################################################# |
| 6 |
#TEST: row based replication of views # |
| 7 |
############################################################################# |
| 8 |
# 2006-02-08 By JBM added order by and sleep for use with ndb engine |
| 9 |
############################################################################# |
| 10 |
# Includes |
| 11 |
-- source include/have_binlog_format_row.inc |
| 12 |
-- source include/set_privilege_checks_user_as_system_user.inc |
| 13 |
-- source include/master-slave.inc |
| 14 |
|
| 15 |
# Begin clean up test section |
| 16 |
connection master; |
| 17 |
create database mysqltest1; |
| 18 |
|
| 19 |
# Begin test section 1 |
| 20 |
CREATE TABLE mysqltest1.t1 (a INT, c CHAR(6),PRIMARY KEY(a)); |
| 21 |
CREATE TABLE mysqltest1.t2 (a INT, c CHAR(6),PRIMARY KEY(a)); |
| 22 |
CREATE TABLE mysqltest1.t3 (a INT, c CHAR(6), c2 CHAR(6), PRIMARY KEY(a)); |
| 23 |
CREATE TABLE mysqltest1.t4 (a INT, qty INT, price INT,PRIMARY KEY(a)); |
| 24 |
CREATE TABLE mysqltest1.t5 (qty INT, price INT, total INT, PRIMARY KEY(qty)); |
| 25 |
INSERT INTO mysqltest1.t1 VALUES (1,'Thank'),(2,'it'),(3,'Friday'); |
| 26 |
INSERT INTO mysqltest1.t2 VALUES (1,'GOD'),(2,'is'),(3,'TGIF'); |
| 27 |
INSERT INTO mysqltest1.t4 VALUES(1, 3, 50),(2, 18, 3),(4, 4, 4); |
| 28 |
|
| 29 |
|
| 30 |
CREATE VIEW mysqltest1.v2 AS SELECT qty, price, qty*price AS value FROM mysqltest1.t4 ORDER BY qty; |
| 31 |
CREATE VIEW mysqltest1.v1 AS SELECT t1.a, t1.c, t2.c as c2 FROM mysqltest1.t1 as t1, mysqltest1.t2 AS t2 WHERE mysqltest1.t1.a = mysqltest1.t2.a ORDER BY a; |
| 32 |
CREATE VIEW mysqltest1.v3 AS SELECT * FROM mysqltest1.t1; |
| 33 |
CREATE VIEW mysqltest1.v4 AS SELECT * FROM mysqltest1.v3 WHERE a > 1 WITH LOCAL CHECK OPTION; |
| 34 |
|
| 35 |
|
| 36 |
SELECT * FROM mysqltest1.v2; |
| 37 |
SELECT * FROM mysqltest1.v1; |
| 38 |
|
| 39 |
|
| 40 |
# Had to add a waiting for use with NDB |
| 41 |
# engine. Injector thread would have not |
| 42 |
# populated binlog and data would not be on |
| 43 |
# the slave. |
| 44 |
|
| 45 |
CREATE TABLE mysqltest1.t10 (a INT, PRIMARY KEY(a)); |
| 46 |
let $wait_binlog_event= CREATE TABLE mysqltest1.t10; |
| 47 |
-- source include/wait_for_binlog_event.inc |
| 48 |
--source include/sync_slave_sql_with_master.inc |
| 49 |
|
| 50 |
SELECT * FROM mysqltest1.v2; |
| 51 |
SELECT * FROM mysqltest1.v1; |
| 52 |
connection master; |
| 53 |
|
| 54 |
INSERT INTO mysqltest1.t5 SELECT * FROM mysqltest1.v2; |
| 55 |
INSERT INTO mysqltest1.t3 SELECT * FROM mysqltest1.v1; |
| 56 |
|
| 57 |
SELECT * FROM mysqltest1.t5 ORDER BY qty; |
| 58 |
SELECT * FROM mysqltest1.t3 ORDER BY a; |
| 59 |
--source include/sync_slave_sql_with_master.inc |
| 60 |
SELECT * FROM mysqltest1.t5 ORDER BY qty; |
| 61 |
SELECT * FROM mysqltest1.t3 ORDER BY a; |
| 62 |
connection master; |
| 63 |
|
| 64 |
INSERT INTO mysqltest1.v4 VALUES (4,'TEST'); |
| 65 |
|
| 66 |
SELECT * FROM mysqltest1.t1 ORDER BY a; |
| 67 |
SELECT * FROM mysqltest1.v4 ORDER BY a; |
| 68 |
--source include/sync_slave_sql_with_master.inc |
| 69 |
SELECT * FROM mysqltest1.t1 ORDER BY a; |
| 70 |
SELECT * FROM mysqltest1.v4 ORDER BY a; |
| 71 |
|
| 72 |
connection master; |
| 73 |
|
| 74 |
# lets cleanup |
| 75 |
DROP VIEW IF EXISTS mysqltest1.v1; |
| 76 |
DROP VIEW IF EXISTS mysqltest1.v2; |
| 77 |
DROP VIEW IF EXISTS mysqltest1.v3; |
| 78 |
DROP VIEW IF EXISTS mysqltest1.v4; |
| 79 |
DROP TABLE IF EXISTS mysqltest1.t3; |
| 80 |
DROP TABLE IF EXISTS mysqltest1.t1; |
| 81 |
DROP TABLE IF EXISTS mysqltest1.t2; |
| 82 |
DROP TABLE IF EXISTS mysqltest1.t4; |
| 83 |
DROP TABLE IF EXISTS mysqltest1.t10; |
| 84 |
DROP DATABASE mysqltest1; |
| 85 |
--source include/sync_slave_sql_with_master.inc |
| 86 |
|
| 87 |
# End of 5.1 test case |
| 88 |
|
| 89 |
--source include/rpl_end.inc |