trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbirds...@apache.org
Subject [1/3] incubator-trafodion git commit: JIRA 1885 : online expansion
Date Thu, 17 Mar 2016 16:24:12 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 616961db5 -> 3687c5c70


JIRA 1885 : online expansion


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/c6bc8a3f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/c6bc8a3f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/c6bc8a3f

Branch: refs/heads/master
Commit: c6bc8a3fc8ed592655598cc37a5c63c81e00cf79
Parents: 1c1ea30
Author: Trina Krug <trinak@edev05.esgyn.local>
Authored: Mon Mar 14 16:45:38 2016 +0000
Committer: Trina Krug <trinak@edev05.esgyn.local>
Committed: Mon Mar 14 16:45:38 2016 +0000

----------------------------------------------------------------------
 core/sqf/monitor/linux/cluster.cxx     |  11 +++
 core/sqf/monitor/linux/cmsh.cxx        |  11 ++-
 core/sqf/monitor/linux/internal.h      |   9 ++
 core/sqf/monitor/linux/makefile        |   2 +
 core/sqf/monitor/linux/mlio.cxx        |   6 +-
 core/sqf/monitor/linux/msgdef.h        |  17 ++++
 core/sqf/monitor/linux/phnode.h        |   2 +
 core/sqf/monitor/linux/pnode.cxx       |  10 ++
 core/sqf/monitor/linux/pnode.h         |   1 +
 core/sqf/monitor/linux/pnodeconfig.cxx |   6 ++
 core/sqf/monitor/linux/pnodeconfig.h   |   2 +-
 core/sqf/monitor/linux/replicate.cxx   |  56 +++++++++++-
 core/sqf/monitor/linux/replicate.h     |  14 +++
 core/sqf/monitor/linux/reqnodename.cxx | 114 +++++++++++++++++++++++
 core/sqf/monitor/linux/reqqueue.cxx    |  60 +++++++++++-
 core/sqf/monitor/linux/reqqueue.h      |  32 ++++++-
 core/sqf/monitor/linux/shell.cxx       | 136 ++++++++++++++++++++++++++--
 core/sqf/monitor/linux/testpoint.h     |   2 +-
 18 files changed, 471 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c6bc8a3f/core/sqf/monitor/linux/cluster.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/cluster.cxx b/core/sqf/monitor/linux/cluster.cxx
index 0373bfd..8190b49 100644
--- a/core/sqf/monitor/linux/cluster.cxx
+++ b/core/sqf/monitor/linux/cluster.cxx
@@ -1888,7 +1888,13 @@ void CCluster::HandleOtherNodeMsg (struct internal_msg_def *recv_msg,
         // Queue the node down request for processing by a worker thread.
         ReqQueue.enqueueDownReq( recv_msg->u.down.pnid );
         break;
+    case InternalType_NodeName:
+        if (trace_settings & (TRACE_SYNC | TRACE_REQUEST | TRACE_PROCESS))
+            trace_printf("%s@%d - Internal node name request (%s to %s)\n", method_name,
__LINE__, recv_msg->u.nodename.current_name, recv_msg->u.nodename.new_name);
 
+        // Queue the node down request for processing by a worker thread.
+        ReqQueue.enqueueNodeNameReq( recv_msg->u.nodename.current_name, recv_msg->u.nodename.new_name
);
+        break;
     case InternalType_SoftNodeDown:
         if (trace_settings & (TRACE_SYNC | TRACE_REQUEST | TRACE_PROCESS))
             trace_printf("%s@%d - Internal soft node down request for pnid=%d\n", method_name,
__LINE__, recv_msg->u.down.pnid);
@@ -2394,6 +2400,11 @@ void CCluster::HandleMyNodeMsg (struct internal_msg_def *recv_msg,
             trace_printf("%s@%d - Internal down node request for pnid=%d\n", method_name,
__LINE__, recv_msg->u.down.pnid);
         break;
 
+    case InternalType_NodeName:
+        if (trace_settings & (TRACE_SYNC | TRACE_REQUEST | TRACE_PROCESS))
+            trace_printf("%s@%d - Internal node name request (%s to %s)\n", method_name,
__LINE__, recv_msg->u.nodename.current_name, recv_msg->u.nodename.new_name);
+        break;
+
     case InternalType_SoftNodeDown:
         if (trace_settings & (TRACE_SYNC | TRACE_REQUEST | TRACE_PROCESS))
             trace_printf("%s@%d - Internal soft down node request for pnid=%d\n", method_name,
__LINE__, recv_msg->u.down.pnid);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c6bc8a3f/core/sqf/monitor/linux/cmsh.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/cmsh.cxx b/core/sqf/monitor/linux/cmsh.cxx
index 1fd9af4..6144a79 100755
--- a/core/sqf/monitor/linux/cmsh.cxx
+++ b/core/sqf/monitor/linux/cmsh.cxx
@@ -127,11 +127,14 @@ int CCmsh::GetClusterState( PhysicalNodeNameMap_t &physicalNodeMap
)
             it = physicalNodeMap.find( nodeName.c_str() );
             if (it != physicalNodeMap.end())
             {
-                // TEST_POINT: to force state down on node name 
+               // TEST_POINT and Exclude List : to force state down on node name 
                 const char *downNodeName = getenv( TP001_NODE_DOWN );
-                if ( downNodeName != NULL && 
-                    !strcmp( downNodeName, nodeName.c_str() ) )
-                {
+                const char *downNodeList = getenv( TRAF_EXCLUDE_LIST );
+                if (( downNodeList != NULL && 
+                    (strstr(downNodeList,nodeName.c_str()))) ||
+                    ( downNodeName != NULL && 
+                   !strcmp( downNodeName, nodeName.c_str() ) ))
+                 {
                     nodeState = StateDown ;
                 }
                 // Set physical node state

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c6bc8a3f/core/sqf/monitor/linux/internal.h
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/internal.h b/core/sqf/monitor/linux/internal.h
index 1edec1a..5766bd4 100644
--- a/core/sqf/monitor/linux/internal.h
+++ b/core/sqf/monitor/linux/internal.h
@@ -39,6 +39,7 @@ enum InternalType
     InternalType_Exit,              // Delete process for monitor
     InternalType_IoData,            // Stdin/Stdout data for a process
     InternalType_Kill,              // Kill monitored process
+    InternalType_NodeName,          // Node Name Change 
     InternalType_Notify,            // Register for monitoring of process death
     InternalType_Process,           // Add process to monitor
     InternalType_ProcessInit,       // Process fork completed
@@ -140,6 +141,13 @@ struct down_def
     int pnid;                       // Physical node id
 };
 
+struct nodename_def
+{
+    char current_name[MAX_PROCESS_NAME];
+    char new_name[MAX_PROCESS_NAME];
+};
+
+
 struct shutdown_def
 {
     int level;                      // shutdown level
@@ -362,6 +370,7 @@ struct internal_msg_def
         struct event_def   event;
         ioData_t           iodata;
         struct kill_def    kill;
+	struct nodename_def  nodename;
         struct notify_def  notify;
         struct process_def process;
         struct process_init_def processInit;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c6bc8a3f/core/sqf/monitor/linux/makefile
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/makefile b/core/sqf/monitor/linux/makefile
index 6a9efac..8ac998f 100755
--- a/core/sqf/monitor/linux/makefile
+++ b/core/sqf/monitor/linux/makefile
@@ -130,6 +130,7 @@ MONITORSRC += reqmount.cxx
 MONITORSRC += reqnewproc.cxx
 MONITORSRC += reqnodedown.cxx
 MONITORSRC += reqnodeinfo.cxx
+MONITORSRC += reqnodename.cxx
 MONITORSRC += reqnodeup.cxx
 MONITORSRC += reqnotify.cxx
 MONITORSRC += reqopen.cxx
@@ -189,6 +190,7 @@ MONITOROBJS += $(OUTDIR)/reqmount.o
 MONITOROBJS += $(OUTDIR)/reqnewproc.o
 MONITOROBJS += $(OUTDIR)/reqnodedown.o
 MONITOROBJS += $(OUTDIR)/reqnodeinfo.o
+MONITOROBJS += $(OUTDIR)/reqnodename.o
 MONITOROBJS += $(OUTDIR)/reqpnodeinfo.o
 MONITOROBJS += $(OUTDIR)/reqnodeup.o
 MONITOROBJS += $(OUTDIR)/reqnotify.o

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c6bc8a3f/core/sqf/monitor/linux/mlio.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/mlio.cxx b/core/sqf/monitor/linux/mlio.cxx
index 20c4c02..47deba3 100644
--- a/core/sqf/monitor/linux/mlio.cxx
+++ b/core/sqf/monitor/linux/mlio.cxx
@@ -113,7 +113,8 @@ const int SQ_LocalIOToClient::serviceRequestSize[] = {
    sizeof(REQTYPE) + sizeof( TmSync_def ),          // ReqType_TmSync
    sizeof(REQTYPE) + sizeof( TransInfo_def ),       // ReqType_TransInfo
    sizeof(REQTYPE) + sizeof( MonStats_def ),        // ReqType_MonStats
-   sizeof(REQTYPE) + sizeof( ZoneInfo_def )         // ReqType_ZoneInfo
+   sizeof(REQTYPE) + sizeof( ZoneInfo_def ),        // ReqType_ZoneInfo
+   sizeof(REQTYPE) + sizeof( NodeName_def )         // ReqType_NodeName
 };
 
 // The serviceReplySize array holds the size of the request messages for
@@ -136,7 +137,8 @@ const int SQ_LocalIOToClient::serviceReplySize[] = {
    sizeof(REPLYTYPE) + sizeof( Startup_reply_def ),     // ReplyType_Startup
    sizeof(REPLYTYPE) + sizeof( Mount_reply_def ),       // ReplyType_Mount
    sizeof(REPLYTYPE) + sizeof( MonStats_reply_def ),    // ReplyType_MonStats
-   sizeof(REPLYTYPE) + sizeof( ZoneInfo_reply_def )     // ReplyType_ZoneInfo
+   sizeof(REPLYTYPE) + sizeof( ZoneInfo_reply_def ),    // ReplyType_ZoneInfo
+   sizeof(REPLYTYPE) + sizeof( NodeName_reply_def )     // ReplyType_NodeName
 };
 
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c6bc8a3f/core/sqf/monitor/linux/msgdef.h
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/msgdef.h b/core/sqf/monitor/linux/msgdef.h
index 5941950..2fc18b1 100755
--- a/core/sqf/monitor/linux/msgdef.h
+++ b/core/sqf/monitor/linux/msgdef.h
@@ -257,6 +257,7 @@ typedef enum {
     ReqType_TransInfo,                      // request transaction enlistment information
     ReqType_MonStats,                       // get monitor statistics
     ReqType_ZoneInfo,                       // zone information request 
+    ReqType_NodeName,                       // change node name request
 
     ReqType_Invalid                         // marks the end of the request
                                             // types, add any new request types 
@@ -285,6 +286,7 @@ typedef enum {
     ReplyType_Mount,                        // reply with mount info
     ReplyType_MonStats,                     // reply with monitor statistics
     ReplyType_ZoneInfo,                     // reply with info on list of zones
+    ReplyType_NodeName,                     // reply with results
 
 
     ReplyType_Invalid                       // marks the end of the reply types,
@@ -605,6 +607,19 @@ struct NodeInfo_reply_def
     bool continuation;                      // true if continuation of earlier request
 };
 
+struct NodeName_def
+{
+    int nid;                                    // node id of requesting process
+    int pid;                                    // process id of requesting process
+    char new_name[MPI_MAX_PROCESSOR_NAME];      // get information on node id (-1 for all)
+    char current_name[MPI_MAX_PROCESSOR_NAME];  // current name of node (validation)
+};
+
+struct NodeName_reply_def
+{
+    int return_code;                        // error returned to sender
+};
+
 struct NodeJoining_def
 {
     int  pnid;
@@ -1059,6 +1074,7 @@ struct request_def
         struct PNodeInfo_def         pnode_info;
         struct SpareUp_def           spare_up;
         struct NodeReInt_def         reintegrate;
+        struct NodeName_def          nodename;
     } u;
 };
 
@@ -1088,6 +1104,7 @@ struct reply_def
         struct Close_reply_def         close;
         struct MonStats_reply_def      mon_info;
         struct ZoneInfo_reply_def      zone_info;
+        struct NodeName_reply_def      nodename;
     } u;
 };
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c6bc8a3f/core/sqf/monitor/linux/phnode.h
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/phnode.h b/core/sqf/monitor/linux/phnode.h
index 937939f..b029ada 100755
--- a/core/sqf/monitor/linux/phnode.h
+++ b/core/sqf/monitor/linux/phnode.h
@@ -55,6 +55,8 @@ public:
     inline const char *GetName( void ) { return( name_.c_str() ); }
     inline NodeState_t GetState( void ) { return( state_ ); }
     inline void    SetState( NodeState_t state ) { state_ = state; }
+    inline void SetName( const char * newName ) { if (newName) name_ = newName; } 
+ 
 
 private:
     string          name_;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c6bc8a3f/core/sqf/monitor/linux/pnode.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/pnode.cxx b/core/sqf/monitor/linux/pnode.cxx
index ab81b2d..dda44f2 100755
--- a/core/sqf/monitor/linux/pnode.cxx
+++ b/core/sqf/monitor/linux/pnode.cxx
@@ -1528,6 +1528,14 @@ void CNodeContainer::AddNodes( )
     int pnid;
     int rank;
     int *sparePNids = NULL;
+    
+    //  only relevant on a workstation acting as a single node
+    const char* envVar = getenv("SQ_MAX_RANK"); 
+    int maxNode;
+    if (envVar != NULL)
+      maxNode = atoi (envVar);
+    else
+      maxNode = MAX_NODES; 
 
     CPNodeConfig *pnodeConfig = clusterConfig_->GetFirstPNodeConfig();
     for ( ; pnodeConfig; pnodeConfig = pnodeConfig->GetNext() )
@@ -1561,6 +1569,8 @@ void CNodeContainer::AddNodes( )
         }
         else
         {
+           if (pnid >= maxNode) // only for workstation acting as single node
+              rank = -1;
             node = new CNode( (char *)pnodeConfig->GetName(), pnid, rank );
             assert( node != NULL );
         }

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c6bc8a3f/core/sqf/monitor/linux/pnode.h
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/pnode.h b/core/sqf/monitor/linux/pnode.h
index 9bfe655..0cc6fd3 100755
--- a/core/sqf/monitor/linux/pnode.h
+++ b/core/sqf/monitor/linux/pnode.h
@@ -285,6 +285,7 @@ public:
     inline void SetTmSyncNid( int nid ) { tmSyncNid_ = nid; }
     inline void SetTmSyncState( SyncState syncState ) { tmSyncState_ = syncState; }
     inline void SetZone( int zid ) { zid_ = zid; }
+    inline void SetName( char *newName ) { if (newName) strcpy (name_, newName); }
     void StartPStartDProcess( void );
     void StartPStartDPersistent( void );
     void StartPStartDPersistentDTM( int nid );

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c6bc8a3f/core/sqf/monitor/linux/pnodeconfig.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/pnodeconfig.cxx b/core/sqf/monitor/linux/pnodeconfig.cxx
index 3c20ef6..6647601 100755
--- a/core/sqf/monitor/linux/pnodeconfig.cxx
+++ b/core/sqf/monitor/linux/pnodeconfig.cxx
@@ -292,6 +292,12 @@ int CPNodeConfigContainer::GetPNid( char *nodename )
     return( pnid );
 }
 
+void CPNodeConfig::SetName( char *newName ) 
+{ 
+    if (newName) 
+      strcpy(name_, newName); 
+} 
+
 CPNodeConfig *CPNodeConfigContainer::GetPNodeConfig( int pnid )
 {
     CPNodeConfig *config;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c6bc8a3f/core/sqf/monitor/linux/pnodeconfig.h
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/pnodeconfig.h b/core/sqf/monitor/linux/pnodeconfig.h
index 939c898..f4c7fb1 100755
--- a/core/sqf/monitor/linux/pnodeconfig.h
+++ b/core/sqf/monitor/linux/pnodeconfig.h
@@ -77,7 +77,7 @@ public:
     inline const char   *GetName( void ) { return ( name_ ); }
     inline CPNodeConfig *GetNext( void ) { return ( next_ ); }
     inline int           GetPNid( void ) { return ( pnid_ ); }
-
+    void                 SetName( char *newName ); 
     int                  GetSpareList( int sparePNid[] );
     inline int           GetSparesCount( void ) { return ( sparePNidsCount_ ); }
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c6bc8a3f/core/sqf/monitor/linux/replicate.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/replicate.cxx b/core/sqf/monitor/linux/replicate.cxx
index 895cf94..fb2565f 100755
--- a/core/sqf/monitor/linux/replicate.cxx
+++ b/core/sqf/monitor/linux/replicate.cxx
@@ -68,7 +68,7 @@ void CReplObj::validateObj()
 // Determine the maximum size of a replication object (excluding CReplEvent)
 int CReplObj::calcAllocSize()
 {
-    return  max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(sizeof(CReplSoftNodeUp),
+    return  max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(sizeof(CReplSoftNodeUp),
                                                                                 sizeof(CReplSoftNodeDown)),
                                                                             sizeof(CReplSchedData)),
                                                                         sizeof(CReplActivateSpare)),
@@ -81,6 +81,7 @@ int CReplObj::calcAllocSize()
                                             sizeof(CReplKill)),
                                         sizeof(CReplDevice)),
                                     sizeof(CReplNodeDown)),
+                                  sizeof(CReplNodeName)),
                                 sizeof(CReplNodeUp)),
                             sizeof(CReplDump)),
                         sizeof(CReplDumpComplete)),
@@ -1208,6 +1209,59 @@ bool CReplShutdown::replicate(struct internal_msg_def *&msg)
     return true;
 }
 
+CReplNodeName::CReplNodeName(const char *current_name, const char* new_name)
+{
+    // Add eyecatcher sequence as a debugging aid
+    memcpy(&eyecatcher_, "RPLZ", 4);
+
+    // Compute message size (adjust if needed to conform to
+    // internal_msg_def structure alignment).
+    replSize_ = (MSG_HDR_SIZE + sizeof ( nodename_def ) + msgAlignment_)
+                & ~msgAlignment_;
+
+    if (trace_settings & (TRACE_SYNC_DETAIL | TRACE_PROCESS_DETAIL))
+    {
+        const char method_name[] = "CReplNodeName::CReplNodeName";
+        trace_printf("%s@%d  - Changing node name, old name =%s, new name = %s\n",
+                     method_name, __LINE__, current_name, new_name);
+    }
+    
+    current_name_ = current_name;
+    new_name_ = new_name;
+}
+
+CReplNodeName::~CReplNodeName()
+{
+    const char method_name[] = "CReplNodeName::~CReplNodeName";
+
+    if (trace_settings & (TRACE_SYNC_DETAIL | TRACE_PROCESS_DETAIL))
+        trace_printf("%s@%d - Node name change replication\n", method_name, __LINE__ );
+
+    // Alter eyecatcher sequence as a debugging aid to identify deleted object
+    memcpy(&eyecatcher_, "rplz", 4);
+}
+
+bool CReplNodeName::replicate(struct internal_msg_def *&msg)
+{
+    const char method_name[] = "CReplNodeName::replicate";
+    TRACE_ENTRY;
+
+    if (trace_settings & (TRACE_SYNC | TRACE_PROCESS))
+        trace_printf("%s@%d" " - Changing node name (%s to %s)\n", method_name, __LINE__,
current_name_.c_str(), new_name_.c_str());
+
+    // build message to replicate this process kill to other nodes
+    msg->type = InternalType_NodeName;
+    strcpy (msg->u.nodename.new_name, new_name_.c_str());
+    strcpy (msg->u.nodename.current_name, current_name_.c_str());
+
+    // Advance sync buffer pointer
+    Nodes->AddMsg( msg, replSize() );
+
+    TRACE_EXIT;
+
+    return true;
+}
+
 CReplNodeDown::CReplNodeDown(int pnid) : pnid_(pnid)
 {
     // Add eyecatcher sequence as a debugging aid

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c6bc8a3f/core/sqf/monitor/linux/replicate.h
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/replicate.h b/core/sqf/monitor/linux/replicate.h
index 1b7e6ac..92bf985 100755
--- a/core/sqf/monitor/linux/replicate.h
+++ b/core/sqf/monitor/linux/replicate.h
@@ -284,6 +284,20 @@ private:
     int pnid_;
 };
 
+class CReplNodeName: public CReplObj
+{
+public:
+    CReplNodeName(const char *current_name, const char *new_name);
+    virtual ~CReplNodeName();
+
+    bool replicate(struct internal_msg_def *& msg);
+
+private:
+    string current_name_;
+    string new_name_;
+};
+
+
 class CReplNodeUp: public CReplObj
 {
 public:

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c6bc8a3f/core/sqf/monitor/linux/reqnodename.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/reqnodename.cxx b/core/sqf/monitor/linux/reqnodename.cxx
new file mode 100644
index 0000000..6c55e23
--- /dev/null
+++ b/core/sqf/monitor/linux/reqnodename.cxx
@@ -0,0 +1,114 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// @@@ START COPYRIGHT @@@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// @@@ END COPYRIGHT @@@
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include <stdio.h>
+#include "reqqueue.h"
+#include "montrace.h"
+#include "monsonar.h"
+#include "monlogging.h"
+#include "replicate.h"
+#include "mlio.h"
+
+extern CMonitor *Monitor;
+extern CMonStats *MonStats;
+extern CNodeContainer *Nodes;
+extern CReplicate Replicator;
+extern CNode *MyNode;
+
+
+CExtNodeNameReq::CExtNodeNameReq (reqQueueMsg_t msgType, int pid,
+                          struct message_def *msg )
+    : CExternalReq(msgType, pid, msg)
+{
+    // Add eyecatcher sequence as a debugging aid
+    memcpy(&eyecatcher_, "RQEZ", 4);
+}
+
+CExtNodeNameReq::~CExtNodeNameReq()
+{
+    // Alter eyecatcher sequence as a debugging aid to identify deleted object
+    memcpy(&eyecatcher_, "rqez", 4);
+}
+
+void CExtNodeNameReq::populateRequestString( void )
+{
+    char strBuf[MON_STRING_BUF_SIZE/2] = { 0 };
+
+    snprintf( strBuf, sizeof(strBuf), 
+              "ExtReq(%s) req #=%ld requester(pid=%d)"
+              , CReqQueue::svcReqType[reqType_], getId(), pid_);
+    requestString_.assign( strBuf );
+}
+
+void CExtNodeNameReq::performRequest()
+{
+   const char method_name[] = "CExtNodeNameReq::performRequest";
+    TRACE_ENTRY;
+
+    CNode    *node = NULL;
+
+    // Trace info about request
+     node = Nodes->GetNode(msg_->u.request.u.nodename.current_name); 
+     if (node)
+     {
+           if (trace_settings & (TRACE_REQUEST | TRACE_PROCESS))
+           {
+                 trace_printf("[%s], Requested node name change from %s to %s\n" , method_name,
msg_->u.request.u.nodename.current_name, msg_->u.request.u.nodename.new_name);
+           }
+
+           node->SetName(msg_->u.request.u.nodename.new_name);
+
+           CReplNodeName *repl = new CReplNodeName(msg_->u.request.u.nodename.current_name,

+                                msg_->u.request.u.nodename.new_name);
+           Replicator.addItem(repl);
+           if (!msg_->noreply)  // client needs a reply 
+           {
+                msg_->u.reply.type = ReplyType_NodeInfo;
+                msg_->u.reply.u.generic.return_code = MPI_SUCCESS;
+   
+                // Send reply to requester
+                lioreply(msg_, pid_);
+           }
+        } else 
+        {
+        if (trace_settings & (TRACE_REQUEST | TRACE_PROCESS))
+           {
+                trace_printf("[%s], Internal Error - Requested node name change from %s to
%s\n" , method_name, msg_->u.request.u.nodename.current_name, msg_->u.request.u.nodename.new_name);
+           }
+
+            if (!msg_->noreply)  // client needs a reply 
+            {
+                msg_->u.reply.type = ReplyType_NodeInfo;
+                msg_->u.reply.u.generic.return_code = MPI_ERR_UNKNOWN;
+   
+                // Send reply to requester
+                 lioreply(msg_, pid_);
+            }
+	  
+	}
+
+    TRACE_EXIT;
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c6bc8a3f/core/sqf/monitor/linux/reqqueue.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/reqqueue.cxx b/core/sqf/monitor/linux/reqqueue.cxx
index 5fb8e38..fcf7620 100644
--- a/core/sqf/monitor/linux/reqqueue.cxx
+++ b/core/sqf/monitor/linux/reqqueue.cxx
@@ -1623,6 +1623,48 @@ void CIntShutdownReq::performRequest()
     TRACE_EXIT;
 }
 
+CIntNodeNameReq::CIntNodeNameReq( const char *current_name, const char *new_name  ) 
+    : CInternalReq()
+{
+    // Add eyecatcher sequence as a debugging aid
+    memcpy(&eyecatcher_, "RQIZ", 4);
+    new_name_ = new_name;
+    current_name_=current_name;
+}
+
+CIntNodeNameReq::~CIntNodeNameReq()
+{
+    // Alter eyecatcher sequence as a debugging aid to identify deleted object
+    memcpy(&eyecatcher_, "rqiz", 4);
+}
+
+void CIntNodeNameReq::populateRequestString( void )
+{
+    char strBuf[MON_STRING_BUF_SIZE/2];
+    sprintf( strBuf, "IntReq(%s) req #=%ld"
+                   , CReqQueue::intReqType[InternalType_NodeName]
+                   , getId() );
+    requestString_.assign( strBuf );
+}
+
+void CIntNodeNameReq::performRequest()
+{
+    const char method_name[] = "CIntNodeNameReq::performRequest";
+    TRACE_ENTRY;
+    char current_n[MAX_PROCESS_NAME];
+    char new_n[MAX_PROCESS_NAME];
+    
+    strcpy (current_n, current_name_.c_str());
+    strcpy (new_n, new_name_.c_str());
+
+    CNode    *node = Nodes->GetNode(current_n); 
+    if (node)
+        node->SetName(new_n);
+
+    TRACE_EXIT;
+}
+
+
 CIntDownReq::CIntDownReq( int pnid ) 
     : CInternalReq(),
       pnid_ ( pnid )
@@ -2591,6 +2633,11 @@ CExternalReq *CReqQueue::prepExternalReq(CExternalReq::reqQueueMsg_t
msgType,
             request->setConcurrent(reqConcurrent[msg->u.request.type]);
             break;
 
+        case ReqType_NodeName:
+            request = new CExtNodeNameReq(msgType, pid, msg);
+            request->setConcurrent(reqConcurrent[msg->u.request.type]);
+            break;
+   
         case ReqType_ProcessInfo:
             request = new CExtProcInfoReq(msgType, pid, msg);
             request->setConcurrent(reqConcurrent[msg->u.request.type]);
@@ -2916,6 +2963,15 @@ void CReqQueue::enqueueDownReq( int pnid )
     enqueueReq ( request );
 }
 
+void CReqQueue::enqueueNodeNameReq( char *current_name, char *new_name)
+{
+    CInternalReq * request;
+
+    request = new CIntNodeNameReq ( current_name, new_name );
+
+    enqueueReq ( request );
+}
+
 void CReqQueue::enqueueSoftNodeDownReq( int pnid )
 {
     CInternalReq * request;
@@ -3565,7 +3621,8 @@ const bool CReqQueue::reqConcurrent[] = {
    false,    // ReqType_TmSync
    false,    // ReqType_TransInfo
    true,     // ReqType_MonStats
-   true      // ReqType_ZoneInfo
+   true,     // ReqType_ZoneInfo
+   false     // ReqType_NodeName
 };
 #endif
 
@@ -3602,6 +3659,7 @@ const bool CReqQueue::reqConcurrent[] = {
    false,    // ReqType_TransInfo
    false,    // ReqType_MonStats
    false,    // ReqType_ZoneInfo
+   false,    // ReqType_NodeName 
    false     // ReqType_Invalid
 };
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c6bc8a3f/core/sqf/monitor/linux/reqqueue.h
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/reqqueue.h b/core/sqf/monitor/linux/reqqueue.h
index 43e008e..4f5a21b 100755
--- a/core/sqf/monitor/linux/reqqueue.h
+++ b/core/sqf/monitor/linux/reqqueue.h
@@ -220,6 +220,20 @@ private:
     void populateRequestString( void );
 };
 
+class CExtNodeNameReq: public CExternalReq
+{
+public:
+    CExtNodeNameReq (reqQueueMsg_t msgType, int pid,
+                 struct message_def *msg );
+    virtual ~CExtNodeNameReq();
+
+    void performRequest();
+
+private:
+    void populateRequestString( void );
+};
+
+
 class CExtEventReq: public CExternalReq
 {
 public:
@@ -849,6 +863,21 @@ private:
     int level_;
 };
 
+class CIntNodeNameReq: public CInternalReq
+{
+public:
+    CIntNodeNameReq( const char *current_name, const char *new_name );
+    virtual ~CIntNodeNameReq();
+
+    void performRequest();
+
+private:
+    void populateRequestString( void );
+
+    string current_name_;
+    string new_name_;
+};
+
 class CIntDownReq: public CInternalReq
 {
 public:
@@ -1027,6 +1056,7 @@ class CReqQueue
     void enqueueChildDeathReq ( pid_t pid );
     void enqueueAttachedDeathReq ( pid_t pid );
     void enqueueDownReq( int pnid );
+    void enqueueNodeNameReq( char *current_name, char *new_name);
     void enqueueSoftNodeDownReq( int pnid );
     void enqueueSoftNodeUpReq( int pnid );
     void enqueueShutdownReq( int level );
@@ -1157,7 +1187,7 @@ private:
       RQEW   CExtZoneInfoReq
       RQEX   (unused)
       RQEY   (unused)
-      RQEZ   (unused)
+      RQEZ   CExtNodeNameReq
       RQE_   CExtNullReq
 
  */

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c6bc8a3f/core/sqf/monitor/linux/shell.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/shell.cxx b/core/sqf/monitor/linux/shell.cxx
index 65d89f9..ca3f3d3 100755
--- a/core/sqf/monitor/linux/shell.cxx
+++ b/core/sqf/monitor/linux/shell.cxx
@@ -183,11 +183,14 @@ bool init_pnode_map( void )
     pnodeConfig = ClusterConfig.GetFirstPNodeConfig();
     for ( ; pnodeConfig; pnodeConfig = pnodeConfig->GetNext() )
     {
-        // TEST_POINT: to force state down on node name 
-        NodeState_t nodeState = StateUp;
-        const char *downNodeName = getenv( TP001_NODE_DOWN );
-        if ( downNodeName != NULL && 
-            !strcmp( downNodeName, pnodeConfig->GetName() ) )
+        // TEST_POINT and exclude list : to force state down on node name
+         NodeState_t nodeState = StateUp;
+         const char *downNodeName = getenv( TP001_NODE_DOWN );
+        const char *downNodeList = getenv( TRAF_EXCLUDE_LIST );
+        if (( downNodeList != NULL && 
+            (strstr(downNodeList,pnodeConfig->GetName()))) ||
+            ( downNodeName != NULL && 
+             !strcmp( downNodeName, pnodeConfig->GetName() ) ))
         {
             nodeState = StateDown;
         }
@@ -2822,7 +2825,7 @@ void help_cmd (void)
     printf ("[%s] -- ls [{[detail]}] [<path>]\n", MyName);
     printf ("[%s] -- measure | measure_cpu\n", MyName);
     printf ("[%s] -- monstats\n", MyName);
-    printf ("[%s] -- node [info [<nid>]]\n", MyName);
+    printf ("[%s] -- node [[info [<nid>]] | [name <old name> <new name>]]\n",
MyName);
     printf ("[%s] -- path [<directory>[,<directory>]...]\n", MyName);
     printf ("[%s] -- ps [{ASE|TSE|DTM|AMP|BO|VR|CS}] [<process_name>|<nid,pid>]\n",
MyName);
     printf ("[%s] -- pwd\n", MyName);
@@ -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;
+           }
+        }
+        else
+        {
+           printf( "[%s] Error: Internal error while changing node name.  Node name=%s\n",
MyName,new_name );           
+           return;
+        }
+    }
+    else
+    {
+        printf( "[%s] Error: Internal error while changing node name.  Node name=%s\n", MyName,
new_name );           
+        return;
+    }
+    
+    // change in another local location
+    int pnid = ClusterConfig.GetPNid (current_name); 
+    CPNodeConfig *pConfig = ClusterConfig.GetPNodeConfig (pnid); 
+    if (pConfig != NULL) 
+        pConfig->SetName(new_name);
+      
+     //and..... in another local location
+     for( int i=0; i<NumNodes; i++)
+     {
+        if ( strcmp (PNode[i], current_name) == 0)
+           strcpy(PNode[i],new_name);
+     }       
+    
+     // now change it in the monitors
+     if ( gp_local_mon_io->acquire_msg( &msg ) != 0 )
+     {   // Could not acquire a message buffer
+         printf ("[%s] Unable to acquire message buffer.\n", MyName);
+         return;
+     }
+
+     msg->type = MsgType_Service;
+     msg->noreply = false;
+     msg->reply_tag = REPLY_TAG;
+     msg->u.request.type = ReqType_NodeName;
+     msg->u.request.u.nodename.nid = MyNid;
+     msg->u.request.u.nodename.pid = MyPid;
+     strcpy (msg->u.request.u.nodename.new_name, new_name);
+     strcpy (msg->u.request.u.nodename.current_name, current_name);
+  
+     gp_local_mon_io->send_recv( msg );
+     count = sizeof( *msg );
+     status.MPI_TAG = msg->reply_tag;
+ 
+     if ((status.MPI_TAG == REPLY_TAG) &&
+            (count == sizeof (struct message_def)))
+     {
+        if ((msg->type == MsgType_Service) &&
+            (msg->u.reply.type == ReplyType_NodeName))
+            {
+                if (msg->u.reply.u.node_info.return_code != MPI_SUCCESS)
+                   printf ("[%s] Unable to change node name in monitors.\n", MyName);
+            }
+     }
+     else
+       printf ("[%s] Invalid Message/Reply type for Node Name Change request.\n", MyName);
+}
+
 void listNodeInfo( int nid )
 {
     int i;
@@ -3083,6 +3183,7 @@ void listNodeInfo( int nid )
         return;
     }
 
+    const char *downNodeList = getenv( TRAF_EXCLUDE_LIST );
     bool needBanner = true;
     bool getMoreInfo = false;
     do
@@ -3128,6 +3229,12 @@ void listNodeInfo( int nid )
 
                         for (i=0; i < msg->u.reply.u.node_info.num_returned; i++)
                         {
+                             CPNodeConfig *pConfig = ClusterConfig.GetPNodeConfig (msg->u.reply.u.node_info.node[i].pnid);
+                            if ((downNodeList != NULL ) && (pConfig != NULL) &&
(strstr(downNodeList, pConfig->GetName())))
+                            {
+                                continue; // We do not want to consider this node since it
is in our exclude list
+                            }
+
                             if ( last_nid != -1 )
                             {
                                 if ( (msg->u.reply.u.node_info.node[i].pnid != 
@@ -3484,6 +3591,7 @@ void node_cmd (char *cmd_tail)
     char token[MAX_TOKEN];
     char delimiter;
     char *ptr;
+    const char *downNodeList = getenv( TRAF_EXCLUDE_LIST );
 
     if (*cmd_tail == '\0')
     {
@@ -3505,9 +3613,10 @@ void node_cmd (char *cmd_tail)
                 }
                 
                 pnodeConfig = lnodeConfig->GetPNodeConfig();
-                if ( lnodeConfig )
+                if ( pnodeConfig )
                 {
-                    printf( "[%s] Node[%d]=%s, %s, %s\n"
+                   if ((!downNodeList) || ((downNodeList) && !(strstr(downNodeList,pnodeConfig->GetName()))))
+                       printf( "[%s] Node[%d]=%s, %s, %s\n"
                           , MyName
                           , i 
                           , pnodeConfig->GetName()
@@ -3521,7 +3630,16 @@ void node_cmd (char *cmd_tail)
     else
     {
         ptr = get_token (cmd_tail, token, &delimiter);
-        if (strcmp (token, "info") == 0)
+        if (strcmp (token, "name") == 0)
+        {
+             char* ptr2 = get_token (ptr, token, &delimiter);
+             if (ptr2 && *ptr2)
+                changeNodeName(token, ptr2);
+             else
+                printf ("[%s] Invalid node name\n", MyName);
+        }
+        else if (strcmp (token, "info") == 0)
+
         {
             if (Started)
             {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c6bc8a3f/core/sqf/monitor/linux/testpoint.h
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/testpoint.h b/core/sqf/monitor/linux/testpoint.h
index 4125b7b..058a36f 100755
--- a/core/sqf/monitor/linux/testpoint.h
+++ b/core/sqf/monitor/linux/testpoint.h
@@ -32,7 +32,7 @@
 
 // Startup in real cluster with down node simulation
 #define TP001_NODE_DOWN  "MON_TP_NODE_DOWN"     // down node name at startup
-
+#define TRAF_EXCLUDE_LIST  "TRAF_EXCLUDE_LIST"     // exclude node
 // Node re-integration failure testpoints
 //   Roles:
 //     new      - new monitor created by shell 



Mime
View raw message