#include <NdbDictionary.hpp>

Public Types | |
| enum | SingleUserMode { SingleUserModeLocked = NDB_SUM_LOCKED, SingleUserModeReadOnly = NDB_SUM_READONLY, SingleUserModeReadWrite = NDB_SUM_READ_WRITE } |
| enum | Status { New, Changed, Retrieved, Invalid, Altered } |
| enum | Type { TypeUndefined = 0, SystemTable = 1, UserTable = 2, UniqueHashIndex = 3, OrderedIndex = 6, HashIndexTrigger = 7, IndexTrigger = 8, SubscriptionTrigger = 9, ReadOnlyConstraint = 10, TableEvent = 11, Tablespace = 20, LogfileGroup = 21, Datafile = 22, Undofile = 23, ReorgTrigger = 19, HashMap = 24 } |
| enum | State { StateUndefined = 0, StateOffline = 1, StateBuilding = 2, StateDropping = 3, StateOnline = 4, StateBackup = 5, StateBroken = 9 } |
| enum | Store { StoreUndefined = 0, StoreNotLogged = 1, StorePermanent = 2 } |
| enum | FragmentType { FragUndefined = 0, FragSingle = 1, FragAllSmall = 2, FragAllMedium = 3, FragAllLarge = 4, DistrKeyHash = 5, DistrKeyLin = 6, UserDefined = 7, HashMapPartition = 9 } |
Public Member Functions | |
| void | setRowGCIIndicator (bool value) |
| bool | getRowGCIIndicator () const |
| void | setRowChecksumIndicator (bool value) |
| bool | getRowChecksumIndicator () const |
| int | aggregate (struct NdbError &error) |
| int | validate (struct NdbError &error) |
| Uint32 | getPartitionId (Uint32 hashvalue) const |
General | |
| const char * | getName () const |
| int | getTableId () const |
| const Column * | getColumn (const char *name) const |
| Column * | getColumn (const int attributeId) |
| Column * | getColumn (const char *name) |
| const Column * | getColumn (const int attributeId) const |
Storage | |
| bool | getLogging () const |
| FragmentType | getFragmentType () const |
| int | getKValue () const |
| int | getMinLoadFactor () const |
| int | getMaxLoadFactor () const |
Other | |
| int | getNoOfColumns () const |
| int | getNoOfPrimaryKeys () const |
| const char * | getPrimaryKey (int no) const |
| bool | equal (const Table &) const |
| const void * | getFrmData () const |
| Uint32 | getFrmLength () const |
| const NdbRecord * | getDefaultRecord () const |
Table creation | |
These methods should normally not be used in an application as the result is not accessible from the MySQL Server | |
| Table (const char *name="") | |
| Table (const Table &table) | |
| virtual | ~Table () |
| Table & | operator= (const Table &table) |
| int | setName (const char *name) |
| int | addColumn (const Column &) |
| void | setLogging (bool) |
| void | setLinearFlag (Uint32 flag) |
| bool | getLinearFlag () const |
| void | setFragmentCount (Uint32) |
| Uint32 | getFragmentCount () const |
| void | setFragmentType (FragmentType) |
| void | setKValue (int kValue) |
| void | setMinLoadFactor (int) |
| void | setMaxLoadFactor (int) |
| int | setTablespaceName (const char *name) |
| const char * | getTablespaceName () const |
| int | setTablespace (const class Tablespace &) |
| bool | getTablespace (Uint32 *id=0, Uint32 *version=0) const |
| bool | getHashMap (Uint32 *id=0, Uint32 *version=0) const |
| int | setHashMap (const class HashMap &) |
| Object::Type | getObjectType () const |
| virtual Object::Status | getObjectStatus () const |
| void | setStatusInvalid () const |
| virtual int | getObjectVersion () const |
| void | setDefaultNoPartitionsFlag (Uint32 indicator) |
| Uint32 | getDefaultNoPartitionsFlag () const |
| virtual int | getObjectId () const |
| int | setFrm (const void *data, Uint32 len) |
| int | setFragmentData (const Uint32 *nodegroups, Uint32 cnt) |
| const Uint32 * | getFragmentData () const |
| Uint32 | getFragmentDataLen () const |
| int | setRangeListData (const Int32 *data, Uint32 cnt) |
| const Int32 * | getRangeListData () const |
| Uint32 | getRangeListDataLen () const |
| void | setObjectType (Object::Type type) |
| void | setMaxRows (Uint64 maxRows) |
| Uint64 | getMaxRows () const |
| void | setMinRows (Uint64 minRows) |
| Uint64 | getMinRows () const |
| void | setSingleUserMode (enum SingleUserMode) |
| enum SingleUserMode | getSingleUserMode () const |
Private Member Functions | |
| Table (NdbTableImpl &) | |
Private Attributes | |
| class NdbTableImpl & | m_impl |
TableSize
When calculating the data storage one should add the size of all attributes (each attributeconsumes at least 4 bytes) and also an overhead of 12 byte. Variable size attributes (not supported yet) will have a size of 12 bytes plus the actual data storage parts where there is an additional overhead based on the size of the variable part.
An example table with 5 attributes: one 64 bit attribute, one 32 bit attribute, two 16 bit attributes and one array of 64 8 bits. This table will consume 12 (overhead) + 8 + 4 + 2*4 (4 is minimum) + 64 = 96 bytes per record. Additionally an overhead of about 2 % as page headers and waste should be allocated. Thus, 1 million records should consume 96 MBytes plus the overhead 2 MByte and rounded up to 100 000 kBytes.
enum NdbDictionary::Object::FragmentType [inherited] |
Type of fragmentation.
This parameter specifies how data in the table or index will be distributed among the db nodes in the cluster.
The bigger the table the more number of fragments should be used. Note that all replicas count as same "fragment".
For a table, default is FragAllMedium. For a unique hash index, default is taken from underlying table and cannot currently be changed.
enum NdbDictionary::Object::State [inherited] |
Object state
enum NdbDictionary::Object::Status [inherited] |
Status of object
| New | The object only exist in memory and has not been created in the NDB Kernel |
| Changed | The object has been modified in memory and has to be commited in NDB Kernel for changes to take effect |
| Retrieved | The object exist and has been read into main memory from NDB Kernel |
| Invalid | The object has been invalidated and should not be used |
| Altered | Table has been altered in NDB kernel but is still valid for usage |
enum NdbDictionary::Object::Store [inherited] |
enum NdbDictionary::Object::Type [inherited] |
Object type
| TypeUndefined | Undefined. |
| SystemTable | System table. |
| UserTable | User table (may be temporary). |
| UniqueHashIndex | Unique un-ordered hash index. |
| OrderedIndex | Non-unique ordered index. |
| HashIndexTrigger | Index maintenance, internal. |
| IndexTrigger | Index maintenance, internal. |
| SubscriptionTrigger | Backup or replication, internal. |
| ReadOnlyConstraint | Trigger, internal. |
| TableEvent | Table event. |
| Tablespace | Tablespace. |
| LogfileGroup | Logfile group. |
| Datafile | Datafile. |
| Undofile | Undofile. |
| ReorgTrigger | |
| HashMap |
Reimplemented in NdbDictionary::Index.
| NdbDictionary::Table::Table | ( | const char * | name = "" |
) |
Constructor
| name | Name of table |
| NdbDictionary::Table::Table | ( | const Table & | table | ) |
Copy constructor
| table | Table to be copied |
| virtual NdbDictionary::Table::~Table | ( | ) | [virtual] |
| NdbDictionary::Table::Table | ( | NdbTableImpl & | ) | [private] |
| int NdbDictionary::Table::addColumn | ( | const Column & | ) |
Add a column definition to a table
| int NdbDictionary::Table::aggregate | ( | struct NdbError & | error | ) |
This method is not needed in normal usage.
Compute aggregate data on table being defined. Required for aggregate methods such as getNoOfPrimaryKeys() to work before table has been created and retrieved via getTable().
May adjust some column flags. If no PK is so far marked as distribution key then all PK's will be marked.
Returns 0 on success. Returns -1 and sets error if an inconsistency is detected.
| bool NdbDictionary::Table::equal | ( | const Table & | ) | const |
Check if table is equal to some other table
| const Column* NdbDictionary::Table::getColumn | ( | const int | attributeId | ) | const |
Get column definition via index in table.
| Column* NdbDictionary::Table::getColumn | ( | const char * | name | ) |
Get column definition via name.
| Column* NdbDictionary::Table::getColumn | ( | const int | attributeId | ) |
Get column definition via index in table.
| const Column* NdbDictionary::Table::getColumn | ( | const char * | name | ) | const |
Get column definition via name.
| Uint32 NdbDictionary::Table::getDefaultNoPartitionsFlag | ( | ) | const |
| const NdbRecord* NdbDictionary::Table::getDefaultRecord | ( | ) | const |
Get default NdbRecord object for this table This NdbRecord object becomes invalid at the same time as the table object - when the ndb_cluster_connection is closed.
| Uint32 NdbDictionary::Table::getFragmentCount | ( | ) | const |
Get fragment count
| const Uint32* NdbDictionary::Table::getFragmentData | ( | ) | const |
Get Fragment Data (array of node groups)
| Uint32 NdbDictionary::Table::getFragmentDataLen | ( | ) | const |
| FragmentType NdbDictionary::Table::getFragmentType | ( | ) | const |
Get fragmentation type
| const void* NdbDictionary::Table::getFrmData | ( | ) | const |
Get frm file stored with this table
| Uint32 NdbDictionary::Table::getFrmLength | ( | ) | const |
| bool NdbDictionary::Table::getHashMap | ( | Uint32 * | id = 0, |
|
| Uint32 * | version = 0 | |||
| ) | const |
| int NdbDictionary::Table::getKValue | ( | ) | const |
Get KValue (Hash parameter.) Only allowed value is 6. Later implementations might add flexibility in this parameter.
| bool NdbDictionary::Table::getLinearFlag | ( | ) | const |
| bool NdbDictionary::Table::getLogging | ( | ) | const |
If set to false, then the table is a temporary table and is not logged to disk.
In case of a system restart the table will still be defined and exist but will be empty. Thus no checkpointing and no logging is performed on the table.
The default value is true and indicates a normal table with full checkpointing and logging activated.
| int NdbDictionary::Table::getMaxLoadFactor | ( | ) | const |
Get MaxLoadFactor (Hash parameter.) This value specifies the load factor when starting to split the containers in the local hash tables. 100 is the maximum which will optimize memory usage. A lower figure will store less information in each container and thus find the key faster but consume more memory.
| Uint64 NdbDictionary::Table::getMaxRows | ( | ) | const |
| int NdbDictionary::Table::getMinLoadFactor | ( | ) | const |
Get MinLoadFactor (Hash parameter.) This value specifies the load factor when starting to shrink the hash table. It must be smaller than MaxLoadFactor. Both these factors are given in percentage.
| Uint64 NdbDictionary::Table::getMinRows | ( | ) | const |
| const char* NdbDictionary::Table::getName | ( | ) | const |
Get table name
| int NdbDictionary::Table::getNoOfColumns | ( | ) | const |
Get number of columns in the table
| int NdbDictionary::Table::getNoOfPrimaryKeys | ( | ) | const |
Get number of primary keys in the table
| virtual int NdbDictionary::Table::getObjectId | ( | ) | const [virtual] |
Get object id
Implements NdbDictionary::Object.
| virtual Object::Status NdbDictionary::Table::getObjectStatus | ( | ) | const [virtual] |
Get object status
Implements NdbDictionary::Object.
| Object::Type NdbDictionary::Table::getObjectType | ( | ) | const |
Get table object type
| virtual int NdbDictionary::Table::getObjectVersion | ( | ) | const [virtual] |
Get object version
Implements NdbDictionary::Object.
| Uint32 NdbDictionary::Table::getPartitionId | ( | Uint32 | hashvalue | ) | const |
Return partitionId given a hashvalue Note, if table is not retreived (e.i using getTable) result will most likely be wrong
| const char* NdbDictionary::Table::getPrimaryKey | ( | int | no | ) | const |
Get name of primary key
| const Int32* NdbDictionary::Table::getRangeListData | ( | ) | const |
Get Range or List Array (value, partition)
| Uint32 NdbDictionary::Table::getRangeListDataLen | ( | ) | const |
| bool NdbDictionary::Table::getRowChecksumIndicator | ( | ) | const |
| bool NdbDictionary::Table::getRowGCIIndicator | ( | ) | const |
| enum SingleUserMode NdbDictionary::Table::getSingleUserMode | ( | ) | const |
| int NdbDictionary::Table::getTableId | ( | ) | const |
Get table id
| bool NdbDictionary::Table::getTablespace | ( | Uint32 * | id = 0, |
|
| Uint32 * | version = 0 | |||
| ) | const |
| const char* NdbDictionary::Table::getTablespaceName | ( | ) | const |
Assignment operator, deep copy
| table | Table to be copied |
| void NdbDictionary::Table::setDefaultNoPartitionsFlag | ( | Uint32 | indicator | ) |
Set/Get indicator if default number of partitions is used in table.
| void NdbDictionary::Table::setFragmentCount | ( | Uint32 | ) |
Set fragment count
| int NdbDictionary::Table::setFragmentData | ( | const Uint32 * | nodegroups, | |
| Uint32 | cnt | |||
| ) |
Set fragmentation One Uint32 per fragment, containing nodegroup of fragment nodegroups[0] - correspondce to fragment 0
Note: This calls also modifies setFragmentCount
| void NdbDictionary::Table::setFragmentType | ( | FragmentType | ) |
Set fragmentation type
| int NdbDictionary::Table::setFrm | ( | const void * | data, | |
| Uint32 | len | |||
| ) |
Set frm file to store with this table
| int NdbDictionary::Table::setHashMap | ( | const class HashMap & | ) |
| void NdbDictionary::Table::setKValue | ( | int | kValue | ) |
Set KValue (Hash parameter.) Only allowed value is 6. Later implementations might add flexibility in this parameter.
| void NdbDictionary::Table::setLinearFlag | ( | Uint32 | flag | ) |
Set/Get Linear Hash Flag
| void NdbDictionary::Table::setLogging | ( | bool | ) |
| void NdbDictionary::Table::setMaxLoadFactor | ( | int | ) |
Set MaxLoadFactor (Hash parameter.) This value specifies the load factor when starting to split the containers in the local hash tables. 100 is the maximum which will optimize memory usage. A lower figure will store less information in each container and thus find the key faster but consume more memory.
| void NdbDictionary::Table::setMaxRows | ( | Uint64 | maxRows | ) |
Set/Get Maximum number of rows in table (only used to calculate number of partitions).
| void NdbDictionary::Table::setMinLoadFactor | ( | int | ) |
Set MinLoadFactor (Hash parameter.) This value specifies the load factor when starting to shrink the hash table. It must be smaller than MaxLoadFactor. Both these factors are given in percentage.
| void NdbDictionary::Table::setMinRows | ( | Uint64 | minRows | ) |
Set/Get Minimum number of rows in table (only used to calculate number of partitions).
| int NdbDictionary::Table::setName | ( | const char * | name | ) |
Name of table
| name | Name of table |
| void NdbDictionary::Table::setObjectType | ( | Object::Type | type | ) |
Set table object type
| int NdbDictionary::Table::setRangeListData | ( | const Int32 * | data, | |
| Uint32 | cnt | |||
| ) |
Set array of information mapping range values and list values to fragments.
For range, this is a sorted list of range values For list, this is a list of pairs { value, partition }
| void NdbDictionary::Table::setRowChecksumIndicator | ( | bool | value | ) |
| void NdbDictionary::Table::setRowGCIIndicator | ( | bool | value | ) |
| void NdbDictionary::Table::setSingleUserMode | ( | enum | SingleUserMode | ) |
Set/Get SingleUserMode
| void NdbDictionary::Table::setStatusInvalid | ( | ) | const |
| int NdbDictionary::Table::setTablespace | ( | const class Tablespace & | ) |
| int NdbDictionary::Table::setTablespaceName | ( | const char * | name | ) |
| int NdbDictionary::Table::validate | ( | struct NdbError & | error | ) |
This method is not needed in normal usage.
Validate new table definition before create. Does aggregate() and additional checks. There may still be errors which are detected only by NDB kernel at create table.
Create table and retrieve table do validate() automatically.
Returns 0 on success. Returns -1 and sets error if an inconsistency is detected.
class NdbTableImpl& NdbDictionary::Table::m_impl [private] |
Based on MySQL Cluster 7.0.6.
This page is for information only and is not maintained by MySQL or Sun Microsystems - use at your own risk. For an upto date view of the API refer to the header files included with your MySQL Cluster distribution or check the MySQL Cluster API Developer Guide.