本文整理汇总了C++中ndbdictionary::Dictionary::getTablespace方法的典型用法代码示例。如果您正苦于以下问题:C++ Dictionary::getTablespace方法的具体用法?C++ Dictionary::getTablespace怎么用?C++ Dictionary::getTablespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ndbdictionary::Dictionary
的用法示例。
在下文中一共展示了Dictionary::getTablespace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: old
bool
BackupRestore::object(Uint32 type, const void * ptr)
{
if (!m_restore_meta)
return true;
NdbDictionary::Dictionary* dict = m_ndb->getDictionary();
switch(type){
case DictTabInfo::Tablespace:
{
NdbDictionary::Tablespace old(*(NdbDictionary::Tablespace*)ptr);
Uint32 id = old.getObjectId();
if (!m_no_restore_disk)
{
NdbDictionary::LogfileGroup * lg = m_logfilegroups[old.getDefaultLogfileGroupId()];
old.setDefaultLogfileGroup(* lg);
info << "Creating tablespace: " << old.getName() << "..." << flush;
int ret = dict->createTablespace(old);
if (ret)
{
NdbError errobj= dict->getNdbError();
info << "FAILED" << endl;
err << "Create tablespace failed: " << old.getName() << ": " << errobj << endl;
return false;
}
info << "done" << endl;
}
NdbDictionary::Tablespace curr = dict->getTablespace(old.getName());
NdbError errobj = dict->getNdbError();
if ((int) errobj.classification == (int) ndberror_cl_none)
{
NdbDictionary::Tablespace* currptr = new NdbDictionary::Tablespace(curr);
NdbDictionary::Tablespace * null = 0;
m_tablespaces.set(currptr, id, null);
debug << "Retreived tablespace: " << currptr->getName()
<< " oldid: " << id << " newid: " << currptr->getObjectId()
<< " " << (void*)currptr << endl;
return true;
}
err << "Failed to retrieve tablespace \"" << old.getName() << "\": "
<< errobj << endl;
return false;
break;
}
case DictTabInfo::LogfileGroup:
{
NdbDictionary::LogfileGroup old(*(NdbDictionary::LogfileGroup*)ptr);
Uint32 id = old.getObjectId();
if (!m_no_restore_disk)
{
info << "Creating logfile group: " << old.getName() << "..." << flush;
int ret = dict->createLogfileGroup(old);
if (ret)
{
NdbError errobj= dict->getNdbError();
info << "FAILED" << endl;
err << "Create logfile group failed: " << old.getName() << ": " << errobj << endl;
return false;
}
info << "done" << endl;
}
NdbDictionary::LogfileGroup curr = dict->getLogfileGroup(old.getName());
NdbError errobj = dict->getNdbError();
if ((int) errobj.classification == (int) ndberror_cl_none)
{
NdbDictionary::LogfileGroup* currptr =
new NdbDictionary::LogfileGroup(curr);
NdbDictionary::LogfileGroup * null = 0;
m_logfilegroups.set(currptr, id, null);
debug << "Retreived logfile group: " << currptr->getName()
<< " oldid: " << id << " newid: " << currptr->getObjectId()
<< " " << (void*)currptr << endl;
return true;
}
err << "Failed to retrieve logfile group \"" << old.getName() << "\": "
<< errobj << endl;
return false;
break;
}
case DictTabInfo::Datafile:
{
if (!m_no_restore_disk)
{
NdbDictionary::Datafile old(*(NdbDictionary::Datafile*)ptr);
NdbDictionary::ObjectId objid;
old.getTablespaceId(&objid);
NdbDictionary::Tablespace * ts = m_tablespaces[objid.getObjectId()];
debug << "Connecting datafile " << old.getPath()
<< " to tablespace: oldid: " << objid.getObjectId()
<< " newid: " << ts->getObjectId() << endl;
//.........这里部分代码省略.........
示例2:
int
NDBT_Tables::create_default_tablespace(Ndb* pNdb)
{
NdbDictionary::Dictionary* pDict = pNdb->getDictionary();
int res;
NdbDictionary::LogfileGroup lg = pDict->getLogfileGroup("DEFAULT-LG");
if (strcmp(lg.getName(), "DEFAULT-LG") != 0)
{
lg.setName("DEFAULT-LG");
lg.setUndoBufferSize(8*1024*1024);
res = pDict->createLogfileGroup(lg);
if(res != 0){
g_err << "Failed to create logfilegroup:"
<< endl << pDict->getNdbError() << endl;
return NDBT_FAILED;
}
}
{
NdbDictionary::Undofile uf = pDict->getUndofile(0, "undofile01.dat");
if (strcmp(uf.getPath(), "undofile01.dat") != 0)
{
uf.setPath("undofile01.dat");
uf.setSize(32*1024*1024);
uf.setLogfileGroup("DEFAULT-LG");
res = pDict->createUndofile(uf, true);
if(res != 0){
g_err << "Failed to create undofile:"
<< endl << pDict->getNdbError() << endl;
return NDBT_FAILED;
}
}
}
{
NdbDictionary::Undofile uf = pDict->getUndofile(0, "undofile02.dat");
if (strcmp(uf.getPath(), "undofile02.dat") != 0)
{
uf.setPath("undofile02.dat");
uf.setSize(32*1024*1024);
uf.setLogfileGroup("DEFAULT-LG");
res = pDict->createUndofile(uf, true);
if(res != 0){
g_err << "Failed to create undofile:"
<< endl << pDict->getNdbError() << endl;
return NDBT_FAILED;
}
}
}
NdbDictionary::Tablespace ts = pDict->getTablespace("DEFAULT-TS");
if (strcmp(ts.getName(), "DEFAULT-TS") != 0)
{
ts.setName("DEFAULT-TS");
ts.setExtentSize(1024*1024);
ts.setDefaultLogfileGroup("DEFAULT-LG");
res = pDict->createTablespace(ts);
if(res != 0){
g_err << "Failed to create tablespace:"
<< endl << pDict->getNdbError() << endl;
return NDBT_FAILED;
}
}
{
NdbDictionary::Datafile df = pDict->getDatafile(0, "datafile01.dat");
if (strcmp(df.getPath(), "datafile01.dat") != 0)
{
df.setPath("datafile01.dat");
df.setSize(64*1024*1024);
df.setTablespace("DEFAULT-TS");
res = pDict->createDatafile(df, true);
if(res != 0){
g_err << "Failed to create datafile:"
<< endl << pDict->getNdbError() << endl;
return NDBT_FAILED;
}
}
}
{
NdbDictionary::Datafile df = pDict->getDatafile(0, "datafile02.dat");
if (strcmp(df.getPath(), "datafile02.dat") != 0)
{
df.setPath("datafile02.dat");
df.setSize(64*1024*1024);
df.setTablespace("DEFAULT-TS");
res = pDict->createDatafile(df, true);
if(res != 0){
g_err << "Failed to create datafile:"
<< endl << pDict->getNdbError() << endl;
return NDBT_FAILED;
}
}
}
return NDBT_OK;
//.........这里部分代码省略.........