MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NdbDictionary::Dictionary Class Reference

Dictionary for defining and retreiving meta data. More...

#include <NdbDictionary.hpp>

Inheritance diagram for NdbDictionary::Dictionary:

Classes

class  List
 Structure for retrieving lists of object names. More...

Public Member Functions

const TablegetTable (const char *name, void **data) const
void set_local_table_data_size (unsigned sz)
const IndexgetIndexGlobal (const char *indexName, const Table &ndbtab) const
const IndexgetIndexGlobal (const char *indexName, const char *tableName) const
const TablegetTableGlobal (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)
NdbRecordcreateRecord (const Table *table, const RecordSpecification *recSpec, Uint32 length, Uint32 elemSize, Uint32 flags=0)
NdbRecordcreateRecord (const Index *index, const Table *table, const RecordSpecification *recSpec, Uint32 length, Uint32 elemSize, Uint32 flags=0)
NdbRecordcreateRecord (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 NdbErrorgetNdbError () const
int getWarningFlags () const
Retrieving references to Tables and Indexes
const TablegetTable (const char *name) const
const TablegetBlobTable (const Table *, const char *col_name)
const TablegetBlobTable (const Table *, Uint32 col_no)
void putTable (const Table *table)
const IndexgetIndex (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 EventgetEvent (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

Detailed Description

Dictionary for defining and retreiving meta data.

Definition at line 2048 of file NdbDictionary.hpp.

Member Enumeration Documentation

Flags for endSchemaTrans, or-ed together.

Definition at line 2540 of file NdbDictionary.hpp.

Member Function Documentation

int NdbDictionary::Dictionary::alterTable ( const Table f,
const Table t 
)

Alter defined table given defined Table instance

Parameters
fTable to alter
tNew definition of table
Returns
-2 (incompatible version)
-1 general error
0 success

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.

Returns
0 on success, -1 on error

Definition at line 3603 of file NdbDictionary.cpp.

int NdbDictionary::Dictionary::createEvent ( const Event event)

Create event given defined Event instance

Parameters
eventEvent to create
Returns
0 if successful otherwise -1.

Definition at line 2730 of file NdbDictionary.cpp.

Here is the caller graph for this function:

int NdbDictionary::Dictionary::createHashMap ( const HashMap map,
ObjectId dst = 0 
)

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

Parameters
indexIndex to create
Returns
0 if successful otherwise -1.

Definition at line 2544 of file NdbDictionary.cpp.

int NdbDictionary::Dictionary::createTable ( const Table table)

Create defined table given defined Table instance

Parameters
tableTable to create
Returns
0 if successful otherwise -1.

Definition at line 2134 of file NdbDictionary.cpp.

Here is the caller graph for this function:

int NdbDictionary::Dictionary::createTable ( const Table table,
ObjectId objid 
)

Create defined table given defined Table instance return ObjectId

Parameters
tableTable to create
Returns
0 if successful otherwise -1.

Definition at line 2140 of file NdbDictionary.cpp.

Here is the call graph for this function:

int NdbDictionary::Dictionary::dropEvent ( const char *  eventName,
int  force = 0 
)

Drop event with given name

Parameters
eventNameName of event to drop.
Returns
0 if successful otherwise -1.

Reimplemented in NdbDictionaryImpl.

Definition at line 2736 of file NdbDictionary.cpp.

Here is the caller graph for this function:

int NdbDictionary::Dictionary::dropIndex ( const char *  indexName,
const char *  tableName 
)

Drop index with given name

Parameters
indexNameName of index to drop.
tableNameName of table that index belongs to.
Returns
0 if successful otherwise -1.

Reimplemented in NdbDictionaryImpl.

Definition at line 2569 of file NdbDictionary.cpp.

Here is the caller graph for this function:

int NdbDictionary::Dictionary::dropTable ( Table table)

Drop table given retrieved Table instance

Parameters
tableTable to drop
Returns
0 if successful otherwise -1.

Definition at line 2182 of file NdbDictionary.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int NdbDictionary::Dictionary::dropTable ( const char *  name)

Drop table given table name

Parameters
nameName of table to drop
Returns
0 if successful otherwise -1.

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.

Note
Like any method, may overwrite current error code. First save error code from any failed operation.
Parameters
flagsBitmask of options. Default 0 commits the transaction. Including option 1 aborts the transaction. See SchemaTransFlag for others.
Returns
0 on success, -1 on error

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.

Here is the call graph for this function:

Here is the caller graph for this function:

int NdbDictionary::Dictionary::getDefaultHashMap ( NdbDictionary::HashMap dst,
Uint32  fragments 
)

Get default HashMap

Definition at line 1894 of file NdbDictionary.cpp.

Here is the call graph for this function:

const NdbDictionary::Event * NdbDictionary::Dictionary::getEvent ( const char *  eventName)

Get event with given name.

Parameters
eventNameName of event to get.
Returns
an Event if successful, otherwise NULL.

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.

Here is the call graph for this function:

const NdbDictionary::Index * NdbDictionary::Dictionary::getIndex ( const char *  indexName,
const char *  tableName 
) const

Get index with given name, NULL if undefined

Parameters
indexNameName of index to get.
tableNameName of table that index belongs to.
Returns
index if successful, otherwise 0.

Definition at line 2648 of file NdbDictionary.cpp.

Here is the caller graph for this function:

struct NdbError & NdbDictionary::Dictionary::getNdbError ( ) const
read

Get the latest error

Returns
Error object.

Reimplemented in NdbDictionaryImpl.

Definition at line 2816 of file NdbDictionary.cpp.

Here is the caller graph for this function:

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

Parameters
nameName of table to get
Returns
table if successful otherwise NULL.

Definition at line 2491 of file NdbDictionary.cpp.

Here is the caller graph for this function:

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.

Here is the call graph for this function:

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

Parameters
nameName of table to invalidate

Definition at line 2516 of file NdbDictionary.cpp.

int NdbDictionary::Dictionary::listEvents ( List list)

List defined events

Parameters
listList of events returned in the dictionary
Returns
0 if successful otherwise -1.

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.

Parameters
listReference to list where to store the listed indexes
tableNameName of table that index belongs to.
Returns
0 if successful, otherwise -1

Definition at line 2789 of file NdbDictionary.cpp.

int NdbDictionary::Dictionary::listIndexes ( List list,
const Table table 
) const

Fetch list of indexes of given table.

Parameters
listReference to list where to store the listed indexes
tableReference to table that index belongs to.
Returns
0 if successful, otherwise -1

Definition at line 2809 of file NdbDictionary.cpp.

Here is the call graph for this function:

int NdbDictionary::Dictionary::listObjects ( List list,
Object::Type  type = Object::TypeUndefined 
)

Fetch list of all objects, optionally restricted to given type.

Parameters
listList of objects returned in the dictionary
typeRestrict returned list to only contain objects of this type
Returns
-1 if error.

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

Parameters
indObject of index to optimize
Pre-allocatedOptimizeIndexHandle
Returns
0 if successful otherwise -1.

Definition at line 2173 of file NdbDictionary.cpp.

int NdbDictionary::Dictionary::optimizeTable ( const Table t,
OptimizeTableHandle h 
)

Start table optimization given defined table object

Parameters
tObject of table to optimize
Pre-allocatedOptimizeTableHandle
Returns
0 if successful otherwise -1.

Definition at line 2165 of file NdbDictionary.cpp.

int NdbDictionary::Dictionary::prepareHashMap ( const Table oldTable,
Table newTable 
)

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.

Here is the call graph for this function:

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.

bool NdbDictionary::Dictionary::supportedAlterTable ( const Table f,
const Table t 
)

Check if alter of table given defined Table instance to new definition is supported

Parameters
fTable to alter
tNew definition of table
Returns
TRUE supported
FALSE not supported

Definition at line 2242 of file NdbDictionary.cpp.


The documentation for this class was generated from the following files: