⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configuration.cpp

📁 mysql-5.0.22.tar.gz源码包
💻 CPP
📖 第 1 页 / 共 2 页
字号:
	      "RestartOnErrorInsert missing");  }  /**   * Create the watch dog thread   */  {     Uint32 t = _timeBetweenWatchDogCheck;    t = globalEmulatorData.theWatchDog ->setCheckInterval(t);    _timeBetweenWatchDogCheck = t;  }    ConfigValues* cf = ConfigValuesFactory::extractCurrentSection(iter.m_config);  if(m_clusterConfigIter)    ndb_mgm_destroy_iterator(m_clusterConfigIter);  m_clusterConfigIter = ndb_mgm_create_configuration_iterator    (p, CFG_SECTION_NODE);  calcSizeAlt(cf);  DBUG_VOID_RETURN;}bool Configuration::lockPagesInMainMemory() const {  return _lockPagesInMainMemory;}int Configuration::timeBetweenWatchDogCheck() const {  return _timeBetweenWatchDogCheck;}void Configuration::timeBetweenWatchDogCheck(int value) {  _timeBetweenWatchDogCheck = value;}int Configuration::maxNoOfErrorLogs() const {  return _maxErrorLogs;}void Configuration::maxNoOfErrorLogs(int val){  _maxErrorLogs = val;}boolConfiguration::stopOnError() const {  return _stopOnError;}void Configuration::stopOnError(bool val){  _stopOnError = val;}intConfiguration::getRestartOnErrorInsert() const {  return m_restartOnErrorInsert;}voidConfiguration::setRestartOnErrorInsert(int i){  m_restartOnErrorInsert = i;}const char *Configuration::getConnectString() const {  return _connectString;}char *Configuration::getConnectStringCopy() const {  if(_connectString != 0)    return strdup(_connectString);  return 0;}const ndb_mgm_configuration_iterator * Configuration::getOwnConfigIterator() const {  return m_ownConfigIterator;}  ndb_mgm_configuration_iterator * Configuration::getClusterConfigIterator() const {  return m_clusterConfigIter;}voidConfiguration::calcSizeAlt(ConfigValues * ownConfig){  const char * msg = "Invalid configuration fetched";  char buf[255];  unsigned int noOfTables = 0;  unsigned int noOfUniqueHashIndexes = 0;  unsigned int noOfOrderedIndexes = 0;  unsigned int noOfTriggers = 0;  unsigned int noOfReplicas = 0;  unsigned int noOfDBNodes = 0;  unsigned int noOfAPINodes = 0;  unsigned int noOfMGMNodes = 0;  unsigned int noOfNodes = 0;  unsigned int noOfAttributes = 0;  unsigned int noOfOperations = 0;  unsigned int noOfLocalOperations = 0;  unsigned int noOfTransactions = 0;  unsigned int noOfIndexPages = 0;  unsigned int noOfDataPages = 0;  unsigned int noOfScanRecords = 0;  unsigned int noOfLocalScanRecords = 0;  unsigned int noBatchSize = 0;  m_logLevel = new LogLevel();    struct AttribStorage { int paramId; Uint32 * storage; bool computable; };  AttribStorage tmp[] = {    { CFG_DB_NO_SCANS, &noOfScanRecords, false },    { CFG_DB_NO_LOCAL_SCANS, &noOfLocalScanRecords, true },    { CFG_DB_BATCH_SIZE, &noBatchSize, false },    { CFG_DB_NO_TABLES, &noOfTables, false },    { CFG_DB_NO_ORDERED_INDEXES, &noOfOrderedIndexes, false },    { CFG_DB_NO_UNIQUE_HASH_INDEXES, &noOfUniqueHashIndexes, false },    { CFG_DB_NO_TRIGGERS, &noOfTriggers, true },    { CFG_DB_NO_REPLICAS, &noOfReplicas, false },    { CFG_DB_NO_ATTRIBUTES, &noOfAttributes, false },    { CFG_DB_NO_OPS, &noOfOperations, false },    { CFG_DB_NO_LOCAL_OPS, &noOfLocalOperations, true },    { CFG_DB_NO_TRANSACTIONS, &noOfTransactions, false }  };  ndb_mgm_configuration_iterator db(*(ndb_mgm_configuration*)ownConfig, 0);    const int sz = sizeof(tmp)/sizeof(AttribStorage);  for(int i = 0; i<sz; i++){    if(ndb_mgm_get_int_parameter(&db, tmp[i].paramId, tmp[i].storage)){      if (tmp[i].computable) {        *tmp[i].storage = 0;      } else {        BaseString::snprintf(buf, sizeof(buf),"ConfigParam: %d not found", tmp[i].paramId);        ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);      }    }  }  Uint64 indexMem = 0, dataMem = 0;  ndb_mgm_get_int64_parameter(&db, CFG_DB_DATA_MEM, &dataMem);  ndb_mgm_get_int64_parameter(&db, CFG_DB_INDEX_MEM, &indexMem);  if(dataMem == 0){    BaseString::snprintf(buf, sizeof(buf), "ConfigParam: %d not found", CFG_DB_DATA_MEM);    ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);  }  if(indexMem == 0){    BaseString::snprintf(buf, sizeof(buf), "ConfigParam: %d not found", CFG_DB_INDEX_MEM);    ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);  }  noOfDataPages = (dataMem / 32768);  noOfIndexPages = (indexMem / 8192);  for(unsigned j = 0; j<LogLevel::LOGLEVEL_CATEGORIES; j++){    Uint32 tmp;    if(!ndb_mgm_get_int_parameter(&db, CFG_MIN_LOGLEVEL+j, &tmp)){      m_logLevel->setLogLevel((LogLevel::EventCategory)j, tmp);    }  }    // tmp  ndb_mgm_configuration_iterator * p = m_clusterConfigIter;  Uint32 nodeNo = noOfNodes = 0;  NodeBitmask nodes;  for(ndb_mgm_first(p); ndb_mgm_valid(p); ndb_mgm_next(p), nodeNo++){        Uint32 nodeId;    Uint32 nodeType;        if(ndb_mgm_get_int_parameter(p, CFG_NODE_ID, &nodeId)){      ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, "Node data (Id) missing");    }        if(ndb_mgm_get_int_parameter(p, CFG_TYPE_OF_SECTION, &nodeType)){      ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, "Node data (Type) missing");    }        if(nodeId > MAX_NODES || nodeId == 0){      BaseString::snprintf(buf, sizeof(buf),	       "Invalid node id: %d", nodeId);      ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);    }        if(nodes.get(nodeId)){      BaseString::snprintf(buf, sizeof(buf), "Two node can not have the same node id: %d",	       nodeId);      ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);    }    nodes.set(nodeId);            switch(nodeType){    case NODE_TYPE_DB:      noOfDBNodes++; // No of NDB processes            if(nodeId > MAX_NDB_NODES){		  BaseString::snprintf(buf, sizeof(buf), "Maximum node id for a ndb node is: %d", 		 MAX_NDB_NODES);	ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);      }      break;    case NODE_TYPE_API:      noOfAPINodes++; // No of API processes      break;    case NODE_TYPE_REP:      break;    case NODE_TYPE_MGM:      noOfMGMNodes++; // No of MGM processes      break;    case NODE_TYPE_EXT_REP:      break;    default:      BaseString::snprintf(buf, sizeof(buf), "Unknown node type: %d", nodeType);      ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);    }  }  noOfNodes = nodeNo;  noOfTables+= 2; // Add System tables  noOfAttributes += 9;  // Add System table attributes  ConfigValues::Iterator it2(*ownConfig, db.m_config);  it2.set(CFG_DB_NO_TABLES, noOfTables);  it2.set(CFG_DB_NO_ATTRIBUTES, noOfAttributes);  {    Uint32 neededNoOfTriggers =   /* types: Insert/Update/Delete/Custom */      3 * noOfUniqueHashIndexes + /* for unique hash indexes, I/U/D */      3 * NDB_MAX_ACTIVE_EVENTS + /* for events in suma, I/U/D */      3 * noOfTables +            /* for backup, I/U/D */      noOfOrderedIndexes;         /* for ordered indexes, C */    if (noOfTriggers < neededNoOfTriggers)    {      noOfTriggers= neededNoOfTriggers;      it2.set(CFG_DB_NO_TRIGGERS, noOfTriggers);    }  }  /**   * Do size calculations   */  ConfigValuesFactory cfg(ownConfig);  Uint32 noOfMetaTables= noOfTables + noOfOrderedIndexes +                           noOfUniqueHashIndexes;  Uint32 noOfMetaTablesDict= noOfMetaTables;  if (noOfMetaTablesDict > MAX_TABLES)    noOfMetaTablesDict= MAX_TABLES;  {    /**     * Dict Size Alt values     */    cfg.put(CFG_DICT_ATTRIBUTE, 	    noOfAttributes);    cfg.put(CFG_DICT_TABLE,	    noOfMetaTablesDict);  }  if (noOfLocalScanRecords == 0) {    noOfLocalScanRecords = (noOfDBNodes * noOfScanRecords) + 1;  }  if (noOfLocalOperations == 0) {    noOfLocalOperations= (11 * noOfOperations) / 10;  }  Uint32 noOfTCScanRecords = noOfScanRecords;  {    Uint32 noOfAccTables= noOfMetaTables/*noOfTables+noOfUniqueHashIndexes*/;    /**     * Acc Size Alt values     */    // Can keep 65536 pages (= 0.5 GByte)    cfg.put(CFG_ACC_DIR_RANGE, 	    4 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);         cfg.put(CFG_ACC_DIR_ARRAY,	    (noOfIndexPages >> 8) + 	    4 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);        cfg.put(CFG_ACC_FRAGMENT,	    2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);        /*-----------------------------------------------------------------------*/    // The extra operation records added are used by the scan and node     // recovery process.     // Node recovery process will have its operations dedicated to ensure    // that they never have a problem with allocation of the operation record.    // The remainder are allowed for use by the scan processes.    /*-----------------------------------------------------------------------*/    cfg.put(CFG_ACC_OP_RECS,	    (noOfLocalOperations + 50) + 	    (noOfLocalScanRecords * noBatchSize) +	    NODE_RECOVERY_SCAN_OP_RECORDS);        cfg.put(CFG_ACC_OVERFLOW_RECS,	    noOfIndexPages + 	    2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);        cfg.put(CFG_ACC_PAGE8, 	    noOfIndexPages + 32);        cfg.put(CFG_ACC_ROOT_FRAG, 	    NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);        cfg.put(CFG_ACC_TABLE, noOfAccTables);        cfg.put(CFG_ACC_SCAN, noOfLocalScanRecords);  }    {    /**     * Dih Size Alt values     */    cfg.put(CFG_DIH_API_CONNECT, 	    2 * noOfTransactions);        cfg.put(CFG_DIH_CONNECT, 	    noOfOperations + noOfTransactions + 46);        Uint32 noFragPerTable= ((noOfDBNodes + NO_OF_FRAGS_PER_CHUNK - 1) >>                           LOG_NO_OF_FRAGS_PER_CHUNK) <<                           LOG_NO_OF_FRAGS_PER_CHUNK;    cfg.put(CFG_DIH_FRAG_CONNECT, 	    noFragPerTable *  noOfMetaTables);        int temp;    temp = noOfReplicas - 2;    if (temp < 0)      temp = 1;    else      temp++;    cfg.put(CFG_DIH_MORE_NODES, 	    temp * NO_OF_FRAG_PER_NODE *	    noOfMetaTables *  noOfDBNodes);    cfg.put(CFG_DIH_REPLICAS, 	    NO_OF_FRAG_PER_NODE * noOfMetaTables *	    noOfDBNodes * noOfReplicas);    cfg.put(CFG_DIH_TABLE, 	    noOfMetaTables);  }    {    /**     * Lqh Size Alt values     */    cfg.put(CFG_LQH_FRAG, 	    NO_OF_FRAG_PER_NODE * noOfMetaTables * noOfReplicas);        cfg.put(CFG_LQH_TABLE, 	    noOfMetaTables);    cfg.put(CFG_LQH_TC_CONNECT, 	    noOfLocalOperations + 50);        cfg.put(CFG_LQH_SCAN, 	    noOfLocalScanRecords);  }    {    /**     * Tc Size Alt values     */    cfg.put(CFG_TC_API_CONNECT, 	    3 * noOfTransactions);        cfg.put(CFG_TC_TC_CONNECT, 	    (2 * noOfOperations) + 16 + noOfTransactions);        cfg.put(CFG_TC_TABLE, 	    noOfMetaTables);        cfg.put(CFG_TC_LOCAL_SCAN, 	    noOfLocalScanRecords);        cfg.put(CFG_TC_SCAN, 	    noOfTCScanRecords);  }    {    /**     * Tup Size Alt values     */    cfg.put(CFG_TUP_FRAG, 	    2 * NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas);        cfg.put(CFG_TUP_OP_RECS, 	    noOfLocalOperations + 50);        cfg.put(CFG_TUP_PAGE, 	    noOfDataPages);        cfg.put(CFG_TUP_PAGE_RANGE, 	    4 * NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas);        cfg.put(CFG_TUP_TABLE, 	    noOfMetaTables);        cfg.put(CFG_TUP_TABLE_DESC, 	    2 * 6 * NO_OF_FRAG_PER_NODE * noOfAttributes * noOfReplicas +	    2 * 10 * NO_OF_FRAG_PER_NODE * noOfMetaTables * noOfReplicas );        cfg.put(CFG_TUP_STORED_PROC,	    noOfLocalScanRecords);  }  {    /**     * Tux Size Alt values     */    cfg.put(CFG_TUX_INDEX, 	    noOfMetaTables /*noOfOrderedIndexes*/);        cfg.put(CFG_TUX_FRAGMENT,	    2 * NO_OF_FRAG_PER_NODE * noOfOrderedIndexes * noOfReplicas);        cfg.put(CFG_TUX_ATTRIBUTE, 	    noOfOrderedIndexes * 4);    cfg.put(CFG_TUX_SCAN_OP, noOfLocalScanRecords);   }  m_ownConfig = (ndb_mgm_configuration*)cfg.getConfigValues();  m_ownConfigIterator = ndb_mgm_create_configuration_iterator    (m_ownConfig, 0);}voidConfiguration::setInitialStart(bool val){  _initialStart = val;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -