1create table t1 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb;
2select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
3where fq_name = 'test/def/t1' order by node_id, fragment_num, block_instance;
4node_id	fragment_num	block_instance
51	0	1
61	2	2
71	4	3
81	6	4
91	8	1
101	10	2
111	12	3
121	14	4
132	0	1
142	2	2
152	4	3
162	6	4
172	8	1
182	10	2
192	12	3
202	14	4
213	1	1
223	3	2
233	5	3
243	7	4
253	9	1
263	11	2
273	13	3
283	15	4
294	1	1
304	3	2
314	5	3
324	7	4
334	9	1
344	11	2
354	13	3
364	15	4
37create table t2 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
38comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
39select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
40where fq_name = 'test/def/t2' order by node_id, fragment_num, block_instance;
41node_id	fragment_num	block_instance
421	0	1
431	2	2
441	4	3
451	6	4
461	8	1
471	10	2
481	12	3
491	14	4
502	0	1
512	2	2
522	4	3
532	6	4
542	8	1
552	10	2
562	12	3
572	14	4
583	1	1
593	3	2
603	5	3
613	7	4
623	9	1
633	11	2
643	13	3
653	15	4
664	1	1
674	3	2
684	5	3
694	7	4
704	9	1
714	11	2
724	13	3
734	15	4
74create table t3 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
75comment="NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_LDM";
76select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
77where fq_name = 'test/def/t3' order by node_id, fragment_num, block_instance;
78node_id	fragment_num	block_instance
791	0	1
801	2	2
811	4	3
821	6	4
832	0	1
842	2	2
852	4	3
862	6	4
873	1	1
883	3	2
893	5	3
903	7	4
914	1	1
924	3	2
934	5	3
944	7	4
95create table t4 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
96comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_NODE";
97select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
98where fq_name = 'test/def/t4' order by node_id, fragment_num, block_instance;
99node_id	fragment_num	block_instance
1001	0	1
1011	2	2
1022	0	1
1032	2	2
1043	1	1
1053	3	2
1064	1	1
1074	3	2
108create table t5 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
109comment="NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_NODE";
110select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
111where fq_name = 'test/def/t5' order by node_id, fragment_num, block_instance;
112node_id	fragment_num	block_instance
1131	0	3
1142	0	3
1153	1	3
1164	1	3
117create table t6 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
118comment="NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_LDM_X_2";
119select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
120where fq_name = 'test/def/t6' order by node_id, fragment_num, block_instance;
121node_id	fragment_num	block_instance
1221	0	1
1231	2	2
1241	4	3
1251	6	4
1261	8	1
1271	10	2
1281	12	3
1291	14	4
1302	0	1
1312	2	2
1322	4	3
1332	6	4
1342	8	1
1352	10	2
1362	12	3
1372	14	4
1383	1	1
1393	3	2
1403	5	3
1413	7	4
1423	9	1
1433	11	2
1443	13	3
1453	15	4
1464	1	1
1474	3	2
1484	5	3
1494	7	4
1504	9	1
1514	11	2
1524	13	3
1534	15	4
154create table t7 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
155comment="NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_LDM_X_3";
156select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
157where fq_name = 'test/def/t7' order by node_id, fragment_num, block_instance;
158node_id	fragment_num	block_instance
1591	0	1
1601	2	2
1611	4	3
1621	6	4
1631	8	1
1641	10	2
1651	12	3
1661	14	4
1671	16	1
1681	18	2
1691	20	3
1701	22	4
1712	0	1
1722	2	2
1732	4	3
1742	6	4
1752	8	1
1762	10	2
1772	12	3
1782	14	4
1792	16	1
1802	18	2
1812	20	3
1822	22	4
1833	1	1
1843	3	2
1853	5	3
1863	7	4
1873	9	1
1883	11	2
1893	13	3
1903	15	4
1913	17	1
1923	19	2
1933	21	3
1943	23	4
1954	1	1
1964	3	2
1974	5	3
1984	7	4
1994	9	1
2004	11	2
2014	13	3
2024	15	4
2034	17	1
2044	19	2
2054	21	3
2064	23	4
207create table t8 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
208comment="NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_LDM_X_4";
209select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
210where fq_name = 'test/def/t8' order by node_id, fragment_num, block_instance;
211node_id	fragment_num	block_instance
2121	0	1
2131	2	2
2141	4	3
2151	6	4
2161	8	1
2171	10	2
2181	12	3
2191	14	4
2201	16	1
2211	18	2
2221	20	3
2231	22	4
2241	24	1
2251	26	2
2261	28	3
2271	30	4
2282	0	1
2292	2	2
2302	4	3
2312	6	4
2322	8	1
2332	10	2
2342	12	3
2352	14	4
2362	16	1
2372	18	2
2382	20	3
2392	22	4
2402	24	1
2412	26	2
2422	28	3
2432	30	4
2443	1	1
2453	3	2
2463	5	3
2473	7	4
2483	9	1
2493	11	2
2503	13	3
2513	15	4
2523	17	1
2533	19	2
2543	21	3
2553	23	4
2563	25	1
2573	27	2
2583	29	3
2593	31	4
2604	1	1
2614	3	2
2624	5	3
2634	7	4
2644	9	1
2654	11	2
2664	13	3
2674	15	4
2684	17	1
2694	19	2
2704	21	3
2714	23	4
2724	25	1
2734	27	2
2744	29	3
2754	31	4
276select count(*) into @cnt_t1_0
277from information_schema.partitions
278where table_schema = 'test' and table_name = 't1';
279select count(*) into @cnt_t2_0
280from information_schema.partitions
281where table_schema = 'test' and table_name = 't2';
282select count(*) into @cnt_t3_0
283from information_schema.partitions
284where table_schema = 'test' and table_name = 't3';
285select count(*) into @cnt_t4_0
286from information_schema.partitions
287where table_schema = 'test' and table_name = 't4';
288select count(*) into @cnt_t5_0
289from information_schema.partitions
290where table_schema = 'test' and table_name = 't5';
291select count(*) into @cnt_t6_0
292from information_schema.partitions
293where table_schema = 'test' and table_name = 't6';
294select count(*) into @cnt_t7_0
295from information_schema.partitions
296where table_schema = 'test' and table_name = 't7';
297select count(*) into @cnt_t8_0
298from information_schema.partitions
299where table_schema = 'test' and table_name = 't8';
300select @cnt_t1_0 = @cnt_t2_0;
301@cnt_t1_0 = @cnt_t2_0
3021
303select @cnt_t2_0 > @cnt_t3_0;
304@cnt_t2_0 > @cnt_t3_0
3051
306select @cnt_t3_0 > @cnt_t4_0;
307@cnt_t3_0 > @cnt_t4_0
3081
309select @cnt_t4_0 > @cnt_t5_0;
310@cnt_t4_0 > @cnt_t5_0
3111
312select @cnt_t6_0 = 2 * @cnt_t3_0;
313@cnt_t6_0 = 2 * @cnt_t3_0
3141
315select @cnt_t7_0 = 3 * @cnt_t3_0;
316@cnt_t7_0 = 3 * @cnt_t3_0
3171
318select @cnt_t8_0 = 4 * @cnt_t3_0;
319@cnt_t8_0 = 4 * @cnt_t3_0
3201
321Creating nodegroup
322alter table t1 algorithm=inplace, reorganize partition;
323select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
324where fq_name = 'test/def/t1' order by node_id, fragment_num, block_instance;
325node_id	fragment_num	block_instance
3261	0	1
3271	2	2
3281	4	3
3291	6	4
3301	8	1
3311	10	2
3321	12	3
3331	14	4
3342	0	1
3352	2	2
3362	4	3
3372	6	4
3382	8	1
3392	10	2
3402	12	3
3412	14	4
3423	1	1
3433	3	2
3443	5	3
3453	7	4
3463	9	1
3473	11	2
3483	13	3
3493	15	4
3504	1	1
3514	3	2
3524	5	3
3534	7	4
3544	9	1
3554	11	2
3564	13	3
3574	15	4
3585	16	1
3595	17	2
3605	18	3
3615	19	4
3625	20	1
3635	21	2
3645	22	3
3655	23	4
3666	16	1
3676	17	2
3686	18	3
3696	19	4
3706	20	1
3716	21	2
3726	22	3
3736	23	4
374alter table t2 algorithm=inplace, reorganize partition;
375select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
376where fq_name = 'test/def/t2' order by node_id, fragment_num, block_instance;
377node_id	fragment_num	block_instance
3781	0	1
3791	2	2
3801	4	3
3811	6	4
3821	8	1
3831	10	2
3841	12	3
3851	14	4
3862	0	1
3872	2	2
3882	4	3
3892	6	4
3902	8	1
3912	10	2
3922	12	3
3932	14	4
3943	1	1
3953	3	2
3963	5	3
3973	7	4
3983	9	1
3993	11	2
4003	13	3
4013	15	4
4024	1	1
4034	3	2
4044	5	3
4054	7	4
4064	9	1
4074	11	2
4084	13	3
4094	15	4
4105	16	1
4115	17	2
4125	18	3
4135	19	4
4145	20	1
4155	21	2
4165	22	3
4175	23	4
4186	16	1
4196	17	2
4206	18	3
4216	19	4
4226	20	1
4236	21	2
4246	22	3
4256	23	4
426alter table t3 algorithm=inplace, reorganize partition;
427select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
428where fq_name = 'test/def/t3' order by node_id, fragment_num, block_instance;
429node_id	fragment_num	block_instance
4301	0	1
4311	2	2
4321	4	3
4331	6	4
4342	0	1
4352	2	2
4362	4	3
4372	6	4
4383	1	1
4393	3	2
4403	5	3
4413	7	4
4424	1	1
4434	3	2
4444	5	3
4454	7	4
4465	8	1
4475	9	2
4485	10	3
4495	11	4
4506	8	1
4516	9	2
4526	10	3
4536	11	4
454alter table t4 algorithm=inplace, reorganize partition;
455select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
456where fq_name = 'test/def/t4' order by node_id, fragment_num, block_instance;
457node_id	fragment_num	block_instance
4581	0	1
4591	2	2
4602	0	1
4612	2	2
4623	1	1
4633	3	2
4644	1	1
4654	3	2
4665	4	1
4675	5	2
4686	4	1
4696	5	2
470alter table t5 algorithm=inplace, reorganize partition;
471select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
472where fq_name = 'test/def/t5' order by node_id, fragment_num, block_instance;
473node_id	fragment_num	block_instance
4741	0	3
4752	0	3
4763	1	3
4774	1	3
4785	2	3
4796	2	3
480alter table t6 algorithm=inplace, reorganize partition;
481select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
482where fq_name = 'test/def/t6' order by node_id, fragment_num, block_instance;
483node_id	fragment_num	block_instance
4841	0	1
4851	2	2
4861	4	3
4871	6	4
4881	8	1
4891	10	2
4901	12	3
4911	14	4
4922	0	1
4932	2	2
4942	4	3
4952	6	4
4962	8	1
4972	10	2
4982	12	3
4992	14	4
5003	1	1
5013	3	2
5023	5	3
5033	7	4
5043	9	1
5053	11	2
5063	13	3
5073	15	4
5084	1	1
5094	3	2
5104	5	3
5114	7	4
5124	9	1
5134	11	2
5144	13	3
5154	15	4
5165	16	1
5175	17	2
5185	18	3
5195	19	4
5205	20	1
5215	21	2
5225	22	3
5235	23	4
5246	16	1
5256	17	2
5266	18	3
5276	19	4
5286	20	1
5296	21	2
5306	22	3
5316	23	4
532alter table t7 algorithm=inplace, reorganize partition;
533select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
534where fq_name = 'test/def/t7' order by node_id, fragment_num, block_instance;
535node_id	fragment_num	block_instance
5361	0	1
5371	2	2
5381	4	3
5391	6	4
5401	8	1
5411	10	2
5421	12	3
5431	14	4
5441	16	1
5451	18	2
5461	20	3
5471	22	4
5482	0	1
5492	2	2
5502	4	3
5512	6	4
5522	8	1
5532	10	2
5542	12	3
5552	14	4
5562	16	1
5572	18	2
5582	20	3
5592	22	4
5603	1	1
5613	3	2
5623	5	3
5633	7	4
5643	9	1
5653	11	2
5663	13	3
5673	15	4
5683	17	1
5693	19	2
5703	21	3
5713	23	4
5724	1	1
5734	3	2
5744	5	3
5754	7	4
5764	9	1
5774	11	2
5784	13	3
5794	15	4
5804	17	1
5814	19	2
5824	21	3
5834	23	4
5845	24	1
5855	25	2
5865	26	3
5875	27	4
5885	28	1
5895	29	2
5905	30	3
5915	31	4
5925	32	1
5935	33	2
5945	34	3
5955	35	4
5966	24	1
5976	25	2
5986	26	3
5996	27	4
6006	28	1
6016	29	2
6026	30	3
6036	31	4
6046	32	1
6056	33	2
6066	34	3
6076	35	4
608alter table t8 algorithm=inplace, reorganize partition;
609select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
610where fq_name = 'test/def/t8' order by node_id, fragment_num, block_instance;
611node_id	fragment_num	block_instance
6121	0	1
6131	2	2
6141	4	3
6151	6	4
6161	8	1
6171	10	2
6181	12	3
6191	14	4
6201	16	1
6211	18	2
6221	20	3
6231	22	4
6241	24	1
6251	26	2
6261	28	3
6271	30	4
6282	0	1
6292	2	2
6302	4	3
6312	6	4
6322	8	1
6332	10	2
6342	12	3
6352	14	4
6362	16	1
6372	18	2
6382	20	3
6392	22	4
6402	24	1
6412	26	2
6422	28	3
6432	30	4
6443	1	1
6453	3	2
6463	5	3
6473	7	4
6483	9	1
6493	11	2
6503	13	3
6513	15	4
6523	17	1
6533	19	2
6543	21	3
6553	23	4
6563	25	1
6573	27	2
6583	29	3
6593	31	4
6604	1	1
6614	3	2
6624	5	3
6634	7	4
6644	9	1
6654	11	2
6664	13	3
6674	15	4
6684	17	1
6694	19	2
6704	21	3
6714	23	4
6724	25	1
6734	27	2
6744	29	3
6754	31	4
6765	32	1
6775	33	2
6785	34	3
6795	35	4
6805	36	1
6815	37	2
6825	38	3
6835	39	4
6845	40	1
6855	41	2
6865	42	3
6875	43	4
6885	44	1
6895	45	2
6905	46	3
6915	47	4
6926	32	1
6936	33	2
6946	34	3
6956	35	4
6966	36	1
6976	37	2
6986	38	3
6996	39	4
7006	40	1
7016	41	2
7026	42	3
7036	43	4
7046	44	1
7056	45	2
7066	46	3
7076	47	4
708select count(*) into @cnt_t1_1
709from information_schema.partitions
710where table_schema = 'test' and table_name = 't1';
711select count(*) into @cnt_t2_1
712from information_schema.partitions
713where table_schema = 'test' and table_name = 't2';
714select count(*) into @cnt_t3_1
715from information_schema.partitions
716where table_schema = 'test' and table_name = 't3';
717select count(*) into @cnt_t4_1
718from information_schema.partitions
719where table_schema = 'test' and table_name = 't4';
720select count(*) into @cnt_t5_1
721from information_schema.partitions
722where table_schema = 'test' and table_name = 't5';
723select count(*) into @cnt_t6_0
724from information_schema.partitions
725where table_schema = 'test' and table_name = 't6';
726select count(*) into @cnt_t7_0
727from information_schema.partitions
728where table_schema = 'test' and table_name = 't7';
729select count(*) into @cnt_t8_0
730from information_schema.partitions
731where table_schema = 'test' and table_name = 't8';
732select @cnt_t1_1 = @cnt_t2_1;
733@cnt_t1_1 = @cnt_t2_1
7341
735select @cnt_t2_1 > @cnt_t3_1;
736@cnt_t2_1 > @cnt_t3_1
7371
738select @cnt_t3_1 > @cnt_t4_1;
739@cnt_t3_1 > @cnt_t4_1
7401
741select @cnt_t4_1 > @cnt_t5_1;
742@cnt_t4_1 > @cnt_t5_1
7431
744select @cnt_t6_1 = 2 * @cnt_t3_1;
745@cnt_t6_1 = 2 * @cnt_t3_1
746NULL
747select @cnt_t7_1 = 3 * @cnt_t3_1;
748@cnt_t7_1 = 3 * @cnt_t3_1
749NULL
750select @cnt_t8_1 = 4 * @cnt_t3_1;
751@cnt_t8_1 = 4 * @cnt_t3_1
752NULL
753select @cnt_t1_1 > @cnt_t1_0;
754@cnt_t1_1 > @cnt_t1_0
7551
756select @cnt_t2_1 > @cnt_t2_0;
757@cnt_t2_1 > @cnt_t2_0
7581
759select @cnt_t3_1 > @cnt_t3_0;
760@cnt_t3_1 > @cnt_t3_0
7611
762select @cnt_t4_1 > @cnt_t4_0;
763@cnt_t4_1 > @cnt_t4_0
7641
765select @cnt_t5_1 > @cnt_t5_0;
766@cnt_t5_1 > @cnt_t5_0
7671
768select @cnt_t6_1 > @cnt_t6_0;
769@cnt_t6_1 > @cnt_t6_0
770NULL
771select @cnt_t7_1 > @cnt_t7_0;
772@cnt_t7_1 > @cnt_t7_0
773NULL
774select @cnt_t8_1 > @cnt_t8_0;
775@cnt_t8_1 > @cnt_t8_0
776NULL
777-- t1 --
778Version: Any
779Fragment type: HashMapPartition
780K Value: 6
781Min load factor: 78
782Max load factor: 80
783Temporary table: no
784Number of attributes: 2
785Number of primary keys: 1
786Length of frm data: XXX
787Max Rows: 0
788Row Checksum: 1
789Row GCI: 1
790SingleUserMode: 0
791ForceVarPart: 1
792PartitionCount: 24
793FragmentCount: 24
794PartitionBalance: FOR_RP_BY_LDM
795ExtraRowGciBits: 0
796ExtraRowAuthorBits: 0
797TableStatus: Retrieved
798Table options:
799HashMap: HASHMAP-3840-16-24
800-- Attributes --
801id Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
802data Char(32;utf8mb4_0900_ai_ci) NULL AT=FIXED ST=MEMORY
803-- Indexes --
804PRIMARY KEY(id) - UniqueHashIndex
805PRIMARY(id) - OrderedIndex
806-- Per partition info --
807Partition	Row count	Commit count	Frag fixed memory	Frag varsized memory	Extent_space	Free extent_space
8080 ...
8091 ...
8102 ...
8113 ...
8124 ...
8135 ...
8146 ...
8157 ...
8168 ...
8179 ...
81810 ...
81911 ...
82012 ...
82113 ...
82214 ...
82315 ...
82416 ...
82517 ...
82618 ...
82719 ...
82820 ...
82921 ...
83022 ...
83123 ...
832
833
834NDBT_ProgramExit: 0 - OK
835
836drop table t1,t2,t3,t4,t5,t6,t7,t8;
837