MySQL 5.6.14 Source Code Document
|
Represents a table in NDB Cluster. More...
#include <NdbDictionary.hpp>
Public Types | |
enum | SingleUserMode { SingleUserModeLocked = NDB_SUM_LOCKED, SingleUserModeReadOnly = NDB_SUM_READONLY, SingleUserModeReadWrite = NDB_SUM_READ_WRITE } |
Public Types inherited from NdbDictionary::Object | |
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 |
const char * | getMysqlName () const |
void | setStoredTable (bool x) |
bool | getStoredTable () const |
int | getRowSizeInBytes () const |
int | createTableInDb (Ndb *, bool existingEqualIsOk=true) const |
int | getReplicaCount () const |
bool | getTemporary () const |
void | setTemporary (bool) |
bool | getForceVarPart () const |
void | setForceVarPart (bool) |
int | checkColumns (const Uint32 *bitmap, unsigned len_in_bytes) const |
void | assignObjId (const ObjectId &) |
void | setStorageType (Column::StorageType) |
Column::StorageType | getStorageType () const |
void | setExtraRowGciBits (Uint32) |
Uint32 | getExtraRowGciBits () const |
void | setExtraRowAuthorBits (Uint32) |
Uint32 | getExtraRowAuthorBits () const |
int | aggregate (struct NdbError &error) |
int | validate (struct NdbError &error) |
Uint32 | getPartitionId (Uint32 hashvalue) const |
bool | hasDefaultValues () 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 | getNoOfAutoIncrementColumns () 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 |
Uint32 | getFragmentNodes (Uint32 fragmentId, Uint32 *nodeIdArrayPtr, Uint32 arraySize) 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 |
Friends | |
class | Ndb |
class | NdbDictionaryImpl |
class | NdbTableImpl |
class | NdbEventOperationImpl |
Represents a table in NDB Cluster.
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.
Definition at line 664 of file NdbDictionary.hpp.
NdbDictionary::Table::Table | ( | const char * | name = "" | ) |
Constructor
name | Name of table |
Definition at line 483 of file NdbDictionary.cpp.
NdbDictionary::Table::Table | ( | const Table & | table | ) |
Copy constructor
table | Table to be copied |
Definition at line 489 of file NdbDictionary.cpp.
int NdbDictionary::Table::addColumn | ( | const Column & | c | ) |
Add a column definition to a table
Definition at line 537 of file NdbDictionary.cpp.
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.
Reimplemented in NdbTableImpl.
Definition at line 987 of file NdbDictionary.cpp.
void NdbDictionary::Table::assignObjId | ( | const ObjectId & | _objId | ) |
Set tableId,tableVersion on a table... this is a "work-around" since createIndex can't (currently) accept an ObjectId instead of table-object in createIndex this as way way too much stuff is pushed into NdbDictInterface
Definition at line 1029 of file NdbDictionary.cpp.
int NdbDictionary::Table::checkColumns | ( | const Uint32 * | bitmap, |
unsigned | len_in_bytes | ||
) | const |
Check if any of column in bitmaps are disk columns returns bitmap of different columns bit 0 = atleast 1 pk column is set bit 1 = atleast 1 disk column set bit 2 = atleast 1 non disk column set passing NULL pointer will equal to bitmap with all columns set
Definition at line 1308 of file NdbDictionaryImpl.cpp.
bool NdbDictionary::Table::equal | ( | const Table & | col | ) | const |
Check if table is equal to some other table
Definition at line 824 of file NdbDictionary.cpp.
const NdbDictionary::Column * NdbDictionary::Table::getColumn | ( | const char * | name | ) | const |
Get column definition via name.
Reimplemented in NdbTableImpl.
Definition at line 558 of file NdbDictionary.cpp.
NdbDictionary::Column * NdbDictionary::Table::getColumn | ( | const int | attributeId | ) |
Get column definition via index in table.
Definition at line 574 of file NdbDictionary.cpp.
NdbDictionary::Column * NdbDictionary::Table::getColumn | ( | const char * | name | ) |
Get column definition via name.
Reimplemented in NdbTableImpl.
Definition at line 568 of file NdbDictionary.cpp.
const NdbDictionary::Column * NdbDictionary::Table::getColumn | ( | const int | attributeId | ) | const |
Get column definition via index in table.
Definition at line 563 of file NdbDictionary.cpp.
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.
Definition at line 982 of file NdbDictionary.cpp.
bool NdbDictionary::Table::getForceVarPart | ( | ) | const |
Only table with varpart do support online add column Add property so that table wo/ varsize column(s) still allocates varpart-ref, so that later online add column is possible
Definition at line 972 of file NdbDictionary.cpp.
Uint32 NdbDictionary::Table::getFragmentCount | ( | ) | const |
Get fragment count
Reimplemented in NdbTableImpl.
Definition at line 753 of file NdbDictionary.cpp.
const Uint32 * NdbDictionary::Table::getFragmentData | ( | ) | const |
Get Fragment Data (array of node groups)
Reimplemented in NdbTableImpl.
Definition at line 764 of file NdbDictionary.cpp.
Uint32 NdbDictionary::Table::getFragmentNodes | ( | Uint32 | fragmentId, |
Uint32 * | nodeIdArrayPtr, | ||
Uint32 | arraySize | ||
) | const |
Get list of nodes storing given fragment, primary is normally entry 0 Returns : 0 for error, > 0 for fragment count If fragment count is > arraySize param, only arraySize entries are written.
Reimplemented in NdbTableImpl.
Definition at line 796 of file NdbDictionary.cpp.
NdbDictionary::Object::FragmentType NdbDictionary::Table::getFragmentType | ( | ) | const |
Get fragmentation type
Definition at line 595 of file NdbDictionary.cpp.
const void * NdbDictionary::Table::getFrmData | ( | ) | const |
Get frm file stored with this table
Reimplemented in NdbTableImpl.
Definition at line 693 of file NdbDictionary.cpp.
int NdbDictionary::Table::getKValue | ( | ) | const |
Get KValue (Hash parameter.) Only allowed value is 6. Later implementations might add flexibility in this parameter.
Definition at line 605 of file NdbDictionary.cpp.
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.
Definition at line 585 of file NdbDictionary.cpp.
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.
Definition at line 625 of file NdbDictionary.cpp.
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.
Definition at line 615 of file NdbDictionary.cpp.
const char * NdbDictionary::Table::getName | ( | ) | const |
Get table name
Reimplemented in NdbTableImpl.
Definition at line 522 of file NdbDictionary.cpp.
int NdbDictionary::Table::getNoOfAutoIncrementColumns | ( | ) | const |
Get number of auto_increment columns in the table
Definition at line 635 of file NdbDictionary.cpp.
int NdbDictionary::Table::getNoOfColumns | ( | ) | const |
Get number of columns in the table
Definition at line 630 of file NdbDictionary.cpp.
int NdbDictionary::Table::getNoOfPrimaryKeys | ( | ) | const |
Get number of primary keys in the table
Definition at line 640 of file NdbDictionary.cpp.
|
virtual |
Get object id
Implements NdbDictionary::Object.
Definition at line 819 of file NdbDictionary.cpp.
|
virtual |
Get object status
Implements NdbDictionary::Object.
Definition at line 804 of file NdbDictionary.cpp.
Object::Type NdbDictionary::Table::getObjectType | ( | ) | const |
Get table object type
|
virtual |
Get object version
Implements NdbDictionary::Object.
Definition at line 814 of file NdbDictionary.cpp.
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
Definition at line 999 of file NdbDictionary.cpp.
const char * NdbDictionary::Table::getPrimaryKey | ( | int | no | ) | const |
Get name of primary key
Definition at line 681 of file NdbDictionary.cpp.
const Int32 * NdbDictionary::Table::getRangeListData | ( | ) | const |
Get Range or List Array (value, partition)
Reimplemented in NdbTableImpl.
Definition at line 780 of file NdbDictionary.cpp.
int NdbDictionary::Table::getTableId | ( | ) | const |
Get table id
Definition at line 532 of file NdbDictionary.cpp.
NdbDictionary::Table & NdbDictionary::Table::operator= | ( | const Table & | table | ) |
Assignment operator, deep copy
table | Table to be copied |
Definition at line 508 of file NdbDictionary.cpp.
void NdbDictionary::Table::setDefaultNoPartitionsFlag | ( | Uint32 | indicator | ) |
Set/Get indicator if default number of partitions is used in table.
Definition at line 669 of file NdbDictionary.cpp.
void NdbDictionary::Table::setExtraRowAuthorBits | ( | Uint32 | val | ) |
Get/set extra row author bits (max 31)
Definition at line 952 of file NdbDictionary.cpp.
void NdbDictionary::Table::setExtraRowGciBits | ( | Uint32 | val | ) |
Get/set extra GCI bits (max 31)
Definition at line 937 of file NdbDictionary.cpp.
void NdbDictionary::Table::setFragmentCount | ( | Uint32 | count | ) |
Set fragment count
Reimplemented in NdbTableImpl.
Definition at line 747 of file NdbDictionary.cpp.
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
Reimplemented in NdbTableImpl.
Definition at line 774 of file NdbDictionary.cpp.
void NdbDictionary::Table::setFragmentType | ( | FragmentType | ft | ) |
Set fragmentation type
Definition at line 590 of file NdbDictionary.cpp.
int NdbDictionary::Table::setFrm | ( | const void * | data, |
Uint32 | len | ||
) |
Set frm file to store with this table
Reimplemented in NdbTableImpl.
Definition at line 759 of file NdbDictionary.cpp.
void NdbDictionary::Table::setKValue | ( | int | kValue | ) |
Set KValue (Hash parameter.) Only allowed value is 6. Later implementations might add flexibility in this parameter.
Definition at line 600 of file NdbDictionary.cpp.
void NdbDictionary::Table::setLinearFlag | ( | Uint32 | flag | ) |
Set/Get Linear Hash Flag
Definition at line 735 of file NdbDictionary.cpp.
void NdbDictionary::Table::setLogging | ( | bool | val | ) |
Definition at line 580 of file NdbDictionary.cpp.
void NdbDictionary::Table::setMaxLoadFactor | ( | int | lf | ) |
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.
Definition at line 620 of file NdbDictionary.cpp.
void NdbDictionary::Table::setMaxRows | ( | Uint64 | maxRows | ) |
Set/Get Maximum number of rows in table (only used to calculate number of partitions).
Definition at line 645 of file NdbDictionary.cpp.
void NdbDictionary::Table::setMinLoadFactor | ( | int | lf | ) |
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.
Definition at line 610 of file NdbDictionary.cpp.
void NdbDictionary::Table::setMinRows | ( | Uint64 | minRows | ) |
Set/Get Minimum number of rows in table (only used to calculate number of partitions).
Definition at line 657 of file NdbDictionary.cpp.
int NdbDictionary::Table::setName | ( | const char * | name | ) |
Name of table
name | Name of table |
Reimplemented in NdbTableImpl.
Definition at line 517 of file NdbDictionary.cpp.
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 }
Reimplemented in NdbTableImpl.
Definition at line 790 of file NdbDictionary.cpp.
void NdbDictionary::Table::setSingleUserMode | ( | enum | SingleUserMode | ) |
Set/Get SingleUserMode
void NdbDictionary::Table::setStorageType | ( | Column::StorageType | type | ) |
set/get table-storage-method
Definition at line 1037 of file NdbDictionary.cpp.
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.
Reimplemented in NdbTableImpl.
Definition at line 993 of file NdbDictionary.cpp.
|
friend |
Reciver(s)
Definition at line 1126 of file NdbDictionary.hpp.