Skip to content

Source code structure in RonDB#

RonDB is based on MySQL Cluster, thus it uses the same code structure as the MySQL code.

We will only describe the source code structure of the RonDB parts and will not describe the structure of the MySQL code.

All the RonDB specific code is found under the directory storage/ndb. Below this directory the main paths are src, include, test, clusterj, plugin, tools and ndbapi-examples.

clusterj contains the code for ClusterJ, the native Java API towards RonDB. nodejs similarly contains part of the code for the NodeJS although this code is maintained mainly in its own git tree.

tools contains a number of binaries that are useful such as ndb_import, ndb_top, ndb_restore and lots of other tools.

The plugin directory contains all the source code for the NDB storage engine.

The test directory contains all the source code for tests in the Autotest framework.

The ndbapi-examples directory contains a number of example NDB API programs.

The src and include directories contain the actual source code of the RonDB data node, management server and the NDB API.

The test directory#

The test directory contains a src, tools and a include that implements the previously mentioned Hugo framework used in most test programs.

Most of the actual test programs are found in the ndbapi directory.

The include directory#

The most important directory here is the ndbapi directory which contains the header files for the NDB API. Obviously not changed very often, but the base for most of the work in RonDB. Also the mgmapi is important since it defines the C API towards the RonDB management server used by management clients.

There are include files for the transporter, utilities, portability libraries, debug support, data node kernel parts, the management server and common things for management server and clients.

The src directory#

The ndbjtie contains the C++ code that implements the interface to JNI for ClusterJ. It makes it possible to develop code in Java that uses a direct mapping of the C++ NDB API towards Java.

common/portlib contains portability code for RonDB.

common/transporter contains code for communication between nodes in RonDB, these are called transporters in RonDB and can use different communication medias, currently TCP/IP sockets and shared memory communication. Previously there has been transporters for Dolphin SCI, OSE/Delta transporter and also prototypes of RDMA transporters have been developed at research institutes.

common/util contains various utilities used by various parts of the RonDB source code.

common/mgmcommon contains common code for RonDB management server and client.

common/logger contains code for logging in RonDB.

common/debugger contains various debug support functionality in RonDB.

mgmapi contains the source code of the RonDB MGM API.

ndbapi contains the source code of the NDB API.

mgmsrv contains the source code of the RonDB management server.

mgmclient contains the source code of the RonDB management client.

kernel contains the source code of the RonDB data node.

cw/cpcd contains the source code of ndb_cpcd.

The src/kernel directory#

The blocks directory contains all of the important modules of the RonDB data node. There are currently 29 such modules implementing the transaction functionality, checkpoint, REDO logging, recovery, index management, replication and so forth.

The vm contains support code for the blocks. A very important file here is the mt.cpp file which implements the multithreaded asynchronous engine. It can be seen as similar to what the Linux kernel is to Linux. The mt.cpp handles all communication with other threads, within a thread, communication to other nodes, binding to CPUs and a lot of other low-level stuff.