polardbxengine/mysql-test/suite/ndb/t/ndb_bug17624736.test

107 lines
3.1 KiB
Plaintext

--source include/have_ndb.inc
--source suite/ndb/include/backup_restore_setup.inc
# Ignore the warning generated by ndbcluster's binlog thread
# when cluster is restarted
--disable_query_log
call mtr.add_suppression("cluster disconnect An incident event has been written");
call mtr.add_suppression("NDB: stored grants: initialization has failed.");
call mtr.add_suppression("NDB: stored grants: failed to apply stored grants.");
--enable_query_log
# Ignore the warning generated by ndbcluster's binlog thread
# when cluster is restarted - also on the second mysqld
connect(mysqld2,127.0.0.1,root,,test,$MASTER_MYPORT1);
connection mysqld2;
--disable_query_log
call mtr.add_suppression("cluster disconnect An incident event has been written");
call mtr.add_suppression("NDB: stored grants: initialization has failed.");
call mtr.add_suppression("NDB: stored grants: failed to apply stored grants.");
--enable_query_log
connection default;
--disable_query_log ONCE
CREATE TEMPORARY TABLE IF NOT EXISTS ndb_show_tables_results (
id INT,
type VARCHAR(20),
state VARCHAR(20),
logging VARCHAR(20),
_database VARCHAR(255),
_schema VARCHAR(20),
name VARCHAR(255)
);
let $qry =
select type,name from ndb_show_tables_results
where (type like '%Index%' or type like '%ForeignKey%')
and (name like '%t1%' or name like '%t2%')
order by name;
let $cre1 =
create table t1 (
a int not null,
b int not null,
unique key t1x1 (b) using hash,
primary key using hash (a)
) engine=ndb;
let $cre2 =
create table t2 (
a int not null,
b int not null,
key t2x1 (b),
primary key using hash (a),
constraint t2fk1 foreign key (b) references t1 (b)
) engine=ndb;
--eval $cre1
--eval $cre2
--source ndb_show_tables_result.inc
--replace_regex /[0-9]+\/[0-9]+/XX\/XX/
--eval $qry
insert into t1 values (1,10),(2,20),(3,30),(4,40),(5,50);
insert into t2 values (1,10),(2,10),(3,30),(4,50),(5,50);
select * from t1 where b = 10 order by a;
select * from t2 where b = 10 order by a;
--echo # run restart skip indexes
--exec $NDB_MGM --no-defaults -e "all restart -n" >> $NDB_TOOLS_OUTPUT
--exec $NDB_WAITER --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" --not-started >> $NDB_TOOLS_OUTPUT
--exec $NDB_MGM --no-defaults -e "all start" >> $NDB_TOOLS_OUTPUT
--exec $NDB_WAITER --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" >> $NDB_TOOLS_OUTPUT
--source ndb_show_tables_result.inc
--replace_regex /[0-9]+\/[0-9]+/XX\/XX/
--eval $qry
# FRM is wrong so SQL level fails (drop works)
# verify that SQL level can be fixed via BACKUP
--echo # run backup
--source include/ndb_backup.inc
--echo # create empty schema
drop table t2, t1;
--eval $cre1
--eval $cre2
--source ndb_show_tables_result.inc
--replace_regex /[0-9]+\/[0-9]+/XX\/XX/
--eval $qry
--echo # run restore
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT
select * from t1 where b = 10 order by a;
select * from t2 where b = 10 order by a;
drop table t2, t1;
--source suite/ndb/include/backup_restore_cleanup.inc
--remove_file $NDB_TOOLS_OUTPUT