The world's most popular open source database
#include <NdbDictionaryImpl.hpp>
Collaboration diagram for NdbDictInterface:

Definition at line 425 of file NdbDictionaryImpl.hpp.
| NdbDictInterface::NdbDictInterface | ( | NdbError & | err | ) | [inline] |
Definition at line 427 of file NdbDictionaryImpl.hpp.
References m_masterNodeId, m_reference, m_transporter, and NULL.
00427 : m_error(err) { 00428 m_reference = 0; 00429 m_masterNodeId = 0; 00430 m_transporter= NULL; 00431 }
| NdbDictInterface::~NdbDictInterface | ( | ) |
| int NdbDictInterface::alterTable | ( | class Ndb & | ndb, | |
| NdbTableImpl & | ||||
| ) |
Definition at line 2365 of file NdbDictionaryImpl.cpp.
References createOrAlterTable(), DBUG_ENTER, DBUG_RETURN, and ndb.
Referenced by NdbDictionaryImpl::alterTableGlobal().
02367 { 02368 DBUG_ENTER("NdbDictInterface::alterTable"); 02369 DBUG_RETURN(createOrAlterTable(ndb, impl, true)); 02370 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int NdbDictInterface::create_file | ( | const NdbFileImpl & | , | |
| const NdbFilegroupImpl & | , | |||
| bool | overwrite, | |||
| NdbDictObjectImpl * | ||||
| ) |
Definition at line 4493 of file NdbDictionaryImpl.cpp.
References abort(), CreateFileRef::Busy, BaseString::c_str(), CAST_PTR, data, DBDICT, DBUG_ENTER, DBUG_RETURN, dictSignal(), SimpleProperties::Eof, err, f, DictFilegroupInfo::FileMapping, DictFilegroupInfo::FileMappingSize, CreateFileReq::ForceCreateFile, UtilBuffer::get_data(), NdbApiSignal::getDataPtrSend(), GSN_CREATE_FILE_REQ, UtilBuffer::length(), m_buffer, NdbDictObjectImpl::m_id, NdbFileImpl::m_path, m_reference, NdbFileImpl::m_size, NdbDictObjectImpl::m_type, NdbDictObjectImpl::m_version, CreateFileRef::NotMaster, CreateFileReq::objType, LinearSectionPtr::p, SimpleProperties::pack(), CreateFileReq::requestInfo, CreateFileReq::senderData, CreateFileReq::senderRef, LinearSectionPtr::sz, SignalHeader::theLength, SignalHeader::theReceiversBlockNumber, SignalHeader::theVerId_signalNumber, and WAIT_CREATE_INDX_REQ.
Referenced by NdbDictionaryImpl::createDatafile(), and NdbDictionaryImpl::createUndofile().
04497 { 04498 DBUG_ENTER("NdbDictInterface::create_file"); 04499 UtilBufferWriter w(m_buffer); 04500 DictFilegroupInfo::File f; f.init(); 04501 snprintf(f.FileName, sizeof(f.FileName), file.m_path.c_str()); 04502 f.FileType = file.m_type; 04503 f.FilegroupId = group.m_id; 04504 f.FilegroupVersion = group.m_version; 04505 f.FileSizeHi = (file.m_size >> 32); 04506 f.FileSizeLo = (file.m_size & 0xFFFFFFFF); 04507 04508 SimpleProperties::UnpackStatus s; 04509 s = SimpleProperties::pack(w, 04510 &f, 04511 DictFilegroupInfo::FileMapping, 04512 DictFilegroupInfo::FileMappingSize, true); 04513 04514 if(s != SimpleProperties::Eof){ 04515 abort(); 04516 } 04517 04518 NdbApiSignal tSignal(m_reference); 04519 tSignal.theReceiversBlockNumber = DBDICT; 04520 tSignal.theVerId_signalNumber = GSN_CREATE_FILE_REQ; 04521 tSignal.theLength = CreateFileReq::SignalLength; 04522 04523 CreateFileReq* req = CAST_PTR(CreateFileReq, tSignal.getDataPtrSend()); 04524 req->senderRef = m_reference; 04525 req->senderData = 0; 04526 req->objType = file.m_type; 04527 req->requestInfo = 0; 04528 if (overwrite) 04529 req->requestInfo |= CreateFileReq::ForceCreateFile; 04530 04531 LinearSectionPtr ptr[3]; 04532 ptr[0].p = (Uint32*)m_buffer.get_data(); 04533 ptr[0].sz = m_buffer.length() / 4; 04534 04535 int err[] = { CreateFileRef::Busy, CreateFileRef::NotMaster, 0}; 04536 /* 04537 Send signal without time-out since creating files can take a very long 04538 time if the file is very big. 04539 */ 04540 int ret = dictSignal(&tSignal, ptr, 1, 04541 0, // master 04542 WAIT_CREATE_INDX_REQ, 04543 -1, 100, 04544 err); 04545 04546 if (ret == 0 && obj) 04547 { 04548 Uint32* data = (Uint32*)m_buffer.get_data(); 04549 obj->m_id = data[0]; 04550 obj->m_version = data[1]; 04551 } 04552 04553 DBUG_RETURN(ret); 04554 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int NdbDictInterface::create_filegroup | ( | const NdbFilegroupImpl & | , | |
| NdbDictObjectImpl * | ||||
| ) |
Definition at line 4623 of file NdbDictionaryImpl.cpp.
References abort(), CreateFilegroupRef::Busy, BaseString::c_str(), CAST_PTR, data, DBDICT, DBUG_ENTER, DBUG_RETURN, DICT_WAITFOR_TIMEOUT, dictSignal(), SimpleProperties::Eof, err, DictFilegroupInfo::Filegroup::FilegroupName, DictFilegroupInfo::Filegroup::FilegroupType, UtilBuffer::get_data(), get_filegroup(), NdbApiSignal::getDataPtrSend(), GSN_CREATE_FILEGROUP_REQ, DictFilegroupInfo::Filegroup::init(), UtilBuffer::length(), DictFilegroupInfo::Filegroup::LF_UndoBufferSize, DictTabInfo::LogfileGroup, NdbDictionary::Object::LogfileGroup, m_buffer, NdbFilegroupImpl::m_extent_size, NdbDictObjectImpl::m_id, NdbFilegroupImpl::m_logfile_group_id, NdbFilegroupImpl::m_logfile_group_name, NdbFilegroupImpl::m_logfile_group_version, NdbFilegroupImpl::m_name, m_reference, NdbDictObjectImpl::m_type, NdbFilegroupImpl::m_undo_buffer_size, NdbDictObjectImpl::m_version, DictFilegroupInfo::Mapping, DictFilegroupInfo::MappingSize, CreateFilegroupRef::NotMaster, CreateFilegroupReq::objType, LinearSectionPtr::p, SimpleProperties::pack(), CreateFilegroupReq::senderData, CreateFilegroupReq::senderRef, LinearSectionPtr::sz, DictTabInfo::Tablespace, NdbDictionary::Object::Tablespace, SignalHeader::theLength, SignalHeader::theReceiversBlockNumber, SignalHeader::theVerId_signalNumber, DictFilegroupInfo::Filegroup::TS_ExtentSize, DictFilegroupInfo::Filegroup::TS_LogfileGroupId, DictFilegroupInfo::Filegroup::TS_LogfileGroupVersion, and WAIT_CREATE_INDX_REQ.
Referenced by NdbDictionaryImpl::createLogfileGroup(), and NdbDictionaryImpl::createTablespace().
04625 { 04626 DBUG_ENTER("NdbDictInterface::create_filegroup"); 04627 UtilBufferWriter w(m_buffer); 04628 DictFilegroupInfo::Filegroup fg; fg.init(); 04629 snprintf(fg.FilegroupName, sizeof(fg.FilegroupName), group.m_name.c_str()); 04630 switch(group.m_type){ 04631 case NdbDictionary::Object::Tablespace: 04632 { 04633 fg.FilegroupType = DictTabInfo::Tablespace; 04634 //fg.TS_DataGrow = group.m_grow_spec; 04635 fg.TS_ExtentSize = group.m_extent_size; 04636 04637 if(group.m_logfile_group_version != ~(Uint32)0) 04638 { 04639 fg.TS_LogfileGroupId = group.m_logfile_group_id; 04640 fg.TS_LogfileGroupVersion = group.m_logfile_group_version; 04641 } 04642 else 04643 { 04644 NdbLogfileGroupImpl tmp; 04645 if(get_filegroup(tmp, NdbDictionary::Object::LogfileGroup, 04646 group.m_logfile_group_name.c_str()) == 0) 04647 { 04648 fg.TS_LogfileGroupId = tmp.m_id; 04649 fg.TS_LogfileGroupVersion = tmp.m_version; 04650 } 04651 else // error set by get filegroup 04652 { 04653 DBUG_RETURN(-1); 04654 } 04655 } 04656 } 04657 break; 04658 case NdbDictionary::Object::LogfileGroup: 04659 fg.LF_UndoBufferSize = group.m_undo_buffer_size; 04660 fg.FilegroupType = DictTabInfo::LogfileGroup; 04661 //fg.LF_UndoGrow = group.m_grow_spec; 04662 break; 04663 default: 04664 abort(); 04665 DBUG_RETURN(-1); 04666 }; 04667 04668 SimpleProperties::UnpackStatus s; 04669 s = SimpleProperties::pack(w, 04670 &fg, 04671 DictFilegroupInfo::Mapping, 04672 DictFilegroupInfo::MappingSize, true); 04673 04674 if(s != SimpleProperties::Eof){ 04675 abort(); 04676 } 04677 04678 NdbApiSignal tSignal(m_reference); 04679 tSignal.theReceiversBlockNumber = DBDICT; 04680 tSignal.theVerId_signalNumber = GSN_CREATE_FILEGROUP_REQ; 04681 tSignal.theLength = CreateFilegroupReq::SignalLength; 04682 04683 CreateFilegroupReq* req = 04684 CAST_PTR(CreateFilegroupReq, tSignal.getDataPtrSend()); 04685 req->senderRef = m_reference; 04686 req->senderData = 0; 04687 req->objType = fg.FilegroupType; 04688 04689 LinearSectionPtr ptr[3]; 04690 ptr[0].p = (Uint32*)m_buffer.get_data(); 04691 ptr[0].sz = m_buffer.length() / 4; 04692 04693 int err[] = { CreateFilegroupRef::Busy, CreateFilegroupRef::NotMaster, 0}; 04694 int ret = dictSignal(&tSignal, ptr, 1, 04695 0, // master 04696 WAIT_CREATE_INDX_REQ, 04697 DICT_WAITFOR_TIMEOUT, 100, 04698 err); 04699 04700 if (ret == 0 && obj) 04701 { 04702 Uint32* data = (Uint32*)m_buffer.get_data(); 04703 obj->m_id = data[0]; 04704 obj->m_version = data[1]; 04705 } 04706 04707 DBUG_RETURN(ret); 04708 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int NdbDictInterface::create_index_obj_from_table | ( | NdbIndexImpl ** | dst, | |
| NdbTableImpl * | index_table, | |||
| const NdbTableImpl * | primary_table | |||
| ) | [static] |
Definition at line 3032 of file NdbDictionaryImpl.cpp.
References BaseString::assign(), DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, Vector< T >::fill(), mySTL::fill(), NdbTableImpl::getColumn(), NdbDictionary::Column::getColumnNo(), NdbTableImpl::getName(), NdbDictionary::Table::getObjectId(), NdbDictionary::Table::getObjectVersion(), NdbDictionary::Column::getPrimaryKey(), NdbIndexImpl::m_columns, NdbTableImpl::m_columns, NdbColumnImpl::m_distributionKey, NdbTableImpl::m_externalName, NdbIndexImpl::m_externalName, NdbDictObjectImpl::m_id, NdbTableImpl::m_indexType, NdbIndexImpl::m_key_ids, NdbTableImpl::m_logging, NdbIndexImpl::m_logging, NdbTableImpl::m_noOfDistributionKeys, NdbTableImpl::m_noOfKeys, NdbDictObjectImpl::m_status, NdbIndexImpl::m_table_id, NdbIndexImpl::m_table_version, NdbIndexImpl::m_tableName, NdbDictObjectImpl::m_type, NdbDictObjectImpl::m_version, NdbDictionary::Object::OrderedIndex, Vector< T >::push_back(), and Vector< T >::size().
Referenced by BackupRestore::endOfTables(), and InitIndex::init().
03035 { 03036 DBUG_ENTER("NdbDictInterface::create_index_obj_from_table"); 03037 NdbIndexImpl *idx = new NdbIndexImpl(); 03038 idx->m_version = tab->m_version; 03039 idx->m_status = tab->m_status; 03040 idx->m_id = tab->m_id; 03041 idx->m_externalName.assign(tab->getName()); 03042 idx->m_tableName.assign(prim->m_externalName); 03043 NdbDictionary::Object::Type type = idx->m_type = tab->m_indexType; 03044 idx->m_logging = tab->m_logging; 03045 // skip last attribute (NDB$PK or NDB$TNODE) 03046 03047 const Uint32 distKeys = prim->m_noOfDistributionKeys; 03048 Uint32 keyCount = (distKeys ? distKeys : prim->m_noOfKeys); 03049 03050 unsigned i; 03051 for(i = 0; i+1<tab->m_columns.size(); i++){ 03052 NdbColumnImpl* org = tab->m_columns[i]; 03053 03054 NdbColumnImpl* col = new NdbColumnImpl; 03055 // Copy column definition 03056 *col = * org; 03057 idx->m_columns.push_back(col); 03058 03062 const NdbColumnImpl* primCol = prim->getColumn(col->getName()); 03063 int key_id = primCol->getColumnNo(); 03064 int fill = -1; 03065 idx->m_key_ids.fill(key_id, fill); 03066 idx->m_key_ids[key_id] = i; 03067 col->m_keyInfoPos = key_id; 03068 03069 if(type == NdbDictionary::Object::OrderedIndex && 03070 (primCol->m_distributionKey || 03071 (distKeys == 0 && primCol->getPrimaryKey()))) 03072 { 03073 keyCount--; 03074 org->m_distributionKey = 1; 03075 } 03076 } 03077 03078 if(keyCount == 0) 03079 { 03080 tab->m_noOfDistributionKeys = (distKeys ? distKeys : prim->m_noOfKeys); 03081 } 03082 else 03083 { 03084 for(i = 0; i+1<tab->m_columns.size(); i++) 03085 tab->m_columns[i]->m_distributionKey = 0; 03086 } 03087 03088 idx->m_table_id = prim->getObjectId(); 03089 idx->m_table_version = prim->getObjectVersion(); 03090 03091 * dst = idx; 03092 DBUG_PRINT("exit", ("m_id: %d m_version: %d", idx->m_id, idx->m_version)); 03093 DBUG_RETURN(0); 03094 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int NdbDictInterface::createEvent | ( | class Ndb & | ndb, | |
| NdbEventImpl & | , | |||
| int | getFlag | |||
| ) |
Definition at line 3478 of file NdbDictionaryImpl.cpp.
References SimpleProperties::Writer::add(), BaseString::c_str(), CAST_PTR, CreateEvntReq::clearFlags(), NdbError::code, DBDICT, DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, DICT_WAITFOR_TIMEOUT, dictSignal(), NdbDictionary::Event::ER_ALL, NdbDictionary::Event::ER_SUBSCRIBE, ERR_RETURN, UtilBuffer::get_data(), CreateEvntConf::getAttrListBitmask(), NdbApiSignal::getDataPtrSend(), CreateEvntConf::getEventId(), CreateEvntConf::getEventKey(), CreateEvntConf::getEventType(), getNdbError(), CreateEvntConf::getTableId(), CreateEvntConf::getTableVersion(), GSN_CREATE_EVNT_REQ, UtilBuffer::length(), NdbEventImpl::m_attrListBitmask, m_buffer, m_error, NdbEventImpl::m_eventId, NdbEventImpl::m_eventKey, NdbDictObjectImpl::m_id, NdbEventImpl::m_name, m_reference, NdbEventImpl::m_rep, NdbEventImpl::m_table_id, NdbEventImpl::m_table_version, NdbEventImpl::m_tableImpl, NdbEventImpl::m_tableName, NdbDictObjectImpl::m_version, MAX_TAB_NAME_SIZE, NdbEventImpl::mi_type, ndbout_c(), LinearSectionPtr::p, CreateEvntReq::RT_USER_CREATE, CreateEvntReq::RT_USER_GET, CreateEvntReq::setAttrListBitmask(), CreateEvntReq::setEventType(), CreateEvntReq::setReportAll(), CreateEvntReq::setReportSubscribe(), CreateEvntReq::setRequestType(), NdbEventImpl::setTable(), CreateEvntReq::setTableId(), CreateEvntReq::setTableVersion(), CreateEvntReq::setUserData(), CreateEvntReq::setUserRef(), SimpleProperties::StringValue, strlen(), LinearSectionPtr::sz, SignalHeader::theLength, SignalHeader::theReceiversBlockNumber, SignalHeader::theVerId_signalNumber, and WAIT_CREATE_INDX_REQ.
Referenced by NdbDictionaryImpl::getEvent().
03481 { 03482 DBUG_ENTER("NdbDictInterface::createEvent"); 03483 DBUG_PRINT("enter",("getFlag=%d",getFlag)); 03484 03485 NdbApiSignal tSignal(m_reference); 03486 tSignal.theReceiversBlockNumber = DBDICT; 03487 tSignal.theVerId_signalNumber = GSN_CREATE_EVNT_REQ; 03488 if (getFlag) 03489 tSignal.theLength = CreateEvntReq::SignalLengthGet; 03490 else 03491 tSignal.theLength = CreateEvntReq::SignalLengthCreate; 03492 03493 CreateEvntReq * const req = CAST_PTR(CreateEvntReq, tSignal.getDataPtrSend()); 03494 03495 req->setUserRef(m_reference); 03496 req->setUserData(0); 03497 03498 if (getFlag) { 03499 // getting event from Dictionary 03500 req->setRequestType(CreateEvntReq::RT_USER_GET); 03501 } else { 03502 DBUG_PRINT("info",("tableId: %u tableVersion: %u", 03503 evnt.m_tableImpl->m_id, 03504 evnt.m_tableImpl->m_version)); 03505 // creating event in Dictionary 03506 req->setRequestType(CreateEvntReq::RT_USER_CREATE); 03507 req->setTableId(evnt.m_tableImpl->m_id); 03508 req->setTableVersion(evnt.m_tableImpl->m_version); 03509 req->setAttrListBitmask(evnt.m_attrListBitmask); 03510 req->setEventType(evnt.mi_type); 03511 req->clearFlags(); 03512 if (evnt.m_rep & NdbDictionary::Event::ER_ALL) 03513 req->setReportAll(); 03514 if (evnt.m_rep & NdbDictionary::Event::ER_SUBSCRIBE) 03515 req->setReportSubscribe(); 03516 } 03517 03518 UtilBufferWriter w(m_buffer); 03519 03520 const size_t len = strlen(evnt.m_name.c_str()) + 1; 03521 if(len > MAX_TAB_NAME_SIZE) { 03522 m_error.code= 4241; 03523 ERR_RETURN(getNdbError(), -1); 03524 } 03525 03526 w.add(SimpleProperties::StringValue, evnt.m_name.c_str()); 03527 03528 if (getFlag == 0) 03529 { 03530 const BaseString internal_tabname( 03531 ndb.internalize_table_name(evnt.m_tableName.c_str())); 03532 w.add(SimpleProperties::StringValue, 03533 internal_tabname.c_str()); 03534 } 03535 03536 LinearSectionPtr ptr[1]; 03537 ptr[0].p = (Uint32*)m_buffer.get_data(); 03538 ptr[0].sz = (m_buffer.length()+3) >> 2; 03539 03540 int ret = dictSignal(&tSignal,ptr, 1, 03541 0, // master 03542 WAIT_CREATE_INDX_REQ, 03543 DICT_WAITFOR_TIMEOUT, 100, 03544 0, -1); 03545 03546 if (ret) { 03547 ERR_RETURN(getNdbError(), ret); 03548 } 03549 03550 char *dataPtr = (char *)m_buffer.get_data(); 03551 unsigned int lenCreateEvntConf = *((unsigned int *)dataPtr); 03552 dataPtr += sizeof(lenCreateEvntConf); 03553 CreateEvntConf const * evntConf = (CreateEvntConf *)dataPtr; 03554 dataPtr += lenCreateEvntConf; 03555 03556 // NdbEventImpl *evntImpl = (NdbEventImpl *)evntConf->getUserData(); 03557 03558 evnt.m_eventId = evntConf->getEventId(); 03559 evnt.m_eventKey = evntConf->getEventKey(); 03560 evnt.m_table_id = evntConf->getTableId(); 03561 evnt.m_table_version = evntConf->getTableVersion(); 03562 03563 if (getFlag) { 03564 evnt.m_attrListBitmask = evntConf->getAttrListBitmask(); 03565 evnt.mi_type = evntConf->getEventType(); 03566 evnt.setTable(dataPtr); 03567 } else { 03568 if (evnt.m_tableImpl->m_id != evntConf->getTableId() || 03569 evnt.m_tableImpl->m_version != evntConf->getTableVersion() || 03570 //evnt.m_attrListBitmask != evntConf->getAttrListBitmask() || 03571 evnt.mi_type != evntConf->getEventType()) { 03572 ndbout_c("ERROR*************"); 03573 ERR_RETURN(getNdbError(), 1); 03574 } 03575 } 03576 03577 DBUG_RETURN(0); 03578 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int NdbDictInterface::createIndex | ( | class Ndb & | ndb, | |
| const NdbIndexImpl & | , | |||
| const NdbTableImpl & | ||||
| ) |
Definition at line 3119 of file NdbDictionaryImpl.cpp.
References SimpleProperties::Writer::add(), CreateIndxRef::Busy, BaseString::c_str(), CAST_PTR, NdbSqlUtil::check_column_for_hash_index(), NdbSqlUtil::check_column_for_ordered_index(), NdbError::code, DBDICT, DICT_WAITFOR_TIMEOUT, dictSignal(), err, UtilBuffer::get_data(), NdbTableImpl::getColumn(), NdbApiSignal::getDataPtrSend(), getKernelConstant(), NdbIndexImpl::getName(), GSN_CREATE_INDX_REQ, Id_array< SZ >::id, indexTypeMapping, Ndb::internalize_index_name(), UtilBuffer::length(), m_buffer, NdbIndexImpl::m_columns, m_error, NdbIndexImpl::m_externalName, NdbDictObjectImpl::m_id, NdbIndexImpl::m_logging, m_reference, NdbDictObjectImpl::m_type, MAX_TAB_NAME_SIZE, ndb, CreateIndxRef::NotMaster, DictTabInfo::OrderedIndex, LinearSectionPtr::p, CreateIndxReq::RT_USER, CreateIndxReq::setConnectionPtr(), CreateIndxReq::setIndexType(), CreateIndxReq::setOnline(), CreateIndxReq::setRequestType(), CreateIndxReq::setTableId(), CreateIndxReq::setUserRef(), Vector< T >::size(), strlen(), LinearSectionPtr::sz, Id_array< SZ >::sz, DictTabInfo::TableLoggedFlag, DictTabInfo::TableName,

