List:Internals« Previous MessageNext Message »
From:Jonas Oreland Date:July 19 2005 3:54pm
Subject:Re: bk commit into 4.1 tree (tulin:1.2344) BUG#12028
View as plain text  
what's the stuff inbetween ?

> +#ifndef DBUG_OFF


why not init it as well
> +int g_print_full_config;
> +int g_print_full_config = 0;
                           ^^^ 


tomas@stripped wrote:
> Below is the list of changes that have just been committed into a local
> 4.1 repository of ndbdev. When ndbdev 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.2344 05/07/19 14:33:38 tulin@stripped +2 -0
>   BUG#12028, cannot use default value for HostName in cluster config
>   + added switch --print-full-config
>   + removed unused REP configuration
> 
>   ndb/src/mgmsrv/main.cpp
>     1.38 05/07/19 14:31:47 ndbdev@stripped +10 -1
>     BUG#12028, cannot use default value for HostName in cluster config
>     + added switch --print-full-config
>     + removed unused REP configuration
> 
>   ndb/src/mgmsrv/ConfigInfo.cpp
>     1.56 05/07/19 14:31:47 ndbdev@stripped +66 -110
>     BUG#12028, cannot use default value for HostName in cluster config
>     + added switch --print-full-config
>     + removed unused REP configuration
> 
> # 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:	tulin
> # Host:	dl145b.mysql.com
> # Root:	/home/ndbdev/tomas/mysql-4.1
> 
> --- 1.55/ndb/src/mgmsrv/ConfigInfo.cpp	Wed May 25 16:19:14 2005
> +++ 1.56/ndb/src/mgmsrv/ConfigInfo.cpp	Tue Jul 19 14:31:47 2005
> @@ -62,8 +62,6 @@
>    DB_TOKEN,
>    MGM_TOKEN,
>    API_TOKEN,
> -  "REP",
> -  "EXTERNAL REP",
>  
>    "TCP",
>    "SCI",
> @@ -100,6 +98,7 @@
>  static bool fixFileSystemPath(InitConfigFileParser::Context & ctx, const char *
> data);
>  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);
>  
>  const ConfigInfo::SectionRule 
>  ConfigInfo::m_SectionRules[] = {
> @@ -110,8 +109,6 @@
>    { DB_TOKEN,   transformNode, 0 },
>    { API_TOKEN,  transformNode, 0 },
>    { MGM_TOKEN,  transformNode, 0 },
> -  { "REP",  transformNode, 0 },
> -  { "EXTERNAL REP",  transformExtNode, 0 },
>  
>    { MGM_TOKEN,  fixShmUniqueId, 0 },
>  
> @@ -128,8 +125,6 @@
>    { DB_TOKEN,   fixNodeHostname, 0 },
>    { API_TOKEN,  fixNodeHostname, 0 },
>    { MGM_TOKEN,  fixNodeHostname, 0 },
> -  { "REP",  fixNodeHostname, 0 },
> -  //{ "EXTERNAL REP",  fixNodeHostname, 0 },
>  
>    { "TCP",  fixNodeId, "NodeId1" },
>    { "TCP",  fixNodeId, "NodeId2" },
> @@ -168,6 +163,10 @@
>    { "*",    fixDepricated, 0 },
>    { "*",    applyDefaultValues, "system" },
>  
> +  { DB_TOKEN,   checkLocalhostHostnameMix, 0 },
> +  { API_TOKEN,  checkLocalhostHostnameMix, 0 },
> +  { MGM_TOKEN,  checkLocalhostHostnameMix, 0 },
> +
>    { DB_TOKEN,   fixFileSystemPath, 0 },
>    { DB_TOKEN,   fixBackupDataDir, 0 },
>  
> @@ -193,7 +192,6 @@
>    { DB_TOKEN,   saveInConfigValues, 0 },
>    { API_TOKEN,  saveInConfigValues, 0 },
>    { MGM_TOKEN,  saveInConfigValues, 0 },
> -  { "REP",  saveInConfigValues, 0 },
>  
>    { "TCP",  saveInConfigValues, 0 },
>    { "SHM",  saveInConfigValues, 0 },
> @@ -345,17 +343,6 @@
>      0, 0 },
>    
>    {
> -    CFG_SYS_REPLICATION_ROLE,
> -    "ReplicationRole",
> -    "SYSTEM",
> -    "Role in Global Replication (None, Primary, or Standby)",
> -    ConfigInfo::CI_USED,
> -    false,
> -    ConfigInfo::CI_STRING,
> -    UNDEFINED,
> -    0, 0 },
> -  
> -  {
>      CFG_SYS_PRIMARY_MGM_NODE,
>      "PrimaryMGMNode",
>      "SYSTEM",
> @@ -402,7 +389,7 @@
>      ConfigInfo::CI_INTERNAL,
>      false,
>      ConfigInfo::CI_STRING,
> -    UNDEFINED,
> +    "localhost",
>      0, 0 },
>  
>    {
> @@ -1207,78 +1194,6 @@
>      STR_VALUE(MAX_INT_RNIL) },
>  
>    /***************************************************************************
> -   * REP
> -   ***************************************************************************/
> -  {
> -    CFG_SECTION_NODE,
> -    "REP",
> -    "REP",
> -    "Node section",
> -    ConfigInfo::CI_USED,
> -    false,
> -    ConfigInfo::CI_SECTION,
> -    (const char *)NODE_TYPE_REP, 
> -    0, 0
> -  },
> -
> -  {
> -    CFG_NODE_HOST,
> -    "HostName",
> -    "REP",
> -    "Name of computer for this node",
> -    ConfigInfo::CI_INTERNAL,
> -    false,
> -    ConfigInfo::CI_STRING,
> -    UNDEFINED,
> -    0, 0 },
> -
> -  {
> -    CFG_NODE_SYSTEM,
> -    "System",
> -    "REP",
> -    "Name of system for this node",
> -    ConfigInfo::CI_INTERNAL,
> -    false,
> -    ConfigInfo::CI_STRING,
> -    UNDEFINED,
> -    0, 0 },
> -
> -  {
> -    CFG_NODE_ID,
> -    "Id",
> -    "REP",
> -    "Number identifying replication node (REP)",
> -    ConfigInfo::CI_USED,
> -    false,
> -    ConfigInfo::CI_INT,
> -    MANDATORY,
> -    "1",
> -    STR_VALUE(MAX_NODES) },
> -
> -  {
> -    KEY_INTERNAL,
> -    "ExecuteOnComputer",
> -    "REP",
> -    "String referencing an earlier defined COMPUTER",
> -    ConfigInfo::CI_USED,
> -    false,
> -    ConfigInfo::CI_STRING,
> -    MANDATORY,
> -    0, 0 },
> -
> -  {
> -    CFG_REP_HEARTBEAT_INTERVAL,
> -    "HeartbeatIntervalRepRep",
> -    "REP",
> -    "Time between REP-REP heartbeats. Connection closed after 3 missed HBs",
> -    ConfigInfo::CI_USED,
> -    true,
> -    ConfigInfo::CI_INT,
> -    "3000",
> -    "100",
> -    STR_VALUE(MAX_INT_RNIL) },
> -
> -  /***************************************************************************
>     * API
>     ***************************************************************************/
>    {
> @@ -1301,7 +1216,7 @@
>      ConfigInfo::CI_INTERNAL,
>      false,
>      ConfigInfo::CI_STRING,
> -    UNDEFINED,
> +    "",
>      0, 0 },
>  
>    {
> @@ -1421,7 +1336,7 @@
>      ConfigInfo::CI_INTERNAL,
>      false,
>      ConfigInfo::CI_STRING,
> -    UNDEFINED,
> +    "",
>      0, 0 },
>  
>    {
> @@ -2611,7 +2526,7 @@
>    return true;
>  }
>  
> -static bool checkLocalhostHostnameMix(InitConfigFileParser::Context & ctx)
> +static bool checkLocalhostHostnameMix(InitConfigFileParser::Context & ctx, const
> char * data)
>  {
>    DBUG_ENTER("checkLocalhostHostnameMix");
>    const char * hostname= 0;
> @@ -2640,21 +2555,17 @@
>  }
>  
>  bool
> -fixNodeHostname(InitConfigFileParser::Context & ctx, const char * data){
> -  
> +fixNodeHostname(InitConfigFileParser::Context & ctx, const char * data)
> +{
>    const char * hostname;
> +  DBUG_ENTER("fixNodeHostname");
> +
>    if (ctx.m_currentSection->get("HostName", &hostname))
> -    return checkLocalhostHostnameMix(ctx);
> +    DBUG_RETURN(checkLocalhostHostnameMix(ctx,0));
>  
>    const char * compId;
> -  if(!ctx.m_currentSection->get("ExecuteOnComputer", &compId)){
> -    const char * type;
> -    if(ctx.m_currentSection->get("Type", &type) &&
> strcmp(type,DB_TOKEN) == 0)
> -      require(ctx.m_currentSection->put("HostName", "localhost"));
> -    else
> -      require(ctx.m_currentSection->put("HostName", ""));
> -    return checkLocalhostHostnameMix(ctx);
> -  }
> +  if(!ctx.m_currentSection->get("ExecuteOnComputer", &compId))
> +    DBUG_RETURN(true);
>    
>    const Properties * computer;
>    char tmp[255];
> @@ -2663,18 +2574,18 @@
>      ctx.reportError("Computer \"%s\" not declared"
>  		    "- [%s] starting at line: %d",
>  		    compId, ctx.fname, ctx.m_sectionLineno);
> -    return false;
> +    DBUG_RETURN(false);
>    }
>    
>    if(!computer->get("HostName", &hostname)){
>      ctx.reportError("HostName missing in [COMPUTER] (Id: %d) "
>  		    " - [%s] starting at line: %d",
>  		    compId, ctx.fname, ctx.m_sectionLineno);
> -    return false;
> +    DBUG_RETURN(false);
>    }
>    
>    require(ctx.m_currentSection->put("HostName", hostname));
> -  return checkLocalhostHostnameMix(ctx);
> +  DBUG_RETURN(checkLocalhostHostnameMix(ctx,0));
>  }
>  
>  bool
> @@ -2858,7 +2769,7 @@
>      return true;
>    }
>    
> -  return checkLocalhostHostnameMix(ctx);
> +  return checkLocalhostHostnameMix(ctx,0);
>  }
>  
>  /**
> @@ -2866,7 +2777,9 @@
>   */
>  void 
>  applyDefaultValues(InitConfigFileParser::Context & ctx,
> -		   const Properties * defaults){
> +		   const Properties * defaults)
> +{
> +  DBUG_ENTER("applyDefaultValues");
>    if(defaults != NULL){
>      Properties::Iterator it(defaults);
>  
> @@ -2879,26 +2792,58 @@
>  	  Uint32 val = 0;
>  	  ::require(defaults->get(name, &val));
>  	  ctx.m_currentSection->put(name, val);
> +          DBUG_PRINT("info",("%s=%d #default",name,val));
>  	  break;
>  	}
>  	case ConfigInfo::CI_INT64:{
>  	  Uint64 val = 0;
>  	  ::require(defaults->get(name, &val));
>  	  ctx.m_currentSection->put64(name, val);
> +          DBUG_PRINT("info",("%s=%lld #default",name,val));
>  	  break;
>  	}
>  	case ConfigInfo::CI_STRING:{
>  	  const char * val;
>  	  ::require(defaults->get(name, &val));
>  	  ctx.m_currentSection->put(name, val);
> +          DBUG_PRINT("info",("%s=%s #default",name,val));
>  	  break;
>  	}
>  	case ConfigInfo::CI_SECTION:
>  	  break;
>  	}
>        }
> +#ifndef DBUG_OFF
> +      else
> +      {
> +        switch (ctx.m_info->getType(ctx.m_currentInfo, name)){
> +        case ConfigInfo::CI_INT:
> +        case ConfigInfo::CI_BOOL:{
> +          Uint32 val = 0;
> +          ::require(ctx.m_currentSection->get(name, &val));
> +          DBUG_PRINT("info",("%s=%d",name,val));
> +          break;
> +        }
> +        case ConfigInfo::CI_INT64:{
> +          Uint64 val = 0;
> +          ::require(ctx.m_currentSection->get(name, &val));
> +          DBUG_PRINT("info",("%s=%lld",name,val));
> +          break;
> +        }
> +        case ConfigInfo::CI_STRING:{
> +          const char * val;
> +          ::require(ctx.m_currentSection->get(name, &val));
> +          DBUG_PRINT("info",("%s=%s",name,val));
> +          break;
> +        }
> +        case ConfigInfo::CI_SECTION:
> +          break;
> +        }
> +      }
> +#endif
>      }
>    }
> +  DBUG_VOID_RETURN;
>  }
>  
>  bool
> @@ -3447,6 +3392,8 @@
>    return true;
>  }
>  
> +extern int g_print_full_config;
> +
>  static bool
>  saveInConfigValues(InitConfigFileParser::Context & ctx, const char * data){
>    const Properties * sec;
> @@ -3468,6 +3415,9 @@
>        break;
>      }
>      
> +    if (g_print_full_config)
> +      printf("[%s]\n", ctx.fname);
> +
>      Uint32 no = 0;
>      ctx.m_userProperties.get("$Section", id, &no);
>      ctx.m_userProperties.put("$Section", id, no+1, true);
> @@ -3495,18 +3445,24 @@
>  	Uint32 val;
>  	require(ctx.m_currentSection->get(n, &val));
>  	ok = ctx.m_configValues.put(id, val);
> +	if (g_print_full_config)
> +	  printf("%s=%u\n", n, val);
>  	break;
>        }
>        case PropertiesType_Uint64:{
>  	Uint64 val;
>  	require(ctx.m_currentSection->get(n, &val));
>  	ok = ctx.m_configValues.put64(id, val);
> +	if (g_print_full_config)
> +	  printf("%s=%llu\n", n, val);
>  	break;
>        }
>        case PropertiesType_char:{
>  	const char * val;
>  	require(ctx.m_currentSection->get(n, &val));
>  	ok = ctx.m_configValues.put(id, val);
> +	if (g_print_full_config)
> +	  printf("%s=%s\n", n, val);
>  	break;
>        }
>        default:
> 
> --- 1.37/ndb/src/mgmsrv/main.cpp	Thu Jul 14 18:07:55 2005
> +++ 1.38/ndb/src/mgmsrv/main.cpp	Tue Jul 19 14:31:47 2005
> @@ -77,6 +77,7 @@
>  };
>  
>  int g_no_nodeid_checks= 0;
> +int g_print_full_config;
>  static MgmGlobals *glob= 0;
>  
>  /******************************************************************************
> @@ -110,6 +111,9 @@
>    { "config-file", 'f', "Specify cluster configuration file",
>      (gptr*) &opt_config_filename, (gptr*) &opt_config_filename, 0,
>      GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
> +  { "print-full-config", 'P', "Print full config and exit",
> +    (gptr*) &g_print_full_config, (gptr*) &g_print_full_config, 0,
> +    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
>    { "daemon", 'd', "Run ndb_mgmd in daemon mode (default)",
>      (gptr*) &opt_daemon, (gptr*) &opt_daemon, 0,
>      GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
> @@ -188,7 +192,8 @@
>      exit(ho_error);
>  
>    if (opt_interactive ||
> -      opt_non_interactive) {
> +      opt_non_interactive ||
> +      g_print_full_config) {
>      opt_daemon= 0;
>    }
>  
> @@ -200,6 +205,9 @@
>  				opt_config_filename,
>  				opt_connect_str);
>  
> +  if (g_print_full_config)
> +    goto the_end;
> +
>    if (glob->mgmObject->init())
>      goto error_end;
>  
> @@ -309,6 +317,7 @@
>    glob->socketServer->stopServer();
>    glob->socketServer->stopSessions(true);
>    g_eventLogger.info("Shutdown complete");
> + the_end:
>    delete glob;
>    ndb_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
>    return 0;
> 


-- 
Jonas Oreland, Software Engineer
MySQL AB, www.mysql.com
Thread
bk commit into 4.1 tree (tulin:1.2344) BUG#12028tomas19 Jul
  • Re: bk commit into 4.1 tree (tulin:1.2344) BUG#12028Jonas Oreland19 Jul