| 1 |
-- source include/have_multi_ndb.inc |
| 2 |
-- source suite/ndb/include/backup_restore_setup.inc |
| 3 |
|
| 4 |
--connection server1 |
| 5 |
# Ignore the warning generated by ndbcluster's binlog thread |
| 6 |
# when cluster is restarted |
| 7 |
--disable_query_log ONCE |
| 8 |
call mtr.add_suppression("cluster disconnect An incident event has been written"); |
| 9 |
|
| 10 |
--connection server2 |
| 11 |
# Ignore the warning generated by ndbcluster's binlog thread |
| 12 |
# when cluster is restarted - also on the second mysqld |
| 13 |
--disable_query_log ONCE |
| 14 |
call mtr.add_suppression("cluster disconnect An incident event has been written"); |
| 15 |
|
| 16 |
connect (con1,127.0.0.1,root,,test,$MASTER_MYPORT,); |
| 17 |
connect (con2,127.0.0.1,root,,test,$MASTER_MYPORT1,); |
| 18 |
|
| 19 |
# |
| 20 |
# Transaction ongoing while cluster is restarted |
| 21 |
# |
| 22 |
--connection server1 |
| 23 |
create table t1 (a int key) engine=ndbcluster; |
| 24 |
|
| 25 |
begin; |
| 26 |
insert into t1 values (1); |
| 27 |
|
| 28 |
--exec $NDB_MGM -e "all restart" >> $NDB_TOOLS_OUTPUT |
| 29 |
--exec $NDB_WAITER >> $NDB_TOOLS_OUTPUT |
| 30 |
|
| 31 |
# Wait for mysqld to reconnect and exit from readonly mode |
| 32 |
--connection con1 |
| 33 |
--source include/ndb_not_readonly.inc |
| 34 |
# wait for server1 stats thread to re-initialize |
| 35 |
--source suite/ndb/include/ndb_index_stat_wait.inc |
| 36 |
|
| 37 |
--connection con2 |
| 38 |
--source include/ndb_not_readonly.inc |
| 39 |
# wait for server2 stats thread to re-initialize |
| 40 |
--source suite/ndb/include/ndb_index_stat_wait.inc |
| 41 |
|
| 42 |
--connection server1 |
| 43 |
--error 1297 |
| 44 |
insert into t1 values (2); |
| 45 |
rollback; |
| 46 |
|
| 47 |
drop table t1; |
| 48 |
|
| 49 |
# |
| 50 |
# Stale cache after restart -i |
| 51 |
# |
| 52 |
--connection server1 |
| 53 |
create table t2 (a int, b int, primary key(a,b)) engine=ndbcluster; |
| 54 |
insert into t2 |
| 55 |
values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1); |
| 56 |
select * from t2 order by a limit 3; |
| 57 |
|
| 58 |
--source include/ndb_backup_id.inc |
| 59 |
--exec $NDB_MGM -e "all restart -i" >> $NDB_TOOLS_OUTPUT |
| 60 |
--exec $NDB_WAITER >> $NDB_TOOLS_OUTPUT |
| 61 |
# now make a backup with explicit id to restore the backup id after initial start |
| 62 |
--inc $the_backup_id |
| 63 |
--exec $NDB_MGM -e "start backup $the_backup_id" >> $NDB_TOOLS_OUTPUT |
| 64 |
# to ensure mysqld has connected again, and recreated system tables |
| 65 |
|
| 66 |
--connection con1 |
| 67 |
--source include/ndb_not_readonly.inc |
| 68 |
# wait for server1 stats thread to re-initialize |
| 69 |
--source suite/ndb/include/ndb_index_stat_wait.inc |
| 70 |
|
| 71 |
--connection con2 |
| 72 |
--source include/ndb_not_readonly.inc |
| 73 |
# wait for server2 stats thread to re-initialize |
| 74 |
--source suite/ndb/include/ndb_index_stat_wait.inc |
| 75 |
|
| 76 |
--connection server2 |
| 77 |
--error ER_NO_SUCH_TABLE |
| 78 |
select * from t2; |
| 79 |
show tables like 't2'; |
| 80 |
reset master; |
| 81 |
create table t2 (a int key) engine=ndbcluster; |
| 82 |
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); |
| 83 |
select * from t2 order by a limit 3; |
| 84 |
|
| 85 |
# server 1 should have a stale cache, transaction must be retried |
| 86 |
--connection server1 |
| 87 |
select * from t2 order by a limit 3; |
| 88 |
reset master; |
| 89 |
|
| 90 |
--source include/ndb_backup_id.inc |
| 91 |
--exec $NDB_MGM -e "all restart -i" >> $NDB_TOOLS_OUTPUT |
| 92 |
--exec $NDB_WAITER >> $NDB_TOOLS_OUTPUT |
| 93 |
# now make a backup with explicit id to restore the backup id after initial start |
| 94 |
--inc $the_backup_id |
| 95 |
--exec $NDB_MGM -e "start backup $the_backup_id" >> $NDB_TOOLS_OUTPUT |
| 96 |
# to ensure mysqld has connected again, and recreated system tables |
| 97 |
|
| 98 |
--connection con1 |
| 99 |
--source include/ndb_not_readonly.inc |
| 100 |
# wait for server1 stats thread to re-initialize |
| 101 |
--source suite/ndb/include/ndb_index_stat_wait.inc |
| 102 |
|
| 103 |
--connection con2 |
| 104 |
--source include/ndb_not_readonly.inc |
| 105 |
# wait for server2 stats thread to re-initialize |
| 106 |
--source suite/ndb/include/ndb_index_stat_wait.inc |
| 107 |
|
| 108 |
--connection server1 |
| 109 |
--error ER_NO_SUCH_TABLE |
| 110 |
select * from t2; |
| 111 |
show tables like 't2'; |
| 112 |
reset master; |
| 113 |
create table t2 (a int key) engine=ndbcluster; |
| 114 |
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); |
| 115 |
select * from t2 order by a limit 3; |
| 116 |
|
| 117 |
# server 2 should have a stale cache, transaction need not be retried |
| 118 |
--connection server2 |
| 119 |
select * from t2 order by a limit 3; |
| 120 |
reset master; |
| 121 |
|
| 122 |
drop table t2; |
| 123 |
--source suite/ndb/include/backup_restore_cleanup.inc |
| 124 |
--remove_file $NDB_TOOLS_OUTPUT |