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

188 lines
6.9 KiB
Plaintext

-- source include/have_ndb.inc
--source suite/ndb/include/turn_off_ndb_read_backup.inc
create table t1 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb;
select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
where fq_name = 'test/def/t1' order by node_id, fragment_num, block_instance;
create table t2 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
where fq_name = 'test/def/t2' order by node_id, fragment_num, block_instance;
create table t3 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
comment="NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_LDM";
select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
where fq_name = 'test/def/t3' order by node_id, fragment_num, block_instance;
create table t4 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_NODE";
select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
where fq_name = 'test/def/t4' order by node_id, fragment_num, block_instance;
create table t5 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
comment="NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_NODE";
select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
where fq_name = 'test/def/t5' order by node_id, fragment_num, block_instance;
create table t6 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
comment="NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_LDM_X_2";
select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
where fq_name = 'test/def/t6' order by node_id, fragment_num, block_instance;
create table t7 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
comment="NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_LDM_X_3";
select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
where fq_name = 'test/def/t7' order by node_id, fragment_num, block_instance;
create table t8 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
comment="NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_LDM_X_4";
select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
where fq_name = 'test/def/t8' order by node_id, fragment_num, block_instance;
select count(*) into @cnt_t1_0
from information_schema.partitions
where table_schema = 'test' and table_name = 't1';
select count(*) into @cnt_t2_0
from information_schema.partitions
where table_schema = 'test' and table_name = 't2';
select count(*) into @cnt_t3_0
from information_schema.partitions
where table_schema = 'test' and table_name = 't3';
select count(*) into @cnt_t4_0
from information_schema.partitions
where table_schema = 'test' and table_name = 't4';
select count(*) into @cnt_t5_0
from information_schema.partitions
where table_schema = 'test' and table_name = 't5';
select count(*) into @cnt_t6_0
from information_schema.partitions
where table_schema = 'test' and table_name = 't6';
select count(*) into @cnt_t7_0
from information_schema.partitions
where table_schema = 'test' and table_name = 't7';
select count(*) into @cnt_t8_0
from information_schema.partitions
where table_schema = 'test' and table_name = 't8';
##
## skip showing exact counts
##
select @cnt_t1_0 = @cnt_t2_0;
select @cnt_t2_0 > @cnt_t3_0;
select @cnt_t3_0 > @cnt_t4_0;
select @cnt_t4_0 > @cnt_t5_0;
select @cnt_t6_0 = 2 * @cnt_t3_0;
select @cnt_t7_0 = 3 * @cnt_t3_0;
select @cnt_t8_0 = 4 * @cnt_t3_0;
## Create nodegroup for "new" nodes
--echo Creating nodegroup
--exec $NDB_MGM -e "create nodegroup 5,6" > /dev/null
alter table t1 algorithm=inplace, reorganize partition;
select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
where fq_name = 'test/def/t1' order by node_id, fragment_num, block_instance;
alter table t2 algorithm=inplace, reorganize partition;
select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
where fq_name = 'test/def/t2' order by node_id, fragment_num, block_instance;
alter table t3 algorithm=inplace, reorganize partition;
select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
where fq_name = 'test/def/t3' order by node_id, fragment_num, block_instance;
alter table t4 algorithm=inplace, reorganize partition;
select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
where fq_name = 'test/def/t4' order by node_id, fragment_num, block_instance;
alter table t5 algorithm=inplace, reorganize partition;
select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
where fq_name = 'test/def/t5' order by node_id, fragment_num, block_instance;
alter table t6 algorithm=inplace, reorganize partition;
select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
where fq_name = 'test/def/t6' order by node_id, fragment_num, block_instance;
alter table t7 algorithm=inplace, reorganize partition;
select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
where fq_name = 'test/def/t7' order by node_id, fragment_num, block_instance;
alter table t8 algorithm=inplace, reorganize partition;
select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
where fq_name = 'test/def/t8' order by node_id, fragment_num, block_instance;
select count(*) into @cnt_t1_1
from information_schema.partitions
where table_schema = 'test' and table_name = 't1';
select count(*) into @cnt_t2_1
from information_schema.partitions
where table_schema = 'test' and table_name = 't2';
select count(*) into @cnt_t3_1
from information_schema.partitions
where table_schema = 'test' and table_name = 't3';
select count(*) into @cnt_t4_1
from information_schema.partitions
where table_schema = 'test' and table_name = 't4';
select count(*) into @cnt_t5_1
from information_schema.partitions
where table_schema = 'test' and table_name = 't5';
select count(*) into @cnt_t6_0
from information_schema.partitions
where table_schema = 'test' and table_name = 't6';
select count(*) into @cnt_t7_0
from information_schema.partitions
where table_schema = 'test' and table_name = 't7';
select count(*) into @cnt_t8_0
from information_schema.partitions
where table_schema = 'test' and table_name = 't8';
##
## skip showing exact counts
##
select @cnt_t1_1 = @cnt_t2_1;
select @cnt_t2_1 > @cnt_t3_1;
select @cnt_t3_1 > @cnt_t4_1;
select @cnt_t4_1 > @cnt_t5_1;
select @cnt_t6_1 = 2 * @cnt_t3_1;
select @cnt_t7_1 = 3 * @cnt_t3_1;
select @cnt_t8_1 = 4 * @cnt_t3_1;
select @cnt_t1_1 > @cnt_t1_0;
select @cnt_t2_1 > @cnt_t2_0;
select @cnt_t3_1 > @cnt_t3_0;
select @cnt_t4_1 > @cnt_t4_0;
select @cnt_t5_1 > @cnt_t5_0;
select @cnt_t6_1 > @cnt_t6_0;
select @cnt_t7_1 > @cnt_t7_0;
select @cnt_t8_1 > @cnt_t8_0;
let $i = 200;
--disable_query_log
while ($i) {
eval insert into t1 values ($i, '$i');
dec $i;
}
--enable_query_log
--let ndb_desc_opts= -p -d test t1
--source suite/ndb/include/ndb_desc_print.inc
drop table t1,t2,t3,t4,t5,t6,t7,t8;
--source suite/ndb/include/restore_ndb_read_backup.inc