| 1 |
--source include/have_ndb.inc |
| 2 |
CALL mtr.add_suppression("Incorrect information in file"); |
| 3 |
|
| 4 |
if (`select @@log_bin`) |
| 5 |
{ |
| 6 |
die This test is designed to run with --log-bin turned off; |
| 7 |
} |
| 8 |
|
| 9 |
CREATE TABLE t1(a int primary key, b varchar(255), c int) engine=ndb; |
| 10 |
|
| 11 |
select * from t1; |
| 12 |
insert into t1 values (1, "row 1", 2); |
| 13 |
|
| 14 |
connect(con1, localhost, root,,); |
| 15 |
connect(con2, localhost, root,,); |
| 16 |
connect(con3, localhost, root,,); |
| 17 |
|
| 18 |
connection con1; |
| 19 |
select * from t1; |
| 20 |
connection con2; |
| 21 |
select * from t1; |
| 22 |
connection con3; |
| 23 |
select * from t1; |
| 24 |
|
| 25 |
# Restart cluster nodes "nostart" |
| 26 |
--exec $NDB_MGM -e "all restart -n" >> $NDB_TOOLS_OUTPUT |
| 27 |
# Wait for all nodes to enter "nostart" |
| 28 |
--exec $NDB_WAITER --not-started |
| 29 |
|
| 30 |
let $counter = 500; |
| 31 |
--disable_query_log |
| 32 |
--disable_result_log |
| 33 |
while($mysql_errno != 1296) |
| 34 |
{ |
| 35 |
sleep 1; |
| 36 |
--error 1296,1297 |
| 37 |
select * from t1; |
| 38 |
if (!$counter) |
| 39 |
{ |
| 40 |
die Timeout while waiting for MySQL Server to disconnect from cluster; |
| 41 |
} |
| 42 |
dec $counter; |
| 43 |
} |
| 44 |
--enable_query_log |
| 45 |
--enable_result_log |
| 46 |
|
| 47 |
|
| 48 |
connection con1; |
| 49 |
--error 1296 |
| 50 |
select * from t1; |
| 51 |
|
| 52 |
connection con2; |
| 53 |
--error 1296 |
| 54 |
select * from t1; |
| 55 |
|
| 56 |
# Don't do anything with the third connection |
| 57 |
#connection con3; |
| 58 |
|
| 59 |
|
| 60 |
# Start cluster nodes again |
| 61 |
--exec $NDB_MGM -e "all start" >> $NDB_TOOLS_OUTPUT |
| 62 |
# Wait for all nodes to enter "started" |
| 63 |
--exec $NDB_WAITER |
| 64 |
|
| 65 |
|
| 66 |
# |
| 67 |
# Wait until the connection to the |
| 68 |
# cluster has been restored or timeout occurs |
| 69 |
# |
| 70 |
connection default; |
| 71 |
--source include/ndb_not_readonly.inc |
| 72 |
|
| 73 |
# Run selects to show that the cluster are back |
| 74 |
|
| 75 |
connection con1; |
| 76 |
select a,b,c from t1; |
| 77 |
|
| 78 |
connection con2; |
| 79 |
select * from t1; |
| 80 |
|
| 81 |
connection con3; |
| 82 |
select * from t1; |
| 83 |
|
| 84 |
# |
| 85 |
# Wait until mysqld has connected properly to cluster |
| 86 |
# |
| 87 |
source include/ndb_not_readonly.inc; |
| 88 |
|
| 89 |
# Do an insert to see table is writable |
| 90 |
insert into t1 values (2, "row 1", 37); |
| 91 |
|
| 92 |
# cleanup |
| 93 |
drop table t1; |
| 94 |
|
| 95 |
# |
| 96 |
#Bug #13824846 FRM FILES ARE CREATED FOR MYSQLD, BUT TABLE DOES NOT EXIST IN CLUSTER |
| 97 |
# |
| 98 |
|
| 99 |
connection default; |
| 100 |
create table t1(a int, b varchar(10), c date) engine=ndb; |
| 101 |
delimiter //; |
| 102 |
CREATE TRIGGER trg1 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN |
| 103 |
SET new.c = '1901-01-01 01:01:01'; |
| 104 |
End // |
| 105 |
delimiter ;// |
| 106 |
|
| 107 |
insert into t1 values (1, "row 1", NULL),(2, "row 2", NULL); |
| 108 |
select * from t1 order by a; |
| 109 |
|
| 110 |
create table t2(a int, b varchar(10), c date) engine=myisam; |
| 111 |
delimiter //; |
| 112 |
CREATE TRIGGER trg2 BEFORE UPDATE ON t2 FOR EACH ROW BEGIN |
| 113 |
SET new.c = '1901-01-01 01:01:01'; |
| 114 |
End // |
| 115 |
delimiter ;// |
| 116 |
|
| 117 |
# drop the table from NDB only |
| 118 |
--exec $NDB_DROP_TABLE -d test t1 >> $NDB_TOOLS_OUTPUT |
| 119 |
|
| 120 |
# Restart cluster nodes |
| 121 |
--exec $NDB_MGM -e "all restart" >> $NDB_TOOLS_OUTPUT |
| 122 |
# Wait for all nodes to enter "started" |
| 123 |
--exec $NDB_WAITER |
| 124 |
|
| 125 |
# |
| 126 |
# Wait until the connection to the |
| 127 |
# cluster has been restored or timeout occurs |
| 128 |
# |
| 129 |
connection default; |
| 130 |
--source include/ndb_not_readonly.inc |
| 131 |
|
| 132 |
# Create the table again to check there are no conflicts |
| 133 |
create table t1(a int, b varchar(10), c date) engine=ndb; |
| 134 |
delimiter //; |
| 135 |
CREATE TRIGGER trg1 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN |
| 136 |
SET new.c = '1902-02-02 02:02:02'; |
| 137 |
End // |
| 138 |
delimiter ;// |
| 139 |
|
| 140 |
insert into t1 values (1, "row 1", NULL),(2, "row 2", NULL); |
| 141 |
select * from t1 order by a; |
| 142 |
|
| 143 |
# Check that the non NDB tables still exist |
| 144 |
--error ER_TABLE_EXISTS_ERROR |
| 145 |
create table t2(a int, b varchar(10), c date) engine=myisam; |
| 146 |
drop table t2; |
| 147 |
create table t2(a int, b varchar(10), c date) engine=myisam; |
| 148 |
delimiter //; |
| 149 |
CREATE TRIGGER trg2 BEFORE UPDATE ON t2 FOR EACH ROW BEGIN |
| 150 |
SET new.c = '1901-01-01 01:01:01'; |
| 151 |
End // |
| 152 |
delimiter ;// |
| 153 |
|
| 154 |
# cleanup |
| 155 |
drop table t1, t2; |
| 156 |
--remove_file $NDB_TOOLS_OUTPUT |