#include <ndb_global.h>#include <ndb_opt_defaults.h>#include <NdbTCP.h>#include "ConfigInfo.hpp"#include <mgmapi_config_parameters.h>#include <ndb_limits.h>#include "InitConfigFileParser.hpp"#include <m_string.h>Include dependency graph for ConfigInfo.cpp:

Go to the source code of this file.
Definition at line 35 of file ConfigInfo.cpp.
| #define API_TOKEN "API" |
Definition at line 48 of file ConfigInfo.cpp.
| #define API_TOKEN_PRINT "mysqld(API)" |
Definition at line 44 of file ConfigInfo.cpp.
| #define DB_TOKEN "DB" |
Definition at line 46 of file ConfigInfo.cpp.
| #define DB_TOKEN_PRINT "ndbd(DB)" |
Definition at line 42 of file ConfigInfo.cpp.
| #define KEY_INTERNAL 0 |
| #define MAX_INT_RNIL 0xfffffeff |
Definition at line 32 of file ConfigInfo.cpp.
| #define MAX_LINE_LENGTH 255 |
Definition at line 30 of file ConfigInfo.cpp.
| #define MAX_PORT_NO 65535 |
Definition at line 33 of file ConfigInfo.cpp.
| #define MGM_TOKEN "MGM" |
Definition at line 47 of file ConfigInfo.cpp.
| #define MGM_TOKEN_PRINT "ndb_mgmd(MGM)" |
Definition at line 43 of file ConfigInfo.cpp.
Definition at line 36 of file ConfigInfo.cpp.
| static void add_a_connection | ( | Vector< ConfigInfo::ConfigRuleSection > & | sections, | |
| struct InitConfigFileParser::Context & | ctx, | |||
| Uint32 | nodeId1, | |||
| Uint32 | nodeId2, | |||
| bool | use_shm | |||
| ) | [static] |
Definition at line 3561 of file ConfigInfo.cpp.
References buf, ctx, DBUG_PRINT, Properties::get(), Block_context::m_config, ConfigInfo::ConfigRuleSection::m_sectionData, ConfigInfo::ConfigRuleSection::m_sectionType, Vector< T >::push_back(), Properties::put(), require(), BaseString::snprintf(), and strcmp().
Referenced by add_node_connections().
03564 { 03565 ConfigInfo::ConfigRuleSection s; 03566 const char *hostname1= 0, *hostname2= 0; 03567 const Properties *tmp; 03568 03569 require(ctx.m_config->get("Node", nodeId1, &tmp)); 03570 tmp->get("HostName", &hostname1); 03571 03572 require(ctx.m_config->get("Node", nodeId2, &tmp)); 03573 tmp->get("HostName", &hostname2); 03574 03575 char buf[16]; 03576 s.m_sectionData= new Properties(true); 03577 BaseString::snprintf(buf, sizeof(buf), "%u", nodeId1); 03578 s.m_sectionData->put("NodeId1", buf); 03579 BaseString::snprintf(buf, sizeof(buf), "%u", nodeId2); 03580 s.m_sectionData->put("NodeId2", buf); 03581 03582 if (use_shm && 03583 hostname1 && hostname1[0] && 03584 hostname2 && hostname2[0] && 03585 strcmp(hostname1,hostname2) == 0) 03586 { 03587 s.m_sectionType= BaseString("SHM"); 03588 DBUG_PRINT("info",("adding SHM connection %d %d",nodeId1,nodeId2)); 03589 } 03590 else 03591 { 03592 s.m_sectionType= BaseString("TCP"); 03593 DBUG_PRINT("info",("adding TCP connection %d %d",nodeId1,nodeId2)); 03594 } 03595 03596 sections.push_back(s); 03597 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static bool add_node_connections | ( | Vector< ConfigInfo::ConfigRuleSection > & | sections, | |
| struct InitConfigFileParser::Context & | ctx, | |||
| const char * | rule_data | |||
| ) | [static] |
Definition at line 3600 of file ConfigInfo.cpp.
References add_a_connection(), ctx, DBUG_ENTER, DBUG_RETURN, Properties::get(), Block_context::m_config, n, opt_ndb_shm, Properties::put(), and strcmp().
03603 { 03604 DBUG_ENTER("add_node_connections"); 03605 Uint32 i; 03606 Properties * props= ctx.m_config; 03607 Properties p_connections(true); 03608 Properties p_connections2(true); 03609 03610 for (i = 0;; i++){ 03611 const Properties * tmp; 03612 Uint32 nodeId1, nodeId2; 03613 03614 if(!props->get("Connection", i, &tmp)) break; 03615 03616 if(!tmp->get("NodeId1", &nodeId1)) continue; 03617 p_connections.put("", nodeId1, nodeId1); 03618 if(!tmp->get("NodeId2", &nodeId2)) continue; 03619 p_connections.put("", nodeId2, nodeId2); 03620 03621 p_connections2.put("", nodeId1 + nodeId2<<16, nodeId1); 03622 p_connections2.put("", nodeId2 + nodeId1<<16, nodeId2); 03623 } 03624 03625 Uint32 nNodes; 03626 ctx.m_userProperties.get("NoOfNodes", &nNodes); 03627 03628 Properties p_db_nodes(true); 03629 Properties p_api_nodes(true); 03630 Properties p_mgm_nodes(true); 03631 03632 Uint32 i_db= 0, i_api= 0, i_mgm= 0, n; 03633 for (i= 0, n= 0; n < nNodes; i++){ 03634 const Properties * tmp; 03635 if(!props->get("Node", i, &tmp)) continue; 03636 n++; 03637 03638 const char * type; 03639 if(!tmp->get("Type", &type)) continue; 03640 03641 if (strcmp(type,DB_TOKEN) == 0) 03642 p_db_nodes.put("", i_db++, i); 03643 else if (strcmp(type,API_TOKEN) == 0) 03644 p_api_nodes.put("", i_api++, i); 03645 else if (strcmp(type,MGM_TOKEN) == 0) 03646 p_mgm_nodes.put("", i_mgm++, i); 03647 } 03648 03649 Uint32 nodeId1, nodeId2, dummy; 03650 03651 for (i= 0; p_db_nodes.get("", i, &nodeId1); i++){ 03652 for (Uint32 j= i+1;; j++){ 03653 if(!p_db_nodes.get("", j, &nodeId2)) break; 03654 if(!p_connections2.get("", nodeId1+nodeId2<<16, &dummy)) { 03655 add_a_connection(sections,ctx,nodeId1,nodeId2,opt_ndb_shm); 03656 } 03657 } 03658 } 03659 03660 for (i= 0; p_api_nodes.get("", i, &nodeId1); i++){ 03661 if(!p_connections.get("", nodeId1, &dummy)) { 03662 for (Uint32 j= 0;; j++){ 03663 if(!p_db_nodes.get("", j, &nodeId2)) break; 03664 add_a_connection(sections,ctx,nodeId1,nodeId2,opt_ndb_shm); 03665 } 03666 } 03667 } 03668 03669 for (i= 0; p_mgm_nodes.get("", i, &nodeId1); i++){ 03670 if(!p_connections.get("", nodeId1, &dummy)) { 03671 for (Uint32 j= 0;; j++){ 03672 if(!p_db_nodes.get("", j, &nodeId2)) break; 03673 add_a_connection(sections,ctx,nodeId1,nodeId2,0); 03674 } 03675 } 03676 } 03677 03678 DBUG_RETURN(true); 03679 }
Here is the call graph for this function:

| void applyDefaultValues | ( | InitConfigFileParser::Context & | ctx, | |
| const Properties * | defaults | |||
| ) |
Apply default values
Definition at line 2878 of file ConfigInfo.cpp.
References ConfigInfo::CI_BOOL, ConfigInfo::CI_INT, ConfigInfo::CI_INT64, ConfigInfo::CI_STRING, ctx, DBUG_ENTER, DBUG_PRINT, DBUG_VOID_RETURN, Properties::Iterator::first(), name, Properties::Iterator::next(), NULL, and require().
02880 { 02881 DBUG_ENTER("applyDefaultValues"); 02882 if(defaults != NULL){ 02883 Properties::Iterator it(defaults); 02884 02885 for(const char * name = it.first(); name != NULL; name = it.next()){ 02886 ConfigInfo::Status st = ctx.m_info->getStatus(ctx.m_currentInfo, name); 02887 if(!ctx.m_currentSection->contains(name)){ 02888 switch (ctx.m_info->getType(ctx.m_currentInfo, name)){ 02889 case ConfigInfo::CI_INT: 02890 case ConfigInfo::CI_BOOL:{ 02891 Uint32 val = 0; 02892 ::require(defaults->get(name, &val)); 02893 ctx.m_currentSection->put(name, val); 02894 DBUG_PRINT("info",("%s=%d #default",name,val)); 02895 break; 02896 } 02897 case ConfigInfo::CI_INT64:{ 02898 Uint64 val = 0; 02899 ::require(defaults->get(name, &val)); 02900 ctx.m_currentSection->put64(name, val); 02901 DBUG_PRINT("info",("%s=%lld #default",name,val)); 02902 break; 02903 } 02904 case ConfigInfo::CI_STRING:{ 02905 const char * val; 02906 ::require(defaults->get(name, &val)); 02907 ctx.m_currentSection->put(name, val); 02908 DBUG_PRINT("info",("%s=%s #default",name,val)); 02909 break; 02910 } 02911 case ConfigInfo::CI_SECTION: 02912 break; 02913 } 02914 } 02915 #ifndef DBUG_OFF 02916 else 02917 { 02918 switch (ctx.m_info->getType(ctx.m_currentInfo, name)){ 02919 case ConfigInfo::CI_INT: 02920 case ConfigInfo::CI_BOOL:{ 02921 Uint32 val = 0; 02922 ::require(ctx.m_currentSection->get(name, &val)); 02923 DBUG_PRINT("info",("%s=%d",name,val)); 02924 break; 02925 } 02926 case ConfigInfo::CI_INT64:{ 02927 Uint64 val = 0; 02928 ::require(ctx.m_currentSection->get(name, &val)); 02929 DBUG_PRINT("info",("%s=%lld",name,val)); 02930 break; 02931 } 02932 case ConfigInfo::CI_STRING:{ 02933 const char * val; 02934 ::require(ctx.m_currentSection->get(name, &val)); 02935 DBUG_PRINT("info",("%s=%s",name,val)); 02936 break; 02937 } 02938 case ConfigInfo::CI_SECTION: 02939 break; 02940 } 02941 } 02942 #endif 02943 } 02944 } 02945 DBUG_VOID_RETURN; 02946 }
Here is the call graph for this function:

| bool applyDefaultValues | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | ||||
| ) | [static] |
Definition at line 2949 of file ConfigInfo.cpp.
02949 { 02950 02951 if(strcmp(data, "user") == 0) 02952 applyDefaultValues(ctx, ctx.m_userDefaults); 02953 else if (strcmp(data, "system") == 0) 02954 applyDefaultValues(ctx, ctx.m_systemDefaults); 02955 else 02956 return false; 02957 02958 return true; 02959 }
Here is the call graph for this function:

| static bool check_node_vs_replicas | ( | Vector< ConfigInfo::ConfigRuleSection > & | sections, | |
| struct InitConfigFileParser::Context & | ctx, | |||
| const char * | rule_data | |||
| ) | [static] |
Definition at line 3690 of file ConfigInfo.cpp.
References BaseString::append(), BaseString::appfmt(), BaseString::assfmt(), BaseString::c_str(), ctx, DBUG_ASSERT, Properties::get(), host, BaseString::length(), Block_context::m_config, n, ndbout_c(), Properties::put(), Properties::remove(), and strcmp().
03693 { 03694 Uint32 db_nodes= 0; 03695 Uint32 replicas= 0; 03696 Uint32 db_host_count= 0; 03697 ctx.m_userProperties.get(DB_TOKEN, &db_nodes); 03698 ctx.m_userProperties.get("NoOfReplicas", &replicas); 03699 if((db_nodes % replicas) != 0){ 03700 ctx.reportError("Invalid no of db nodes wrt no of replicas.\n" 03701 "No of nodes must be dividable with no or replicas"); 03702 return false; 03703 } 03704 // check that node groups and arbitrators are ok 03705 // just issue warning if not 03706 if(replicas > 1){ 03707 Properties * props= ctx.m_config; 03708 Properties p_db_hosts(true); // store hosts which db nodes run on 03709 Properties p_arbitrators(true); // store hosts which arbitrators run on 03710 // arbitrator should not run together with db node on same host 03711 Uint32 i, n, group= 0, i_group= 0; 03712 Uint32 n_nodes; 03713 BaseString node_group_warning, arbitration_warning; 03714 const char *arbit_warn_fmt= 03715 "\n arbitrator with id %d and db node with id %d on same host %s"; 03716 const char *arbit_warn_fmt2= 03717 "\n arbitrator with id %d has no hostname specified"; 03718 03719 ctx.m_userProperties.get("NoOfNodes", &n_nodes); 03720 for (i= 0, n= 0; n < n_nodes; i++){ 03721 const Properties * tmp; 03722 if(!props->get("Node", i, &tmp)) continue; 03723 n++; 03724 03725 const char * type; 03726 if(!tmp->get("Type", &type)) continue; 03727 03728 const char* host= 0; 03729 tmp->get("HostName", &host); 03730 03731 if (strcmp(type,DB_TOKEN) == 0) 03732 { 03733 { 03734 Uint32 ii; 03735 if (!p_db_hosts.get(host,&ii)) 03736 db_host_count++; 03737 p_db_hosts.put(host,i); 03738 if (p_arbitrators.get(host,&ii)) 03739 { 03740 arbitration_warning.appfmt(arbit_warn_fmt, ii, i, host); 03741 p_arbitrators.remove(host); // only one warning per db node 03742 } 03743 } 03744 { 03745 unsigned j; 03746 BaseString str, str2; 03747 str.assfmt("#group%d_",group); 03748 p_db_hosts.put(str.c_str(),i_group,host); 03749 str2.assfmt("##group%d_",group); 03750 p_db_hosts.put(str2.c_str(),i_group,i); 03751 for (j= 0; j < i_group; j++) 03752 { 03753 const char *other_host; 03754 p_db_hosts.get(str.c_str(),j,&other_host); 03755 if (strcmp(host,other_host) == 0) { 03756 unsigned int other_i, c= 0; 03757 p_db_hosts.get(str2.c_str(),j,&other_i); 03758 p_db_hosts.get(str.c_str(),&c); 03759 if (c == 0) // first warning in this node group 03760 node_group_warning.appfmt(" Node group %d", group); 03761 c|= 1 << j; 03762 p_db_hosts.put(str.c_str(),c); 03763 03764 node_group_warning.appfmt(",\n db node with id %d and id %d " 03765 "on same host %s", other_i, i, host); 03766 } 03767 } 03768 i_group++; 03769 DBUG_ASSERT(i_group <= replicas); 03770 if (i_group == replicas) 03771 { 03772 unsigned c= 0; 03773 p_db_hosts.get(str.c_str(),&c); 03774 if (c+1 == (1u << (replicas-1))) // all nodes on same machine 03775 node_group_warning.append(".\n Host failure will " 03776 "cause complete cluster shutdown."); 03777 else if (c > 0) 03778 node_group_warning.append(".\n Host failure may " 03779 "cause complete cluster shutdown."); 03780 group++; 03781 i_group= 0; 03782 } 03783 } 03784 } 03785 else if (strcmp(type,API_TOKEN) == 0 || 03786 strcmp(type,MGM_TOKEN) == 0) 03787 { 03788 Uint32 rank; 03789 if(tmp->get("ArbitrationRank", &rank) && rank > 0) 03790 { 03791 if(host && host[0] != 0) 03792 { 03793 Uint32 ii; 03794 p_arbitrators.put(host,i); 03795 if (p_db_hosts.get(host,&ii)) 03796 { 03797 arbitration_warning.appfmt(arbit_warn_fmt, i, ii, host); 03798 } 03799 } 03800 else 03801 { 03802 arbitration_warning.appfmt(arbit_warn_fmt2, i); 03803 } 03804 } 03805 } 03806 } 03807 if (db_host_count > 1 && node_group_warning.length() > 0) 03808 ndbout_c("Cluster configuration warning:\n%s",node_group_warning.c_str()); 03809 if (db_host_count > 1 && arbitration_warning.length() > 0) 03810 ndbout_c("Cluster configuration warning:%s%s",arbitration_warning.c_str(), 03811 "\n Running arbitrator on the same host as a database node may" 03812 "\n cause complete cluster shutdown in case of host failure."); 03813 } 03814 return true; 03815 }
Here is the call graph for this function:

| static bool checkConnectionConstraints | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | ||||
| ) | [static] |
Connection rule: Check varius constraints
Report error if the following are true
Definition at line 3275 of file ConfigInfo.cpp.
References ctx, Properties::get(), Block_context::m_config, require(), and strcmp().
03275 { 03276 03277 Uint32 id1 = 0, id2 = 0; 03278 ctx.m_currentSection->get("NodeId1", &id1); 03279 ctx.m_currentSection->get("NodeId2", &id2); 03280 03281 if(id1 == id2){ 03282 ctx.reportError("Illegal connection from node to itself" 03283 " - [%s] starting at line: %d", 03284 ctx.fname, ctx.m_sectionLineno); 03285 return false; 03286 } 03287 03288 const Properties * node1; 03289 if(!ctx.m_config->get("Node", id1, &node1)){ 03290 ctx.reportError("Connection refering to undefined node: %d" 03291 " - [%s] starting at line: %d", 03292 id1, ctx.fname, ctx.m_sectionLineno); 03293 return false; 03294 } 03295 03296 const Properties * node2; 03297 if(!ctx.m_config->get("Node", id2, &node2)){ 03298 ctx.reportError("Connection refering to undefined node: %d" 03299 " - [%s] starting at line: %d", 03300 id2, ctx.fname, ctx.m_sectionLineno); 03301 return false; 03302 } 03303 03304 const char * type1; 03305 const char * type2; 03306 require(node1->get("Type", &type1)); 03307 require(node2->get("Type", &type2)); 03308 03314 if((strcmp(type1, DB_TOKEN) != 0 && strcmp(type2, DB_TOKEN) != 0) && 03315 !(strcmp(type1, MGM_TOKEN) == 0 && strcmp(type2, MGM_TOKEN) == 0)) 03316 { 03317 ctx.reportError("Invalid connection between node %d (%s) and node %d (%s)" 03318 " - [%s] starting at line: %d", 03319 id1, type1, id2, type2, 03320 ctx.fname, ctx.m_sectionLineno); 03321 return false; 03322 } 03323 03324 return true; 03325 }
Here is the call graph for this function:

| bool checkConnectionSupport | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | data | |||
| ) | [static] |
Connection rule: Check support of connection
Definition at line 2776 of file ConfigInfo.cpp.
References ctx, error, and strcasecmp.
02777 { 02778 int error= 0; 02779 if (strcasecmp("TCP",ctx.fname) == 0) 02780 { 02781 // always enabled 02782 } 02783 else if (strcasecmp("SHM",ctx.fname) == 0) 02784 { 02785 #ifndef NDB_SHM_TRANSPORTER 02786 error= 1; 02787 #endif 02788 } 02789 else if (strcasecmp("SCI",ctx.fname) == 0) 02790 { 02791 #ifndef NDB_SCI_TRANSPORTER 02792 error= 1; 02793 #endif 02794 } 02795 else if (strcasecmp("OSE",ctx.fname) == 0) 02796 { 02797 #ifndef NDB_OSE_TRANSPORTER 02798 error= 1; 02799 #endif 02800 } 02801 if (error) 02802 { 02803 ctx.reportError("Binary not compiled with this connection support, " 02804 "[%s] starting at line: %d", 02805 ctx.fname, ctx.m_sectionLineno); 02806 return false; 02807 } 02808 return true; 02809 }
| static bool checkDbConstraints | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | ||||
| ) | [static] |
DB Node rule: Check various constraints
Definition at line 3242 of file ConfigInfo.cpp.
References ctx.
03242 { 03243 03244 Uint32 t1 = 0, t2 = 0; 03245 ctx.m_currentSection->get("MaxNoOfConcurrentOperations", &t1); 03246 ctx.m_currentSection->get("MaxNoOfConcurrentTransactions", &t2); 03247 03248 if (t1 < t2) { 03249 ctx.reportError("MaxNoOfConcurrentOperations must be greater than " 03250 "MaxNoOfConcurrentTransactions - [%s] starting at line: %d", 03251 ctx.fname, ctx.m_sectionLineno); 03252 return false; 03253 } 03254 03255 Uint32 replicas = 0, otherReplicas; 03256 ctx.m_currentSection->get("NoOfReplicas", &replicas); 03257 if(ctx.m_userProperties.get("NoOfReplicas", &otherReplicas)){ 03258 if(replicas != otherReplicas){ 03259 ctx.reportError("NoOfReplicas defined differently on different nodes" 03260 " - [%s] starting at line: %d", 03261 ctx.fname, ctx.m_sectionLineno); 03262 return false; 03263 } 03264 } else { 03265 ctx.m_userProperties.put("NoOfReplicas", replicas); 03266 } 03267 03268 return true; 03269 }
| static bool checkLocalhostHostnameMix | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | data | |||
| ) | [static] |
Definition at line 2677 of file ConfigInfo.cpp.
References ctx, DBUG_ENTER, DBUG_RETURN, and strcmp().
Referenced by fixNodeHostname(), and transformComputer().
02678 { 02679 DBUG_ENTER("checkLocalhostHostnameMix"); 02680 const char * hostname= 0; 02681 ctx.m_currentSection->get("HostName", &hostname); 02682 if (hostname == 0 || hostname[0] == 0) 02683 DBUG_RETURN(true); 02684 02685 Uint32 localhost_used= 0; 02686 if(!strcmp(hostname, "localhost") || !strcmp(hostname, "127.0.0.1")){ 02687 localhost_used= 1; 02688 ctx.m_userProperties.put("$computer-localhost-used", localhost_used); 02689 if(!ctx.m_userProperties.get("$computer-localhost", &hostname)) 02690 DBUG_RETURN(true); 02691 } else { 02692 ctx.m_userProperties.get("$computer-localhost-used", &localhost_used); 02693 ctx.m_userProperties.put("$computer-localhost", hostname); 02694 } 02695 02696 if (localhost_used) { 02697 ctx.reportError("Mixing of localhost (default for [NDBD]HostName) with other hostname(%s) is illegal", 02698 hostname); 02699 DBUG_RETURN(false); 02700 } 02701 02702 DBUG_RETURN(true); 02703 }
Here is the call graph for this function:

Here is the caller graph for this function:

| bool checkMandatory | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | data | |||
| ) | [static] |
Check that a section contains all MANDATORY parameters
Definition at line 2965 of file ConfigInfo.cpp.
References ctx, Properties::Iterator::first(), info, name, Properties::Iterator::next(), NULL, and require().
02965 { 02966 02967 Properties::Iterator it(ctx.m_currentInfo); 02968 for(const char * name = it.first(); name != NULL; name = it.next()){ 02969 const Properties * info = NULL; 02970 ::require(ctx.m_currentInfo->get(name, &info)); 02971 Uint32 val; 02972 if(info->get("Mandatory", &val)){ 02973 const char * fname; 02974 ::require(info->get("Fname", &fname)); 02975 if(!ctx.m_currentSection->contains(fname)){ 02976 ctx.reportError("Mandatory parameter %s missing from section " 02977 "[%s] starting at line: %d", 02978 fname, ctx.fname, ctx.m_sectionLineno); 02979 return false; 02980 } 02981 } 02982 } 02983 return true; 02984 }
Here is the call graph for this function:

| static bool checkTCPConstraints | ( | InitConfigFileParser::Context & | , | |
| const char * | ||||
| ) | [static] |
Definition at line 3328 of file ConfigInfo.cpp.
References ctx, host, Ndb_getInAddr(), and strlen().
03328 { 03329 03330 const char * host; 03331 struct in_addr addr; 03332 if(ctx.m_currentSection->get(data, &host) && strlen(host) && 03333 Ndb_getInAddr(&addr, host)){ 03334 ctx.reportError("Unable to lookup/illegal hostname %s" 03335 " - [%s] starting at line: %d", 03336 host, ctx.fname, ctx.m_sectionLineno); 03337 return false; 03338 } 03339 return true; 03340 }
Here is the call graph for this function:

| bool fixBackupDataDir | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | data | |||
| ) | [static] |
Definition at line 2757 of file ConfigInfo.cpp.
References ctx, path, and require().
02757 { 02758 02759 const char * path; 02760 if (ctx.m_currentSection->get("BackupDataDir", &path)) 02761 return true; 02762 02763 if (ctx.m_currentSection->get("FileSystemPath", &path)) { 02764 require(ctx.m_currentSection->put("BackupDataDir", path)); 02765 return true; 02766 } 02767 02768 require(false); 02769 return false; 02770 }
Here is the call graph for this function:

| static bool fixDepricated | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | ||||
| ) | [static] |
Definition at line 3392 of file ConfigInfo.cpp.
References ctx, f_deprication, Properties::Iterator::first(), Properties::get(), Properties::getTypeOf(), name, Properties::Iterator::next(), NULL, p, PropertiesType_char, PropertiesType_Properties, PropertiesType_Uint32, PropertiesType_Uint64, require(), strcasecmp, strcmp(), and transform().
03392 { 03393 const char * name; 03398 Properties tmp(true); 03399 Properties::Iterator it(ctx.m_currentSection); 03400 for (name = it.first(); name != NULL; name = it.next()) { 03401 const DepricationTransform * p = &f_deprication[0]; 03402 while(p->m_section != 0){ 03403 if(strcmp(p->m_section, ctx.fname) == 0){ 03404 double mul = p->m_mul; 03405 double add = p->m_add; 03406 if(strcasecmp(name, p->m_oldName) == 0){ 03407 if(!transform(ctx, tmp, name, p->m_newName, add, mul)){ 03408 return false; 03409 } 03410 } else if(strcasecmp(name, p->m_newName) == 0) { 03411 if(!transform(ctx, tmp, name, p->m_oldName, -add/mul,1.0/mul)){ 03412 return false; 03413 } 03414 } 03415 } 03416 p++; 03417 } 03418 } 03419 03420 Properties::Iterator it2(&tmp); 03421 for (name = it2.first(); name != NULL; name = it2.next()) { 03422 PropertiesType type; 03423 require(tmp.getTypeOf(name, &type)); 03424 switch(type){ 03425 case PropertiesType_Uint32:{ 03426 Uint32 val; 03427 require(tmp.get(name, &val)); 03428 ::require(ctx.m_currentSection->put(name, val)); 03429 break; 03430 } 03431 case PropertiesType_char:{ 03432 const char * val; 03433 require(tmp.get(name, &val)); 03434 ::require(ctx.m_currentSection->put(name, val)); 03435 break; 03436 } 03437 case PropertiesType_Uint64:{ 03438 Uint64 val; 03439 require(tmp.get(name, &val)); 03440 ::require(ctx.m_currentSection->put64(name, val)); 03441 break; 03442 } 03443 case PropertiesType_Properties: 03444 default: 03445 ::require(false); 03446 } 03447 } 03448 return true; 03449 }
Here is the call graph for this function:

| bool fixFileSystemPath | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | data | |||
| ) | [static] |
Definition at line 2740 of file ConfigInfo.cpp.
References ctx, DBUG_ENTER, DBUG_RETURN, path, and require().
02740 { 02741 DBUG_ENTER("fixFileSystemPath"); 02742 02743 const char * path; 02744 if (ctx.m_currentSection->get("FileSystemPath", &path)) 02745 DBUG_RETURN(true); 02746 02747 if (ctx.m_currentSection->get("DataDir", &path)) { 02748 require(ctx.m_currentSection->put("FileSystemPath", path)); 02749 DBUG_RETURN(true); 02750 } 02751 02752 require(false); 02753 DBUG_RETURN(false); 02754 }
Here is the call graph for this function:

| static bool fixHostname | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | data | |||
| ) | [static] |
Connection rule: Fix hostname
Unless Hostname is not already specified, do steps:
Definition at line 3031 of file ConfigInfo.cpp.
References buf, ctx, Block_context::m_config, and require().
03031 { 03032 03033 char buf[] = "NodeIdX"; buf[6] = data[sizeof("HostNam")]; 03034 char sysbuf[] = "SystemX"; sysbuf[6] = data[sizeof("HostNam")]; 03035 03036 if(!ctx.m_currentSection->contains(data)){ 03037 Uint32 id = 0; 03038 require(ctx.m_currentSection->get(buf, &id)); 03039 03040 const Properties * node; 03041 if(!ctx.m_config->get("Node", id, &node)) 03042 { 03043 ctx.reportError("Unknown node: \"%d\" specified in connection " 03044 "[%s] starting at line: %d", 03045 id, ctx.fname, ctx.m_sectionLineno); 03046 return false; 03047 } 03048 03049 const char * hostname; 03050 require(node->get("HostName", &hostname)); 03051 require(ctx.m_currentSection->put(data, hostname)); 03052 } 03053 return true; 03054 }
Here is the call graph for this function:

| bool fixNodeHostname | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | data | |||
| ) | [static] |
Definition at line 2706 of file ConfigInfo.cpp.
References checkLocalhostHostnameMix(), ctx, DBUG_ENTER, DBUG_RETURN, Properties::get(), require(), and BaseString::snprintf().
02707 { 02708 const char * hostname; 02709 DBUG_ENTER("fixNodeHostname"); 02710 02711 if (ctx.m_currentSection->get("HostName", &hostname)) 02712 DBUG_RETURN(checkLocalhostHostnameMix(ctx,0)); 02713 02714 const char * compId; 02715 if(!ctx.m_currentSection->get("ExecuteOnComputer", &compId)) 02716 DBUG_RETURN(true); 02717 02718 const Properties * computer; 02719 char tmp[255]; 02720 BaseString::snprintf(tmp, sizeof(tmp), "Computer_%s", compId); 02721 if(!ctx.m_config->get(tmp, &computer)){ 02722 ctx.reportError("Computer \"%s\" not declared" 02723 "- [%s] starting at line: %d", 02724 compId, ctx.fname, ctx.m_sectionLineno); 02725 DBUG_RETURN(false); 02726 } 02727 02728 if(!computer->get("HostName", &hostname)){ 02729 ctx.reportError("HostName missing in [COMPUTER] (Id: %d) " 02730 " - [%s] starting at line: %d", 02731 compId, ctx.fname, ctx.m_sectionLineno); 02732 DBUG_RETURN(false); 02733 } 02734 02735 require(ctx.m_currentSection->put("HostName", hostname)); 02736 DBUG_RETURN(checkLocalhostHostnameMix(ctx,0)); 02737 }
Here is the call graph for this function:

| static bool fixNodeId | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | data | |||
| ) | [static] |
Connection rule: Fix node id
Transform a string "NodeidX" (e.g. "uppsala.32") into a Uint32 "NodeIdX" (e.g. 32) and a string "SystemX" (e.g. "uppsala").
Definition at line 2992 of file ConfigInfo.cpp.
References buf, ctx, errno, id, MAX_LINE_LENGTH, NULL, p, require(), strtol(), and yaSSL::warning.
02993 { 02994 char buf[] = "NodeIdX"; buf[6] = data[sizeof("NodeI")]; 02995 char sysbuf[] = "SystemX"; sysbuf[6] = data[sizeof("NodeI")]; 02996 const char* nodeId; 02997 require(ctx.m_currentSection->get(buf, &nodeId)); 02998 02999 char tmpLine[MAX_LINE_LENGTH]; 03000 strncpy(tmpLine, nodeId, MAX_LINE_LENGTH); 03001 char* token1 = strtok(tmpLine, "."); 03002 char* token2 = strtok(NULL, "."); 03003 Uint32 id; 03004 03005 if (token2 == NULL) { // Only a number given 03006 errno = 0; 03007 char* p; 03008 id = strtol(token1, &p, 10); 03009 if (errno != 0) warning("STRTOK1", nodeId); 03010 require(ctx.m_currentSection->put(buf, id, true)); 03011 } else { // A pair given (e.g. "uppsala.32") 03012 errno = 0; 03013 char* p; 03014 id = strtol(token2, &p, 10); 03015 if (errno != 0) warning("STRTOK2", nodeId); 03016 require(ctx.m_currentSection->put(buf, id, true)); 03017 require(ctx.m_currentSection->put(sysbuf, token1)); 03018 } 03019 return true; 03020 }
Here is the call graph for this function:

| static bool fixPortNumber | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | data | |||
| ) | [static] |
Connection rule: Fix port number (using a port number adder)
Definition at line 3060 of file ConfigInfo.cpp.
References BaseString::append(), BaseString::c_str(), ctx, DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, Properties::get(), Block_context::m_config, NDB_TCP_BASE_PORT, ndbout(), port, require(), strcmp(), and strtoll.
03060 { 03061 03062 DBUG_ENTER("fixPortNumber"); 03063 03064 Uint32 id1, id2; 03065 const char *hostName1; 03066 const char *hostName2; 03067 require(ctx.m_currentSection->get("NodeId1", &id1)); 03068 require(ctx.m_currentSection->get("NodeId2", &id2)); 03069 require(ctx.m_currentSection->get("HostName1", &hostName1)); 03070 require(ctx.m_currentSection->get("HostName2", &hostName2)); 03071 DBUG_PRINT("info",("NodeId1=%d HostName1=\"%s\"",id1,hostName1)); 03072 DBUG_PRINT("info",("NodeId2=%d HostName2=\"%s\"",id2,hostName2)); 03073 03074 const Properties *node1, *node2; 03075 require(ctx.m_config->get("Node", id1, &node1)); 03076 require(ctx.m_config->get("Node", id2, &node2)); 03077 03078 const char *type1, *type2; 03079 require(node1->get("Type", &type1)); 03080 require(node2->get("Type", &type2)); 03081 03082 /* add NodeIdServer info */ 03083 { 03084 Uint32 nodeIdServer = id1 < id2 ? id1 : id2; 03085 if(strcmp(type1, API_TOKEN) == 0 || strcmp(type2, MGM_TOKEN) == 0) 03086 nodeIdServer = id2; 03087 else if(strcmp(type2, API_TOKEN) == 0 || strcmp(type1, MGM_TOKEN) == 0) 03088 nodeIdServer = id1; 03089 ctx.m_currentSection->put("NodeIdServer", nodeIdServer); 03090 03091 if (id2 == nodeIdServer) { 03092 { 03093 const char *tmp= hostName1; 03094 hostName1= hostName2; 03095 hostName2= tmp; 03096 } 03097 { 03098 Uint32 tmp= id1; 03099 id1= id2; 03100 id2= tmp; 03101 } 03102 { 03103 const Properties *tmp= node1; 03104 node1= node2; 03105 node2= tmp; 03106 } 03107 { 03108 const char *tmp= type1; 03109 type1= type2; 03110 type2= tmp; 03111 } 03112 } 03113 } 03114 03115 BaseString hostname(hostName1); 03116 03117 if (hostname.c_str()[0] == 0) { 03118 ctx.reportError("Hostname required on nodeid %d since it will " 03119 "act as server.", id1); 03120 DBUG_RETURN(false); 03121 } 03122 03123 Uint32 port= 0; 03124 if(strcmp(type1, MGM_TOKEN)==0) 03125 node1->get("PortNumber",&port); 03126 else if(strcmp(type2, MGM_TOKEN)==0) 03127 node2->get("PortNumber",&port); 03128 03129 if (!port && 03130 !node1->get("ServerPort", &port) && 03131 !ctx.m_userProperties.get("ServerPort_", id1, &port)) 03132 { 03133 Uint32 base= 0; 03134 /* 03135 * If the connection doesn't involve an mgm server, 03136 * and a default port number has been set, behave the old 03137 * way of allocating port numbers for transporters. 03138 */ 03139 if(ctx.m_userDefaults && ctx.m_userDefaults->get("PortNumber", &base)) 03140 { 03141 Uint32 adder= 0; 03142 { 03143 BaseString server_port_adder(hostname); 03144 server_port_adder.append("_ServerPortAdder"); 03145 ctx.m_userProperties.get(server_port_adder.c_str(), &adder); 03146 ctx.m_userProperties.put(server_port_adder.c_str(), adder+1, true); 03147 } 03148 03149 if (!ctx.m_userProperties.get("ServerPortBase", &base)){ 03150 if(!(ctx.m_userDefaults && 03151 ctx.m_userDefaults->get("PortNumber", &base)) && 03152 !ctx.m_systemDefaults->get("PortNumber", &base)) { 03153 base= strtoll(NDB_TCP_BASE_PORT,0,0); 03154 } 03155 ctx.m_userProperties.put("ServerPortBase", base); 03156 } 03157 03158 port= base + adder; 03159 ctx.m_userProperties.put("ServerPort_", id1, port); 03160 } 03161 } 03162 03163 if(ctx.m_currentSection->contains("PortNumber")) { 03164 ndbout << "PortNumber should no longer be specificied " 03165 << "per connection, please remove from config. " 03166 << "Will be changed to " << port << endl; 03167 ctx.m_currentSection->put("PortNumber", port, true); 03168 } 03169 else 03170 { 03171 ctx.m_currentSection->put("PortNumber", port); 03172 } 03173 03174 DBUG_PRINT("info", ("connection %d-%d port %d host %s", 03175 id1, id2, port, hostname.c_str())); 03176 03177 DBUG_RETURN(true); 03178 }
Here is the call graph for this function:

| static bool fixShmKey | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | ||||
| ) | [static] |
Definition at line 3197 of file ConfigInfo.cpp.
References ctx, DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, int(), key, OPT_NDB_SHM_SIGNUM_DEFAULT, and require().
03198 { 03199 DBUG_ENTER("fixShmKey"); 03200 { 03201 static int last_signum= -1; 03202 Uint32 signum; 03203 if(!ctx.m_currentSection->get("Signum", &signum)) 03204 { 03205 signum= OPT_NDB_SHM_SIGNUM_DEFAULT; 03206 if (signum <= 0) 03207 { 03208 ctx.reportError("Unable to set default parameter for [SHM]Signum" 03209 " please specify [SHM DEFAULT]Signum"); 03210 return false; 03211 } 03212 ctx.m_currentSection->put("Signum", signum); 03213 DBUG_PRINT("info",("Added Signum=%u", signum)); 03214 } 03215 if ( last_signum != (int)signum && last_signum >= 0 ) 03216 { 03217 ctx.reportError("All shared memory transporters must have same [SHM]Signum defined." 03218 " Use [SHM DEFAULT]Signum"); 03219 return false; 03220 } 03221 last_signum= (int)signum; 03222 } 03223 { 03224 Uint32 id1= 0, id2= 0, key= 0; 03225 require(ctx.m_currentSection->get("NodeId1", &id1)); 03226 require(ctx.m_currentSection->get("NodeId2", &id2)); 03227 if(!ctx.m_currentSection->get("ShmKey", &key)) 03228 { 03229 require(ctx.m_userProperties.get("ShmUniqueId", &key)); 03230 key= key << 16 | (id1 > id2 ? id1 << 8 | id2 : id2 << 8 | id1); 03231 ctx.m_currentSection->put("ShmKey", key); 03232 DBUG_PRINT("info",("Added ShmKey=0x%x", key)); 03233 } 03234 } 03235 DBUG_RETURN(true); 03236 }
Here is the call graph for this function:

| static bool fixShmUniqueId | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | data | |||
| ) | [static] |
Definition at line 3181 of file ConfigInfo.cpp.
References atoi(), ctx, DBUG_ENTER, DBUG_RETURN, and NDB_PORT.
03182 { 03183 DBUG_ENTER("fixShmUniqueId"); 03184 Uint32 nodes= 0; 03185 ctx.m_userProperties.get(ctx.fname, &nodes); 03186 if (nodes == 1) // first management server 03187 { 03188 Uint32 portno= atoi(NDB_PORT); 03189 ctx.m_currentSection->get("PortNumber", &portno); 03190 ctx.m_userProperties.put("ShmUniqueId", portno); 03191 } 03192 DBUG_RETURN(true); 03193 }
Here is the call graph for this function:

| static Uint64 getInfoInt | ( | const Properties * | section, | |
| const char * | fname, | |||
| const char * | type | |||
| ) | [static] |
Definition at line 2442 of file ConfigInfo.cpp.
References Properties::get(), p, Properties::print(), and yaSSL::warning.
Referenced by ConfigInfo::getDefault(), ConfigInfo::getMax(), ConfigInfo::getMin(), ConfigInfo::getStatus(), ConfigInfo::getType(), and ConfigInfo::verify().
02443 { 02444 Uint32 val32; 02445 const Properties * p; 02446 if (section->get(fname, &p) && p->get(type, &val32)) { 02447 return val32; 02448 } 02449 02450 Uint64 val64; 02451 if(p && p->get(type, &val64)){ 02452 return val64; 02453 } 02454 02455 section->print(); 02456 if(section->get(fname, &p)){ 02457 p->print(); 02458 } 02459 02460 warning(type, fname); 02461 return 0; 02462 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static const char* getInfoString | ( | const Properties * | section, | |
| const char * | fname, | |||
| const char * | type | |||
| ) | [static] |
Definition at line 2466 of file ConfigInfo.cpp.
References Properties::get(), p, and yaSSL::warning.
Referenced by ConfigInfo::getDescription().
02467 { 02468 const char* val; 02469 const Properties * p; 02470 if (section->get(fname, &p) && p->get(type, &val)) { 02471 return val; 02472 } 02473 warning(type, fname); 02474 return val; 02475 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void require | ( | bool | v | ) | [static] |
| static bool sanity_checks | ( | Vector< ConfigInfo::ConfigRuleSection > & | sections, | |
| struct InitConfigFileParser::Context & | ctx, | |||
| const char * | rule_data | |||
| ) | [static] |
Definition at line 3538 of file ConfigInfo.cpp.
References ctx.
03541 { 03542 Uint32 db_nodes = 0; 03543 Uint32 mgm_nodes = 0; 03544 Uint32 api_nodes = 0; 03545 if (!ctx.m_userProperties.get("DB", &db_nodes)) { 03546 ctx.reportError("At least one database node should be defined in config file"); 03547 return false; 03548 } 03549 if (!ctx.m_userProperties.get("MGM", &mgm_nodes)) { 03550 ctx.reportError("At least one management server node should be defined in config file"); 03551 return false; 03552 } 03553 if (!ctx.m_userProperties.get("API", &api_nodes)) { 03554 ctx.reportError("At least one application node (for the mysqld) should be defined in config file"); 03555 return false; 03556 } 03557 return true; 03558 }
| static bool saveInConfigValues | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | ||||
| ) | [static] |
Definition at line 3454 of file ConfigInfo.cpp.
References CFG_TYPE_OF_SECTION, ConfigInfo::CI_INTERNAL, ctx, Properties::Iterator::first(), id, info, KEY_INTERNAL, n, ConfigInfo::nameToAlias(), ndbout_c(), Properties::Iterator::next(), NULL, ok(), PropertiesType_char, PropertiesType_Uint32, PropertiesType_Uint64, require(), sec, and status.
03454 { 03455 const Properties * sec; 03456 if(!ctx.m_currentInfo->get(ctx.fname, &sec)){ 03457 require(false); 03458 return false; 03459 } 03460 03461 do { 03462 const char *secName; 03463 Uint32 id, status, typeVal; 03464 require(sec->get("Fname", &secName)); 03465 require(sec->get("Id", &id)); 03466 require(sec->get("Status", &status)); 03467 require(sec->get("SectionType", &typeVal)); 03468 03469 if(id == KEY_INTERNAL || status == ConfigInfo::CI_INTERNAL){ 03470 ndbout_c("skipping section %s", ctx.fname); 03471 break; 03472 } 03473 03474 if (g_print_full_config) 03475 { 03476 const char *alias= ConfigInfo::nameToAlias(ctx.fname); 03477 printf("[%s]\n", alias ? alias : ctx.fname); 03478 } 03479 03480 Uint32 no = 0; 03481 ctx.m_userProperties.get("$Section", id, &no); 03482 ctx.m_userProperties.put("$Section", id, no+1, true); 03483 03484 ctx.m_configValues.openSection(id, no); 03485 ctx.m_configValues.put(CFG_TYPE_OF_SECTION, typeVal); 03486 03487 Properties::Iterator it(ctx.m_currentSection); 03488 for (const char* n = it.first(); n != NULL; n = it.next()) { 03489 const Properties * info; 03490 if(!ctx.m_currentInfo->get(n, &info)) 03491 continue; 03492 03493 Uint32 id = 0; 03494 info->get("Id", &id); 03495 03496 if(id == KEY_INTERNAL) 03497 continue; 03498 03499 bool ok = true; 03500 PropertiesType type; 03501 require(ctx.m_currentSection->getTypeOf(n, &type)); 03502 switch(type){ 03503 case PropertiesType_Uint32:{ 03504 Uint32 val; 03505 require(ctx.m_currentSection->get(n, &val)); 03506 ok = ctx.m_configValues.put(id, val); 03507 if (g_print_full_config) 03508 printf("%s=%u\n", n, val); 03509 break; 03510 } 03511 case PropertiesType_Uint64:{ 03512 Uint64 val; 03513 require(ctx.m_currentSection->get(n, &val)); 03514 ok = ctx.m_configValues.put64(id, val); 03515 if (g_print_full_config) 03516 printf("%s=%llu\n", n, val); 03517 break; 03518 } 03519 case PropertiesType_char:{ 03520 const char * val; 03521 require(ctx.m_currentSection->get(n, &val)); 03522 ok = ctx.m_configValues.put(id, val); 03523 if (g_print_full_config) 03524 printf("%s=%s\n", n, val); 03525 break; 03526 } 03527 default: 03528 require(false); 03529 } 03530 require(ok); 03531 } 03532 ctx.m_configValues.closeSection(); 03533 } while(0); 03534 return true; 03535 }
Here is the call graph for this function:

| static bool set_connection_priorities | ( | Vector< ConfigInfo::ConfigRuleSection > & | sections, | |
| struct InitConfigFileParser::Context & | ctx, | |||
| const char * | rule_data | |||
| ) | [static] |
Definition at line 3681 of file ConfigInfo.cpp.
References DBUG_ENTER, and DBUG_RETURN.
03684 { 03685 DBUG_ENTER("set_connection_priorities"); 03686 DBUG_RETURN(true); 03687 }
| static bool transform | ( | InitConfigFileParser::Context & | ctx, | |
| Properties & | dst, | |||
| const char * | oldName, | |||
| const char * | newName, | |||
| double | add, | |||
| double | mul | |||
| ) | [static] |
Definition at line 3344 of file ConfigInfo.cpp.
References ConfigInfo::CI_BOOL, ConfigInfo::CI_INT, ConfigInfo::CI_INT64, ctx, int(), ndbout(), PropertiesType_Uint32, PropertiesType_Uint64, Properties::put(), Properties::put64(), and require().
Referenced by fixDepricated().
03348 { 03349 03350 if(ctx.m_currentSection->contains(newName)){ 03351 ctx.reportError("Both %s and %s specified" 03352 " - [%s] starting at line: %d", 03353 oldName, newName, 03354 ctx.fname, ctx.m_sectionLineno); 03355 return false; 03356 } 03357 03358 PropertiesType oldType; 03359 require(ctx.m_currentSection->getTypeOf(oldName, &oldType)); 03360 ConfigInfo::Type newType = ctx.m_info->getType(ctx.m_currentInfo, newName); 03361 03362 if(!((oldType == PropertiesType_Uint32 || oldType == PropertiesType_Uint64) 03363 && (newType == ConfigInfo::CI_INT || newType == ConfigInfo::CI_INT64 || newType == ConfigInfo::CI_BOOL))){ 03364 ndbout << "oldType: " << (int)oldType << ", newType: " << (int)newType << endl; 03365 ctx.reportError("Unable to handle type conversion w.r.t deprication %s %s" 03366 "- [%s] starting at line: %d", 03367 oldName, newName, 03368 ctx.fname, ctx.m_sectionLineno); 03369 return false; 03370 } 03371 Uint64 oldVal; 03372 require(ctx.m_currentSection->get(oldName, &oldVal)); 03373 03374 Uint64 newVal = (Uint64)((Int64)oldVal * mul + add); 03375 if(!ctx.m_info->verify(ctx.m_currentInfo, newName, newVal)){ 03376 ctx.reportError("Unable to handle deprication, new value not within bounds" 03377 "%s %s - [%s] starting at line: %d", 03378 oldName, newName, 03379 ctx.fname, ctx.m_sectionLineno); 03380 return false; 03381 } 03382 03383 if(newType == ConfigInfo::CI_INT || newType == ConfigInfo::CI_BOOL){ 03384 require(dst.put(newName, (Uint32)newVal)); 03385 } else if(newType == ConfigInfo::CI_INT64) { 03386 require(dst.put64(newName, newVal)); 03387 } 03388 return true; 03389 }
Here is the call graph for this function:

Here is the caller graph for this function:

| bool transformComputer | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | data | |||
| ) | [static] |
Computer rule: Update "NoOfComputers", add "Type"
Definition at line 2851 of file ConfigInfo.cpp.
References checkLocalhostHostnameMix(), ctx, id, and BaseString::snprintf().
02851 { 02852 const char * id; 02853 if(!ctx.m_currentSection->get("Id", &id)){ 02854 ctx.reportError("Mandatory parameter Id missing from section " 02855 "[%s] starting at line: %d", 02856 ctx.fname, ctx.m_sectionLineno); 02857 return false; 02858 } 02859 BaseString::snprintf(ctx.pname, sizeof(ctx.pname), "Computer_%s", id); 02860 02861 Uint32 computers = 0; 02862 ctx.m_userProperties.get("NoOfComputers", &computers); 02863 ctx.m_userProperties.put("NoOfComputers", ++computers, true); 02864 02865 const char * hostname = 0; 02866 ctx.m_currentSection->get("HostName", &hostname); 02867 if(!hostname){ 02868 return true; 02869 } 02870 02871 return checkLocalhostHostnameMix(ctx,0); 02872 }
Here is the call graph for this function:

| bool transformConnection | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | data | |||
| ) | [static] |
Connection rule: Update "NoOfConnections"
Definition at line 2815 of file ConfigInfo.cpp.
References ctx, and BaseString::snprintf().
02816 { 02817 Uint32 connections = 0; 02818 ctx.m_userProperties.get("NoOfConnections", &connections); 02819 BaseString::snprintf(ctx.pname, sizeof(ctx.pname), "Connection_%d", connections); 02820 ctx.m_userProperties.put("NoOfConnections", ++connections, true); 02821 02822 ctx.m_currentSection->put("Type", ctx.fname); 02823 return true; 02824 }
Here is the call graph for this function:

| bool transformNode | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | data | |||
| ) | [static] |
Node rule: Add "Type" and update "NoOfNodes"
Update count (per type)
Definition at line 2631 of file ConfigInfo.cpp.
References ctx, id, line, and BaseString::snprintf().
02631 { 02632 02633 Uint32 id, line; 02634 if(!ctx.m_currentSection->get("NodeId", &id) && !ctx.m_currentSection->get("Id", &id)){ 02635 Uint32 nextNodeId= 1; 02636 ctx.m_userProperties.get("NextNodeId", &nextNodeId); 02637 id= nextNodeId; 02638 while (ctx.m_userProperties.get("AllocatedNodeId_", id, &line)) 02639 id++; 02640 if (id != nextNodeId) 02641 { 02642 fprintf(stderr,"Cluster configuration warning line %d: " 02643 "Could not use next node id %d for section [%s], " 02644 "using next unused node id %d.\n", 02645 ctx.m_sectionLineno, nextNodeId, ctx.fname, id); 02646 } 02647 ctx.m_currentSection->put("NodeId", id); 02648 } else if(ctx.m_userProperties.get("AllocatedNodeId_", id, &line)) { 02649 ctx.reportError("Duplicate nodeid in section " 02650 "[%s] starting at line: %d. Previously used on line %d.", 02651 ctx.fname, ctx.m_sectionLineno, line); 02652 return false; 02653 } 02654 02655 // next node id _always_ next numbers after last used id 02656 ctx.m_userProperties.put("NextNodeId", id+1, true); 02657 02658 ctx.m_userProperties.put("AllocatedNodeId_", id, ctx.m_sectionLineno); 02659 BaseString::snprintf(ctx.pname, sizeof(ctx.pname), "Node_%d", id); 02660 02661 ctx.m_currentSection->put("Type", ctx.fname); 02662 02663 Uint32 nodes = 0; 02664 ctx.m_userProperties.get("NoOfNodes", &nodes); 02665 ctx.m_userProperties.put("NoOfNodes", ++nodes, true); 02666 02670 nodes = 0; 02671 ctx.m_userProperties.get(ctx.fname, &nodes); 02672 ctx.m_userProperties.put(ctx.fname, ++nodes, true); 02673 02674 return true; 02675 }
Here is the call graph for this function:

| bool transformSystem | ( | InitConfigFileParser::Context & | ctx, | |
| const char * | data | |||
| ) | [static] |
System rule: Just add it
Definition at line 2830 of file ConfigInfo.cpp.
References ctx, name, ndbout(), and BaseString::snprintf().
02830 { 02831 02832 const char * name; 02833 if(!ctx.m_currentSection->get("Name", &name)){ 02834 ctx.reportError("Mandatory parameter Name missing from section " 02835 "[%s] starting at line: %d", 02836 ctx.fname, ctx.m_sectionLineno); 02837 return false; 02838 } 02839 02840 ndbout << "transformSystem " << name << endl; 02841 02842 BaseString::snprintf(ctx.pname, sizeof(ctx.pname), "SYSTEM_%s", name); 02843 02844 return true; 02845 }
Here is the call graph for this function:

| void warning | ( | const char * | src, | |
| const char * | arg | |||
| ) | [inline] |
const DepricationTransform f_deprication[] [static] |
Initial value:
{
{ DB_TOKEN, "Discless", "Diskless", 0, 1 },
{ DB_TOKEN, "Id", "NodeId", 0, 1 },
{ API_TOKEN, "Id", "NodeId", 0, 1 },
{ MGM_TOKEN, "Id", "NodeId", 0, 1 },
{ 0, 0, 0, 0, 0}
}
Definition at line 224 of file ConfigInfo.cpp.
Referenced by fixDepricated().
Definition at line 33 of file ndb_opts.h.
Definition at line 32 of file ndb_opts.h.
1.4.7

