18 #include <ndb_global.h>
20 #include "Configuration.hpp"
21 #include <ErrorHandlingMacros.hpp>
22 #include "GlobalData.hpp"
24 #include <ConfigRetriever.hpp>
25 #include <IPCConfig.hpp>
26 #include <ndb_version.h>
29 #include <WatchDog.hpp>
30 #include <NdbConfig.h>
32 #include <mgmapi_configuration.hpp>
33 #include <kernel_config_parameters.h>
35 #include <util/ConfigValues.hpp>
38 #include <ndbapi_limits.h>
41 #include <EventLogger.hpp>
44 extern Uint32 g_start_type;
47 Configuration::init(
int _no_start,
int _initial,
52 globalData.theRestartFlag = initial_state;
54 globalData.theRestartFlag = perform_start;
65 g_start_type |= (1 << NodeState::ST_INITIAL_START);
68 threadIdMutex = NdbMutex_Create();
71 g_eventLogger->
error(
"Failed to create threadIdMutex");
78 Configuration::Configuration()
82 _initialStart =
false;
83 m_config_retriever= 0;
85 m_clusterConfigIter= 0;
89 Configuration::~Configuration(){
94 if(_backupPath != NULL)
97 if (m_config_retriever) {
98 delete m_config_retriever;
107 Configuration::closeConfiguration(
bool end_session){
108 m_config_retriever->end_session(end_session);
109 if (m_config_retriever) {
110 delete m_config_retriever;
112 m_config_retriever= 0;
118 const char* _bind_address,
119 NodeId allocated_nodeid)
124 if (m_config_retriever) {
125 delete m_config_retriever;
133 if (!m_config_retriever)
135 ERROR_SET(fatal, NDBD_EXIT_MEMALLOC,
136 "Failed to create ConfigRetriever",
"");
139 if (m_config_retriever->hasError())
141 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
142 "Could not initialize handle to management server",
143 m_config_retriever->getErrorString());
146 if(m_config_retriever->do_connect(12,5,1) == -1){
147 const char * s = m_config_retriever->getErrorString();
149 s =
"No error given!";
153 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
"Could not connect to ndb_mgmd", s);
158 if (allocated_nodeid)
162 globalData.ownId = allocated_nodeid;
167 const int alloc_retries = 2;
168 const int alloc_delay = 3;
169 globalData.ownId = cr.
allocNodeId(alloc_retries, alloc_delay);
170 if(globalData.ownId == 0)
172 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
173 "Unable to alloc node id",
174 m_config_retriever->getErrorString());
177 assert(globalData.ownId);
181 const char * s = cr.getErrorString();
183 s =
"No error given!";
189 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
"Could not fetch configuration"
190 "/invalid configuration", s);
193 free(m_clusterConfig);
198 cfg->pack(m_clusterConfigPacked);
203 if (sys_iter.get(CFG_SYS_CONFIG_GENERATION, &generation))
205 g_eventLogger->
info(
"Configuration fetched from '%s:%d', unknown generation!! (likely older ndb_mgmd)",
206 m_config_retriever->get_mgmd_host(),
207 m_config_retriever->get_mgmd_port());
211 g_eventLogger->
info(
"Configuration fetched from '%s:%d', generation: %d",
212 m_config_retriever->get_mgmd_host(),
213 m_config_retriever->get_mgmd_port(),
219 if (iter.find(CFG_NODE_ID, globalData.ownId)){
220 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
"Invalid configuration fetched",
"DB missing");
223 if(iter.get(CFG_DB_STOP_ON_ERROR, &_stopOnError)){
224 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
"Invalid configuration fetched",
225 "StopOnError missing");
228 const char * datadir;
229 if(iter.get(CFG_NODE_DATADIR, &datadir)){
230 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
"Invalid configuration fetched",
233 NdbConfig_SetPath(datadir);
238 Uint32 param,
const char *param_string)
240 const char* path = NULL;
241 if(iter.get(param, &path)){
242 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
"Invalid configuration fetched missing ",
246 if(path == 0 || strlen(path) == 0){
247 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
248 "Invalid configuration fetched. Configuration does not contain valid ",
255 memset(buf2, 0,
sizeof(buf2));
258 if(!GetFullPathName(path,
sizeof(buf2), buf2, &szFilePart) ||
259 (GetFileAttributes(buf2) & FILE_ATTRIBUTE_READONLY))
261 if((::realpath(path, buf2) == NULL)||
262 (::access(buf2, W_OK) != 0))
265 ERROR_SET(fatal, NDBD_EXIT_AFS_INVALIDPATH, path, param_string);
268 if (strcmp(&buf2[strlen(buf2) - 1], DIR_SEPARATOR))
269 strcat(buf2, DIR_SEPARATOR);
274 #include "../../common/util/parse_mask.hpp"
279 DBUG_ENTER(
"Configuration::setupConfiguration");
286 if (!globalTransporterRegistry.init(globalData.ownId))
288 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
289 "Invalid configuration fetched",
290 "Could not init transporter registry");
295 globalTransporterRegistry))
297 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
298 "Invalid configuration fetched",
299 "Could not configure transporters");
306 if (iter.find(CFG_NODE_ID, globalData.ownId)){
307 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
"Invalid configuration fetched",
"DB missing");
311 if(!(iter.get(CFG_TYPE_OF_SECTION, &type) == 0 && type == NODE_TYPE_DB)){
312 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
"Invalid configuration fetched",
313 "I'm wrong type of node");
316 Uint32 total_send_buffer = 0;
317 iter.get(CFG_TOTAL_SEND_BUFFER_MEMORY, &total_send_buffer);
320 if(iter.get(CFG_DB_NO_SAVE_MSGS, &_maxErrorLogs)){
321 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
"Invalid configuration fetched",
322 "MaxNoOfSavedMessages missing");
325 if(iter.get(CFG_DB_MEMLOCK, &_lockPagesInMainMemory)){
326 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
"Invalid configuration fetched",
327 "LockPagesInMainMemory missing");
330 if(iter.get(CFG_DB_WATCHDOG_INTERVAL, &_timeBetweenWatchDogCheck)){
331 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
"Invalid configuration fetched",
332 "TimeBetweenWatchDogCheck missing");
335 _schedulerExecutionTimer = 50;
336 iter.get(CFG_DB_SCHED_EXEC_TIME, &_schedulerExecutionTimer);
338 _schedulerSpinTimer = 0;
339 iter.get(CFG_DB_SCHED_SPIN_TIME, &_schedulerSpinTimer);
341 _realtimeScheduler = 0;
342 iter.get(CFG_DB_REALTIME_SCHEDULER, &_realtimeScheduler);
344 if(iter.get(CFG_DB_WATCHDOG_INTERVAL_INITIAL,
345 &_timeBetweenWatchDogCheckInitial)){
346 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
"Invalid configuration fetched",
347 "TimeBetweenWatchDogCheckInitial missing");
355 _fsPath= get_and_validate_path(iter, CFG_DB_FILESYSTEM_PATH,
"FileSystemPath");
358 _backupPath= get_and_validate_path(iter, CFG_DB_BACKUP_DATADIR,
"BackupDataDir");
360 if(iter.get(CFG_DB_STOP_ON_ERROR_INSERT, &m_restartOnErrorInsert)){
361 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
"Invalid configuration fetched",
362 "RestartOnErrorInsert missing");
369 if (_timeBetweenWatchDogCheckInitial < _timeBetweenWatchDogCheck)
370 _timeBetweenWatchDogCheckInitial = _timeBetweenWatchDogCheck;
372 Uint32 t = _timeBetweenWatchDogCheckInitial;
373 t = globalEmulatorData.theWatchDog ->setCheckInterval(t);
374 _timeBetweenWatchDogCheckInitial = t;
377 const char * lockmask = 0;
379 if (iter.get(CFG_DB_EXECUTE_LOCK_CPU, &lockmask) == 0)
381 int res = m_thr_config.setLockExecuteThreadToCPU(lockmask);
385 g_eventLogger->
warning(
"Failed to parse 'LockExecuteThreadToCPU=%s' "
386 "(error: %d), ignoring it!",
393 Uint32 maintCPU = NO_LOCK_CPU;
394 iter.get(CFG_DB_MAINT_LOCK_CPU, &maintCPU);
395 if (maintCPU == 65535)
396 maintCPU = NO_LOCK_CPU;
397 if (maintCPU != NO_LOCK_CPU)
398 m_thr_config.setLockIoThreadsToCPU(maintCPU);
401 const char * thrconfigstring = NdbEnv_GetEnv(
"NDB_MT_THREAD_CONFIG",
403 if (thrconfigstring ||
404 iter.get(CFG_DB_MT_THREAD_CONFIG, &thrconfigstring) == 0)
406 int res = m_thr_config.do_parse(thrconfigstring);
409 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
410 "Invalid configuration fetched, invalid ThreadConfig",
411 m_thr_config.getErrorMessage());
416 Uint32 mtthreads = 0;
417 iter.get(CFG_DB_MT_THREADS, &mtthreads);
420 iter.get(CFG_NDBMT_CLASSIC, &classic);
421 const char* p = NdbEnv_GetEnv(
"NDB_MT_LQH", (
char*)0, 0);
424 if (strstr(p,
"NOPLEASE") != 0)
428 Uint32 lqhthreads = 0;
429 iter.get(CFG_NDBMT_LQH_THREADS, &lqhthreads);
431 int res = m_thr_config.do_parse(mtthreads, lqhthreads, classic);
434 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
435 "Invalid configuration fetched, invalid thread configuration",
436 m_thr_config.getErrorMessage());
441 ndbout_c(
"ThreadConfig: input: %s LockExecuteThreadToCPU: %s => parsed: %s",
443 lockmask ? lockmask :
"",
444 m_thr_config.getConfigString());
448 ndbout_c(
"ThreadConfig (old ndb_mgmd) LockExecuteThreadToCPU: %s => parsed: %s",
449 lockmask ? lockmask :
"",
450 m_thr_config.getConfigString());
453 ConfigValues* cf = ConfigValuesFactory::extractCurrentSection(iter.m_config);
455 if(m_clusterConfigIter)
456 ndb_mgm_destroy_iterator(m_clusterConfigIter);
458 (p, CFG_SECTION_NODE);
466 Configuration::lockPagesInMainMemory()
const {
467 return _lockPagesInMainMemory;
471 Configuration::schedulerExecutionTimer()
const {
472 return _schedulerExecutionTimer;
476 Configuration::schedulerExecutionTimer(
int value) {
478 _schedulerExecutionTimer = value;
482 Configuration::schedulerSpinTimer()
const {
483 return _schedulerSpinTimer;
487 Configuration::schedulerSpinTimer(
int value) {
490 _schedulerSpinTimer = value;
494 Configuration::realtimeScheduler()
const
496 return (
bool)_realtimeScheduler;
500 Configuration::realtimeScheduler(
bool realtime_on)
502 bool old_value = (bool)_realtimeScheduler;
503 _realtimeScheduler = (Uint32)realtime_on;
504 if (old_value != realtime_on)
505 setAllRealtimeScheduler();
509 Configuration::timeBetweenWatchDogCheck()
const {
510 return _timeBetweenWatchDogCheck;
514 Configuration::timeBetweenWatchDogCheck(
int value) {
515 _timeBetweenWatchDogCheck = value;
519 Configuration::maxNoOfErrorLogs()
const {
520 return _maxErrorLogs;
524 Configuration::maxNoOfErrorLogs(
int val){
529 Configuration::stopOnError()
const {
534 Configuration::stopOnError(
bool val){
539 Configuration::getRestartOnErrorInsert()
const {
540 return m_restartOnErrorInsert;
544 Configuration::setRestartOnErrorInsert(
int i){
545 m_restartOnErrorInsert =
i;
549 Configuration::getOwnConfigIterator()
const {
550 return m_ownConfigIterator;
554 Configuration::getClusterConfigIterator()
const {
555 return m_clusterConfigIter;
559 Configuration::get_config_generation()
const {
560 Uint32 generation = ~0;
563 sys_iter.get(CFG_SYS_CONFIG_GENERATION, &generation);
570 const char *
msg =
"Invalid configuration fetched";
573 unsigned int noOfTables = 0;
574 unsigned int noOfUniqueHashIndexes = 0;
575 unsigned int noOfOrderedIndexes = 0;
576 unsigned int noOfTriggers = 0;
577 unsigned int noOfReplicas = 0;
578 unsigned int noOfDBNodes = 0;
579 unsigned int noOfAPINodes = 0;
580 unsigned int noOfMGMNodes = 0;
581 unsigned int noOfNodes = 0;
582 unsigned int noOfAttributes = 0;
583 unsigned int noOfOperations = 0;
584 unsigned int noOfLocalOperations = 0;
585 unsigned int noOfTransactions = 0;
586 unsigned int noOfIndexPages = 0;
587 unsigned int noOfDataPages = 0;
588 unsigned int noOfScanRecords = 0;
589 unsigned int noOfLocalScanRecords = 0;
590 unsigned int noBatchSize = 0;
594 ERROR_SET(fatal, NDBD_EXIT_MEMALLOC,
"Failed to create LogLevel",
"");
597 struct AttribStorage {
int paramId; Uint32 * storage;
bool computable; };
598 AttribStorage tmp[] = {
599 { CFG_DB_NO_SCANS, &noOfScanRecords,
false },
600 { CFG_DB_NO_LOCAL_SCANS, &noOfLocalScanRecords,
true },
601 { CFG_DB_BATCH_SIZE, &noBatchSize,
false },
602 { CFG_DB_NO_TABLES, &noOfTables,
false },
603 { CFG_DB_NO_ORDERED_INDEXES, &noOfOrderedIndexes,
false },
604 { CFG_DB_NO_UNIQUE_HASH_INDEXES, &noOfUniqueHashIndexes,
false },
605 { CFG_DB_NO_TRIGGERS, &noOfTriggers,
true },
606 { CFG_DB_NO_REPLICAS, &noOfReplicas,
false },
607 { CFG_DB_NO_ATTRIBUTES, &noOfAttributes,
false },
608 { CFG_DB_NO_OPS, &noOfOperations,
false },
609 { CFG_DB_NO_LOCAL_OPS, &noOfLocalOperations,
true },
610 { CFG_DB_NO_TRANSACTIONS, &noOfTransactions,
false }
615 const int sz =
sizeof(tmp)/
sizeof(AttribStorage);
616 for(
int i = 0;
i<sz;
i++){
617 if(ndb_mgm_get_int_parameter(&db, tmp[
i].paramId, tmp[
i].storage)){
618 if (tmp[
i].computable) {
622 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
627 Uint32 lqhInstances = 1;
628 if (globalData.isNdbMtLqh)
630 lqhInstances = globalData.ndbMtLqhWorkers;
633 Uint64 indexMem = 0, dataMem = 0;
634 ndb_mgm_get_int64_parameter(&db, CFG_DB_DATA_MEM, &dataMem);
635 ndb_mgm_get_int64_parameter(&db, CFG_DB_INDEX_MEM, &indexMem);
638 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
643 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
646 #define DO_DIV(x,y) (((x) + (y - 1)) / (y))
648 noOfDataPages = (Uint32)(dataMem / 32768);
649 noOfIndexPages = (Uint32)(indexMem / 8192);
650 noOfIndexPages = DO_DIV(noOfIndexPages, lqhInstances);
652 for(
unsigned j = 0; j<LogLevel::LOGLEVEL_CATEGORIES; j++){
654 if(!ndb_mgm_get_int_parameter(&db, CFG_MIN_LOGLEVEL+j, &tmp)){
655 m_logLevel->
setLogLevel((LogLevel::EventCategory)j, tmp);
662 Uint32 nodeNo = noOfNodes = 0;
664 for(ndb_mgm_first(p); ndb_mgm_valid(p); ndb_mgm_next(p), nodeNo++){
669 if(ndb_mgm_get_int_parameter(p, CFG_NODE_ID, &nodeId)){
670 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg,
"Node data (Id) missing");
673 if(ndb_mgm_get_int_parameter(p, CFG_TYPE_OF_SECTION, &nodeType)){
674 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg,
"Node data (Type) missing");
677 if(nodeId > MAX_NODES || nodeId == 0){
679 "Invalid node id: %d", nodeId);
680 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
683 if(nodes.
get(nodeId)){
686 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
694 if(nodeId > MAX_NDB_NODES){
697 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
708 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
717 it2.set(CFG_DB_NO_TABLES, noOfTables);
718 it2.set(CFG_DB_NO_ATTRIBUTES, noOfAttributes);
720 Uint32 neededNoOfTriggers =
721 3 * noOfUniqueHashIndexes +
722 3 * NDB_MAX_ACTIVE_EVENTS +
725 if (noOfTriggers < neededNoOfTriggers)
727 noOfTriggers= neededNoOfTriggers;
728 it2.set(CFG_DB_NO_TRIGGERS, noOfTriggers);
737 Uint32 noOfMetaTables= noOfTables + noOfOrderedIndexes +
738 noOfUniqueHashIndexes;
739 Uint32 noOfMetaTablesDict= noOfMetaTables;
740 if (noOfMetaTablesDict > NDB_MAX_TABLES)
741 noOfMetaTablesDict= NDB_MAX_TABLES;
747 cfg.put(CFG_DICT_ATTRIBUTE,
750 cfg.put(CFG_DICT_TABLE,
755 if (noOfLocalScanRecords == 0) {
756 #if NDB_VERSION_D < NDB_MAKE_VERSION(7,2,0)
757 noOfLocalScanRecords = (noOfDBNodes * noOfScanRecords) +
759 noOfLocalScanRecords = 4 * (noOfDBNodes * noOfScanRecords) +
764 if (noOfLocalOperations == 0) {
765 noOfLocalOperations= (11 * noOfOperations) / 10;
768 Uint32 noOfTCScanRecords = noOfScanRecords;
769 Uint32 noOfTCLocalScanRecords = noOfLocalScanRecords;
771 noOfLocalOperations = DO_DIV(noOfLocalOperations, lqhInstances);
772 noOfLocalScanRecords = DO_DIV(noOfLocalScanRecords, lqhInstances);
775 Uint32 noOfAccTables= noOfMetaTables;
780 cfg.put(CFG_ACC_DIR_RANGE,
781 2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
783 cfg.put(CFG_ACC_DIR_ARRAY,
784 (noOfIndexPages >> 8) +
785 2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
787 cfg.put(CFG_ACC_FRAGMENT,
788 NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
797 cfg.put(CFG_ACC_OP_RECS,
798 (noOfLocalOperations + 50) +
799 (noOfLocalScanRecords * noBatchSize) +
800 NODE_RECOVERY_SCAN_OP_RECORDS);
802 cfg.put(CFG_ACC_OVERFLOW_RECS,
804 NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
806 cfg.put(CFG_ACC_PAGE8,
807 noOfIndexPages + 32);
809 cfg.put(CFG_ACC_TABLE, noOfAccTables);
811 cfg.put(CFG_ACC_SCAN, noOfLocalScanRecords);
818 cfg.put(CFG_DIH_API_CONNECT,
819 2 * noOfTransactions);
821 Uint32 noFragPerTable= (((noOfDBNodes * lqhInstances) +
822 NO_OF_FRAGS_PER_CHUNK - 1) >>
823 LOG_NO_OF_FRAGS_PER_CHUNK) <<
824 LOG_NO_OF_FRAGS_PER_CHUNK;
826 cfg.put(CFG_DIH_FRAG_CONNECT,
827 noFragPerTable * noOfMetaTables);
829 cfg.put(CFG_DIH_REPLICAS,
830 NO_OF_FRAG_PER_NODE * noOfMetaTables *
831 noOfDBNodes * noOfReplicas * lqhInstances);
833 cfg.put(CFG_DIH_TABLE,
841 cfg.put(CFG_LQH_FRAG,
842 NO_OF_FRAG_PER_NODE * noOfMetaTables * noOfReplicas);
844 cfg.put(CFG_LQH_TABLE,
847 cfg.put(CFG_LQH_TC_CONNECT,
848 noOfLocalOperations + 50);
850 cfg.put(CFG_LQH_SCAN,
851 noOfLocalScanRecords);
858 cfg.put(CFG_TC_API_CONNECT,
859 3 * noOfTransactions);
861 cfg.put(CFG_TC_TC_CONNECT,
862 (2 * noOfOperations) + 16 + noOfTransactions);
864 cfg.put(CFG_TC_TABLE,
867 cfg.put(CFG_TC_LOCAL_SCAN,
868 noOfTCLocalScanRecords);
878 cfg.put(CFG_TUP_FRAG,
879 NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas);
881 cfg.put(CFG_TUP_OP_RECS,
882 noOfLocalOperations + 50);
884 cfg.put(CFG_TUP_PAGE,
887 cfg.put(CFG_TUP_TABLE,
890 cfg.put(CFG_TUP_STORED_PROC,
891 noOfLocalScanRecords);
898 cfg.put(CFG_TUX_INDEX,
901 cfg.put(CFG_TUX_FRAGMENT,
902 NO_OF_FRAG_PER_NODE * noOfOrderedIndexes * noOfReplicas);
904 cfg.put(CFG_TUX_ATTRIBUTE,
905 noOfOrderedIndexes * 4);
907 cfg.put(CFG_TUX_SCAN_OP, noOfLocalScanRecords);
916 Configuration::setAllRealtimeScheduler()
919 for (i = 0; i < threadInfo.size(); i++)
921 if (threadInfo[i].
type != NotInUse)
923 if (setRealtimeScheduler(threadInfo[i].pThread,
933 Configuration::setAllLockCPU(
bool exec_thread)
936 for (i = 0; i < threadInfo.size(); i++)
938 if (threadInfo[i].
type == NotInUse)
942 (exec_thread && threadInfo[
i].type == MainThread) ||
943 (!exec_thread && threadInfo[i].
type != MainThread);
947 setLockCPU(threadInfo[i].pThread, threadInfo[i].
type);
953 Configuration::setRealtimeScheduler(
NdbThread* pThread,
954 enum ThreadTypes
type,
962 if (!init || real_time)
965 if ((error_no = NdbThread_SetScheduler(pThread, real_time,
966 (type != MainThread))))
976 Configuration::setLockCPU(
NdbThread * pThread,
977 enum ThreadTypes type)
980 if (type != MainThread)
982 res = m_thr_config.do_bind_io(pThread);
984 else if (!NdbIsMultiThreaded())
986 BlockNumber list[] = { CMVMI };
987 res = m_thr_config.do_bind(pThread, list, 1);
994 ndbout <<
"Locked to CPU ok" << endl;
999 ndbout <<
"Failed to lock CPU, error_no = " << (-res) << endl;
1011 NdbMutex_Lock(threadIdMutex);
1012 for (i = 0; i < threadInfo.size(); i++)
1014 if (threadInfo[i].type == NotInUse)
1017 if (i == threadInfo.size())
1020 threadInfo.push_back(tmp);
1022 threadInfo[
i].pThread = pThread;
1023 threadInfo[
i].type =
type;
1024 NdbMutex_Unlock(threadIdMutex);
1025 setRealtimeScheduler(pThread, type, _realtimeScheduler, TRUE);
1026 if (type != MainThread)
1032 setLockCPU(pThread, type);
1038 Configuration::removeThreadId(Uint32
index)
1040 NdbMutex_Lock(threadIdMutex);
1041 threadInfo[
index].pThread = 0;
1042 threadInfo[
index].type = NotInUse;
1043 NdbMutex_Unlock(threadIdMutex);
1047 Configuration::yield_main(Uint32
index,
bool start)
1049 if (_realtimeScheduler)
1052 setRealtimeScheduler(threadInfo[index].pThread,
1053 threadInfo[index].type,
1057 setRealtimeScheduler(threadInfo[index].pThread,
1058 threadInfo[index].type,
1065 Configuration::initThreadArray()
1067 NdbMutex_Lock(threadIdMutex);
1068 for (Uint32 i = 0; i < threadInfo.size(); i++)
1070 threadInfo[
i].pThread = 0;
1071 threadInfo[
i].type = NotInUse;
1073 NdbMutex_Unlock(threadIdMutex);