MySQL® NDB API Developers' Guide

Peter Kitson

ISBN : -

Order a printed copy of this book from Amazon --UNAVAILABLE--


Cover Design - MySQL® NDB API Developers' Guide
 

For your free electronic copy of this book please verify the numbers below. 

(We need to do this to make sure you're a person and not a malicious script)

Numbers

 




Sample Chapter From MySQL® NDB API Developers' Guide
     Copyright © MySQL



1.1. Introduction

This section introduces the NDB Transaction and Scanning APIs as well as the NDB Management
(MGM) API for use in building applications to run on MySQL Cluster. It also discusses the general theory
and principles involved in developing such applications.

1.1.1. The NDB API

The NDB API is an object-oriented application programming interface for MySQL Cluster that implements
indexes, scans, transactions, and event handling. NDB transactions are ACID-compliant in that
they provide a means to group together operations in such a way that they succeed (commit) or fail as a
unit (rollback). It is also possible to perform operations in a 'no-commit' or deferred mode, to be committed
at a later time.

NDB scans are conceptually rather similar to the SQL cursors implemented in MySQL 5.0 and other
common enterprise-level database management systems. These allow for high-speed row processing for
record retrieval purposes. (MySQL Cluster naturally supports set processing just as does MySQL in its
non-Cluster distributions. This can be accomplished via the usual MySQL APIs discussed in the
MySQL Manual and elsewhere.) The NDB API supports both table scans and row scans; the latter can
be performed using either unique or ordered indexes. Event detection and handling is discussed in Section
3.5, “The NdbEventOperation Class”, as well as Section 6.6, “NDB API Event Handling Example”.
In addition, the NDB API provides object-oriented error-handling facilities in order to provide a means
of recovering gracefully from failed operations and other problems. See Section 6.3, “Handling Errors
and Retrying Transactions”, for a detailed example.
The NDB API provides a number of classes implementing the functionality described above. The most
important of these include the Ndb, Ndb_cluster_connection, NdbTransaction, and Ndb-
Operation classes. These model (respectively) database connections, cluster connections, transactions,
and operations. These classes and their subclasses are listed in Chapter 3, NDB API CLASSES. Error
conditions in the NDB API are handled using NdbError, a structure which is described in Section
4.1, “The NdbError Structure”.

1.1.2. The MGM API

The MySQL Cluster Management API, also known as the MGM API, is a C-language programming interface
intended to provide administrative services for the cluster. These include starting and stopping
Cluster nodes, handling Cluster logging, backups, and restoration from backups, as well as various other
management tasks. A conceptual overview of MGM and its uses can be found in Chapter 5, THE MGM
API.

The MGM API's principal structures model the states of individual modes (ndb_mgm_node_state),
the state of the Cluster as a whole (ndb_mgm_cluster_state), and management server response
messages (ndb_mgm_reply). See Section 5.4, “MGM Structures”, for detailed descirptions of these.
1.2. Terminology