Documentation Home
MySQL Cluster NDB 6.1-7.1
Related Documentation Download this Excerpt
PDF (US Ltr) - 3.5Mb
PDF (A4) - 3.5Mb
EPUB - 1.3Mb
HTML Download (TGZ) - 1.2Mb
HTML Download (Zip) - 1.2Mb

MySQL Cluster NDB 6.1-7.1  /  ...  /  MySQL Cluster Development in MySQL Cluster NDB 6.3

3.4.4 MySQL Cluster Development in MySQL Cluster NDB 6.3

The following list provides an overview of significant feature additions and changes first made in MySQL Cluster NDB 6.3. For more detailed information about all feature changes and bugfixes made in MySQL Cluster NDB 6.3, see

  • Conflict detection and resolution. It is now possible to detect and resolve conflicts that arise in multi-master replication scenarios, such as circular replication, when different masters may try to update the same row on the slave with different data. Both greatest timestamp wins and same timestamp wins scenarios are supported. For more information, see Section 8.11, “MySQL Cluster Replication Conflict Resolution”.

  • Recovery of one master, many slaves replication setups. Recovery of multi-way replication setups (one master, many slaves) is now supported using the --ndb-log-orig server option and changes in the mysql.ndb_binlog_index table. See Section 8.4, “MySQL Cluster Replication Schema and Tables”, for more information.

  • Enhanced selection options for transaction coordinator. New values and behaviors are introduced for --ndb_optimized_node_selection, enabling greater flexibility when an SQL node chooses a transaction coordinator. For more information, see the description of ndb_optimized_node_selection in Section, “MySQL Cluster System Variables”.

  • Replication heartbeats. Replication heartbeats facilitate the task of monitoring and detecting failures in master-slave connections in real time. This feature is implemented using a new MASTER_HEARTBEAT_PERIOD = value clause for the CHANGE MASTER TO statement and the addition of two status variables Slave_heartbeat_period and Slave_received_heartbeats. For more information, see CHANGE MASTER TO Syntax.

  • NDB thread locks. It is possible to lock NDB execution threads and maintenance threads (such as file system and other operating system threads) to specific CPUs on multiprocessor data node hosts, and to leverage real-time scheduling.

  • Improved performance of updates using primary keys or unique keys. The number of unnecessary reads when performing a primary key or unique key update has been greatly reduced. Since it is seldom necessary to read a record prior to an update, this can yield a considerable improvement in performance. In addition, primary key columns are no longer written to when not needed during update operations.

  • Batching improvements. Support of batched DELETE and UPDATE operations has been significantly improved. Batching of UPDATE WHERE... and multiple DELETE operations is also now implemented.

  • Improved SQL statement performance metrics. The Ndb_execute_count system status variable measures the number of round trips made by SQL statements to the NDB kernel, providing an improved metric for determining efficiency with which statements are executed. For more information, see MySQL Cluster Status Variables: Ndb_execute_count.

  • Compressed LCPs and backups. Compressed local checkpoints and backups can save 50% or more of the disk space used by uncompressed LCPs and backups. These can be enabled using the two new data node configuration parameters CompressedLCP and CompressedBackup, respectively.

  • OPTIMIZE TABLE support with NDBCLUSTER tables. OPTIMIZE TABLE is supported for dynamic columns of in-memory NDB tables. In such cases, it is no longer necessary to drop (and possibly to re-create) a table, or to perform a rolling restart, in order to recover memory from deleted rows for general re-use by Cluster. The performance of OPTIMIZE on Cluster tables can be tuned by adjusting the value of the ndb_optimization_delay system variable, which controls the number of milliseconds to wait between processing batches of rows by OPTIMIZE TABLE. In addition, OPTIMIZE TABLE on an NDBCLUSTER table can be interrupted by, for example, killing the SQL thread performing the OPTIMIZE operation.

  • Batching of transactions. It is possible to cause statements occurring within the same transaction to be run as a batch by setting the session variable transaction_allow_batching to 1 or ON. To use this feature, autocommit must be set to 0 or OFF. Batch sizes can be controlled using the --ndb-batch-size option for mysqld. For additional information, see Section, “MySQL Server Options for MySQL Cluster”, and Section, “MySQL Cluster System Variables”.

  • Attribute promotion with ndb_restore. It is possible using ndb_restore to restore data reliably from a column of a given type to a column that uses a larger type. This is sometimes referred to as attribute promotion. For example, MySQL Cluster backup data that originated in a SMALLINT column can be restored to a MEDIUMINT, INT, or BIGINT column. See Section 6.20, “ndb_restore — Restore a MySQL Cluster Backup”, for more information.

  • Parallel data node recovery. Recovery of multiple data nodes can now be done in parallel, rather than sequentially. In other words, several data nodes can be restored concurrently, which can often result in much faster recovery times than when they are restored one at a time.

  • Increased local checkpoint efficiency. Only 2 local checkpoints are stored, rather than 3, lowering disk space requirements and the size and number of redo log files.

  • NDBCLUSTER table persistence control. Persistence of NDB tables can be controlled using the session variables ndb_table_temporary and ndb_table_no_logging. ndb_table_no_logging causes NDB tables not to be checkpointed to disk; ndb_table_temporary does the same, and in addition, no schema files are created. See Section 5.2.5, “MySQL Cluster mysqld Option and Variable Reference”.

  • Epoll support (Linux only). Epoll is an improved method for handling file descriptors, which is more efficient than scanning to determine whether a file descriptor has data to be read. (The term epoll is specific to Linux and equivalent functionality is known by other names on other platforms such as Solaris and FreeBSD.) Currently, MySQL Cluster supports this functionality on Linux only.

  • Distribution awareness (SQL nodes). In MySQL Cluster NDB 6.3, SQL nodes can take advantage of distribution awareness. Here we provide a brief example showing how to design a table to make a given class of queries distrubtion-aware. Suppose an NDBCLUSTER table t1 has the following schema:

        userid INT NOT NULL,
        data VARCHAR(255)

    Suppose further that most of the queries to be used in our application test values of the userid column of this table. The form of such a query looks something like this:

    SELECT columns FROM t1
        WHERE userid relation value;

    In this query, relation represents some relational operator, such as =, <, >, and so on. Queries using IN and a list of values can also be used:

    SELECT columns FROM t1
        WHERE userid IN value_list;

    To make use of distribution awareness, we need to make the userid column part of the table's primary key, then explicitly partition the table with this column being used as the partitioning key. (Recall that for a partitioned table having one or more unique keys, all columns of the table's partitioning key must also be part of all of the unique keys—for more information and examples, see Partitioning Keys, Primary Keys, and Unique Keys.) In other words, the table schema should be equivalent to the following CREATE TABLE statement:

        userid INT NOT NULL,
        serviceid INT NOT NULL AUTO_INCREMENT,
        data VARCHAR(255),
        PRIMARY KEY p (userid,serviceid)
        PARTITION BY KEY(userid);

    When the table is partitioned in this way, all rows having the same userid value are found on the same node group, and the MySQL Server can immediately select the optimal node to use as the transaction coordinator.

  • Realtime extensions for multiple CPUs. When running MySQL Cluster data nodes on hosts with multiple processors, the realtime extensions make it possible to give priority to the data node process and control on which CPU cores it should operate. This can be done using the data node configuration parameters RealtimeScheduler, SchedulerExecutionTimer, and SchedulerSpinTimer. Doing so properly can significantly lower response times and make them much more predictable response. For more information about using these parameters, see Defining Data Nodes: Realtime Performance Parameters

  • Fully automatic database discovery. It is no longer a requirement for database autodiscovery that an SQL node already be connected to the cluster at the time that a database is created on another SQL node, or for a CREATE DATABASE or CREATE SCHEMA statement to be issued on the new SQL node after it joins the cluster.

  • Detection of NDB API client connection errors. Beginning with MySQL Cluster NDB 6.3.20, the NDB API's Ndb_cluster_connection class adds the get_latest_error() and get_latest_error_msg() methods for catching and diagnosing problems with NDB API client connections.

  • Restoring specific databases, tables, or columns from a MySQL Cluster backup. It is now possible to exercise more fine-grained control when restoring a MySQL Cluster from backup using ndb_restore. Beginning with MySQL Cluster NDB 6.3.22, you can choose to restore only specified tables or databases, or exclude specific tables or databases from being restored, using the new ndb_restore options --include-tables, --include-databases, --exclude-tables, and --exclude-databases. Beginning with MySQL Cluster NDB 6.3.26, it is also possible to restore to a table having fewer columns than the original using the --exclude-missing-columns option. For more information about all of these options, see Section 6.20, “ndb_restore — Restore a MySQL Cluster Backup”.

  • Improved Disk Data file system configuration. As of MySQL Cluster NDB 6.3.22, you can specify default locations for MySQL Cluster Disk Data data files and undo log files using the data node configuration parameters FileSystemPathDD, FileSystemPathDataFiles, and FileSystemPathUndoFiles. This eliminates the need to use symbolic links to place Disk Data files separately from other files in data node file systems to improve Disk Data performance. For more information, see Disk Data file system parameters.

  • Automatic creation of Disk Data log file groups and tablespaces. Beginning with MySQL Cluster NDB 6.3.22, using the data node configuration parameters InitialLogFileGroup and InitialTablespace, you can cause the creation of a MySQL Cluster Disk Data log file group, tablespace, or both, when the cluster is first started. When using these parameters, no SQL statements are required to create these Disk Data objects. For more information, see Disk Data object creation parameters.

  • Configuration parameter data dumps. Starting with MySQL Cluster NDB 6.3.25, the ndb_config utility supports a --configinfo option that causes it to dump a list of all configuration parameters supported by the cluster, along with brief descriptions, information about the parameters' default and permitted values, and the sections of the config.ini file in which the parameters apply. An additional --xml switch causes ndb_config to use XML rather than plain text output. Using ndb_config --configinfo or ndb_config --configinfo --xml requires no access to a running MySQL Cluster, any other programs, or any files. For more information and examples, see Section 6.7, “ndb_config — Extract MySQL Cluster Configuration Information”.

  • Per-table reporting of free space on disk. The INFORMATION_SCHEMA.FILES table shows information about used and free space in MySQL Cluster Disk Data data files, but this information is not applicable to individual tables. In MySQL Cluster NDB 6.3.27 and later, the ndb_desc utility provides two additional columns in its output that show the amount of space allocated on disk for a given NDB table as well the amount of space that remains available for additional storage of disk-based column data for that table. For more information, see Section 6.10, “ndb_desc — Describe NDB Tables”.

  • Improved restart times. Optimizations in redo log handling and other file system operations introduced in MySQL Cluster NDB 6.3.28 have the potential to reduce considerably the time required for restarts. While actual performance benefits observed in production setups will naturally vary depending on database size, hardware, and other conditions, our own preliminary testing has shown that these improvements can yield startup times that are faster than those typical of previous MySQL Cluster NDB 6.3 releases by a factor of 50 or more.

  • Increased flexibility in online upgrade procedure. Previously, when performing an upgrade of a running MySQL cluster, the order in which the types of cluster nodes had to be upgraded was very strict. However, beginning with MySQL Cluster NDB 6.3.29, MySQL Cluster supports online upgrading of API nodes (including MySQL servers running as SQL nodes) before upgrading management nodes, data nodes, or both.


    Before attempting to use this new upgrade functionality, see Section 7.5, “Performing a Rolling Restart of a MySQL Cluster”, for additional information, especially if you are planning an online upgrade from MySQL Cluster NDB 6.3 to MySQL Cluster NDB 7.0.

  • New replication conflict resolution strategy. Beginning with MySQL Cluster NDB 6.3.31, the function NDB$MAX_DELETE_WIN() is available to implement greatest timestamp, delete wins conflict resolution. See NDB$MAX_DELETE_WIN(column_name), for more information.

  • New CHANGE MASTER TO option for circular replication. Beginning with MySQL Cluster NDB 6.3.31, the CHANGE MASTER TO statement supports an IGNORE_SERVER_IDS option which takes a comma-separated list of server IDs and causes events originating from the corresponding servers to be ignored. (Log rotation and log deletion events are preserved.)

    See CHANGE MASTER TO Syntax, as well as SHOW SLAVE STATUS Syntax, for more information.

  • Heartbeat thread policy and priority. Beginning with MySQL Cluster NDB 6.3.32, a new configuration parameter HeartbeatThreadPriority makes it possible to set the policy and the priority for the heartbeat thread on management and API nodes.

  • Improved access to partitioning information. The ndb_desc utility now provides additional information about the partitioning of data stored in MySQL Cluster. Beginning with MySQL Cluster NDB 6.3.32, the --blob-info option causes this program to include partition information for BLOB tables in its output. Beginning with MySQL Cluster NDB 6.3.33, the --extra-node-info option causes ndb_desc to include information about data distribution (that is, which table fragments are stored on which data nodes). Each of these options also requires the use of the --extra-partition-info option.

    Information about partition-to-node mappings can also be obtained using the Table::getFragmentNodes() method, also added in MySQL Cluster NDB 6.3.33.

  • Replication attribute promotion and demotion. Beginning with MySQL Cluster NDB 6.3.33, MySQL Cluster Replication supports attribute promotion and demotion when replicating between columns of different but similar types on the master and the slave. For example, it is possible to promote an INT column on the master to a BIGINT column on the slave, and to demote a TEXT column to a VARCHAR column.

    The implementation of type demotion distinguishes between lossy and non-lossy type conversions, and their use on the slave can be controlled by setting the slave_type_conversions global server system variable.

    For more information, see Attribute promotion and demotion (MySQL Cluster).

  • Incompatible change in NDB API event reporting. Beginning with MySQL Cluster NDB 6.3.34, DDL events are no longer reported on Event objects by default. Instead such event reporting must be enabled explicitly using the Event::setReport() method. For more information, see Event::setReport(), and The Event::EventReport Type.

  • Heartbeat ordering. Beginning with MySQL Cluster NDB 6.3.35, it is possible to set a specific order for transmission of heartbeats between data nodes, using the HeartbeatOrder data node configuration parameter introduced in this version. This parameter can be useful in situations where multiple data nodes are running on the same host and a temporary disruption in connectivity between hosts would otherwise cause the loss of a node group (and thus failure of the cluster).

  • Relaxed ndb_restore column comparison rules. When restoring data, ndb_restore compares the attributes of a column for equality with the definition of the column in the target table. However, not all of these attributes need to be the same for ndb_restore to be meaningful, safe and useful. Beginning with MySQL Cluster NDB 6.3.35, ndb_restore automatically ignores differences in certain column attributes which do not necessarily have to match between the version of the column in a backup and the version of that column in the MySQL Cluster to which the column data is being restored. These attributes include the following:


    • STORAGE setting (MEMORY or DISK)

    • The default value

    • The distribution key

    In such cases, ndb_restore reports any such differences to minimize any chance of user error.

  • --add-drop-trigger option for mysqldump. Beginning with MySQL Cluster NDB 6.3.38, this option can be used to force all CREATE TRIGGER statements in mysqldump output to be preceded by a DROP TRIGGER IF EXISTS statement.

  • Skipping corrupted tables in NDB native backups. Beginning with MySQL Cluster NDB 6.3.40, you can cause ndb_restore to ignore tables that are corrupted due to missing blob parts tables by using the --skip-broken-objects option. When this option is used, such tables are skipped, and the restoration of any remaining uncorrupted tables in the backup continues.

  • Restoring from a NDB native backup to a differently-named database. MySQL Cluster NDB 6.3.41 adds a new --rewrite-database option to ndb_restore, which makes it possible to restore to a database having a different name from that of the database in the backup. The option can be used multiple times, and it is possible to restore from more than one source database in the backup to a single target database (although no protection against table or other object name collision is provided).

    See Section 6.20, “ndb_restore — Restore a MySQL Cluster Backup”, for more information.

Download this Excerpt
PDF (US Ltr) - 3.5Mb
PDF (A4) - 3.5Mb
EPUB - 1.3Mb
HTML Download (TGZ) - 1.2Mb
HTML Download (Zip) - 1.2Mb
User Comments
Sign Up Login You must be logged in to post a comment.