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

51 lines
2.3 KiB
Plaintext

-- source include/have_ndb.inc
create table t1(id1 int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
create table t2(id2 int NOT NULL PRIMARY KEY, id1 int, data char(8)) engine=ndb
comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
alter table t2 algorithm=inplace, add constraint id1 foreign key (id1) references t1(id1);
load data local infile 'suite/ndb/data/table_data10000.dat' into table t1 fields terminated by ' ' lines terminated by '\n' ignore 900 lines;
load data local infile 'suite/ndb/data/table_data10000.dat' into table t2 fields terminated by ' ' lines terminated by '\n' ignore 900 lines (@id, data) set id1 = @id, id2 = -@id;
## Check details of partitioning
--replace_regex /FragmentCount:/FragmentCount/ /PartitionCount:/PartitionCount/ /HashMap:/HashMap/ /.*[=:#].*// /.*- .*// /[0-9]*\/[0-9]*\/id1/.../
--exec $NDB_DESC -dtest t1
--replace_regex /FragmentCount:/FragmentCount/ /PartitionCount:/PartitionCount/ /HashMap:/HashMap/ /.*[=:#].*// /.*- .*// /[0-9]*\/[0-9]*\/id1/.../
--exec $NDB_DESC -dtest t2
## Create nodegroup for "new" nodes
--replace_regex /Connected to Management Server at: .*//
--exec $NDB_MGM -e "create nodegroup 3,4"
## Drop
--replace_regex /Connected to Management Server at: .*//
--exec $NDB_MGM -e "drop nodegroup 1"
## and create
--replace_regex /Connected to Management Server at: .*//
--exec $NDB_MGM -e "create nodegroup 3,4"
alter table t2 algorithm=inplace, reorganize partition;
alter table t1 algorithm=inplace, reorganize partition;
## Check details of partitioning
--replace_regex /FragmentCount:/FragmentCount/ /PartitionCount:/PartitionCount/ /HashMap:/HashMap/ /.*[=:#].*// /.*- .*// /[0-9]*\/[0-9]*\/id1/.../
--exec $NDB_DESC -dtest t1
--replace_regex /FragmentCount:/FragmentCount/ /PartitionCount:/PartitionCount/ /HashMap:/HashMap/ /.*[=:#].*// /.*- .*// /[0-9]*\/[0-9]*\/id1/.../
--exec $NDB_DESC -dtest t2
## Drop nodegroup with "new" nodes is not allowed with data one those nodes
# NOTE: --error=0 is due to return codes doesnt work on windoze
--replace_regex /Connected to Management Server at: .*//
--error 0,255
--exec $NDB_MGM -e "drop nodegroup 1"
drop table t2,t1;
## Drop nodegroup with "new" nodes
--replace_regex /Connected to Management Server at: .*//
--exec $NDB_MGM -e "drop nodegroup 1"
# Cleanup