MySQL NDB Cluster API Developer Guide

2.3.26 The Object Class

This section provides information about the Object class, which contains meta-information about database objects such as tables and indexes. Object subclasses model these and other database objects.

Object Class Overview

Parent class

NdbDictionary

Child classes

Datafile, Event, Index, LogfileGroup, Table, Tablespace, Undofile, HashMap, ForeignKey

Methods

The following table lists the public methods of the Object class and the purpose or use of each method:

Table 2.70 Object class methods and descriptions

Name Description
getObjectId() Gets an object's ID
getObjectStatus() Gets an object's status
getObjectVersion() Gets the version of an object

All 3 of these methods are pure virtual methods, and are reimplemented in the Table, Index, and Event subclasses where needed.

Types

These are the public types of the Object class:

Table 2.71 Object class types and descriptions

Name Description
FragmentType Fragmentation type used by the object (a table or index)
State The object's state (whether it is usable)
Status The object's state (whether it is available)
Store Whether the object has been temporarily or permanently stored
Type The object's type (what sort of table, index, or other database object the Object represents)

Object::FragmentType

This section provides information about the FragmentType type, which describes the fragmentation type of an instance of Object.

Description

This parameter specifies how data in the table or index is distributed among the cluster's storage nodes, that is, the number of fragments per node. The larger the table, the larger the number of fragments that should be used. Note that all replicas count as a single fragment. For a table, the default is FragAllMedium. For a unique hash index, the default is taken from the underlying table and cannot currently be changed.

Enumeration values

Possible values for FragmentType are shown, along with descriptions, in the following table:

Table 2.72 FragmentType values and descriptions

Name Description
FragUndefined The fragmentation type is undefined or the default
FragAllMedium Two fragments per node
FragAllLarge Four fragments per node
DistrKeyHash Distributed hash key
DistrKeyLin Distributed linear hash key
UserDefined User defined
HashMapPartition Hash map partition

Object::getObjectStatus()

Description

This method retrieves the status of the object for which it is invoked.

Signature
virtual Status getObjectStatus
    (
      void
    ) const
Parameters

None.

Return value

Returns the current Status of the Object.

Object::getObjectId()

Description

This method retrieves the object's ID.

Signature
virtual int getObjectId
    (
      void
    ) const
Parameters

None.

Return value

The object ID, an integer.

Object::getObjectVersion()

Description

The method gets the current version of the object.

Signature
virtual int getObjectVersion
    (
      void
    ) const
Parameters

None.

Return value

The object's version number, an integer.

Object::PartitionBalance

This section provides information about the PartitionBalance data type.

Description

This type enumerates partition balance settings (fragment count types) from which to choose when using setPartitionBalance(). This is also the type returned by getPartitionBalance()

Enumeration values

Possible values for PartitionBalance are shown, along with descriptions, in the following table:

Table 2.73 Object::PartitionBalance data type values and descriptions

Name Description
PartitionBalance_ForRPByLDM Use one fragment per LDM per node
PartitionBalance_ForRAByLDM Use one fragment per LDM per node group
PartitionBalance_ForRPByNode Use one fragment per node
PartitionBalance_ForRAByNode Use one fragment per node group
PartitionBalance_Specific Use setting determined by setPartitionBalance()

Prior to NDB 7.5.4, this was known as FragmentCountType, and could take one of the values FragmentCount_OnePerLDMPerNode, FragmentCount_OnePerLDMPerNodeGroup, FragmentCount_OnePerNode, FragmentCount_OnePerNodeGroup, or FragmentCount_Specific. These values correspond to those shown in the previous table, in the order shown.

Object::State

This section provides information about the State type, which models the state of the Object.

Description

This parameter provides us with the object's state. By state, we mean whether or not the object is defined and is in a usable condition.

Enumeration values

Possible values for State are shown, along with descriptions, in the following table:

Table 2.74 Object State type values and descriptions

Name Description
StateUndefined Undefined
StateOffline Offline, not useable
StateBuilding Building (e.g. restore?), not useable(?)
StateDropping Going offline or being dropped; not usable
StateOnline Online, usable
StateBackup Online, being backed up, usable
StateBroken Broken; should be dropped and re-created

Object::Status

This section provides information about the Status type, which models the status of an Object.

Description

Reading an object's Status tells whether or not it is available in the NDB kernel.

Enumeration values

Possible values for Status are shown, along with descriptions, in the following table:

Table 2.75 Object Status data type values and descriptions

Name Description
New The object exists only in memory, and has not yet been created in the NDB kernel
Changed The object has been modified in memory, and must be committed in the NDB Kernel for changes to take effect
Retrieved The object exists, and has been read into main memory from the NDB Kernel
Invalid The object has been invalidated, and should no longer be used
Altered The table has been altered in the NDB kernel, but is still available for use

Object::Store

This section provides information about the Store type, which describes the persistence of an Object.

Description

Reading this value tells us is the object is temporary or permanent.

Enumeration values

Possible values for Store are shown, along with descriptions, in the following table:

Table 2.76 Object Store data type values and descriptions

Name Description
StoreUndefined The object is undefined
StoreTemporary Temporary storage; the object or data will be deleted on system restart
StorePermanent The object or data is permanent; it has been logged to disk

Object::Type

This section provides information about the Type type.

Description

The Type of the object can be one of several different sorts of index, trigger, tablespace, and so on.

Enumeration values

Possible values for Type are shown, along with descriptions, in the following table:

Table 2.77 Object Type data type values and descriptions

Name Description
TypeUndefined Undefined
SystemTable System table
UserTable User table (may be temporary)
UniqueHashIndex Unique (but unordered) hash index
OrderedIndex Ordered (but not unique) index
HashIndexTrigger Index maintenance (internal)
IndexTrigger Index maintenance (internal)
SubscriptionTrigger Backup or replication (internal)
ReadOnlyConstraint Trigger (internal)
Tablespace Tablespace
LogfileGroup Log file group
Datafile Data file
Undofile Undo file
ReorgTrigger Trigger
HashMap Hash map
ForeignKey Foreign key
FKParentTrigger Trigger on a foreign key's parent table
FKChildTrigger Trigger on a foreign key's child table

For more information about ForeignKey, FKParentTrigger, and FKChildTrigger, see Section 2.3.6, “The ForeignKey Class”.