| 1 |
create table t1 ( |
| 2 |
a int not null, |
| 3 |
b int not null, |
| 4 |
unique key t1x1 (b) using hash, |
| 5 |
primary key using hash (a) |
| 6 |
) engine=ndb; |
| 7 |
create table t2 ( |
| 8 |
a int not null, |
| 9 |
b int not null, |
| 10 |
key t2x1 (b), |
| 11 |
primary key using hash (a), |
| 12 |
constraint t2fk1 foreign key (b) references t1 (b) |
| 13 |
) engine=ndb; |
| 14 |
Expect fk and indexes to exist |
| 15 |
type name |
| 16 |
Unique hash index t1x1$unique |
| 17 |
Foreign key definition t2fk1 |
| 18 |
Ordered index t2x1 |
| 19 |
insert into t1 values (1,10),(2,20),(3,30),(4,40),(5,50); |
| 20 |
insert into t2 values (1,10),(2,10),(3,30),(4,50),(5,50); |
| 21 |
select * from t1 where b = 10 order by a; |
| 22 |
a b |
| 23 |
1 10 |
| 24 |
select * from t2 where b = 10 order by a; |
| 25 |
a b |
| 26 |
1 10 |
| 27 |
2 10 |
| 28 |
# run restart skip indexes |
| 29 |
Node 1: NOT_STARTED |
| 30 |
Node 2: NOT_STARTED |
| 31 |
Node 1: STARTED |
| 32 |
Node 2: STARTED |
| 33 |
Expect neither fk or indexes since restart was without indexes |
| 34 |
type name |
| 35 |
# run backup |
| 36 |
# create empty schema |
| 37 |
drop table t2, t1; |
| 38 |
create table t1 ( |
| 39 |
a int not null, |
| 40 |
b int not null, |
| 41 |
unique key t1x1 (b) using hash, |
| 42 |
primary key using hash (a) |
| 43 |
) engine=ndb; |
| 44 |
create table t2 ( |
| 45 |
a int not null, |
| 46 |
b int not null, |
| 47 |
key t2x1 (b), |
| 48 |
primary key using hash (a), |
| 49 |
constraint t2fk1 foreign key (b) references t1 (b) |
| 50 |
) engine=ndb; |
| 51 |
Expect fk and indexes to exist again |
| 52 |
type name |
| 53 |
Unique hash index t1x1$unique |
| 54 |
Foreign key definition t2fk1 |
| 55 |
Ordered index t2x1 |
| 56 |
# run restore |
| 57 |
select * from t1 where b = 10 order by a; |
| 58 |
a b |
| 59 |
1 10 |
| 60 |
select * from t2 where b = 10 order by a; |
| 61 |
a b |
| 62 |
1 10 |
| 63 |
2 10 |
| 64 |
drop table t2, t1; |