#include <Configuration.hpp>
Collaboration diagram for Configuration:

Definition at line 26 of file Configuration.hpp.
| Configuration::Configuration | ( | ) |
Definition at line 203 of file Configuration.cpp.
References _backupPath, _connectString, _daemonMode, _foregroundMode, _fsPath, _initialStart, _programName, m_clusterConfig, m_clusterConfigIter, m_config_retriever, and m_logLevel.
00204 { 00205 _programName = 0; 00206 _connectString = 0; 00207 _fsPath = 0; 00208 _backupPath = 0; 00209 _initialStart = false; 00210 _daemonMode = false; 00211 _foregroundMode = false; 00212 m_config_retriever= 0; 00213 m_clusterConfig= 0; 00214 m_clusterConfigIter= 0; 00215 m_logLevel= 0; 00216 }
| Configuration::~Configuration | ( | ) |
Definition at line 218 of file Configuration.cpp.
References _backupPath, _connectString, _fsPath, _programName, free, m_config_retriever, m_logLevel, NULL, and opt_connect_str.
00218 { 00219 if (opt_connect_str) 00220 free(_connectString); 00221 00222 if(_programName != NULL) 00223 free(_programName); 00224 00225 if(_fsPath != NULL) 00226 free(_fsPath); 00227 00228 if(_backupPath != NULL) 00229 free(_backupPath); 00230 00231 if (m_config_retriever) { 00232 delete m_config_retriever; 00233 } 00234 00235 if(m_logLevel) { 00236 delete m_logLevel; 00237 } 00238 }
| const char * Configuration::backupFilePath | ( | ) | const [inline] |
Definition at line 129 of file Configuration.hpp.
References _backupPath.
Referenced by Ndbfs::execREAD_CONFIG_REQ().
00129 { 00130 return _backupPath; 00131 }
Here is the caller graph for this function:

| void Configuration::calcSizeAlt | ( | class ConfigValues * | ) | [private] |
Definition at line 541 of file Configuration.cpp.
References buf, cfg, CFG_ACC_DIR_ARRAY, CFG_ACC_DIR_RANGE, CFG_ACC_FRAGMENT, CFG_ACC_OP_RECS, CFG_ACC_OVERFLOW_RECS, CFG_ACC_PAGE8, CFG_ACC_SCAN, CFG_ACC_TABLE, CFG_DB_BATCH_SIZE, CFG_DB_DATA_MEM, CFG_DB_INDEX_MEM, CFG_DB_NO_ATTRIBUTES, CFG_DB_NO_LOCAL_OPS, CFG_DB_NO_LOCAL_SCANS, CFG_DB_NO_OPS, CFG_DB_NO_ORDERED_INDEXES, CFG_DB_NO_REPLICAS, CFG_DB_NO_SCANS, CFG_DB_NO_TABLES, CFG_DB_NO_TRANSACTIONS, CFG_DB_NO_TRIGGERS, CFG_DB_NO_UNIQUE_HASH_INDEXES, CFG_DICT_ATTRIBUTE, CFG_DICT_TABLE, CFG_DIH_API_CONNECT, CFG_DIH_CONNECT, CFG_DIH_FRAG_CONNECT, CFG_DIH_MORE_NODES, CFG_DIH_REPLICAS, CFG_DIH_TABLE, CFG_LQH_FRAG, CFG_LQH_SCAN, CFG_LQH_TABLE, CFG_LQH_TC_CONNECT, CFG_MIN_LOGLEVEL, CFG_NODE_ID, CFG_TC_API_CONNECT, CFG_TC_LOCAL_SCAN, CFG_TC_SCAN, CFG_TC_TABLE, CFG_TC_TC_CONNECT, CFG_TUP_FRAG, CFG_TUP_OP_RECS, CFG_TUP_PAGE, CFG_TUP_PAGE_RANGE, CFG_TUP_STORED_PROC, CFG_TUP_TABLE, CFG_TUP_TABLE_DESC, CFG_TUX_ATTRIBUTE, CFG_TUX_FRAGMENT, CFG_TUX_INDEX, CFG_TUX_SCAN_OP, CFG_TYPE_OF_SECTION, db, ERROR_SET, yaSSL::fatal, BitmaskPOD< size >::get(), LOG_NO_OF_FRAGS_PER_CHUNK, m_clusterConfigIter, m_logLevel, m_ownConfig, m_ownConfigIterator, MAX_NDB_NODES, MAX_NODES, MAX_TABLES, NDB_MAX_ACTIVE_EVENTS, ndb_mgm_create_configuration_iterator(), ndb_mgm_first(), ndb_mgm_get_int64_parameter(), ndb_mgm_get_int_parameter(), ndb_mgm_next(), ndb_mgm_valid(), NDBD_EXIT_INVALID_CONFIG, NO_OF_FRAG_PER_NODE, NO_OF_FRAGS_PER_CHUNK, NODE_RECOVERY_SCAN_OP_RECORDS, NODE_TYPE_API, NODE_TYPE_DB, NODE_TYPE_MGM, p, ConfigValues::Iterator::set(), BitmaskPOD< size >::set(), LogLevel::setLogLevel(), and BaseString::snprintf().
Referenced by setupConfiguration().
00541 { 00542 const char * msg = "Invalid configuration fetched"; 00543 char buf[255]; 00544 00545 unsigned int noOfTables = 0; 00546 unsigned int noOfUniqueHashIndexes = 0; 00547 unsigned int noOfOrderedIndexes = 0; 00548 unsigned int noOfTriggers = 0; 00549 unsigned int noOfReplicas = 0; 00550 unsigned int noOfDBNodes = 0; 00551 unsigned int noOfAPINodes = 0; 00552 unsigned int noOfMGMNodes = 0; 00553 unsigned int noOfNodes = 0; 00554 unsigned int noOfAttributes = 0; 00555 unsigned int noOfOperations = 0; 00556 unsigned int noOfLocalOperations = 0; 00557 unsigned int noOfTransactions = 0; 00558 unsigned int noOfIndexPages = 0; 00559 unsigned int noOfDataPages = 0; 00560 unsigned int noOfScanRecords = 0; 00561 unsigned int noOfLocalScanRecords = 0; 00562 unsigned int noBatchSize = 0; 00563 m_logLevel = new LogLevel(); 00564 00565 struct AttribStorage { int paramId; Uint32 * storage; bool computable; }; 00566 AttribStorage tmp[] = { 00567 { CFG_DB_NO_SCANS, &noOfScanRecords, false }, 00568 { CFG_DB_NO_LOCAL_SCANS, &noOfLocalScanRecords, true }, 00569 { CFG_DB_BATCH_SIZE, &noBatchSize, false }, 00570 { CFG_DB_NO_TABLES, &noOfTables, false }, 00571 { CFG_DB_NO_ORDERED_INDEXES, &noOfOrderedIndexes, false }, 00572 { CFG_DB_NO_UNIQUE_HASH_INDEXES, &noOfUniqueHashIndexes, false }, 00573 { CFG_DB_NO_TRIGGERS, &noOfTriggers, true }, 00574 { CFG_DB_NO_REPLICAS, &noOfReplicas, false }, 00575 { CFG_DB_NO_ATTRIBUTES, &noOfAttributes, false }, 00576 { CFG_DB_NO_OPS, &noOfOperations, false }, 00577 { CFG_DB_NO_LOCAL_OPS, &noOfLocalOperations, true }, 00578 { CFG_DB_NO_TRANSACTIONS, &noOfTransactions, false } 00579 }; 00580 00581 ndb_mgm_configuration_iterator db(*(ndb_mgm_configuration*)ownConfig, 0); 00582 00583 const int sz = sizeof(tmp)/sizeof(AttribStorage); 00584 for(int i = 0; i<sz; i++){ 00585 if(ndb_mgm_get_int_parameter(&db, tmp[i].paramId, tmp[i].storage)){ 00586 if (tmp[i].computable) { 00587 *tmp[i].storage = 0; 00588 } else { 00589 BaseString::snprintf(buf, sizeof(buf),"ConfigParam: %d not found", tmp[i].paramId); 00590 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf); 00591 } 00592 } 00593 } 00594 00595 Uint64 indexMem = 0, dataMem = 0; 00596 ndb_mgm_get_int64_parameter(&db, CFG_DB_DATA_MEM, &dataMem); 00597 ndb_mgm_get_int64_parameter(&db, CFG_DB_INDEX_MEM, &indexMem); 00598 if(dataMem == 0){ 00599 BaseString::snprintf(buf, sizeof(buf), "ConfigParam: %d not found", CFG_DB_DATA_MEM); 00600 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf); 00601 } 00602 00603 if(indexMem == 0){ 00604 BaseString::snprintf(buf, sizeof(buf), "ConfigParam: %d not found", CFG_DB_INDEX_MEM); 00605 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf); 00606 } 00607 00608 noOfDataPages = (dataMem / 32768); 00609 noOfIndexPages = (indexMem / 8192); 00610 00611 for(unsigned j = 0; j<LogLevel::LOGLEVEL_CATEGORIES; j++){ 00612 Uint32 tmp; 00613 if(!ndb_mgm_get_int_parameter(&db, CFG_MIN_LOGLEVEL+j, &tmp)){ 00614 m_logLevel->setLogLevel((LogLevel::EventCategory)j, tmp); 00615 } 00616 } 00617 00618 // tmp 00619 ndb_mgm_configuration_iterator * p = m_clusterConfigIter; 00620 00621 Uint32 nodeNo = noOfNodes = 0; 00622 NodeBitmask nodes; 00623 for(ndb_mgm_first(p); ndb_mgm_valid(p); ndb_mgm_next(p), nodeNo++){ 00624 00625 Uint32 nodeId; 00626 Uint32 nodeType; 00627 00628 if(ndb_mgm_get_int_parameter(p, CFG_NODE_ID, &nodeId)){ 00629 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, "Node data (Id) missing"); 00630 } 00631 00632 if(ndb_mgm_get_int_parameter(p, CFG_TYPE_OF_SECTION, &nodeType)){ 00633 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, "Node data (Type) missing"); 00634 } 00635 00636 if(nodeId > MAX_NODES || nodeId == 0){ 00637 BaseString::snprintf(buf, sizeof(buf), 00638 "Invalid node id: %d", nodeId); 00639 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf); 00640 } 00641 00642 if(nodes.get(nodeId)){ 00643 BaseString::snprintf(buf, sizeof(buf), "Two node can not have the same node id: %d", 00644 nodeId); 00645 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf); 00646 } 00647 nodes.set(nodeId); 00648 00649 switch(nodeType){ 00650 case NODE_TYPE_DB: 00651 noOfDBNodes++; // No of NDB processes 00652 00653 if(nodeId > MAX_NDB_NODES){ 00654 BaseString::snprintf(buf, sizeof(buf), "Maximum node id for a ndb node is: %d", 00655 MAX_NDB_NODES); 00656 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf); 00657 } 00658 break; 00659 case NODE_TYPE_API: 00660 noOfAPINodes++; // No of API processes 00661 break; 00662 case NODE_TYPE_MGM: 00663 noOfMGMNodes++; // No of MGM processes 00664 break; 00665 default: 00666 BaseString::snprintf(buf, sizeof(buf), "Unknown node type: %d", nodeType); 00667 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf); 00668 } 00669 } 00670 noOfNodes = nodeNo; 00671 00672 noOfTables+= 2; // Add System tables 00673 noOfAttributes += 9; // Add System table attributes 00674 00675 ConfigValues::Iterator it2(*ownConfig, db.m_config); 00676 it2.set(CFG_DB_NO_TABLES, noOfTables); 00677 it2.set(CFG_DB_NO_ATTRIBUTES, noOfAttributes); 00678 { 00679 Uint32 neededNoOfTriggers = /* types: Insert/Update/Delete/Custom */ 00680 3 * noOfUniqueHashIndexes + /* for unique hash indexes, I/U/D */ 00681 3 * NDB_MAX_ACTIVE_EVENTS + /* for events in suma, I/U/D */ 00682 3 * noOfTables + /* for backup, I/U/D */ 00683 noOfOrderedIndexes; /* for ordered indexes, C */ 00684 if (noOfTriggers < neededNoOfTriggers) 00685 { 00686 noOfTriggers= neededNoOfTriggers; 00687 it2.set(CFG_DB_NO_TRIGGERS, noOfTriggers); 00688 } 00689 } 00690 00694 ConfigValuesFactory cfg(ownConfig); 00695 00696 Uint32 noOfMetaTables= noOfTables + noOfOrderedIndexes + 00697 noOfUniqueHashIndexes; 00698 Uint32 noOfMetaTablesDict= noOfMetaTables; 00699 if (noOfMetaTablesDict > MAX_TABLES) 00700 noOfMetaTablesDict= MAX_TABLES; 00701 00702 { 00706 cfg.put(CFG_DICT_ATTRIBUTE, 00707 noOfAttributes); 00708 00709 cfg.put(CFG_DICT_TABLE, 00710 noOfMetaTablesDict); 00711 } 00712 00713 00714 if (noOfLocalScanRecords == 0) { 00715 noOfLocalScanRecords = (noOfDBNodes * noOfScanRecords) + 1; 00716 } 00717 if (noOfLocalOperations == 0) { 00718 noOfLocalOperations= (11 * noOfOperations) / 10; 00719 } 00720 Uint32 noOfTCScanRecords = noOfScanRecords; 00721 00722 { 00723 Uint32 noOfAccTables= noOfMetaTables/*noOfTables+noOfUniqueHashIndexes*/; 00727 // Can keep 65536 pages (= 0.5 GByte) 00728 cfg.put(CFG_ACC_DIR_RANGE, 00729 2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas); 00730 00731 cfg.put(CFG_ACC_DIR_ARRAY, 00732 (noOfIndexPages >> 8) + 00733 2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas); 00734 00735 cfg.put(CFG_ACC_FRAGMENT, 00736 NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas); 00737 00738 /*-----------------------------------------------------------------------*/ 00739 // The extra operation records added are used by the scan and node 00740 // recovery process. 00741 // Node recovery process will have its operations dedicated to ensure 00742 // that they never have a problem with allocation of the operation record. 00743 // The remainder are allowed for use by the scan processes. 00744 /*-----------------------------------------------------------------------*/ 00745 cfg.put(CFG_ACC_OP_RECS, 00746 (noOfLocalOperations + 50) + 00747 (noOfLocalScanRecords * noBatchSize) + 00748 NODE_RECOVERY_SCAN_OP_RECORDS); 00749 00750 cfg.put(CFG_ACC_OVERFLOW_RECS, 00751 noOfIndexPages + 00752 NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas); 00753 00754 cfg.put(CFG_ACC_PAGE8, 00755 noOfIndexPages + 32); 00756 00757 cfg.put(CFG_ACC_TABLE, noOfAccTables); 00758 00759 cfg.put(CFG_ACC_SCAN, noOfLocalScanRecords); 00760 } 00761 00762 { 00766 cfg.put(CFG_DIH_API_CONNECT, 00767 2 * noOfTransactions); 00768 00769 cfg.put(CFG_DIH_CONNECT, 00770 noOfOperations + noOfTransactions + 46); 00771 00772 Uint32 noFragPerTable= ((noOfDBNodes + NO_OF_FRAGS_PER_CHUNK - 1) >> 00773 LOG_NO_OF_FRAGS_PER_CHUNK) << 00774 LOG_NO_OF_FRAGS_PER_CHUNK; 00775 00776 cfg.put(CFG_DIH_FRAG_CONNECT, 00777 noFragPerTable * noOfMetaTables); 00778 00779 int temp; 00780 temp = noOfReplicas - 2; 00781 if (temp < 0) 00782 temp = 1; 00783 else 00784 temp++; 00785 cfg.put(CFG_DIH_MORE_NODES, 00786 temp * NO_OF_FRAG_PER_NODE * 00787 noOfMetaTables * noOfDBNodes); 00788 00789 cfg.put(CFG_DIH_REPLICAS, 00790 NO_OF_FRAG_PER_NODE * noOfMetaTables * 00791 noOfDBNodes * noOfReplicas); 00792 00793 cfg.put(CFG_DIH_TABLE, 00794 noOfMetaTables); 00795 } 00796 00797 { 00801 cfg.put(CFG_LQH_FRAG, 00802 NO_OF_FRAG_PER_NODE * noOfMetaTables * noOfReplicas); 00803 00804 cfg.put(CFG_LQH_TABLE, 00805 noOfMetaTables); 00806 00807 cfg.put(CFG_LQH_TC_CONNECT, 00808 noOfLocalOperations + 50); 00809 00810 cfg.put(CFG_LQH_SCAN, 00811 noOfLocalScanRecords); 00812 } 00813 00814 { 00818 cfg.put(CFG_TC_API_CONNECT, 00819 3 * noOfTransactions); 00820 00821 cfg.put(CFG_TC_TC_CONNECT, 00822 (2 * noOfOperations) + 16 + noOfTransactions); 00823 00824 cfg.put(CFG_TC_TABLE, 00825 noOfMetaTables); 00826 00827 cfg.put(CFG_TC_LOCAL_SCAN, 00828 noOfLocalScanRecords); 00829 00830 cfg.put(CFG_TC_SCAN, 00831 noOfTCScanRecords); 00832 } 00833 00834 { 00838 cfg.put(CFG_TUP_FRAG, 00839 NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas); 00840 00841 cfg.put(CFG_TUP_OP_RECS, 00842 noOfLocalOperations + 50); 00843 00844 cfg.put(CFG_TUP_PAGE, 00845 noOfDataPages); 00846 00847 cfg.put(CFG_TUP_PAGE_RANGE, 00848 2 * NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas); 00849 00850 cfg.put(CFG_TUP_TABLE, 00851 noOfMetaTables); 00852 00853 cfg.put(CFG_TUP_TABLE_DESC, 00854 6 * NO_OF_FRAG_PER_NODE * noOfAttributes * noOfReplicas + 00855 10 * NO_OF_FRAG_PER_NODE * noOfMetaTables * noOfReplicas ); 00856 00857 cfg.put(CFG_TUP_STORED_PROC, 00858 noOfLocalScanRecords); 00859 } 00860 00861 { 00865 cfg.put(CFG_TUX_INDEX, 00866 noOfMetaTables /*noOfOrderedIndexes*/); 00867 00868 cfg.put(CFG_TUX_FRAGMENT, 00869 NO_OF_FRAG_PER_NODE * noOfOrderedIndexes * noOfReplicas); 00870 00871 cfg.put(CFG_TUX_ATTRIBUTE, 00872 noOfOrderedIndexes * 4); 00873 00874 cfg.put(CFG_TUX_SCAN_OP, noOfLocalScanRecords); 00875 } 00876 00877 m_ownConfig = (ndb_mgm_configuration*)cfg.getConfigValues(); 00878 m_ownConfigIterator = ndb_mgm_create_configuration_iterator 00879 (m_ownConfig, 0); 00880 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void Configuration::closeConfiguration | ( | bool | end_session = true |
) |
Definition at line 241 of file Configuration.cpp.
References ConfigRetriever::end_session(), and m_config_retriever.
Referenced by main().
00241 { 00242 m_config_retriever->end_session(end_session); 00243 if (m_config_retriever) { 00244 delete m_config_retriever; 00245 } 00246 m_config_retriever= 0; 00247 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void Configuration::fetch_configuration | ( | ) |
Definition at line 250 of file Configuration.cpp.
References _stopOnError, BaseString::appfmt(), BaseString::assign(), CFG_DB_STOP_ON_ERROR, CFG_MGM_PORT, CFG_NODE_HOST, CFG_NODE_ID, CFG_SECTION_NODE, CFG_TYPE_OF_SECTION, Vector< T >::clear(), cr(), ConfigRetriever::do_connect(), ERROR_SET, yaSSL::fatal, ndb_mgm_configuration_iterator::find(), free, ndb_mgm_configuration_iterator::get(), ConfigRetriever::get_mgmd_host(), ConfigRetriever::get_mgmd_port(), getConnectString(), ConfigRetriever::getErrorString(), globalData, ConfigRetriever::hasError(), m_clusterConfig, m_config_retriever, m_mgmd_host, m_mgmd_port, m_mgmds, NodeInfo::MGM, ndb_mgm_first(), ndb_mgm_get_int_parameter(), ndb_mgm_get_string_parameter(), ndb_mgm_next(), ndb_mgm_valid(), NDB_VERSION, NDBD_EXIT_INVALID_CONFIG, NODE_TYPE_DB, GlobalData::ownId, p, port, and Vector< T >::push_back().
Referenced by main().
00250 { 00254 if (m_config_retriever) { 00255 delete m_config_retriever; 00256 } 00257 00258 m_mgmd_port= 0; 00259 m_config_retriever= new ConfigRetriever(getConnectString(), 00260 NDB_VERSION, NODE_TYPE_DB); 00261 00262 if (m_config_retriever->hasError()) 00263 { 00264 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, 00265 "Could not connect initialize handle to management server", 00266 m_config_retriever->getErrorString()); 00267 } 00268 00269 if(m_config_retriever->do_connect(12,5,1) == -1){ 00270 const char * s = m_config_retriever->getErrorString(); 00271 if(s == 0) 00272 s = "No error given!"; 00273 /* Set stop on error to true otherwise NDB will 00274 go into an restart loop... 00275 */ 00276 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Could not connect to ndb_mgmd", s); 00277 } 00278 00279 m_mgmd_port= m_config_retriever->get_mgmd_port(); 00280 m_mgmd_host.assign(m_config_retriever->get_mgmd_host()); 00281 00282 ConfigRetriever &cr= *m_config_retriever; 00283 00288 if (globalData.ownId) 00289 cr.setNodeId(globalData.ownId); 00290 00291 globalData.ownId = cr.allocNodeId(globalData.ownId ? 10 : 2 /*retry*/, 00292 3 /*delay*/); 00293 00294 if(globalData.ownId == 0){ 00295 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, 00296 "Unable to alloc node id", m_config_retriever->getErrorString()); 00297 } 00298 00299 ndb_mgm_configuration * p = cr.getConfig(); 00300 if(p == 0){ 00301 const char * s = cr.getErrorString(); 00302 if(s == 0) 00303 s = "No error given!"; 00304 00305 /* Set stop on error to true otherwise NDB will 00306 go into an restart loop... 00307 */ 00308 00309 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Could not fetch configuration" 00310 "/invalid configuration", s); 00311 } 00312 if(m_clusterConfig) 00313 free(m_clusterConfig); 00314 00315 m_clusterConfig = p; 00316 00317 ndb_mgm_configuration_iterator iter(* p, CFG_SECTION_NODE); 00318 if (iter.find(CFG_NODE_ID, globalData.ownId)){ 00319 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched", "DB missing"); 00320 } 00321 00322 if(iter.get(CFG_DB_STOP_ON_ERROR, &_stopOnError)){ 00323 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched", 00324 "StopOnError missing"); 00325 } 00326 00327 m_mgmds.clear(); 00328 for(ndb_mgm_first(&iter); ndb_mgm_valid(&iter); ndb_mgm_next(&iter)) 00329 { 00330 Uint32 nodeType, port; 00331 char const *hostname; 00332 00333 ndb_mgm_get_int_parameter(&iter,CFG_TYPE_OF_SECTION,&nodeType); 00334 00335 if (nodeType != NodeInfo::MGM) 00336 continue; 00337 00338 if (ndb_mgm_get_string_parameter(&iter,CFG_NODE_HOST, &hostname) || 00339 ndb_mgm_get_int_parameter(&iter,CFG_MGM_PORT, &port) || 00340 hostname == 0 || hostname[0] == 0) 00341 { 00342 continue; 00343 } 00344 BaseString connectstring(hostname); 00345 connectstring.appfmt(":%d", port); 00346 00347 m_mgmds.push_back(connectstring); 00348 } 00349 }
Here is the call graph for this function:

Here is the caller graph for this function:

| const char * Configuration::fileSystemPath | ( | ) | const [inline] |
Definition at line 123 of file Configuration.hpp.
References _fsPath.
Referenced by Ndbfs::execREAD_CONFIG_REQ().
00123 { 00124 return _fsPath; 00125 }
Here is the caller graph for this function:

| ConfigRetriever* Configuration::get_config_retriever | ( | ) | [inline] |
Definition at line 73 of file Configuration.hpp.
References m_config_retriever.
Referenced by main().
00073 { return m_config_retriever; };
Here is the caller graph for this function:

| const char* Configuration::get_mgmd_host | ( | ) | const [inline] |
Definition at line 72 of file Configuration.hpp.
References BaseString::c_str(), and m_mgmd_host.
00072 {return m_mgmd_host.c_str();};
Here is the call graph for this function:

| Uint32 Configuration::get_mgmd_port | ( | ) | const [inline] |
Definition at line 71 of file Configuration.hpp.
References m_mgmd_port.
00071 {return m_mgmd_port;};
| ndb_mgm_configuration_iterator * Configuration::getClusterConfigIterator | ( | ) | const [private] |
Definition at line 536 of file Configuration.cpp.
References m_clusterConfigIter.
Referenced by Cmvmi::Cmvmi(), and Qmgr::initData().
00536 { 00537 return m_clusterConfigIter; 00538 }
Here is the caller graph for this function:

| const char * Configuration::getConnectString | ( | ) | const |
Definition at line 519 of file Configuration.cpp.
References _connectString.
Referenced by fetch_configuration().
00519 { 00520 return _connectString; 00521 }
Here is the caller graph for this function:

| char * Configuration::getConnectStringCopy | ( | ) | const |
Definition at line 524 of file Configuration.cpp.
References _connectString, and strdup().
00524 { 00525 if(_connectString != 0) 00526 return strdup(_connectString); 00527 return 0; 00528 }
Here is the call graph for this function:

| bool Configuration::getDaemonMode | ( | ) | const [inline] |
Definition at line 141 of file Configuration.hpp.
References _daemonMode.
Referenced by main(), and SimulatedBlock::progError().
00141 { 00142 return _daemonMode; 00143 }
Here is the caller graph for this function:

| bool Configuration::getForegroundMode | ( | ) | const [inline] |
Definition at line 147 of file Configuration.hpp.
References _foregroundMode.
Referenced by catchsigs(), and main().
00147 { 00148 return _foregroundMode; 00149 }
Here is the caller graph for this function:

| bool Configuration::getInitialStart | ( | ) | const [inline] |
Definition at line 135 of file Configuration.hpp.
References _initialStart.
Referenced by Dbdih::execDIH_RESTARTREQ(), Ndbcntr::execSTTOR(), and SimulatedBlock::progError().
00135 { 00136 return _initialStart; 00137 }
Here is the caller graph for this function:

| const ndb_mgm_configuration_iterator * Configuration::getOwnConfigIterator | ( | ) | const |
Definition at line 531 of file Configuration.cpp.
References m_ownConfigIterator.
Referenced by Cmvmi::Cmvmi(), Dbdict::create_file_prepare_start(), Dbtc::Dbtc(), Ndbcntr::execCONTINUEB(), Cmvmi::execDUMP_STATE_ORD(), Trix::execREAD_CONFIG_REQ(), Suma::execREAD_CONFIG_REQ(), Restore::execREAD_CONFIG_REQ(), Qmgr::execREAD_CONFIG_REQ(), Pgman::execREAD_CONFIG_REQ(), Ndbfs::execREAD_CONFIG_REQ(), Ndbcntr::execREAD_CONFIG_REQ(), DbUtil::execREAD_CONFIG_REQ(), Dbtux::execREAD_CONFIG_REQ(), Dbtup::execREAD_CONFIG_REQ(), Dbtc::execREAD_CONFIG_REQ(), Dblqh::execREAD_CONFIG_REQ(), Dbdih::execREAD_CONFIG_REQ(), Dbdict::execREAD_CONFIG_REQ(), Dbacc::execREAD_CONFIG_REQ(), Cmvmi::execREAD_CONFIG_REQ(), Ndbcntr::execREAD_NODESCONF(), Dbdih::initCommonData(), Qmgr::initData(), Dbtup::initRecords(), and SimBlockList::load().
00531 { 00532 return m_ownConfigIterator; 00533 }
Here is the caller graph for this function:

| int Configuration::getRestartOnErrorInsert | ( | ) | const |
Definition at line 509 of file Configuration.cpp.
References m_restartOnErrorInsert.
Referenced by NdbShutdown().
00509 { 00510 return m_restartOnErrorInsert; 00511 }
Here is the caller graph for this function:

| bool Configuration::init | ( | int | argc, | |
| char ** | argv | |||
| ) |
Returns false if arguments are invalid
Definition at line 116 of file Configuration.cpp.
References _connectString, _daemon, _daemonMode, _foreground, _foregroundMode, _initial, _initialstart, _initialStart, _no_daemon, _no_start, _nowait_nodes, _programName, DBUG_PRINT, endptr, exit, g_nowait_nodes, g_start_type, globalData, handle_options(), initial_state, load_default_groups, load_defaults(), MAX_NDB_NODES, my_long_options, ndb_std_get_one_option(), ndbout_c(), ndbSetOwnVersion(), opt_connect_str, opt_debug, GlobalData::ownId, perform_start, BitmaskPOD< size >::set(), Vector< T >::size(), BaseString::split(), NodeState::ST_INITIAL_START, strdup(), strtol(), and GlobalData::theRestartFlag.
Referenced by main().
00117 { 00118 const char *load_default_groups[]= { "mysql_cluster","ndbd",0 }; 00119 load_defaults("my",load_default_groups,&argc,&argv); 00120 00121 int ho_error; 00122 #ifndef DBUG_OFF 00123 opt_debug= "d:t:O,/tmp/ndbd.trace"; 00124 #endif 00125 if ((ho_error=handle_options(&argc, &argv, my_long_options, 00126 ndb_std_get_one_option))) 00127 exit(ho_error); 00128 00129 if (_no_daemon || _foreground) { 00130 _daemon= 0; 00131 } 00132 00133 DBUG_PRINT("info", ("no_start=%d", _no_start)); 00134 DBUG_PRINT("info", ("initial=%d", _initial)); 00135 DBUG_PRINT("info", ("daemon=%d", _daemon)); 00136 DBUG_PRINT("info", ("foreground=%d", _foreground)); 00137 DBUG_PRINT("info", ("connect_str=%s", opt_connect_str)); 00138 00139 ndbSetOwnVersion(); 00140 00141 // Check the start flag 00142 if (_no_start) 00143 globalData.theRestartFlag = initial_state; 00144 else 00145 globalData.theRestartFlag = perform_start; 00146 00147 // Check the initial flag 00148 if (_initial) 00149 _initialStart = true; 00150 00151 // Check connectstring 00152 if (opt_connect_str) 00153 _connectString = strdup(opt_connect_str); 00154 00155 // Check daemon flag 00156 if (_daemon) 00157 _daemonMode = true; 00158 if (_foreground) 00159 _foregroundMode = true; 00160 00161 // Save programname 00162 if(argc > 0 && argv[0] != 0) 00163 _programName = strdup(argv[0]); 00164 else 00165 _programName = strdup(""); 00166 00167 globalData.ownId= 0; 00168 00169 if (_nowait_nodes) 00170 { 00171 BaseString str(_nowait_nodes); 00172 Vector<BaseString> arr; 00173 str.split(arr, ","); 00174 for (Uint32 i = 0; i<arr.size(); i++) 00175 { 00176 char *endptr = 0; 00177 long val = strtol(arr[i].c_str(), &endptr, 10); 00178 if (*endptr) 00179 { 00180 ndbout_c("Unable to parse nowait-nodes argument: %s : %s", 00181 arr[i].c_str(), _nowait_nodes); 00182 exit(-1); 00183 } 00184 if (! (val > 0 && val < MAX_NDB_NODES)) 00185 { 00186 ndbout_c("Invalid nodeid specified in nowait-nodes: %d : %s", 00187 val, _nowait_nodes); 00188 exit(-1); 00189 } 00190 g_nowait_nodes.set(val); 00191 } 00192 } 00193 00194 if (_initialstart) 00195 { 00196 _initialStart = true; 00197 g_start_type |= (1 << NodeState::ST_INITIAL_START); 00198 } 00199 00200 return true; 00201 }
Here is the call graph for this function:

Here is the caller graph for this function:

| bool Configuration::lockPagesInMainMemory | ( | ) | const |
Definition at line 474 of file Configuration.cpp.
References _lockPagesInMainMemory.
Referenced by Cmvmi::execSTTOR().
00474 { 00475 return _lockPagesInMainMemory; 00476 }
Here is the caller graph for this function:

| void Configuration::maxNoOfErrorLogs | ( | int | val | ) |
Definition at line 494 of file Configuration.cpp.
References _maxErrorLogs.
00494 { 00495 _maxErrorLogs = val; 00496 }
| int Configuration::maxNoOfErrorLogs | ( | ) | const |
Definition at line 489 of file Configuration.cpp.
References _maxErrorLogs.
Referenced by ErrorReporter::get_trace_no(), Cmvmi::handleSET_VAR_REQ(), and WriteMessage().
00489 { 00490 return _maxErrorLogs; 00491 }
Here is the caller graph for this function:

| const char * Configuration::programName | ( | ) | const [inline] |
Definition at line 117 of file Configuration.hpp.
References _programName.
00117 { 00118 return _programName; 00119 }
| void Configuration::setInitialStart | ( | bool | val | ) |
Definition at line 883 of file Configuration.cpp.
References _initialStart.
Referenced by main().
00883 { 00884 _initialStart = val; 00885 }
Here is the caller graph for this function:

| void Configuration::setRestartOnErrorInsert | ( | int | ) |
Definition at line 514 of file Configuration.cpp.
References m_restartOnErrorInsert.
Referenced by Cmvmi::execDUMP_STATE_ORD().
00514 { 00515 m_restartOnErrorInsert = i; 00516 }
Here is the caller graph for this function:

| void Configuration::setupConfiguration | ( | ) |
Definition at line 389 of file Configuration.cpp.
References _backupPath, _fsPath, _lockPagesInMainMemory, _maxErrorLogs, _timeBetweenWatchDogCheck, calcSizeAlt(), CFG_DB_BACKUP_DATADIR, CFG_DB_FILESYSTEM_PATH, CFG_DB_MEMLOCK, CFG_DB_NO_SAVE_MSGS, CFG_DB_STOP_ON_ERROR_INSERT, CFG_DB_WATCHDOG_INTERVAL, CFG_NODE_ID, CFG_SECTION_NODE, CFG_TYPE_OF_SECTION, IPCConfig::configureTransporters(), DBUG_ENTER, DBUG_VOID_RETURN, ERROR_SET, ConfigValuesFactory::extractCurrentSection(), yaSSL::fatal, ndb_mgm_configuration_iterator::find(), free, ndb_mgm_configuration_iterator::get(), get_and_validate_path(), globalData, globalEmulatorData, globalTransporterRegistry, m_clusterConfig, m_clusterConfigIter, ndb_mgm_configuration_iterator::m_config, m_restartOnErrorInsert, ndb_mgm_create_configuration_iterator(), ndb_mgm_destroy_iterator(), NDBD_EXIT_INVALID_CONFIG, NODE_TYPE_DB, GlobalData::ownId, p, WatchDog::setCheckInterval(), and EmulatorData::theWatchDog.
Referenced by main().
00389 { 00390 00391 DBUG_ENTER("Configuration::setupConfiguration"); 00392 00393 ndb_mgm_configuration * p = m_clusterConfig; 00394 00398 { 00399 int res = IPCConfig::configureTransporters(globalData.ownId, 00400 * p, 00401 globalTransporterRegistry); 00402 if(res <= 0){ 00403 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched", 00404 "No transporters configured"); 00405 } 00406 } 00407 00411 ndb_mgm_configuration_iterator iter(* p, CFG_SECTION_NODE); 00412 if (iter.find(CFG_NODE_ID, globalData.ownId)){ 00413 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched", "DB missing"); 00414 } 00415 00416 unsigned type; 00417 if(!(iter.get(CFG_TYPE_OF_SECTION, &type) == 0 && type == NODE_TYPE_DB)){ 00418 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched", 00419 "I'm wrong type of node"); 00420 } 00421 00422 if(iter.get(CFG_DB_NO_SAVE_MSGS, &_maxErrorLogs)){ 00423 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched", 00424 "MaxNoOfSavedMessages missing"); 00425 } 00426 00427 if(iter.get(CFG_DB_MEMLOCK, &_lockPagesInMainMemory)){ 00428 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched", 00429 "LockPagesInMainMemory missing"); 00430 } 00431 00432 if(iter.get(CFG_DB_WATCHDOG_INTERVAL, &_timeBetweenWatchDogCheck)){ 00433 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched", 00434 "TimeBetweenWatchDogCheck missing"); 00435 } 00436 00440 if (_fsPath) 00441 free(_fsPath); 00442 _fsPath= get_and_validate_path(iter, CFG_DB_FILESYSTEM_PATH, "FileSystemPath"); 00443 if (_backupPath) 00444 free(_backupPath); 00445 _backupPath= get_and_validate_path(iter, CFG_DB_BACKUP_DATADIR, "BackupDataDir"); 00446 00447 if(iter.get(CFG_DB_STOP_ON_ERROR_INSERT, &m_restartOnErrorInsert)){ 00448 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched", 00449 "RestartOnErrorInsert missing"); 00450 } 00451 00455 { 00456 Uint32 t = _timeBetweenWatchDogCheck; 00457 t = globalEmulatorData.theWatchDog ->setCheckInterval(t); 00458 _timeBetweenWatchDogCheck = t; 00459 } 00460 00461 ConfigValues* cf = ConfigValuesFactory::extractCurrentSection(iter.m_config); 00462 00463 if(m_clusterConfigIter) 00464 ndb_mgm_destroy_iterator(m_clusterConfigIter); 00465 m_clusterConfigIter = ndb_mgm_create_configuration_iterator 00466 (p, CFG_SECTION_NODE); 00467 00468 calcSizeAlt(cf); 00469 00470 DBUG_VOID_RETURN; 00471 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void Configuration::stopOnError | ( | bool | val | ) |
Definition at line 504 of file Configuration.cpp.
References _stopOnError.
00504 { 00505 _stopOnError = val; 00506 }
| bool Configuration::stopOnError | ( | ) | const |
Definition at line 499 of file Configuration.cpp.
References _stopOnError.
Referenced by Ndbcntr::execDUMP_STATE_ORD(), Cmvmi::handleSET_VAR_REQ(), main(), NdbShutdown(), and SimulatedBlock::progError().
00499 { 00500 return _stopOnError; 00501 }
Here is the caller graph for this function:

| void Configuration::timeBetweenWatchDogCheck | ( | int | value | ) |
Definition at line 484 of file Configuration.cpp.
References _timeBetweenWatchDogCheck.
00484 { 00485 _timeBetweenWatchDogCheck = value; 00486 }
| int Configuration::timeBetweenWatchDogCheck | ( | ) | const |
Definition at line 479 of file Configuration.cpp.
References _timeBetweenWatchDogCheck.
Referenced by Cmvmi::handleSET_VAR_REQ().
00479 { 00480 return _timeBetweenWatchDogCheck; 00481 }
Here is the caller graph for this function:

friend class Cmvmi [friend] |
Definition at line 77 of file Configuration.hpp.
friend class Qmgr [friend] |
Definition at line 78 of file Configuration.hpp.
| int reportShutdown | ( | class Configuration * | config, | |
| int | error, | |||
| int | restart | |||
| ) | [friend] |
Definition at line 145 of file main.cpp.
00146 { 00147 Uint32 error= 0, signum= 0, sphase= 256; 00148 Properties info; 00149 readChildInfo(info); 00150 00151 get_int_property(info, "signal", &signum); 00152 get_int_property(info, "error", &error); 00153 get_int_property(info, "sphase", &sphase); 00154 00155 Uint32 length, theData[25]; 00156 EventReport *rep = (EventReport *)theData; 00157 00158 rep->setNodeId(globalData.ownId); 00159 if (restart) 00160 theData[1] = 1 | 00161 (globalData.theRestartFlag == initial_state ? 2 : 0) | 00162 (config->getInitialStart() ? 4 : 0); 00163 else 00164 theData[1] = 0; 00165 00166 if (error_exit == 0) 00167 { 00168 rep->setEventType(NDB_LE_NDBStopCompleted); 00169 theData[2] = signum; 00170 length = 3; 00171 } 00172 else 00173 { 00174 rep->setEventType(NDB_LE_NDBStopForced); 00175 theData[2] = signum; 00176 theData[3] = error; 00177 theData[4] = sphase; 00178 theData[5] = 0; // extra 00179 length = 6; 00180 } 00181 00182 { // Log event 00183 const EventReport * const eventReport = (EventReport *)&theData[0]; 00184 g_eventLogger.log(eventReport->getEventType(), theData, 00185 eventReport->getNodeId(), 0); 00186 } 00187 00188 for (unsigned n = 0; n < config->m_mgmds.size(); n++) 00189 { 00190 NdbMgmHandle h = ndb_mgm_create_handle(); 00191 if (h == 0 || 00192 ndb_mgm_set_connectstring(h, config->m_mgmds[n].c_str()) || 00193 ndb_mgm_connect(h, 00194 1, //no_retries 00195 0, //retry_delay_in_seconds 00196 0 //verbose 00197 )) 00198 goto handle_error; 00199 00200 { 00201 if (ndb_mgm_report_event(h, theData, length)) 00202 goto handle_error; 00203 } 00204 goto do_next; 00205 00206 handle_error: 00207 if (h) 00208 { 00209 BaseString tmp(ndb_mgm_get_latest_error_msg(h)); 00210 tmp.append(" : "); 00211 tmp.append(ndb_mgm_get_latest_error_desc(h)); 00212 g_eventLogger.warning("Unable to report shutdown reason to %s: %s", 00213 config->m_mgmds[n].c_str(), tmp.c_str()); 00214 } 00215 else 00216 { 00217 g_eventLogger.error("Unable to report shutdown reason to %s", 00218 config->m_mgmds[n].c_str()); 00219 } 00220 do_next: 00221 if (h) 00222 { 00223 ndb_mgm_disconnect(h); 00224 ndb_mgm_destroy_handle(&h); 00225 } 00226 } 00227 return 0; 00228 }
char* Configuration::_backupPath [private] |
Definition at line 104 of file Configuration.hpp.
Referenced by backupFilePath(), Configuration(), setupConfiguration(), and ~Configuration().
char* Configuration::_connectString [private] |
Definition at line 106 of file Configuration.hpp.
Referenced by Configuration(), getConnectString(), getConnectStringCopy(), init(), and ~Configuration().
bool Configuration::_daemonMode [private] |
Definition at line 109 of file Configuration.hpp.
Referenced by Configuration(), getDaemonMode(), and init().
bool Configuration::_foregroundMode [private] |
Definition at line 110 of file Configuration.hpp.
Referenced by Configuration(), getForegroundMode(), and init().
char* Configuration::_fsPath [private] |
Definition at line 103 of file Configuration.hpp.
Referenced by Configuration(), fileSystemPath(), setupConfiguration(), and ~Configuration().
bool Configuration::_initialStart [private] |
Definition at line 105 of file Configuration.hpp.
Referenced by Configuration(), getInitialStart(), init(), and setInitialStart().
Uint32 Configuration::_lockPagesInMainMemory [private] |
Definition at line 86 of file Configuration.hpp.
Referenced by lockPagesInMainMemory(), and setupConfiguration().
Uint32 Configuration::_maxErrorLogs [private] |
Definition at line 85 of file Configuration.hpp.
Referenced by maxNoOfErrorLogs(), and setupConfiguration().
char* Configuration::_programName [private] |
arguments to NDB process
Definition at line 102 of file Configuration.hpp.
Referenced by Configuration(), init(), programName(), and ~Configuration().
Uint32 Configuration::_stopOnError [private] |
Definition at line 83 of file Configuration.hpp.
Referenced by fetch_configuration(), and stopOnError().
Definition at line 87 of file Configuration.hpp.
Referenced by setupConfiguration(), and timeBetweenWatchDogCheck().
Definition at line 90 of file Configuration.hpp.
Referenced by Configuration(), fetch_configuration(), and setupConfiguration().
Definition at line 92 of file Configuration.hpp.
Referenced by calcSizeAlt(), Configuration(), getClusterConfigIterator(), and setupConfiguration().
ConfigRetriever* Configuration::m_config_retriever [private] |
Definition at line 95 of file Configuration.hpp.
Referenced by closeConfiguration(), Configuration(), fetch_configuration(), get_config_retriever(), and ~Configuration().
Definition at line 75 of file Configuration.hpp.
Referenced by calcSizeAlt(), Configuration(), main(), and ~Configuration().
BaseString Configuration::m_mgmd_host [private] |
Definition at line 108 of file Configuration.hpp.
Referenced by fetch_configuration(), and get_mgmd_host().
Uint32 Configuration::m_mgmd_port [private] |
Definition at line 107 of file Configuration.hpp.
Referenced by fetch_configuration(), and get_mgmd_port().
Vector<BaseString> Configuration::m_mgmds [private] |
ndb_mgm_configuration* Configuration::m_ownConfig [private] |
Definition at line 93 of file Configuration.hpp.
Referenced by calcSizeAlt(), and getOwnConfigIterator().
Uint32 Configuration::m_restartOnErrorInsert [private] |
Definition at line 84 of file Configuration.hpp.
Referenced by getRestartOnErrorInsert(), setRestartOnErrorInsert(), and setupConfiguration().
1.4.7

