content_image/727203.jpg
an exception in this regard; when used in this way, no other keywords or identifiers follow REORGANIZE PARTITION . 

For more information, see Section 13.1.9, “ALTER TABLE Statement” . 

In addition, for each table, the ALTER TABLE  statement should be followed by an OPTIMIZE TABLE  to reclaim wasted space. You can obtain a list of all NDBCLUSTER  tables using the following query against the INFORMATION_SCHEMA.TABLES  table: 

SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE ENGINE = ’NDBCLUSTER’; 

<img src='content_image/727203.jpg'>

## Note 

The INFORMATION_SCHEMA.TABLES.ENGINE  value for an NDB Cluster table is always NDBCLUSTER , regardless of whether the CREATE TABLE  statement used to create the table (or ALTER TABLE  statement used to convert an existing table from a different storage engine) used NDB  or NDBCLUSTER  in its ENGINE  option. 

You can see after performing these statements in the output of ALL REPORT MEMORY  that the data and indexes are now redistributed between all cluster data nodes, as shown here: 

ndb_mgm> ALL REPORT MEMORY Node 1: Data usage is 5%(176 32K pages of total 3200) Node 1: Index usage is 0%(76 8K pages of total 12832) Node 2: Data usage is 5%(176 32K pages of total 3200) Node 2: Index usage is 0%(76 8K pages of total 12832) Node 3: Data usage is 2%(80 32K pages of total 3200) Node 3: Index usage is 0%(51 8K pages of total 12832) Node 4: Data usage is 2%(80 32K pages of total 3200) Node 4: Index usage is 0%(50 8K pages of total 12832) 

Since only one DDL operation on NDBCLUSTER  tables can be executed at a time, you must wait for each ALTER TABLE ... REORGANIZE PARTITION  statement to finish before issuing the next one. 

It is not necessary to issue ALTER TABLE ... REORGANIZE PARTITION  statements for NDBCLUSTER tables created after  the new data nodes have been added; data added to such tables is distributed among all data nodes automatically. However, in NDBCLUSTER  tables that existed prior to  the addition of the new nodes, neither existing nor new data is distributed using the new nodes until these tables have been reorganized using ALTER TABLE ... REORGANIZE PARTITION . 

Alternative procedure, without rolling restart.  It is possible to avoid the need for a rolling restart by configuring the extra data nodes, but not starting them, when first starting the cluster. We assume, as before, that you wish to start with two data nodes—nodes 1 and 2—in one node group and later to expand the cluster to four data nodes, by adding a second node group consisting of nodes 3 and 4: 

[ndbd default] DataMemory = 100M IndexMemory = 100M NoOfReplicas = 2 DataDir = /usr/local/mysql/var/mysql-cluster [ndbd] Id = 1 HostName = 198.51.100.1 [ndbd] 

