List:Internals« Previous MessageNext Message »
From:jonas Date:April 18 2006 8:13pm
Subject:bk commit into 5.0 tree (jonas:1.2164)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jonas. When jonas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2164 06/04/18 22:13:50 jonas@eel.(none) +6 -0
  Merge joreland@stripped:/home/bk/mysql-5.0
  into  eel.(none):/home/jonas/src/50-atrt

  ndb/src/mgmsrv/InitConfigFileParser.cpp
    1.27 06/04/18 22:13:46 jonas@eel.(none) +1 -2
    merge

  ndb/src/mgmsrv/ConfigInfo.cpp
    1.72 06/04/18 22:13:46 jonas@eel.(none) +0 -1
    merge

  ndb/src/mgmsrv/MgmtSrvr.cpp
    1.97 06/04/18 22:06:16 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/kernel/vm/Configuration.cpp
    1.45 06/04/18 22:06:15 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
    1.25 06/04/18 22:06:15 jonas@eel.(none) +0 -0
    Auto merged

  ndb/include/mgmapi/mgmapi_config_parameters.h
    1.21 06/04/18 22:06:15 jonas@eel.(none) +0 -0
    Auto merged

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jonas
# Host:	eel.(none)
# Root:	/home/jonas/src/50-atrt/RESYNC

--- 1.20/ndb/include/mgmapi/mgmapi_config_parameters.h	2006-02-02 15:25:22 +01:00
+++ 1.21/ndb/include/mgmapi/mgmapi_config_parameters.h	2006-04-18 22:06:15 +02:00
@@ -170,6 +170,7 @@
 #define NODE_TYPE_MGM                 2
 #define NODE_TYPE_REP                 3
 #define NODE_TYPE_EXT_REP             4
+#define NODE_TYPE_MYSQLD              5
 
 #define CONNECTION_TYPE_TCP           0
 #define CONNECTION_TYPE_SHM           1

--- 1.71/ndb/src/mgmsrv/ConfigInfo.cpp	2005-10-12 15:19:41 +02:00
+++ 1.72/ndb/src/mgmsrv/ConfigInfo.cpp	2006-04-18 22:13:46 +02:00
@@ -46,31 +46,22 @@
 #define MGM_TOKEN "MGM"
 #define API_TOKEN "API"
 
-const ConfigInfo::AliasPair
-ConfigInfo::m_sectionNameAliases[]={
-  {API_TOKEN, "MYSQLD"},
-  {DB_TOKEN,  "NDBD"},
-  {MGM_TOKEN, "NDB_MGMD"},
-  {0, 0}
-};
-
-const char* 
-ConfigInfo::m_sectionNames[]={
-  "SYSTEM",
-  "COMPUTER",
-
-  DB_TOKEN,
-  MGM_TOKEN,
-  API_TOKEN,
-
-  "TCP",
-  "SCI",
-  "SHM",
-  "OSE"
+const ConfigInfoAliasPair
+ConfigInfo::m_sectionNames[]=
+{
+  { "SYSTEM", 0, 0 },
+  { "COMPUTER", 0, 0 },
+  
+  { DB_TOKEN, "NDBD", 0 },
+  { MGM_TOKEN, "NDB_MGMD", 0 },
+  { API_TOKEN, "MYSQLD", 0 },
+  
+  { "TCP", 0, 0 },
+  { "SCI", 0, 0 },
+  { "SHM", 0, 0 },
+  { "OSE", 0, 0 },
+  { 0, 0, 0 }
 };
-const int ConfigInfo::m_noOfSectionNames = 
-sizeof(m_sectionNames)/sizeof(char*);
-
 
 /****************************************************************************
  * Section Rules declarations
@@ -96,6 +87,7 @@
 static bool fixBackupDataDir(InitConfigFileParser::Context & ctx, const char * data);
 static bool fixShmUniqueId(InitConfigFileParser::Context & ctx, const char * data);
 static bool checkLocalhostHostnameMix(InitConfigFileParser::Context & ctx, const char * data);
+static bool handleApiMysqld(InitConfigFileParser::Context & ctx, const char * data);
 
 const ConfigInfo::SectionRule 
 ConfigInfo::m_SectionRules[] = {
@@ -175,6 +167,8 @@
   
   { "*",    checkMandatory, 0 },
   
+  { API_TOKEN, handleApiMysqld, 0 },
+  
   { DB_TOKEN,   saveInConfigValues, 0 },
   { API_TOKEN,  saveInConfigValues, 0 },
   { MGM_TOKEN,  saveInConfigValues, 0 },
@@ -2433,27 +2427,33 @@
   return getInfoString(section, fname, "Description");
 }
 
-bool
-ConfigInfo::isSection(const char * section) const {
-  for (int i = 0; i<m_noOfSectionNames; i++) {
-    if(!strcasecmp(section, m_sectionNames[i])) return true;
+const ConfigInfoAliasPair*
+ConfigInfo::getSection(const char * section) const 
+{
+  for (int i = 0; m_sectionNames[i].name; i++) {
+    if (!strcasecmp(section, m_sectionNames[i].name)) 
+      return m_sectionNames + i;
+    if (m_sectionNames[i].alias && 
+	!strcasecmp(section, m_sectionNames[i].alias))
+      return m_sectionNames + i;
   }
-  return false;
+  return 0;
 }
 
 const char*
 ConfigInfo::nameToAlias(const char * name) {
-  for (int i = 0; m_sectionNameAliases[i].name != 0; i++)
-    if(!strcasecmp(name, m_sectionNameAliases[i].name))
-      return m_sectionNameAliases[i].alias;
+  for (int i = 0; m_sectionNames[i].name; i++)
+    if(!strcasecmp(name, m_sectionNames[i].name) && m_sectionNames[i].alias)
+      return m_sectionNames[i].alias;
   return 0;
 }
 
 const char*
 ConfigInfo::getAlias(const char * section) {
-  for (int i = 0; m_sectionNameAliases[i].name != 0; i++)
-    if(!strcasecmp(section, m_sectionNameAliases[i].alias))
-      return m_sectionNameAliases[i].name;
+  for (int i = 0; m_sectionNames[i].name != 0; i++)
+    if(m_sectionNames[i].alias && 
+       !strcasecmp(section, m_sectionNames[i].alias))
+      return m_sectionNames[i].name;
   return 0;
 }
 
@@ -2640,6 +2640,19 @@
   DBUG_RETURN(true);
 }
 
+static bool 
+handleApiMysqld(InitConfigFileParser::Context & ctx, const char * data)
+{
+  const char * name = 0;
+  if (ctx.m_currentSection->get("FileSection", &name) &&
+      strcmp(name, "MYSQLD") == 0)
+  {
+    ctx.m_currentSection->put("SectionType", NODE_TYPE_MYSQLD);
+    ndbout_c("changing to MYSQLD");
+  }
+  return true;
+}
+
 bool
 fixNodeHostname(InitConfigFileParser::Context & ctx, const char * data)
 {
@@ -3402,7 +3415,8 @@
     require(sec->get("Fname", &secName));
     require(sec->get("Id", &id));
     require(sec->get("Status", &status));
-    require(sec->get("SectionType", &typeVal));
+    if (!ctx.m_currentSection->get("SectionType", &typeVal))
+      require(sec->get("SectionType", &typeVal));
     
     if(id == KEY_INTERNAL || status == ConfigInfo::CI_INTERNAL){
       ndbout_c("skipping section %s", ctx.fname);

--- 1.26/ndb/src/mgmsrv/InitConfigFileParser.cpp	2005-10-12 15:30:57 +02:00
+++ 1.27/ndb/src/mgmsrv/InitConfigFileParser.cpp	2006-04-18 22:13:46 +02:00
@@ -107,14 +107,14 @@
     /********************************
      * 1. Parse new default section *
      ********************************/
-    if (char* section = parseDefaultSectionHeader(line)) {
+    ConfigInfoAliasPair section;
+    if (parseDefaultSectionHeader(line, &section)) {
       if(!storeSection(ctx)){
-	free(section);
 	ctx.reportError("Could not store previous default section "
 			"of configuration file.");
 	return 0;
       }
-      BaseString::snprintf(ctx.fname, sizeof(ctx.fname), section); free(section);
+      BaseString::snprintf(ctx.fname, sizeof(ctx.fname), section.name);
       ctx.type             = InitConfigFileParser::DefaultSection;
       ctx.m_sectionLineno  = ctx.m_lineno;
       ctx.m_currentSection = new Properties(true);
@@ -127,18 +127,17 @@
     /************************
      * 2. Parse new section *
      ************************/
-    if (char* section = parseSectionHeader(line)) {
+    if (parseSectionHeader(line, &section)) {
       if(!storeSection(ctx)){
-	free(section);
 	ctx.reportError("Could not store previous section "
 			"of configuration file.");
 	return 0;
       }
-      BaseString::snprintf(ctx.fname, sizeof(ctx.fname), section);
-      free(section);
+      BaseString::snprintf(ctx.fname, sizeof(ctx.fname), section.name);
       ctx.type             = InitConfigFileParser::Section;
       ctx.m_sectionLineno  = ctx.m_lineno;      
       ctx.m_currentSection = new Properties(true);
+      ctx.m_currentSection->put("FileSection", section.supplied_name);
       ctx.m_userDefaults   = getSection(ctx.fname, ctx.m_defaults);
       require((ctx.m_currentInfo    = m_info->getInfo(ctx.fname)) != 0);
       require((ctx.m_systemDefaults = m_info->getDefaults(ctx.fname)) != 0);
@@ -463,70 +462,85 @@
   memmove(str, &str[pos], len - pos + 2);
 }
 
-char* 
-InitConfigFileParser::parseSectionHeader(const char* line) const {
+bool
+InitConfigFileParser::parseSectionHeader(const char* line,
+					 ConfigInfoAliasPair* out) const {
+  bool retVal = false;
   char * tmp = strdup(line);
 
-  if(tmp[0] != '['){
-    free(tmp);
-    return NULL;
-  }
-
-  if(tmp[strlen(tmp)-1] != ']'){
-    free(tmp);
-    return NULL;
-  }
-  tmp[strlen(tmp)-1] = 0;
+  do {
+    if(tmp[0] != '[')
+      break;
 
-  tmp[0] = ' ';
-  trim(tmp);
+    if(tmp[strlen(tmp)-1] != ']')
+      break;
 
-  // Get the correct header name if an alias
-  {
-    const char *tmp_alias= m_info->getAlias(tmp);
-    if (tmp_alias) {
-      free(tmp);
-      tmp= strdup(tmp_alias);
+    tmp[strlen(tmp)-1] = 0;
+    
+    tmp[0] = ' ';
+    trim(tmp);
+    
+    // Get the correct header name if an alias
+    const ConfigInfoAliasPair *section = m_info->getSection(tmp);
+    if (section == 0)
+      break;
+    
+    * out = *section;
+    if (strcasecmp(tmp, out->name) == 0)
+    {
+      out->supplied_name = out->name;
     }
-  }
-
-  // Lookup token among sections
-  if(!m_info->isSection(tmp)) {
-    free(tmp);
-    return NULL;
-  }
-  if(m_info->getInfo(tmp)) return tmp;
-
+    else
+    {
+      out->supplied_name = out->alias;
+    }
+    
+    if(m_info->getInfo(out->name))
+      retVal = true;
+    
+  } while(0);
+  
   free(tmp);
-  return NULL;
+  return retVal;
 }
 
 //****************************************************************************
 //  Parse Default Section Header
 //****************************************************************************
 
-char* 
-InitConfigFileParser::parseDefaultSectionHeader(const char* line) const {
+bool
+InitConfigFileParser::parseDefaultSectionHeader
+(const char* line, ConfigInfoAliasPair *out) const 
+{
   static char token1[MAX_LINE_LENGTH], token2[MAX_LINE_LENGTH];
-
+  
   int no = sscanf(line, "[%120[A-Z_a-z] %120[A-Z_a-z]]", token1, token2);
-
+  
   // Not correct no of tokens 
-  if (no != 2) return NULL;
-
+  if (no != 2) 
+    return false;
+  
   // Not correct keyword at end
-  if (!strcasecmp(token2, "DEFAULT") == 0) return NULL;
+  if (!strcasecmp(token2, "DEFAULT") == 0) 
+    return false;
+  
+  const ConfigInfoAliasPair * section = m_info->getSection(token1);
+  if (section == 0)
+    return false;
 
-  const char *token1_alias= m_info->getAlias(token1);
-  if (token1_alias == 0)
-    token1_alias= token1;
+  * out = * section;
+  if (strcasecmp(token1, out->name) == 0)
+    out->supplied_name = out->name;
+  else
+    out->supplied_name = out->alias;
 
-  if(m_info->getInfo(token1_alias)){
-    return strdup(token1_alias);
+  if(m_info->getInfo(out->name))
+  {
+    return true;
   }
   
   // Did not find section
-  return NULL;
+  return false;
 }
 
 const Properties *
@@ -800,6 +814,7 @@
   /**
    * Add ndbd, ndb_mgmd, api/mysqld
    */
+  Uint32 idx = options.size();
   {
     struct my_option opt;
     bzero(&opt, sizeof(opt));
@@ -809,7 +824,6 @@
     opt.var_type = GET_STR;
     opt.arg_type = REQUIRED_ARG;
     options.push_back(opt);
-    ndbd = &options.back();
 
     opt.name = "ndb_mgmd";
     opt.id = 256;
@@ -817,7 +831,6 @@
     opt.var_type = GET_STR;
     opt.arg_type = REQUIRED_ARG;
     options.push_back(opt);
-    ndb_mgmd = &options.back();
 
     opt.name = "mysqld";
     opt.id = 256;
@@ -825,7 +838,6 @@
     opt.var_type = GET_STR;
     opt.arg_type = REQUIRED_ARG;
     options.push_back(opt);
-    mysqld = &options.back();
 
     opt.name = "api";
     opt.id = 256;
@@ -833,12 +845,15 @@
     opt.var_type = GET_STR;
     opt.arg_type = REQUIRED_ARG;
     options.push_back(opt);
-    api = &options.back();
 
     bzero(&opt, sizeof(opt));
     options.push_back(opt);
+    ndbd = &options[idx];
+    ndb_mgmd = &options[idx+1];
+    mysqld = &options[idx+2];
+    api = &options[idx+3];
   }
-
+  
   
   Context ctx(m_info, m_errstream); 
   const char *groups[]= { "cluster_config", 0 };
@@ -860,12 +875,17 @@
     goto end;
 
   {
-    struct sect { struct my_option* src; const char * name; } sections[] = 
+    struct sect 
+    { 
+      struct my_option* src; 
+      const char * name; 
+      const char * real_name;
+    } sections[] = 
       {
-	{ ndb_mgmd, "MGM" }
-	,{ ndbd, "DB" }
-	,{ mysqld, "API" }
-	,{ api, "API" }
+	{ ndb_mgmd, "MGM", "MGM" }
+	,{ ndbd, "DB", "DB" }
+	,{ mysqld, "API", "MYSQLD" }
+	,{ api, "API", "API" }
 	,{ 0, 0 }, { 0, 0 }
       };
     
@@ -913,8 +933,8 @@
 	  require((ctx.m_currentInfo = m_info->getInfo(ctx.fname)) != 0);
 	  require((ctx.m_systemDefaults = m_info->getDefaults(ctx.fname))!= 0);
 	  ctx.m_currentSection->put("HostName", list[j].c_str());
-	  if(!load_mycnf_groups(options, ctx, sections[i].name, 
-				defaults_groups))
+	  ctx.m_currentSection->put("FileSection", sections[i].real_name);
+	  if(!load_mycnf_groups(options, ctx, ctx.fname, defaults_groups))
 	    goto end;
 	  
 	  if(!storeSection(ctx))

--- 1.24/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2006-04-05 11:21:34 +02:00
+++ 1.25/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2006-04-18 22:06:15 +02:00
@@ -120,6 +120,9 @@
     case NodeInfo::MGM:
     case NodeInfo::REP:
       break;
+    case NODE_TYPE_MYSQLD:
+      nodeType = NodeInfo::API;
+      break;
     default:
       ndbrequire(false);
     }

--- 1.44/ndb/src/kernel/vm/Configuration.cpp	2006-04-06 11:43:28 +02:00
+++ 1.45/ndb/src/kernel/vm/Configuration.cpp	2006-04-18 22:06:15 +02:00
@@ -645,6 +645,7 @@
 	ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
       }
       break;
+    case NODE_TYPE_MYSQLD:
     case NODE_TYPE_API:
       noOfAPINodes++; // No of API processes
       break;

--- 1.96/ndb/src/mgmsrv/MgmtSrvr.cpp	2006-04-07 12:00:59 +02:00
+++ 1.97/ndb/src/mgmsrv/MgmtSrvr.cpp	2006-04-18 22:06:16 +02:00
@@ -2508,7 +2508,7 @@
       break;
     case 1:
       res = i2.set(param, val_64);
-      ndbout_c("Updating node %d param: %d to %Ld",  node, param, val_32);
+      ndbout_c("Updating node %d param: %d to %Ld",  node, param, val_64);
       break;
     case 2:
       res = i2.set(param, val_char);
Thread
bk commit into 5.0 tree (jonas:1.2164)jonas18 Apr