trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DaveBirdsall <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request: TRAFODION-1885 : online expansio...
Date Wed, 16 Mar 2016 20:11:10 GMT
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/385#discussion_r56405697
  
    --- Diff: core/sqf/monitor/linux/shell.cxx ---
    @@ -3069,6 +3072,103 @@ const char *zone_type_string( ZoneType type )
         return( str );
     }
     
    +void changeNodeName (char *current_name, char *new_name)
    +{
    +  
    +    if ((current_name == NULL) || (new_name == NULL))
    +    {
    +         printf( "[%s] Error: Invalid node name while attempting to change node name.\n",
MyName );           
    +         return;
    +    }
    +    int count;
    +    MPI_Status status;
    +    CPhysicalNode  *physicalNode;
    +    PhysicalNodeNameMap_t::iterator it;
    +    pair<PhysicalNodeNameMap_t::iterator, bool> pnmit;
    +
    +    // Look up name
    +    it = PhysicalNodeMap.find( current_name );
    +
    +    if (it != PhysicalNodeMap.end())
    +    {
    +        physicalNode = it->second;
    +        if (physicalNode)
    +        {
    +           CPhysicalNode  *newPhysicalNode = new CPhysicalNode( new_name, physicalNode->GetState()
);
    +           if (newPhysicalNode == NULL)
    +          {
    +               printf( "[%s] Error: Internal error with configuration while changing
node name.\n", MyName );           
    +              return;
    +           }
    +           //remove and read
    +           PhysicalNodeMap.erase(current_name);
    +           pnmit = PhysicalNodeMap.insert( PhysicalNodeNameMap_t::value_type 
    +                                            ( newPhysicalNode->GetName(), newPhysicalNode
));
    +           if (pnmit.second == false)
    +           {   // Already had an entry with the given key value.  
    +                printf( "[%s] Error: Internal error while changing node name. Node name
exists, node name=%s\n", MyName, new_name );
    +                return;
    --- End diff --
    
    Should we do a delete on newPhysicalNode in this code path? (Will it leak?)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message