MySQL 5.6.14 Source Code Document
|
Dictionary for defining and retreiving meta data. More...
#include <NdbDictionary.hpp>
Classes | |
class | List |
Structure for retrieving lists of object names. More... |
Public Member Functions | |
const Table * | getTable (const char *name, void **data) const |
void | set_local_table_data_size (unsigned sz) |
const Index * | getIndexGlobal (const char *indexName, const Table &ndbtab) const |
const Index * | getIndexGlobal (const char *indexName, const char *tableName) const |
const Table * | getTableGlobal (const char *tableName) const |
int | alterTableGlobal (const Table &f, const Table &t) |
int | dropTableGlobal (const Table &ndbtab) |
int | dropIndexGlobal (const Index &index) |
int | removeIndexGlobal (const Index &ndbidx, int invalidate) const |
int | removeTableGlobal (const Table &ndbtab, int invalidate) const |
void | invalidateDbGlobal (const char *dbname) |
NdbRecord * | createRecord (const Table *table, const RecordSpecification *recSpec, Uint32 length, Uint32 elemSize, Uint32 flags=0) |
NdbRecord * | createRecord (const Index *index, const Table *table, const RecordSpecification *recSpec, Uint32 length, Uint32 elemSize, Uint32 flags=0) |
NdbRecord * | createRecord (const Index *index, const RecordSpecification *recSpec, Uint32 length, Uint32 elemSize, Uint32 flags=0) |
void | releaseRecord (NdbRecord *rec) |
General | |
int | listObjects (List &list, Object::Type type=Object::TypeUndefined) |
int | listObjects (List &list, Object::Type type=Object::TypeUndefined) const |
int | listObjects (List &list, Object::Type type, bool fullyQualified) const |
struct NdbError & | getNdbError () const |
int | getWarningFlags () const |
Retrieving references to Tables and Indexes | |
const Table * | getTable (const char *name) const |
const Table * | getBlobTable (const Table *, const char *col_name) |
const Table * | getBlobTable (const Table *, Uint32 col_no) |
void | putTable (const Table *table) |
const Index * | getIndex (const char *indexName, const char *tableName) const |
int | listIndexes (List &list, const char *tableName) |
int | listIndexes (List &list, const char *tableName) const |
int | listIndexes (List &list, const Table &table) const |
Events | |
int | createEvent (const Event &event) |
int | dropEvent (const char *eventName, int force=0) |
const Event * | getEvent (const char *eventName) |
int | listEvents (List &list) |
int | listEvents (List &list) const |
Table creation | |
These methods should normally not be used in an application as the result will not be visible from the MySQL Server | |
int | createTable (const Table &table) |
int | createTable (const Table &table, ObjectId *objid) |
int | optimizeTable (const Table &t, OptimizeTableHandle &h) |
int | optimizeIndex (const Index &ind, OptimizeIndexHandle &h) |
int | dropTable (Table &table) |
int | dropTable (const char *name) |
bool | supportedAlterTable (const Table &f, const Table &t) |
int | alterTable (const Table &f, const Table &t) |
void | invalidateTable (const char *name) |
void | removeCachedTable (const char *table) |
void | removeCachedIndex (const char *index, const char *table) |
Index creation | |
These methods should normally not be used in an application as the result will not be visible from the MySQL Server | |
int | createIndex (const Index &index, bool offline=false) |
int | createIndex (const Index &index, const Table &table, bool offline=false) |
int | dropIndex (const char *indexName, const char *tableName) |
int | updateIndexStat (const Index &, const Table &) |
int | updateIndexStat (Uint32 indexId, Uint32 indexVersion, Uint32 tableId) |
int | deleteIndexStat (const Index &, const Table &) |
int | deleteIndexStat (Uint32 indexId, Uint32 indexVersion, Uint32 tableId) |
void | removeCachedTable (const Table *table) |
void | removeCachedIndex (const Index *index) |
void | invalidateTable (const Table *table) |
void | invalidateIndex (const char *indexName, const char *tableName) |
void | invalidateIndex (const Index *index) |
int | forceGCPWait () |
int | forceGCPWait (int type) |
int | getRestartGCI (Uint32 *gci) |
HashMap | |
int | createHashMap (const HashMap &, ObjectId *=0) |
int | getHashMap (HashMap &dst, const char *name) |
int | getHashMap (HashMap &dst, const Table *table) |
int | getDefaultHashMap (HashMap &dst, Uint32 fragments) |
int | initDefaultHashMap (HashMap &dst, Uint32 fragments) |
int | prepareHashMap (const Table &oldTable, Table &newTable) |
Protected Member Functions | |
Dictionary (Ndb &ndb) |
Friends | |
class | NdbDictionaryImpl |
class | UtilTransactions |
class | NdbBlob |
Disk data objects | |
enum | { WarnUndobufferRoundUp = 0x1, WarnUndofileRoundDown = 0x2, WarnExtentRoundUp = 0x4, WarnDatafileRoundDown = 0x8, WarnDatafileRoundUp = 0x10 } |
int | createLogfileGroup (const LogfileGroup &, ObjectId *=0) |
int | dropLogfileGroup (const LogfileGroup &) |
LogfileGroup | getLogfileGroup (const char *name) |
int | createTablespace (const Tablespace &, ObjectId *=0) |
int | dropTablespace (const Tablespace &) |
Tablespace | getTablespace (const char *name) |
Tablespace | getTablespace (Uint32 tablespaceId) |
int | createDatafile (const Datafile &, bool overwrite_existing=false, ObjectId *=0) |
int | dropDatafile (const Datafile &) |
Datafile | getDatafile (Uint32 node, const char *path) |
int | createUndofile (const Undofile &, bool overwrite_existing=false, ObjectId *=0) |
int | dropUndofile (const Undofile &) |
Undofile | getUndofile (Uint32 node, const char *path) |
Schema transactions | |
Metadata operations are create, alter, and drop of objects of various types. An operation may create additional sub-operations in the kernel. By default, each user operation is executed separately. That is, a schema transaction is started implicitly, the operation and its suboperations are executed, and the transaction is closed. The Ndb object and its associated Dictionary support one schema transaction at a time. Using begin and end transaction explicitly it is possible to execute a set of user defined operations atomically i.e. either all operations succeed or all are aborted (rolled back). The steps are 1) beginSchemaTrans 2) submit operations such as createTable 3) endSchemaTrans. Each operation is sent to the kernel which parses and saves it. Parse failure does rollback to previous user operation before returning. The user can continue or abort entire transaction. After all operations have been submitted, endSchemaTrans with flags 0 (the default) processes and commits them. On error return the transaction is already aborted. If the user exits before calling endSchemaTrans, the kernel aborts the transaction. If the user exits before the call to endSchemaTrans returns, the kernel continues with the request. Completion status is reported in cluster log. | |
enum | SchemaTransFlag { SchemaTransAbort = 1, SchemaTransBackground = 2 } |
int | beginSchemaTrans () |
int | endSchemaTrans (Uint32 flags=0) |
bool | hasSchemaTrans () const |
Dictionary for defining and retreiving meta data.
Definition at line 2048 of file NdbDictionary.hpp.
Flags for endSchemaTrans, or-ed together.
Definition at line 2540 of file NdbDictionary.hpp.
Alter defined table given defined Table instance
f | Table to alter |
t | New definition of table |
Definition at line 2250 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::beginSchemaTrans | ( | ) |
Begin schema transaction. Returns error if a transaction is already active or if the kernel metadata is locked.
Definition at line 3603 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::createEvent | ( | const Event & | event | ) |
Create event given defined Event instance
event | Event to create |
Definition at line 2730 of file NdbDictionary.cpp.
Create a HashMap in database
Definition at line 3621 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::createIndex | ( | const Index & | index, |
bool | offline = false |
||
) |
Create index given defined Index instance
index | Index to create |
Definition at line 2544 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::createTable | ( | const Table & | table | ) |
Create defined table given defined Table instance
table | Table to create |
Definition at line 2134 of file NdbDictionary.cpp.
Create defined table given defined Table instance return ObjectId
table | Table to create |
Definition at line 2140 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::dropEvent | ( | const char * | eventName, |
int | force = 0 |
||
) |
Drop event with given name
eventName | Name of event to drop. |
Reimplemented in NdbDictionaryImpl.
Definition at line 2736 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::dropIndex | ( | const char * | indexName, |
const char * | tableName | ||
) |
Drop index with given name
indexName | Name of index to drop. |
tableName | Name of table that index belongs to. |
Reimplemented in NdbDictionaryImpl.
Definition at line 2569 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::dropTable | ( | Table & | table | ) |
Drop table given retrieved Table instance
table | Table to drop |
Definition at line 2182 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::dropTable | ( | const char * | name | ) |
Drop table given table name
name | Name of table to drop |
Reimplemented in NdbDictionaryImpl.
Definition at line 2222 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::endSchemaTrans | ( | Uint32 | flags = 0 | ) |
End schema transaction, with commit or with abort. Combines execute and close which do not exist separately. May be called and succeeds even if no transaction is active.
flags | Bitmask of options. Default 0 commits the transaction. Including option 1 aborts the transaction. See SchemaTransFlag for others. |
Reimplemented in NdbDictionaryImpl.
Definition at line 3609 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::forceGCPWait | ( | ) |
Force gcp and wait for gcp complete
Definition at line 2679 of file NdbDictionary.cpp.
const NdbDictionary::Table * NdbDictionary::Dictionary::getBlobTable | ( | const Table * | table, |
const char * | col_name | ||
) |
Given main table, get blob table.
Definition at line 2497 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::getDefaultHashMap | ( | NdbDictionary::HashMap & | dst, |
Uint32 | fragments | ||
) |
Get default HashMap
Definition at line 1894 of file NdbDictionary.cpp.
const NdbDictionary::Event * NdbDictionary::Dictionary::getEvent | ( | const char * | eventName | ) |
Get event with given name.
eventName | Name of event to get. |
Definition at line 2742 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::getHashMap | ( | NdbDictionary::HashMap & | dst, |
const char * | name | ||
) |
Get a HashMap by name
Definition at line 1905 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::getHashMap | ( | NdbDictionary::HashMap & | dst, |
const Table * | table | ||
) |
Get a HashMap for a table
Definition at line 1912 of file NdbDictionary.cpp.
const NdbDictionary::Index * NdbDictionary::Dictionary::getIndex | ( | const char * | indexName, |
const char * | tableName | ||
) | const |
Get index with given name, NULL if undefined
indexName | Name of index to get. |
tableName | Name of table that index belongs to. |
Definition at line 2648 of file NdbDictionary.cpp.
|
read |
Get the latest error
Reimplemented in NdbDictionaryImpl.
Definition at line 2816 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::getRestartGCI | ( | Uint32 * | gci | ) |
Get restart gci
Reimplemented in NdbDictionaryImpl.
Definition at line 2691 of file NdbDictionary.cpp.
const NdbDictionary::Table * NdbDictionary::Dictionary::getTable | ( | const char * | name | ) | const |
Get table with given name, NULL if undefined
name | Name of table to get |
Definition at line 2491 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::getWarningFlags | ( | ) | const |
Get warning flags. The value is valid only if the operation did not return an error and can return warnings. The flags are specific to the operation.
Definition at line 2821 of file NdbDictionary.cpp.
bool NdbDictionary::Dictionary::hasSchemaTrans | ( | ) | const |
Check if a schema transaction exists currently.
Reimplemented in NdbDictionaryImpl.
Definition at line 3615 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::initDefaultHashMap | ( | NdbDictionary::HashMap & | dst, |
Uint32 | fragments | ||
) |
Init a default HashMap
Definition at line 1926 of file NdbDictionary.cpp.
void NdbDictionary::Dictionary::invalidateIndex | ( | const char * | indexName, |
const char * | tableName | ||
) |
Invalidate cached index object
Definition at line 2667 of file NdbDictionary.cpp.
void NdbDictionary::Dictionary::invalidateTable | ( | const char * | name | ) |
Invalidate cached table object
name | Name of table to invalidate |
Definition at line 2516 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::listEvents | ( | List & | list | ) |
List defined events
list | List of events returned in the dictionary |
Reimplemented in NdbDictionaryImpl.
Definition at line 2751 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::listIndexes | ( | List & | list, |
const char * | tableName | ||
) |
Fetch list of indexes of given table.
list | Reference to list where to store the listed indexes |
tableName | Name of table that index belongs to. |
Definition at line 2789 of file NdbDictionary.cpp.
Fetch list of indexes of given table.
list | Reference to list where to store the listed indexes |
table | Reference to table that index belongs to. |
Definition at line 2809 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::listObjects | ( | List & | list, |
Object::Type | type = Object::TypeUndefined |
||
) |
Fetch list of all objects, optionally restricted to given type.
list | List of objects returned in the dictionary |
type | Restrict returned list to only contain objects of this type |
Definition at line 2765 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::optimizeIndex | ( | const Index & | ind, |
NdbDictionary::OptimizeIndexHandle & | h | ||
) |
Start index optimization given defined index object
ind | Object of index to optimize |
Pre-allocated | OptimizeIndexHandle |
Definition at line 2173 of file NdbDictionary.cpp.
int NdbDictionary::Dictionary::optimizeTable | ( | const Table & | t, |
OptimizeTableHandle & | h | ||
) |
Start table optimization given defined table object
t | Object of table to optimize |
Pre-allocated | OptimizeTableHandle |
Definition at line 2165 of file NdbDictionary.cpp.
create (or retreive) a HashMap suitable for alter NOTE: Requires a started schema transaction
reorg...we don't know how many fragments new table should have create if exist a default map...which will "know" how many fragments there are
drop partition is currently not supported... and since this is a "reorg" (newcnt == 0) we silently change it to a nop
Check if this accidently became a "default" map
Definition at line 1946 of file NdbDictionary.cpp.
void NdbDictionary::Dictionary::removeCachedIndex | ( | const char * | index, |
const char * | table | ||
) |
Remove index from local cache
Definition at line 2706 of file NdbDictionary.cpp.
void NdbDictionary::Dictionary::removeCachedTable | ( | const char * | table | ) |
Remove table from local cache
Definition at line 2531 of file NdbDictionary.cpp.
Check if alter of table given defined Table instance to new definition is supported
f | Table to alter |
t | New definition of table |
Definition at line 2242 of file NdbDictionary.cpp.