trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sure...@apache.org
Subject [42/50] [abbrv] trafodion git commit: Fixes to Name Server enabled logic.
Date Sat, 16 Jun 2018 17:10:12 GMT
Fixes to Name Server enabled logic.


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

Branch: refs/heads/master
Commit: cd4f700621ab9d13ea7e39baef0e989714a34b0b
Parents: 65ac556
Author: Zalo Correa <zalo.correa@esgyn.com>
Authored: Mon Jun 4 07:34:37 2018 -0700
Committer: Zalo Correa <zalo.correa@esgyn.com>
Committed: Mon Jun 4 07:34:37 2018 -0700

----------------------------------------------------------------------
 .../export/include/common/evl_sqlog_eventnum.h  |   1 -
 core/sqf/monitor/linux/cluster.cxx              |  99 +++--
 core/sqf/monitor/linux/cluster.h                |   5 +-
 core/sqf/monitor/linux/config.cxx               | 390 +++++++++++++++++++
 core/sqf/monitor/linux/config.h                 |  25 +-
 core/sqf/monitor/linux/localio.h                |   4 +-
 core/sqf/monitor/linux/monitor.cxx              |   5 +
 core/sqf/monitor/linux/reqget.cxx               |   2 +-
 core/sqf/monitor/linux/reqnewproc.cxx           |   2 +-
 core/sqf/monitor/linux/reqqueue.cxx             |  13 +
 core/sqf/monitor/linux/shell.cxx                | 152 +++++++-
 core/sqf/sql/scripts/gensq.pl                   |  25 ++
 core/sqf/sql/scripts/gomon.cold                 | 108 +++--
 core/sqf/sql/scripts/sqconfigdb.pm              |  20 +
 core/sqf/sql/scripts/sqgen                      | 211 +++++-----
 core/sqf/sql/scripts/sqstart                    | 207 +++++-----
 core/sqf/sql/scripts/sqstop                     |  36 +-
 core/sqf/src/trafconf/Makefile                  |   2 +-
 core/sqf/src/trafconf/clusterconf.cpp           |  43 ++
 core/sqf/src/trafconf/tctrace.h                 |   2 +-
 20 files changed, 1041 insertions(+), 311 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/export/include/common/evl_sqlog_eventnum.h
----------------------------------------------------------------------
diff --git a/core/sqf/export/include/common/evl_sqlog_eventnum.h b/core/sqf/export/include/common/evl_sqlog_eventnum.h
index de3e60e..8930ccc 100644
--- a/core/sqf/export/include/common/evl_sqlog_eventnum.h
+++ b/core/sqf/export/include/common/evl_sqlog_eventnum.h
@@ -253,7 +253,6 @@
 #define MON_CLUSTER_ASSIGNMONITORLEADER_2   101015302
 #define MON_CLUSTER_ASSIGNMONITORLEADER_3   101015303
 #define MON_CLUSTER_ASSIGNMONITORLEADER_4   101015304
-
 #define MON_CLUSTER_CHECKIFDONE_1           101015401
 
 /* Module: monitor.cxx = 02 */

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/monitor/linux/cluster.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/cluster.cxx b/core/sqf/monitor/linux/cluster.cxx
index 69647ec..8bf47c3 100644
--- a/core/sqf/monitor/linux/cluster.cxx
+++ b/core/sqf/monitor/linux/cluster.cxx
@@ -877,10 +877,11 @@ CCluster::CCluster (void)
     char *env = getenv("SQ_MON_CHECK_SEQNUM");
     if ( env )
     {
-        int val;
-        errno = 0;
-        val = strtol(env, NULL, 10);
-        if ( errno == 0) checkSeqNum_ = (val != 0);
+        int val = atoi(env);
+        if ( val > 0)
+        {
+            checkSeqNum_ = (val != 0);
+        }
     }
 
     if (trace_settings & TRACE_INIT)
@@ -934,10 +935,11 @@ CCluster::CCluster (void)
     env = getenv("SQ_MON_NODE_DOWN_VALIDATION");
     if ( env )
     {
-        int val;
-        errno = 0;
-        val = strtol(env, NULL, 10);
-        if ( errno == 0) validateNodeDown_ = (val != 0);
+        int val = atoi(env);
+        if ( val > 0)
+        {
+            validateNodeDown_ = (val != 0);
+        }
     }
 
     char buf[MON_STRING_BUF_SIZE];
@@ -1244,9 +1246,14 @@ void CCluster::HardNodeDown (int pnid, bool communicate_state)
     }
 #endif
 
+#ifndef NAMESERVER_PROCESS
     if ( Emulate_Down )
     {
-        IAmIntegrated = false;
+        AssignTmLeader(pnid, false);
+    }
+    else
+#endif
+    {
         AssignLeaders(pnid, node->GetName(), false);
     }
 
@@ -1351,7 +1358,6 @@ void CCluster::SoftNodeDown( int pnid )
                     , node->IsSoftNodeDown());
     }
 
-    IAmIntegrated = false;
     AssignLeaders(pnid, node->GetName(), false);
 
     TRACE_EXIT;
@@ -2625,7 +2631,7 @@ void CCluster::HandleOtherNodeMsg (struct internal_msg_def *recv_msg,
                      "pid=%d for stdin data request.\n", method_name,
                      recv_msg->u.stdin_req.nid,
                      recv_msg->u.stdin_req.pid);
-            mon_log_write(MON_CLUSTER_HANDLEOTHERNODE_9, SQ_LOG_ERR, buf);
+            mon_log_write(MON_CLUSTER_HANDLEOTHERNODE_9, SQ_LOG_INFO, buf);
         }
         break;
 #endif
@@ -8752,6 +8758,7 @@ void CCluster::InitServerSock( void )
 #else
     int ptpPort = 0;
 #endif
+    int val = 0;
 
     unsigned char addr[4];
     struct hostent *he;
@@ -8777,12 +8784,22 @@ void CCluster::InitServerSock( void )
 #endif
     if ( env )
     {
-        int val;
-        errno = 0;
-        val = strtol(env, NULL, 10);
-        if ( !IsRealCluster )
-            val += MyPNID;
-        if ( errno == 0) serverCommPort = val;
+        val = atoi(env);
+        if ( val > 0)
+        {
+            if ( !IsRealCluster )
+            {
+                val += MyPNID;
+            }
+            serverCommPort = val;
+        }
+    }
+
+    if (trace_settings & (TRACE_INIT | TRACE_RECOVERY))
+    {
+        trace_printf( "%s@%d COMM_PORT Node_name=%s, env=%s, serverCommPort=%d, val=%d\n"
+                    , method_name, __LINE__
+                    , Node_name, env, serverCommPort, val );
     }
 
     commSock_ = MkSrvSock( &serverCommPort );
@@ -8829,14 +8846,24 @@ void CCluster::InitServerSock( void )
 #endif
     if ( env )
     {
-        int val;
-        errno = 0;
-        val = strtol(env, NULL, 10);
-        if ( errno == 0 ) syncPort_ = val;
-        if ( !IsRealCluster )
-            val += MyPNID;
-        if ( errno == 0) serverSyncPort = val;
+        val = atoi(env);
+        if ( val > 0)
+        {
+            if ( !IsRealCluster )
+            {
+                val += MyPNID;
+            }
+            syncPort_ = serverSyncPort = val;
+        }
+    }
+
+    if (trace_settings & (TRACE_INIT | TRACE_RECOVERY))
+    {
+        trace_printf( "%s@%d SYNC_PORT Node_name=%s, env=%s, serverSyncPort=%d, val=%d\n"
+                    , method_name, __LINE__
+                    , Node_name, env, syncPort_, val );
     }
+
     syncSock_ = MkSrvSock( &serverSyncPort );
     if ( syncSock_ < 0 )
     {
@@ -8877,12 +8904,15 @@ void CCluster::InitServerSock( void )
     env = getenv("NS_M2N_COMM_PORT");
     if ( env )
     {
-        int val;
-        errno = 0;
-        val = strtol(env, NULL, 10);
-        if ( !IsRealCluster )
-            val += MyPNID;
-        if ( errno == 0) mon2nsPort = val;
+        val = atoi(env);
+        if ( val > 0)
+        {
+            if ( !IsRealCluster )
+            {
+                val += MyPNID;
+            }
+            mon2nsPort = val;
+        }
     }
 
     mon2nsSock_ = MkSrvSock( &mon2nsPort );
@@ -8924,10 +8954,11 @@ void CCluster::InitServerSock( void )
         env = getenv("MON2MON_COMM_PORT");
         if ( env )
         {
-            int val;
-            errno = 0;
-            val = strtol(env, NULL, 10);
-            if ( errno == 0) ptpPort = val;
+            val = atoi(env);
+            if ( val > 0)
+            {
+                ptpPort = val;
+            }
         }
         else
         {

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/monitor/linux/cluster.h
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/cluster.h b/core/sqf/monitor/linux/cluster.h
index 1d7e1ac..970cf4c 100644
--- a/core/sqf/monitor/linux/cluster.h
+++ b/core/sqf/monitor/linux/cluster.h
@@ -227,7 +227,10 @@ public:
         long fullSize_;
         long compressedSize_;
         long tmLeader_;
-        unsigned long long seqNum_; 
+        long clusterRegistryCount_;
+        long processRegistryCount_;
+        long uniqueStringCount_;
+        unsigned long long seqNum_;
     } snapShotHeader_t; 
 
     enum { ACCEPT_NEW_MONITOR_RETRIES = 120 };  // Maximum retries by creator monitor

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/monitor/linux/config.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/config.cxx b/core/sqf/monitor/linux/config.cxx
index c757e25..4ef9b72 100644
--- a/core/sqf/monitor/linux/config.cxx
+++ b/core/sqf/monitor/linux/config.cxx
@@ -51,6 +51,7 @@ extern CMonStats *MonStats;
 extern CMonTrace *MonTrace;
 extern CMonLog *MonLog;
 extern CReplicate Replicator;
+extern CMonitor *Monitor;
 
 extern char *ErrorMsg (int error_code);
 
@@ -997,3 +998,392 @@ void CConfigContainer::strIdToString( strId_t stringId,  string & value )
 
     TRACE_EXIT;
 }
+
+int CConfigContainer::getRegistrySize()
+{
+    const char method_name[] = "CConfigContainer::getRegistrySize";
+    TRACE_ENTRY;
+    
+    int regClusterCount = 0;
+    int regProcessCount = 0;
+    int regClusterMax = 0;
+    int regCount = 0;
+    int regSize = 0;
+    
+    int rc = tc_get_registry_cluster_set( &regClusterCount
+                                    , regClusterMax
+                                    , NULL );
+    if ( rc )
+    {
+          char la_buf[MON_STRING_BUF_SIZE];
+          snprintf( la_buf, sizeof(la_buf)
+            , "[%s] Cluster scope configuration registry access failed!\n"
+            , method_name );
+          mon_log_write(MON_CONFIGCONT_INIT_2, SQ_LOG_CRIT, la_buf);
+          TRACE_EXIT;
+          return 0;
+     }
+     
+     regCount = regClusterCount;
+     
+     regClusterMax = 0;
+     
+     rc = tc_get_registry_process_set( &regClusterCount
+                                    , regClusterMax
+                                    , NULL );
+     if ( rc )
+     {
+          char la_buf[MON_STRING_BUF_SIZE];
+          snprintf( la_buf, sizeof(la_buf)
+            , "[%s] Cluster scope configuration registry access failed!\n"
+            , method_name );
+          mon_log_write(MON_CONFIGCONT_INIT_2, SQ_LOG_CRIT, la_buf);
+          TRACE_EXIT;
+          return 0;
+      }
+      
+      regCount += regProcessCount;
+      regCount += 10; // just to be safe
+      
+      // cluster_set -> regCount of these
+      // int
+      // int`
+      // int 
+      // int
+      // variable length : [Scope, Key, Value] 
+      
+      regSize = regCount * sizeof (cluster_set); // accounts fore verything but the variable data;
+      regSize = regSize + (regCount*(TC_REGISTRY_KEY_MAX + TC_REGISTRY_KEY_MAX + TC_REGISTRY_VALUE_MAX));
+         
+      TRACE_EXIT;  
+      return regSize;
+}
+
+int CConfigContainer::getUniqueStringsSize() 
+{
+    const char method_name[] = "CConfigContainer::getUniqueStringsSize";
+    TRACE_ENTRY;
+    int maxUniqueId = 0;
+    int totalUniqueIds = 0;
+    int uniqueIdSize = 0;
+    
+    for (int pnid = 0; pnid < Monitor->GetConfigPNodesMax(); pnid++)
+    {
+        tc_get_unique_string_id_max (pnid, &maxUniqueId);
+        totalUniqueIds += maxUniqueId;
+    }
+    
+    totalUniqueIds += 5; // just to be safe
+    uniqueIdSize = totalUniqueIds * sizeof(unique_string_set);
+    uniqueIdSize = uniqueIdSize + (totalUniqueIds*TC_UNIQUE_STRING_VALUE_MAX);
+    
+    TRACE_EXIT;  
+    return uniqueIdSize;
+}
+    
+int CConfigContainer::PackRegistry( char *&buffer, ConfigType type )
+{
+    const char method_name[] = "CConfigContainer::PackRegistry";
+    TRACE_ENTRY;
+    int rc;
+    int regClusterCount = 0;
+    int regClusterMax = 0;
+    TcRegistryConfiguration_t *regClusterConfig = NULL;
+    char *bufPtr = buffer;    
+    
+    struct cluster_set *clusterObj = (struct cluster_set *)bufPtr;
+    char *stringData = &clusterObj->stringData;
+
+    int stringDataLen = 0;
+    int numberOfEntries = 0;
+    
+    switch (type)
+    {
+      case ConfigType_Cluster:
+      {
+          // Get cluster scope configuration registry entries count
+          rc = tc_get_registry_cluster_set( &regClusterCount
+                                    , regClusterMax
+                                    , NULL );
+          if ( rc )
+          {
+              char la_buf[MON_STRING_BUF_SIZE];
+              snprintf( la_buf, sizeof(la_buf)
+                , "[%s] Cluster scope configuration registry access failed!\n"
+                , method_name );
+              mon_log_write(MON_CONFIGCONT_INIT_2, SQ_LOG_CRIT, la_buf);
+              TRACE_EXIT;
+              return 0;
+          }
+    
+          regClusterMax = regClusterCount;
+          regClusterConfig = new TcRegistryConfiguration_t[regClusterMax];
+          rc = tc_get_registry_cluster_set( &regClusterCount
+                                              , regClusterMax
+                                              , regClusterConfig );
+          if ( rc )
+          {
+              char la_buf[MON_STRING_BUF_SIZE];
+              snprintf( la_buf, sizeof(la_buf)
+                    , "[%s] Cluster scope configuration registry access failed!\n"
+                    , method_name );
+              mon_log_write(MON_CONFIGCONT_INIT_2, SQ_LOG_CRIT, la_buf);
+              TRACE_EXIT;
+              return 0;
+          } 
+          break;
+      }
+      
+      case ConfigType_Process:
+      {
+          // Get cluster scope configuration registry entries count
+          rc = tc_get_registry_process_set( &regClusterCount
+                                    , regClusterMax
+                                    , NULL );
+          if ( rc )
+          {
+              char la_buf[MON_STRING_BUF_SIZE];
+              snprintf( la_buf, sizeof(la_buf)
+                , "[%s] Cluster scope configuration registry access failed!\n"
+                , method_name );
+              mon_log_write(MON_CONFIGCONT_INIT_2, SQ_LOG_CRIT, la_buf);
+              TRACE_EXIT;
+              return 0;
+          }
+    
+          regClusterMax = regClusterCount;
+          regClusterConfig = new TcRegistryConfiguration_t[regClusterMax];
+          rc = tc_get_registry_process_set( &regClusterCount
+                                        , regClusterMax
+                                        , regClusterConfig );
+          if ( rc )
+          {
+              char la_buf[MON_STRING_BUF_SIZE];
+              snprintf( la_buf, sizeof(la_buf)
+                    , "[%s] Cluster scope configuration registry access failed!\n"
+                    , method_name );
+              mon_log_write(MON_CONFIGCONT_INIT_2, SQ_LOG_CRIT, la_buf);
+              TRACE_EXIT;
+              return 0;
+          }
+          break;
+       }
+      default:
+      {
+           // programming error
+          char la_buf[MON_STRING_BUF_SIZE];
+          snprintf( la_buf, sizeof(la_buf)
+                    , "[%s]Rregistry access failed!\n"
+                    , method_name );
+          mon_log_write(MON_CONFIGCONT_INIT_2, SQ_LOG_CRIT, la_buf);
+          TRACE_EXIT;
+          return 0;
+          break;
+      }
+    }
+    
+    // Process cluster scope configuration registry entries
+    cluster_set *regClusterEntry = clusterObj;
+    for (int i = 0; i < regClusterCount; i++ )
+    {
+        regClusterEntry->type = type;
+
+        regClusterEntry->scopeLength = strlen (regClusterConfig[i].scope);
+        regClusterEntry->keyLength = strlen (regClusterConfig[i].key);
+        regClusterEntry->valueLength = strlen (regClusterConfig[i].value);
+        if (trace_settings & (TRACE_INIT | TRACE_REQUEST))
+        {
+            trace_printf ("%s%d pack type %d, scope %s (%d), key %s (%d), value %s(%d)\n",method_name, __LINE__,
+                           regClusterEntry->type, regClusterConfig[i].scope, 
+                           regClusterEntry->scopeLength,regClusterConfig[i].key,regClusterEntry->keyLength,  
+                           regClusterConfig[i].value, regClusterEntry->valueLength);
+        }
+     
+        memcpy(stringData, regClusterConfig[i].scope,  regClusterEntry->scopeLength);
+        stringData += regClusterEntry->scopeLength;
+        stringDataLen += regClusterEntry->scopeLength;
+
+        memcpy(stringData, regClusterConfig[i].key,  regClusterEntry->keyLength);
+        stringData += regClusterEntry->keyLength;
+        stringDataLen += regClusterEntry->keyLength;
+
+        memcpy(stringData, regClusterConfig[i].value,  regClusterEntry->valueLength);
+        stringData += regClusterEntry->valueLength;
+        stringDataLen += regClusterEntry->valueLength;
+        ++numberOfEntries;
+
+        if ((i+1) < regClusterCount)
+        {
+            regClusterEntry = (cluster_set *)stringData;
+            stringData = &regClusterEntry->stringData;
+        }
+    }    
+
+    if (numberOfEntries > 0)
+    {
+        buffer = stringData;
+    }
+    
+    if (regClusterConfig)
+    {
+         delete regClusterConfig; 
+    }
+    return numberOfEntries;
+    
+    TRACE_EXIT;
+}
+
+void CConfigContainer::UnpackRegistry( char *&buffer, int count )
+{
+     const char method_name[] = "CConfigContainer::UnpackRegistry";
+     TRACE_ENTRY;
+
+     ConfigType type;
+     char myScope[TC_REGISTRY_KEY_MAX];
+     char myValue [TC_REGISTRY_VALUE_MAX];
+     char myKey[TC_REGISTRY_KEY_MAX];
+
+     if (count <= 0)
+     {
+         TRACE_EXIT;
+         return;
+     }
+     struct cluster_set *clusterObj2 =  (cluster_set *)buffer;
+     char *stringData2 = &clusterObj2->stringData;
+     for (int i = 0; i < count; i++ )
+     {     
+        memset (myScope, '\0', sizeof (myScope));
+        memset (myValue, '\0', sizeof (myValue));
+        memset (myKey, '\0', sizeof (myKey));
+
+        if (trace_settings & (TRACE_INIT | TRACE_REQUEST))
+        {
+            trace_printf ("%s%d scope length %d, key length %d, value length %d\n", method_name, __LINE__,
+                          clusterObj2->scopeLength, 
+                          clusterObj2->keyLength, clusterObj2->valueLength);
+        }
+        type = clusterObj2->type;
+
+        memcpy(myScope, stringData2,  clusterObj2->scopeLength);
+        stringData2 += clusterObj2->scopeLength;
+
+        memcpy(myKey, stringData2,  clusterObj2->keyLength);
+        stringData2 += clusterObj2->keyLength;
+
+        memcpy(myValue, stringData2,  clusterObj2->valueLength);
+        stringData2 += clusterObj2->valueLength;
+
+        if ((i+1) < count)
+        {
+            clusterObj2 = (cluster_set *)stringData2;
+            stringData2 = &clusterObj2->stringData;
+        }
+    } 
+    
+    Set( myScope
+       , type
+       , myValue
+       , myKey
+       , false );
+    
+    buffer = stringData2;
+    TRACE_EXIT; 
+}
+
+int CConfigContainer::PackUniqueStrings( char *&buffer )
+{
+    const char method_name[] = "CConfigContainer::PackUniqueStrings";
+    TRACE_ENTRY;
+    int maxUniqueId = 0;
+    char unique_string[TC_UNIQUE_STRING_VALUE_MAX] = { 0 };
+    int  stringDataLen;
+    char *bufPtr = buffer;
+
+    struct unique_string_set *stringObj = (struct unique_string_set *)bufPtr;
+    char *stringData = &stringObj->stringData;
+    int numberOfEntries = 0;
+
+    for (int pnid = 0; pnid < Monitor->GetConfigPNodesMax(); pnid++)
+    {
+        tc_get_unique_string_id_max (pnid, &maxUniqueId);
+
+        for (int maxId = 0; maxId <= maxUniqueId; maxId++)
+        {
+             memset (unique_string, 0, TC_UNIQUE_STRING_VALUE_MAX);
+             int error = tc_get_unique_string( pnid, maxId, unique_string );
+
+             if (!error)
+             {
+                 stringObj->stringLength = strlen(unique_string);
+                 if (trace_settings & (TRACE_INIT | TRACE_REQUEST))
+                 {
+                      trace_printf ("%s%d  packing nid %d, unique id %d, stringt %s (length %d)\n", method_name, __LINE__,
+                                     pnid, maxId, unique_string,stringObj->stringLength );
+                 } 
+                 stringObj->unique_id = maxId;
+                 stringObj->nid = pnid;
+                 memcpy (stringData, unique_string, stringObj->stringLength);
+                 stringDataLen+= stringObj->stringLength;
+                 stringData+=stringObj->stringLength;
+                 ++numberOfEntries;
+                 if ((pnid + 1) < Monitor->GetConfigPNodesMax())
+                 {
+                      stringObj = ( unique_string_set *)stringData;
+                      stringData = &stringObj->stringData;
+                 }
+             }
+             // don't advance if we didn't write anything
+        }
+
+    }
+    
+    if (numberOfEntries > 0)
+    {
+        buffer = stringData;    
+    }
+
+    TRACE_EXIT;  
+    return numberOfEntries;
+}
+
+void CConfigContainer::UnpackUniqueStrings( char *&buffer, int entries )
+{
+    const char method_name[] = "CConfigContainer::UnpackUniqueStrings";
+    TRACE_ENTRY;
+    
+    if (entries <= 0)
+    { 
+         TRACE_EXIT;
+         return;
+    }
+     
+    struct unique_string_set *stringObj =  (unique_string_set *)buffer;
+    char *stringData = &stringObj->stringData;
+    char unique_string[TC_UNIQUE_STRING_VALUE_MAX] = { 0 };
+    
+    for (int i = 0; i < entries; i++)
+    {
+        if (stringObj)
+        {
+            int maxUniqueId;
+            tc_get_unique_string_id_max (stringObj->nid, &maxUniqueId);
+            memset(unique_string, 0, TC_UNIQUE_STRING_VALUE_MAX);
+            memcpy (unique_string, stringData,stringObj->stringLength);
+            if (stringObj->unique_id > maxUniqueId)
+            {
+                tc_put_unique_string( stringObj->nid, stringObj->unique_id, unique_string );
+            }
+
+            stringData += stringObj->stringLength;
+        }
+        if ((i + 1) < entries)
+        {
+             stringObj = (unique_string_set *)stringData;
+             stringData = &stringObj->stringData;
+        }
+    }
+
+    buffer = stringData;
+    TRACE_EXIT;  
+}
+   

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/monitor/linux/config.h
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/config.h b/core/sqf/monitor/linux/config.h
index ea606de..80b1089 100644
--- a/core/sqf/monitor/linux/config.h
+++ b/core/sqf/monitor/linux/config.h
@@ -34,6 +34,23 @@
 
 class CConfigGroup;
 
+struct cluster_set
+{
+   ConfigType type;
+   int scopeLength;
+   int keyLength;
+   int valueLength;
+   char stringData;
+};
+
+struct unique_string_set
+{
+   int nid;
+   int unique_id;
+   int stringLength;
+   char stringData;
+};
+
 class CConfigKey
 {
  private:
@@ -127,7 +144,13 @@ public:
     int  getMaxUniqueId( int nid );
     void strIdToString ( strId_t stringId, string & value );
 
-   
+    int    PackRegistry( char *&buffer, ConfigType type );
+    void   UnpackRegistry( char *&buffer, int length );    
+    int    PackUniqueStrings( char *&buffer );
+    void   UnpackUniqueStrings( char *&buffer, int length );
+    int    getRegistrySize();
+    int    getUniqueStringsSize();
+
 protected:
 private:
     CConfigGroup *cluster_;     // predefined cluster global group 

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/monitor/linux/localio.h
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/localio.h b/core/sqf/monitor/linux/localio.h
index 331ac4c..bcdbae2 100644
--- a/core/sqf/monitor/linux/localio.h
+++ b/core/sqf/monitor/linux/localio.h
@@ -42,8 +42,8 @@ using namespace std;
 
 #define SQ_LIO_MAX_BUFFERS      1000 // shared buffers per node in real cluster,
                                      // SQ_LIO_MAX_BUFFERS/4 in virtual cluster
-#define SQ_LIO_SHM_PERMISSIONS  0640 // shared memory permissions
-#define SQ_LIO_MSQ_PERMISSIONS  0640 // message queue permissions
+#define SQ_LIO_SHM_PERMISSIONS  0660 // shared memory permissions
+#define SQ_LIO_MSQ_PERMISSIONS  0660 // message queue permissions
 
 #define SQ_LIO_NORMAL_MSG          1 // normal messages
 #define SQ_LIO_SIGNAL_TIMEOUT      (5000000) // 5 milliseconds (in nano seconds)

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/monitor/linux/monitor.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/monitor.cxx b/core/sqf/monitor/linux/monitor.cxx
index 6757f2c..d588945 100755
--- a/core/sqf/monitor/linux/monitor.cxx
+++ b/core/sqf/monitor/linux/monitor.cxx
@@ -1559,6 +1559,11 @@ int main (int argc, char *argv[])
         strcpy (short_node_name, str1 );
     }
 
+    if (IsRealCluster) 
+    {
+      strcpy (Node_name, short_node_name );
+    }
+
 #ifdef MULTI_TRACE_FILES
     setThreadVariable( (char *)"mainThread" );
 #endif

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/monitor/linux/reqget.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/reqget.cxx b/core/sqf/monitor/linux/reqget.cxx
index fe8bab9..d53fdf5 100644
--- a/core/sqf/monitor/linux/reqget.cxx
+++ b/core/sqf/monitor/linux/reqget.cxx
@@ -217,7 +217,7 @@ void CExtGetReq::performRequest()
             sprintf( buf, "%s@%d - Can't find group(%s).\n"
                    , method_name, __LINE__
                    , msg_->u.request.u.get.group);
-            mon_log_write(MON_MONITOR_GETCONF_3, SQ_LOG_ERR, buf);
+            mon_log_write(MON_MONITOR_GETCONF_3, SQ_LOG_INFO, buf);
              
             msg_->u.reply.type = ReplyType_Get;
             msg_->u.reply.u.get.type = ConfigType_Undefined;

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/monitor/linux/reqnewproc.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/reqnewproc.cxx b/core/sqf/monitor/linux/reqnewproc.cxx
index 972d785..d12ddc2 100644
--- a/core/sqf/monitor/linux/reqnewproc.cxx
+++ b/core/sqf/monitor/linux/reqnewproc.cxx
@@ -438,7 +438,7 @@ void CExtNewProcReq::performRequest()
 
             return;
         }
-    
+
         if (lnode->GetNumProcs() < MAX_PROCESSES)
         {
             strId_t pathStrId = MyNode->GetStringId ( msg_->u.request.u.new_process.path, lnode );

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/monitor/linux/reqqueue.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/reqqueue.cxx b/core/sqf/monitor/linux/reqqueue.cxx
index c7af4ca..2238d71 100644
--- a/core/sqf/monitor/linux/reqqueue.cxx
+++ b/core/sqf/monitor/linux/reqqueue.cxx
@@ -3622,6 +3622,12 @@ void CIntReviveReq::performRequest()
     if (trace_settings & (TRACE_REQUEST | TRACE_INIT | TRACE_RECOVERY))
         trace_printf("%s@%d - Process Objects unpacked\n", method_name, __LINE__);
 
+    Config->UnpackRegistry(buffer, (header.clusterRegistryCount_ + header.processRegistryCount_));
+    Config->UnpackUniqueStrings(buffer, header.uniqueStringCount_);
+    
+    if (trace_settings & (TRACE_REQUEST | TRACE_INIT | TRACE_RECOVERY))
+        trace_printf("%s@%d - Registry unpacked\n", method_name, __LINE__);
+       
     mem_log_write(MON_REQQUEUE_REVIVE_5);
 
     // process the requests that were deferred to the revive side queue.
@@ -3724,6 +3730,9 @@ void CIntSnapshotReq::performRequest()
     int idsSize = Nodes->GetSNodesCount() * sizeof(int); // spare pnids
     idsSize += (Nodes->GetPNodesCount() + Nodes->GetLNodesCount()) * sizeof(int); // pnid/nid map
     idsSize += Nodes->GetPNodesCount() * 2 * sizeof(int);    // pnid/zid
+    idsSize += Nodes->GetLNodesCount() * sizeof(int);    // nids
+    idsSize += Config->getUniqueStringsSize();
+    idsSize += Config->getRegistrySize();
 
     if (trace_settings & (TRACE_REQUEST | TRACE_INIT | TRACE_RECOVERY))
         trace_printf("%s@%d - Snapshot sizes, procSize = %d, idsSize = %d\n",
@@ -3768,6 +3777,10 @@ void CIntSnapshotReq::performRequest()
     // pack process objects
     header.procCount_ = Monitor->PackProcObjs(buf);
 
+    header.clusterRegistryCount_ =  Config->PackRegistry(buf, ConfigType_Cluster);
+    header.processRegistryCount_ =  Config->PackRegistry(buf, ConfigType_Process);
+    header.uniqueStringCount_   =  Config->PackUniqueStrings(buf);
+    
     mem_log_write(MON_REQQUEUE_SNAPSHOT_6, header.nodeMapCount_, header.procCount_);
 
     header.fullSize_ = buf - snapshotBuf;

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/monitor/linux/shell.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/shell.cxx b/core/sqf/monitor/linux/shell.cxx
index 51206d3..6c5f14b 100644
--- a/core/sqf/monitor/linux/shell.cxx
+++ b/core/sqf/monitor/linux/shell.cxx
@@ -390,6 +390,154 @@ char *ErrorMsg (int error_code)
     return buffer;
 }
 
+bool check_environment( void )
+{
+    bool  rs = true;
+    bool  isNameServerEnabled = false;
+    char* env;
+    char  msgString[MAX_BUFFER] = { 0 };
+    int   val = 0;
+
+    env = getenv("MONITOR_COMM_PORT");
+    if ( env )
+    {
+        val = atoi(env);
+        if ( val <= 0)
+        {
+            if (VirtualNodes)
+            {
+                sprintf( msgString, "[%s] Warning: MONITOR_COMM_PORT value is invalid (%s)!", MyName, env );
+                write_startup_log( msgString );
+                printf("%s\n", msgString );
+            }
+            else
+            {
+                sprintf( msgString, "[%s] Error: MONITOR_COMM_PORT value is invalid (%s)! Set MONITOR_COMM_PORT environment variable and try again.", MyName, env );
+                write_startup_log( msgString );
+                printf("%s\n", msgString );
+                rs = false;
+            }
+        }
+    }
+
+    env = getenv("MONITOR_SYNC_PORT");
+    if ( env )
+    {
+        val = atoi(env);
+        if ( val <= 0)
+        {
+            if (VirtualNodes)
+            {
+                sprintf( msgString, "[%s] Warning: MONITOR_SYNC_PORT value is invalid (%s)!", MyName, env );
+                write_startup_log( msgString );
+                printf("%s\n", msgString );
+            }
+            else
+            {
+                sprintf( msgString, "[%s] Error: MONITOR_SYNC_PORT value is invalid (%s)! Set MONITOR_COMM_PORT environment variable and try again.", MyName, env );
+                write_startup_log( msgString );
+                printf("%s\n", msgString );
+                rs = false;
+            }
+        }
+    }
+
+    env = getenv("SQ_NAMESERVER_ENABLED");
+    if ( env )
+    {
+        val = atoi(env);
+        if ( val > 0)
+        {
+            isNameServerEnabled = (val != 0);
+        }
+    }
+    
+    if (isNameServerEnabled)
+    {
+        env = getenv("NS_COMM_PORT");
+        if ( env )
+        {
+            val = atoi(env);
+            if ( val <= 0)
+            {
+                sprintf( msgString, "[%s] Error: Name Server is enabled and NS_COMM_PORT value is invalid (%s)! Set NS_COMM_PORT environment variable and try again.", MyName, env );
+                write_startup_log( msgString );
+                printf("%s\n", msgString );
+                rs = false;
+            }
+        }
+        else
+        {
+            sprintf( msgString, "[%s] Error: Name Server is enabled and NS_COMM_PORT is undefined! Set NS_COMM_PORT environment variable and try again.", MyName );
+            write_startup_log( msgString );
+            printf("%s\n", msgString );
+            rs = false;
+        }
+
+        env = getenv("NS_SYNC_PORT");
+        if ( env )
+        {
+            val = atoi(env);
+            if ( val <= 0)
+            {
+                sprintf( msgString, "[%s] Error: Name Server is enabled and NS_SYNC_PORT value is invalid (%s)! Set NS_SYNC_PORT environment variable and try again.", MyName, env );
+                write_startup_log( msgString );
+                printf("%s\n", msgString );
+                rs = false;
+            }
+        }
+        else
+        {
+            sprintf( msgString, "[%s] Error: Name Server is enabled and NS_SYNC_PORT is undefined! Set NS_SYNC_PORT environment variable and try again.", MyName );
+            write_startup_log( msgString );
+            printf("%s\n", msgString );
+            rs = false;
+        }
+
+        env = getenv("NS_M2N_COMM_PORT");
+        if ( env )
+        {
+            val = atoi(env);
+            if ( val <= 0)
+            {
+                sprintf( msgString, "[%s] Error: Name Server is enabled and NS_M2N_COMM_PORT value is invalid (%s)! Set NS_M2N_COMM_PORT environment variable and try again.", MyName, env );
+                write_startup_log( msgString );
+                printf("%s\n", msgString );
+                rs = false;
+            }
+        }
+        else
+        {
+            sprintf( msgString, "[%s] Error: Name Server is enabled and NS_M2N_COMM_PORT is undefined! Set NS_M2N_COMM_PORT environment variable and try again.", MyName );
+            write_startup_log( msgString );
+            printf("%s\n", msgString );
+            rs = false;
+        }
+
+        env = getenv("MON2MON_COMM_PORT");
+        if ( env )
+        {
+            val = atoi(env);
+            if ( val <= 0)
+            {
+                sprintf( msgString, "[%s] Error: Name Server is enabled and MON2MON_COMM_PORT value is invalid (%s)! Set MON2MON_COMM_PORT environment variable and try again.", MyName, env );
+                write_startup_log( msgString );
+                printf("%s\n", msgString );
+                rs = false;
+            }
+        }
+        else
+        {
+            sprintf( msgString, "[%s] Error: Name Server is enabled and MON2MON_COMM_PORT is undefined! Set MON2MON_COMM_PORT environment variable and try again.", MyName );
+            write_startup_log( msgString );
+            printf("%s\n", msgString );
+            rs = false;
+        }
+    }
+
+    return(rs);
+}
+
 bool init_pnode_map( void )
 {
     CPNodeConfig   *pnodeConfig;
@@ -5296,7 +5444,7 @@ int start_process (int *nid, PROCESSTYPE type, char *name, bool debug, int prior
 {
     int count;
     char delimiter;
-    char token[MAX_TOKEN];
+    char token[MAX_ARG_SIZE];
     char program[MAX_PROCESS_PATH];
     char path[MAX_SEARCH_PATH];
     char ldpath[MAX_SEARCH_PATH];
@@ -9074,7 +9222,7 @@ bool process_command( char *token, char *cmd_tail, char delimiter )
             write_startup_log( msgString );
             printf ("[%s] Current node (%s) is a configured spare node! Must use non-spare node to startup environment.\n", MyName, MyNode);
         }
-        else
+        else if ( check_environment() )
         {
             if ( start_monitor( cmd_tail,false, false ) )
             {

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/sql/scripts/gensq.pl
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/gensq.pl b/core/sqf/sql/scripts/gensq.pl
index c872cdd..b48ea3b 100755
--- a/core/sqf/sql/scripts/gensq.pl
+++ b/core/sqf/sql/scripts/gensq.pl
@@ -77,6 +77,8 @@ my $SQ_IDTMSRV = $ENV{'SQ_IDTMSRV'};
 my $BDR_ERROR = 70;
 
 
+my $g_insDbUniqStrStmt = 0;
+
 sub printScript {
     ($dWhich, @rest) = @_;
 
@@ -641,6 +643,27 @@ sub doInit {
 
 }
 
+sub setupDbUniqStrings {
+
+    my $my_scripts_dir = "$TRAF_HOME" . "/sql/scripts/" ;
+    for ($i=0; $i < $gdNumNodes; $i++) {
+        sqconfigdb::addDbUniqStr($i, 1, 'shell');
+        sqconfigdb::addDbUniqStr($i, 2, 'pstartd');
+        sqconfigdb::addDbUniqStr($i, 3, 'sqwatchdog');
+        sqconfigdb::addDbUniqStr($i, 4, 'idtmsrv');
+        sqconfigdb::addDbUniqStr($i, 5, 'tm');
+        sqconfigdb::addDbUniqStr($i, 6, 'service_monitor');
+        sqconfigdb::addDbUniqStr($i, 7, 'mxsscp');
+        sqconfigdb::addDbUniqStr($i, 8, 'mxssmp');
+        sqconfigdb::addDbUniqStr($i, 9, 'run_command');
+        sqconfigdb::addDbUniqStr($i, 10, 'mxosrvr');
+        sqconfigdb::addDbUniqStr($i, 11, 'tdm_arkesp');
+        sqconfigdb::addDbUniqStr($i, 12, 'tdm_arkcmp');
+        sqconfigdb::addDbUniqStr($i, 13, 'traf_notify');
+        sqconfigdb::addDbUniqStr($i, 14, 'mxlobsrvr');
+        sqconfigdb::addDbUniqStr($i, 15, 'trafns');
+    }
+}
 
 #
 # Main
@@ -689,6 +712,8 @@ while (<>) {
 
 #printZoneList;
 
+setupDbUniqStrings();
+
 printScriptEndLines;
 
 endGame;

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/sql/scripts/gomon.cold
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/gomon.cold b/core/sqf/sql/scripts/gomon.cold
index 3be86ee..28807fd 100755
--- a/core/sqf/sql/scripts/gomon.cold
+++ b/core/sqf/sql/scripts/gomon.cold
@@ -23,14 +23,13 @@
 # @@@ END COPYRIGHT @@@
 #
 
-
 if [ -f $TRAF_HOME/sql/scripts/sqshell.env ]; then
     . $TRAF_HOME/sql/scripts/sqshell.env
 fi
 
 if [[ -z ${TRAF_AGENT} ]]; then
    echo  "***"
-   echo  "*** Starting Monitor processes"
+   echo  "***" `date`  " - Starting Monitor processes"
    echo  "***"
 
 sqshell <<eof 
@@ -38,71 +37,104 @@ sqshell <<eof
 ! Start the monitor processes across the cluster
 startup
 
+set SQ_MBTYPE=$SQ_MBTYPE
+set MY_NODES=$MY_NODES
+set JAVA_HOME=$JAVA_HOME
+set MY_CLUSTER_ID=$MY_CLUSTER_ID
+set TRAF_FOUNDATION_READY=0
+
 exit
 eof
+
 else
-   echo  "***"
-   echo  "*** Waiting for Monitor processes to start"
-   echo  "***"
-sqshell <<eof 
+   echo `date`" - Waiting for the Trafodion monitor process..."
+
+   # 5 seconds, iterations 240 = 20 minutes
+   let loop_count=0
+   let loop_max=240
+   let monitor_ready=0
+   while [[ $loop_count -lt $loop_max ]];
+   do
+     if sqcheckmon -f
+     then
+       let ++monitor_ready
+       break
+     else
+       echo -n "."
+       sleep 5
+       sleep $wtime
+       let ++loop_count
+     fi
+   done
+
+   if [[ $monitor_ready -lt 1 ]]; then
+      echo "Aborting startup!"
+      cat $TRAF_HOME/logs/sqcheckmon.log
+      exit 1
+   else
+
+# Set initial registry values
+sqshell -a <<eof
 
-! Waiting for the monitor processes to start across the cluster
-delay 15
+set SQ_MBTYPE=$SQ_MBTYPE
+set MY_NODES=$MY_NODES
+set JAVA_HOME=$JAVA_HOME
+set MY_CLUSTER_ID=$MY_CLUSTER_ID
+set TRAF_FOUNDATION_READY=0
 
 exit
 eof
 
-sqshell -c node info
+      echo `date`" - Delaying 15 seconds before continuing with Startup"
+      sleep 15
+      echo `date`" - Continuing with Startup ..."
+      echo
+   fi
 
-fi
+   # Set the number of nodes configured
+   let node_count=`trafconf -nid-count`
+   #echo  "*** node_count = ${node_count}"
+   #echo  "*** TRAF_SCALING_FACTOR = $TRAF_SCALING_FACTOR"
 
-sqcheckmon
-let lv_checkmon_ret=$?
-if [ $lv_checkmon_ret '==' 0 ]; then
-   echo "Continuing with the Startup..."
-   echo
-else
-   echo "Aborting startup."
-   more $TRAF_HOME/logs/sqcheckmon.log
-   exit 1
+   # allow time for other nodes to integrate, scaled to cluster size
+   # scaling factor may be non-integer, so use awk to evaluate
+   start_delay=$( echo "${node_count} $TRAF_SCALING_FACTOR" | awk '{print $1 * $2}')
+   echo  "***"
+   echo  "***" %`date`" - Waiting ${start_delay} seconds for Monitor processes to integrate"
+   echo  "***"
+   sleep $start_delay
 fi
 
+sqshell -c node info
+
 # If the 'shell.env' file does not exist, we are in a real cluster
 if [ -e $TRAF_HOME/sql/scripts/sqshell.env ]; then
    sqshell -c set CLUSTERNAME=$CLUSTERNAME
 fi
 
-sqshell -a <<eof
-
-set SQ_MBTYPE=64d
-set MY_NODES=$MY_NODES
-set JAVA_HOME=$JAVA_HOME
-set MY_CLUSTER_ID=$MY_CLUSTER_ID
-set TRAF_FOUNDATION_READY=0
-
-exit
-eof
-
 # Starting TSID
 
 idtmstart
 sqshell -c delay 1
 
-echo  "***"
-echo  "*** Starting Cluster Monitor"
-echo  "***"
+if [[ $TRAF_AGENT != "CM" ]]
+then
+  echo  "***"
+  echo  "***" `date`  " - Starting Cluster Monitor"
+  echo  "***"
 
-cmonstart
-sqshell -c delay 1
+  cmonstart
+  sqshell -c delay 1
+fi
 
 echo  "***"
-echo  "*** Starting Node Monitors"
+echo  "***" `date`  " - Starting Node Monitors"
 echo  "***"
 
 nmonstart
 
 echo  "***"
-echo  "*** Starting Distributed Transaction Manager (DTM)"
+echo  "***" `date`  " - Starting Distributed Transaction Manager (DTM)"
 echo  "***"
 
 tmstart
@@ -126,7 +158,7 @@ fi
 
 
 echo  "***"
-echo  "*** Trafodion Foundation Services are ready!"
+echo  "***" `date`  " - Trafodion Foundation Services are ready!"
 echo  "***"
 sqshell -a <<eof
 

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/sql/scripts/sqconfigdb.pm
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/sqconfigdb.pm b/core/sqf/sql/scripts/sqconfigdb.pm
index f354900..517a0c8 100644
--- a/core/sqf/sql/scripts/sqconfigdb.pm
+++ b/core/sqf/sql/scripts/sqconfigdb.pm
@@ -319,6 +319,26 @@ sub addDbSpare {
     $insDbSpareStmt->execute;
 }
 
+sub addDbUniqStr {
+
+    if (not defined $DBH) {
+        # Database not available
+        return;
+    }
+
+    my $lv_nid      = $_[0];
+    my $lv_id       = $_[1];
+    my $lv_str      = $_[2];
+
+    my $insDbUniqStrStmt = $DBH->prepare("insert or replace into monRegUniqueStrings values ( ?, ?, ?)");
+
+    $insDbUniqStrStmt->bind_param(1, $lv_nid);
+    $insDbUniqStrStmt->bind_param(2, $lv_id);
+    $insDbUniqStrStmt->bind_param(3, $lv_str);
+
+    $insDbUniqStrStmt->execute;
+}
+
 sub listNodes {
     if (not defined $DBH) {
         # Database not available

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/sql/scripts/sqgen
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/sqgen b/core/sqf/sql/scripts/sqgen
index a5d2d9d..25c10a1 100755
--- a/core/sqf/sql/scripts/sqgen
+++ b/core/sqf/sql/scripts/sqgen
@@ -29,6 +29,7 @@ function Usage {
     echo $script_name generates various Trafodion files in the $TRAF_HOME/sql/scripts directory.
     echo
     echo "Usage: $script_name [ -? | -h ] [<sqconfig_filename>]"
+    echo "  -?    Help"
     echo "  -h    Help"
     echo "  <sqconfig_filename> Name of the SQ config file (in $TRAF_HOME/sql/scripts directory)(defaults to 'sqconfig')"
     echo
@@ -38,34 +39,31 @@ function Usage {
 
 
 function GetSQcnfg {
-# Get SQ Node configuration
- TempList=`grep -o 'node-name=.[A-Za-z0-9\.\-]*' $TRAF_HOME/sql/scripts/sqconfig | cut -d "=" -f 2 | cut -d ";" -f 1 | sort -u`
+   # Get SQ Node configuration
+   TempList=`grep -o 'node-name=.[A-Za-z0-9\.\-]*' $TRAF_HOME/sql/scripts/sqconfig | cut -d "=" -f 2 | cut -d ";" -f 1 | sort -u`
 
- i=0
- for NODE in $TempList
-   do
-     SQNodeNames[$i]=$NODE
-     ((i=i+1))
+   i=0
+   for NODE in $TempList
+     do
+       SQNodeNames[$i]=$NODE
+       ((i=i+1))
 
      done
 
- # Check that the Node names were corretly added
- NumberOfSQnodes=${#SQNodeNames[*]}
- ExNodeList="$(echo ${SQNodeNames[@]} | tr ' ' ',')"
-
-
- if [ ! -z ${ExNodeList[@]} ]; then   
-     echo "${ExNodeList[@]}"
- 
- else
-     echo
-     echo "Could not parse $TRAF_HOME/sql/scripts/sqconfig file."
-     echo "Please ensure sqenv.sh has been sourced and the sqconfig file is valid.  Then, re-run sqgen."
-     echo
-     exit 1;
- fi
-
- }
+   # Check that the Node names were correctly added
+   NumberOfSQnodes=${#SQNodeNames[*]}
+   ExNodeList="$(echo ${SQNodeNames[@]} | tr ' ' ',')"
+
+   if [ ! -z ${ExNodeList[@]} ]; then   
+      echo "${ExNodeList[@]}"
+   else
+      echo
+      echo "Could not parse $TRAF_HOME/sql/scripts/sqconfig file."
+      echo "Please ensure sqenv.sh has been sourced and the sqconfig file is valid.  Then, re-run sqgen."
+      echo
+      exit 1;
+   fi
+}
 
 ###########################################################
 # MAIN portion of sqgen begins
@@ -118,29 +116,45 @@ fi
 
 cd $TRAF_HOME/sql/scripts
 
-# Check to make sure this is a real cluster
-if  [[ -n "$node_count" ]] && [[ "$node_count" -gt "1" ]]; then 
-    # The configuration database can only be created the first time.
-    # Since nodes can be added and deleted through the 'shell node add/delete'
-    # commands, the 'sqconfig' node section may not reflect the current node
-    # configured. The 'sqregen' script can be used to update the SQCONFIG_FILE
-    # node section to reflect the current node configuration stored in
-    # the SQCONFIG_DB_FILE.
-    echo "Checking for the configuration file ($SQCONFIG_DB_FILE)."
-    if [ -f $SQCONFIG_DB_FILE ]; then
-        echo
-        echo "The configuration file ($SQCONFIG_DB_FILE) exists."
-        echo "Use the 'sqshell node add/delete' commands to change the node membership in the configuration database."
-        echo "Use the 'sqshell persist add/delete' commands to change the persist object configuration in the configuration database."
-        echo "Use the 'sqregen -node' script to update the $SQCONFIG_FILE 'node' section with the"
-        echo "current node membership in the configuration database."
-        echo "Use the 'sqregen -persist' script to update the $SQCONFIG_FILE 'persist' section with the"
-        echo "current persist configuration stored in the configuration database."
-        exit 1
+# Check to make sure this is a real cluster configuration
+if  [[ -n "$node_count" ]] && [[ "$node_count" -gt "1" ]]  || [[ -n ${TRAF_AGENT} ]]; then
+    #
+    # NOTE: Temporarily bypass the following check and always recreate the
+    #       'sqconfig.db' file on the local node when invoked from an
+    #       agent like (CM).
+    #
+    #       Re-enable once the Trafodion Configuration database supports a 
+    #       non-SQLite storage method as well as support for the node add function.
+    #
+    if [[ -z ${TRAF_AGENT} ]]; then
+        if  [[ -n "$node_count" ]] && [[ "$node_count" -gt "1" ]]; then
+            # The configuration database can only be created the first time.
+            # Since nodes can be added and deleted through the 'shell node add/delete'
+            # commands, the 'sqconfig' node section may not reflect the current node
+            # configured. The 'sqregen' script can be used to update the SQCONFIG_FILE
+            # node section to reflect the current node configuration stored in
+            # the SQCONFIG_DB_FILE.
+            echo "Checking for the configuration file ($SQCONFIG_DB_FILE)."
+            if [ -f $SQCONFIG_DB_FILE ]; then
+                echo
+                echo "The configuration file ($SQCONFIG_DB_FILE) exists."
+                echo "Use the 'sqshell node add/delete' commands to change the node membership in the configuration database."
+                echo "Use the 'sqshell persist add/delete' commands to change the persist object configuration in the configuration database."
+                echo "Use the 'sqregen -node' script to update the $SQCONFIG_FILE 'node' section with the"
+                echo "current node membership in the configuration database."
+                echo "Use the 'sqregen -persist' script to update the $SQCONFIG_FILE 'persist' section with the"
+                echo "current persist configuration stored in the configuration database."
+                exit 1
+            fi
+        fi
+    else
+        # Temporary removal of configuration database file
+        rm -f $SQCONFIG_DB_FILE
     fi
 
     GetSQcnfg
 else
+    echo "node_count=${node_Count}"
     echo
     echo "Workstation environment - Not a clustered environment"
     if [ -f $SQCONFIG_DB_FILE ]; then
@@ -168,6 +182,7 @@ export SQLOG_DIR=$TRAF_HOME/logs
 mkdir -p $SQETC_DIR
 mkdir -p $SQLOG_DIR
 mkdir -p $MPI_TMPDIR
+mkdir -p $MPI_TMPDIR/tmp
 # mkdir a dir for CBF data used by SQL IUS feature
 mkdir -p $HOME/cbfs
 
@@ -175,25 +190,32 @@ mkdir -p $HOME/cbfs
 echo "Clean up HBase classpath cache file: $TRAF_VAR/hbase_classpath"
 rm -rf $TRAF_VAR/hbase_classpath
 
-if  [[ -n "$node_count" ]] && [[ "$node_count" -gt "1" ]]; then    
-    echo
-    echo "Creating directories on cluster nodes"
+# Bypass if in agent mode
+if [[ -z ${TRAF_AGENT} ]]; then
+    #If pdsh exists
+    if  [[ -n "$node_count" ]] && [[ "$node_count" -gt "1" ]]; then    
+        echo
+        echo "Creating directories on cluster nodes"
 
-    # Clean HBase classpath cache file on all nodes
-    $PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD rm -rf $TRAF_VAR/hbase_classpath
+        # Clean HBase classpath cache file on all nodes
+        $PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD rm -rf $TRAF_VAR/hbase_classpath
 
-    echo "$PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD mkdir -p $SQETC_DIR "
-    $PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD mkdir -p $SQETC_DIR
+        echo "$PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD mkdir -p $SQETC_DIR "
+        $PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD mkdir -p $SQETC_DIR
+        
+        echo "$PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD mkdir -p $SQLOG_DIR "
+        $PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD mkdir -p $SQLOG_DIR
     
-    echo "$PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD mkdir -p $SQLOG_DIR "
-    $PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD mkdir -p $SQLOG_DIR
-
-    echo "$PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD mkdir -p $MPI_TMPDIR "
-    $PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD mkdir -p $MPI_TMPDIR
-
-    echo "$PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD mkdir -p $PWD "
-    $PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD mkdir -p $PWD
-
+        echo "$PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD mkdir -p $MPI_TMPDIR "
+        $PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD mkdir -p $MPI_TMPDIR
+    
+        echo "$PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD mkdir -p $MPI_TMPDIR/tmp "
+        $PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD mkdir -p $MPI_TMPDIR/tmp
+    
+        echo "$PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD mkdir -p $PWD "
+        $PDSH -w ${ExNodeList[@]} -x `uname -n` $PDSH_SSH_CMD mkdir -p $PWD
+    
+    fi
 fi
 
 SQSCRIPT_FILE=./gomon
@@ -253,42 +275,40 @@ if [ -f $SQESPENV_FILE ]; then
     fi
 fi
 
-if  [[ -n "$node_count" ]] && [[ "$node_count" -gt "1" ]]; then    
-    echo
-    echo
-    echo "Copying the generated files to all the nodes in the cluster"
-    echo
-
-    echo
-    echo "Copying $SQETC_DIR/ms.env to $SQETC_DIR of all the nodes"
-    echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQETC_DIR/ms.env   $SQETC_DIR "
-    $PDCP -w ${ExNodeList[@]} -x `uname -n` $SQETC_DIR/ms.env   $SQETC_DIR
+# Bypass if in agent mode
+if [[ -z ${TRAF_AGENT} ]]; then
+    if  [[ -n "$node_count" ]] && [[ "$node_count" -gt "1" ]]; then    
+        echo
+        echo
+        echo "Copying the generated files to all the nodes in the cluster"
+        echo
+        echo "Copying $SQETC_DIR/ms.env to $SQETC_DIR of all the nodes"
+        echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQETC_DIR/ms.env   $SQETC_DIR "
+        $PDCP -w ${ExNodeList[@]} -x `uname -n` $SQETC_DIR/ms.env   $SQETC_DIR
 
-    echo
-    echo "Copying $SQETC_DIR/seamonster.env to $SQETC_DIR of all the nodes"
-    echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQETC_DIR/seamonster.env   $SQETC_DIR "
-    $PDCP -w ${ExNodeList[@]} -x `uname -n` $SQETC_DIR/seamonster.env   $SQETC_DIR
 
-    if [[ $sq_seamonster == 1 ]]; then 
-        if [ -f $SQESPENV_FILE ]; then
-            echo
-            echo "Copying $SQESPENV_FILE to $TRAF_HOME/sql/scripts of all the nodes"
-            echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQESPENV_FILE   $TRAF_HOME/sql/scripts "
-            $PDCP -w ${ExNodeList[@]} -x `uname -n` $SQESPENV_FILE   $TRAF_HOME/sql/scripts
+        echo
+        echo "Copying $SQETC_DIR/seamonster.env to $SQETC_DIR of all the nodes"
+        echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQETC_DIR/seamonster.env   $SQETC_DIR "
+        $PDCP -w ${ExNodeList[@]} -x `uname -n` $SQETC_DIR/seamonster.env   $SQETC_DIR
+
+        if [[ $sq_seamonster == 1 ]]; then 
+            if [ -f $SQESPENV_FILE ]; then
+                echo
+                echo "Copying $SQESPENV_FILE to $TRAF_HOME/sql/scripts of all the nodes"
+                echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQESPENV_FILE   $TRAF_HOME/sql/scripts "
+                $PDCP -w ${ExNodeList[@]} -x `uname -n` $SQESPENV_FILE   $TRAF_HOME/sql/scripts
+            fi
         fi
-    fi
 
-    echo
-    echo "Copying rest of the generated files to $PWD"
-
-    echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` sqconfig sqshell gomon.cold rmsstart rmsstop rmscheck.sql ssmpstart ssmpstop sscpstart sscpstop $PWD"
-    $PDCP -w ${ExNodeList[@]} -x `uname -n` sqconfig sqshell gomon.cold rmsstart rmsstop rmscheck.sql ssmpstart ssmpstop sscpstart sscpstop $PWD
-
-    echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQCONFIG_FILE $SQCONFIG_DB_FILE $PWD "
-    $PDCP -w ${ExNodeList[@]} -x `uname -n` $SQCONFIG_FILE $SQCONFIG_DB_FILE $PWD
+        echo
+        echo "Copying Trafodion Configuration files to $PWD"
 
+        echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQCONFIG_FILE $SQCONFIG_DB_FILE $PWD "
+        $PDCP -w ${ExNodeList[@]} -x `uname -n` $SQCONFIG_FILE $SQCONFIG_DB_FILE $PWD
 
-    echo
+        echo
+    fi
 fi
 
 # mkdir a dir for CBF data used by SQL IUS feature
@@ -297,13 +317,12 @@ mkdir -p $HOME/cbfs
 echo
 echo "******* Generate public/private certificates *******"
 echo
-# Generate certificates for ODBC, ...
 if (test -f $TRAF_HOME/sql/scripts/sqcertgen); then
-   $TRAF_HOME/sql/scripts/sqcertgen 2>/dev/null
-   echo
+  $TRAF_HOME/sql/scripts/sqcertgen 2>/dev/null
+  echo
 else
-   echo
-   echo "ERROR: Certificate generation script (sqcertgen) does not exist in $TRAF_HOME/sql/scripts folder"
-   echo
-   exit 1
+  echo
+  echo "ERROR: Certificate generation script (sqcertgen) does not exist in $TRAF_HOME/sql/scripts folder"
+  echo
+  exit 1
 fi

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/sql/scripts/sqstart
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/sqstart b/core/sqf/sql/scripts/sqstart
index 8e41afc..30fedff 100755
--- a/core/sqf/sql/scripts/sqstart
+++ b/core/sqf/sql/scripts/sqstart
@@ -22,7 +22,7 @@
 # @@@ END COPYRIGHT @@@
 #
 
-#SQ Startup Driver Script. Use sqgen prior to this to generate various files required for startup.
+#Trafodion startup Script. 
 
 function LogIt {
     echo  "`date`: $1" >> $TRAF_HOME/logs/startup.log
@@ -72,14 +72,6 @@ function GetOpts {
     done
 }
 
-function chkReturnCode {
-    if [[ $2 != 0 ]]; then
-       LogIt "End $script_name $sq_start, exit code: $2"
-       echo "$1 returned error $2, Exiting..."
-       exit $2;
-    fi
-}
-
 function echoLog {
 
     echo $1 | tee -a $SQMON_LOG
@@ -138,35 +130,40 @@ function getJobInfo {
 
 }
 
-function SQStartProcesses {
+function TrafodionStartProcesses {
 
-    echoLog "Starting the SQ Environment (Executing $SQSCRIPT_FILE)"
+    echoLog "Starting the Trafodion Environment (Executing $SQSCRIPT_FILE)"
     echoLog
     $SQSCRIPT_FILE > $SQMON_LOG 2>&1
 
     sqstart_stat=$?
     echo
     if [[ $sqstart_stat == 0 ]]; then
-        echoLog "SQ Startup script ($SQSCRIPT_FILE) ran successfully. Performing further checks..."
+        echoLog "Trafodion Startup script ($SQSCRIPT_FILE) ran successfully. Performing further checks..."
         echo "0" > $SQSTART_EXIT_STATUS
     else
         echoLog "Error while executing the startup script!!!"
-        sqcheck -f
-        sq_stat=$?
-        if [[ $sq_stat == 0 ]]; then
-            echoLog "Even though all the SQ processes started up, the startup did not succeed!"
+        # Bypass if in agent mode
+        if [[ -z ${TRAF_AGENT} ]]; then
+            sqcheck -f
+            sq_stat=$?
+            if [[ $sq_stat == 0 ]]; then
+                echoLog "Even though all the Trafodion processes started up, the startup did not succeed!"
+            fi
         fi
         echoLog
-        echoLog "Please check the SQ shell log file : $SQMON_LOG"
+        echoLog "Please check the Trafodion shell log file : $SQMON_LOG"
         echoLog
-        echoLog "SQ Startup (from $PWD) Failed"
+        echoLog "For additional information, please check the monitor mon.*.log file in $TRAF_HOME/logs"
+        echoLog
+        echoLog "Trafodion Startup (from $PWD) Failed"
         echoLog
         echo "1" > $SQSTART_EXIT_STATUS
     fi
 
 }
 
-function SQCheckOrphanProcesses {
+function TrafodionCheckOrphanProcesses {
 
     let lv_orphans_exist=0
     let lv_orphan_process_count=0
@@ -177,7 +174,11 @@ function SQCheckOrphanProcesses {
     echo -n "Checking orphan processes"
     while [ $lv_sqcop_done '==' 0 ]; do
     echo -n "."
-    lv_orphan_process_count=`cstat -h | wc -l`
+    if [[ -z ${TRAF_AGENT} ]]; then
+        lv_orphan_process_count=`cstat -h | wc -l`
+    else     
+        lv_orphan_process_count=`pstat -h | wc -l`
+    fi
     let lv_orphans_exist=(lv_orphan_process_count '>' 2)
 
     if [ $lv_orphans_exist '==' 1 ]; then
@@ -195,11 +196,15 @@ function SQCheckOrphanProcesses {
 
     echo
     if [ $lv_orphans_exist '==' 1 ]; then
-        lv_msg1="There are orphan processes from a previous SQ instance."
+        lv_msg1="There are orphan processes from a previous Trafodion instance."
         echo "$lv_msg1"
-        cstat
+        if [[ -z ${TRAF_AGENT} ]]; then
+            cstat
+        else
+            pstat
+        fi
         echo
-        lv_msg2="SQ startup has not been initiated. Exiting..."
+        lv_msg2="Trafodion startup has not been initiated. Exiting..."
         echo "$lv_msg"
         LogIt "End $script_name, exit code: 1, $lv_msg1 $lv_msg2"
         exit 1
@@ -233,16 +238,6 @@ function checkKerberos {
 }
 
 function checkUlimit {
-  
- #check max_pid 
- userProc=`cat /proc/sys/kernel/pid_max`
- if [[ $userProc -gt 65535 ]] ; then
-    echoLog ""
-    echoLog "ERROR: issue detected during startup. Please make sure your kernel parameter (sysctl) is set up correctly."
-    echoLog "ERROR: max_pid should not be greater than 65535"
-    echoLog ""
-    return
- fi
 
  #check ulimit -l
  maxLockMem=`ulimit -l`
@@ -282,7 +277,7 @@ STARTtime=$(date +%s)
 
 GetOpts $BASH_ARGV
 
-if [ ! -z $TRAF_HOME ]; then
+if [[ ! -z $TRAF_HOME ]]; then
     cd $TRAF_HOME/sql/scripts
 else
     echoLog
@@ -295,7 +290,6 @@ fi
 checkUlimit
 
 let nameserver_configured=`trafconf -ns | grep nodes | wc -l`
-
 if [[ "$SQ_NAMESERVER_ENABLED" == "1" ]]; then
    if [ $nameserver_configured '<' 1 ]; then
      echoLog
@@ -306,24 +300,6 @@ if [[ "$SQ_NAMESERVER_ENABLED" == "1" ]]; then
    fi
 fi
 
-# Check SeaMonster kernel module if SeaMonster is enabled
-if [[ $SQ_SEAMONSTER == "1" ]]; then
-    echoLog
-    echoLog "SeaMonster is enabled, checking SeaMonster Kernel Module installed version..."
-    echoLog
-    sminfo_out=`$TRAF_HOME/export/bin${SQ_MBTYPE}/sminfo 2>&1`
-    if [ $? -gt 0 ]; then
-       echoLog "$sminfo_out"
-       lv_msg="Correct SeaMonster Kernel Module in not installed; please resolve this issue and re-run $script_name!"
-       echo "$lv_msg"
-       LogIt "End $script_name $sq_start, exit code: 1, $lv_msg"
-       exit 1
-    fi
-    echoLog "$sminfo_out"
-    LogIt "$sminfo_out"
-    echoLog
-fi
-
 if [[ ! -e $TRAF_HOME/sql/scripts/sw_env.sh ]]; then
    checkKerberos
    if [[ $? -ne 0 ]]; then
@@ -347,22 +323,30 @@ if [ $lv_len_mysqroot '>' $lv_max_mysqroot_len ]; then
     exit 1;
 fi
 
-LogIt "Begin $script_name $sq_start"
-sqcheck -i 1 -d 1 > /dev/null 2>&1
-sq_stat=$?
-if [[ $sq_stat == 0 ]]; then
-    lv_msg="SQ environment is already up."
-    echoLog "$lv_msg"
-    LogIt "End $script_name $sq_start, exit code: 1, $lv_msg"
-    exit 1
-elif [[ $sq_stat == 1 ]]; then
-    lv_msg="SQ environment is partially up."
-    echoLog "$lv_msg"
-    LogIt "End $script_name $sq_start, exit code: 1, $lv_msg"
-    exit 1
-fi
+# Bypass if in agent mode
+if [[ -z ${TRAF_AGENT} ]]; then
+    LogIt "Begin $script_name $sq_start"
+    sqcheck -i 1 -d 1 > /dev/null 2>&1
+    sq_stat=$?
+    if [[ $sq_stat == 0 ]]; then
+        lv_msg="Trafodion environment is already up."
+        echoLog "$lv_msg"
+        LogIt "End $script_name $sq_start, exit code: 1, $lv_msg"
+        exit 1
+    elif [[ $sq_stat == 1 ]]; then
+        lv_msg="Trafodion environment is partially up."
+        echoLog "$lv_msg"
+        LogIt "End $script_name $sq_start, exit code: 1, $lv_msg"
+        exit 1
+    fi
 
-SQCheckOrphanProcesses
+    if ( [[ ! -z CHECK_ORPHANS ]] &&
+         [[ ${CHECK_ORPHANS} == 0 ]] ); then
+        echo "Not checking for orphans." 
+    else
+        TrafodionCheckOrphanProcesses
+    fi
+fi
 
 if [[ $run_chk_dbperms == 1 ]]; then
     chk_dbperms=$TRAF_HOME/sql/scripts/chk_dbperms
@@ -423,22 +407,29 @@ fi
 echoLog "Removing old mpijob* files from $MPI_TMPDIR"
 echoLog  ""
 rm -f $MPI_TMPDIR/mpijob*
-echoLog "Removing old monitor.port* files from $MPI_TMPDIR"
-echoLog  ""
-rm -f $MPI_TMPDIR/monitor.port.*
 
+# Bypass if in agent mode
+if [[ -z ${TRAF_AGENT} ]]; then
+    # This code assumes that gomon.cold executes 'shell startup' to create the 
+    # monitor processes. 
+    # This pre-startup cleanup must be done in the CSD script monitor.sh.
+    echoLog "Removing old monitor.port* files from $MPI_TMPDIR"
+    echoLog  ""
+    rm -f $MPI_TMPDIR/monitor.port.*
 
-setup_sqpdsh
 
-# Clean HBase classpath cache file
-echo "Clean up HBase classpath cache file: $TRAF_VAR/hbase_classpath"
-$SQPDSHA "rm -rf $TRAF_VAR/hbase_classpath"
+    setup_sqpdsh
 
-# Clear unique strings
-$SQPDSHA "cd $TRAF_HOME/sql/scripts; utilConfigDb -u"
+    # Clean HBase classpath cache file
+    echo "Clean up HBase classpath cache file: $TRAF_VAR/hbase_classpath"
+    $SQPDSHA "rm -rf $TRAF_VAR/hbase_classpath"
 
-echoLog "Executing sqipcrm (output to sqipcrm.out)"
-sqipcrm > sqipcrm.out
+    # Clear unique strings
+    $SQPDSHA "cd $TRAF_HOME/sql/scripts; utilConfigDb -u"
+
+    echoLog "Executing sqipcrm (output to sqipcrm.out)"
+    sqipcrm > sqipcrm.out
+fi
 
 echoLog "Executing cleanZKNodes (output to cleanZKNodes.out)"
 cleanZKNodes > cleanZKNodes.out 2>&1
@@ -453,14 +444,14 @@ if [ $? != 0 ]; then
 fi
 
 rm -f $SQSTART_EXIT_STATUS
-SQStartProcesses &
-getJobInfo SQStartProcesses
+TrafodionStartProcesses &
+getJobInfo TrafodionStartProcesses
 
 if [ ! -z "$gv_job_pid" ]; then
     lv_sqstartup_job_pid=$gv_job_pid
-    echoLog "Background SQ Startup job (pid: $lv_sqstartup_job_pid)"
+    echoLog "Background Trafodion Startup job (pid: $lv_sqstartup_job_pid)"
 else
-    lv_msg="Some problem with the initiation of the job to startup SQ processes"
+    lv_msg="Some problem with the initiation of the job to startup Trafodion processes"
     echoLog "$lv_msg"
     LogIt "End $script_name $sqstart, exit code: 3, $lv_msg"
     exit 3
@@ -511,7 +502,11 @@ do
       let lv_done=1
   else
 
-      lv_process_count_curr=`cstat 2>/dev/null | grep -v "\-\-\-   \-\-\-\-" | grep -v 'pid   ppid' | wc -l`
+      if [[ -z ${TRAF_AGENT} ]]; then
+         lv_process_count_curr=`cstat 2>/dev/null | grep -v "\-\-\-   \-\-\-\-" | grep -v 'pid   ppid' | wc -l`
+      else
+         lv_process_count_curr=`pstat 2>/dev/null | grep -v "\-\-\-   \-\-\-\-" | grep -v 'pid   ppid' | wc -l`
+      fi
       let lv_cnt_check=(lv_process_count_curr '>' lv_process_count_last)
 
       if [ $lv_cnt_check '==' 1 ]; then
@@ -519,39 +514,17 @@ do
       fi
       lv_process_count_last=lv_process_count_curr
 
-#      lv_TM0_started=`cstat 2>/dev/null | grep -v "\-\-\-   \-\-\-\-" | grep -v 'pid   ppid' | grep TM | wc -l`
-
-#      if [ $lv_TM0_started '!=' 0 ]; then
-#         let lv_num_checks=0
-#         lv_recovery_tx_cnt=`sqshell -c show | grep -v 'Configuration Change Notice' | grep DTM_RECOVERING_TX_COUNT | cut -d= -f2 | sed -e 's/^[[:space:]]*//'`
-#         if [ "$lv_recovery_tx_cnt" -gt "0" ]; then
-#            echo -ne "\r# of Transactions being recovered: $lv_recovery_tx_cnt "
-#         else
-#            if [ "$lv_tm_svc_ready" -eq 0 ]; then
-#               echo -ne "\r# of Transactions being recovered: $lv_recovery_tx_cnt "
-#               sqregck -r SQ_TXNSVC_READY -d 5 -i 5
-#               lv_tm_svc_ready=$?
-#            else
-#               if [ $tx_srvc_ready_printed -eq 0 ]; then
-#                 echo -ne "\rTransaction Services Ready          "
-#                 tx_srvc_ready_printed=1
-#               fi
-#               let lv_tm_svc_ready=1
-#            fi
-#         fi
-#      else
-         if [ $lv_num_checks '==' 0 ]; then
-            echo -ne "\r# of SQ processes: $lv_process_count_last "
-         else
-            echo -n "."
-         fi
-#      fi
+      if [ $lv_num_checks '==' 0 ]; then
+         echo -ne "\r# of Trafodion processes: $lv_process_count_last "
+      else
+         echo -n "."
+      fi
 
-      getJobInfo SQStartProcesses
+      getJobInfo TrafodionStartProcesses
       if [ -z "$gv_job_pid" ]; then
           if [ ! -e $SQSTART_EXIT_STATUS ]; then
-              echoLog "The background SQ job (pid: $lv_sqstartup_job_pid) that was starting up the SQ processes exitted abnormally."
-              echoLog "There are still $lv_process_count_curr SQ processes that exist in the environment."
+              echoLog "The background Trafodion job (pid: $lv_sqstartup_job_pid) that was starting up the Trafodion processes exited abnormally."
+              echoLog "There are still $lv_process_count_curr Trafodion processes that exist in the environment."
               echoLog "Exiting."
               let lv_done=1
               lv_startup_status=3
@@ -567,8 +540,8 @@ do
       if [ $lv_done '==' 1 ]; then
           lv_startup_status=2
           echoLog ""
-          echoLog "SQ Startup is taking longer than usual and seems to be stalled at $lv_process_count_curr processes. "
-          echoLog "The background SQ job (pid: $lv_sqstartup_job_pid) that is starting up the SQ processes is still running."
+          echoLog "Trafodion Startup is taking longer than usual and seems to be stalled at $lv_process_count_curr processes. "
+          echoLog "The background Trafodion job (pid: $lv_sqstartup_job_pid) that is starting up the Trafodion processes is still running."
           echoLog "Exiting."
       fi
       sleep 10
@@ -595,7 +568,7 @@ if [ $lv_startup_status '==' 0 ]; then
             let lv_done=1
         else
             if [ $lv_num_iterations '==' 0 ]; then
-                echo "The SQ environment is partially up! Continuing checks."
+                echo "The Trafodion environment is partially up! Continuing checks."
                 echo -n "Checking"
             fi
             echo -n "."

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/sql/scripts/sqstop
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/sqstop b/core/sqf/sql/scripts/sqstop
index c09169b..c4da486 100755
--- a/core/sqf/sql/scripts/sqstop
+++ b/core/sqf/sql/scripts/sqstop
@@ -74,13 +74,15 @@ if [[ ! -e $SQGOMON_FILE ]]; then
 fi
 
 # Check if the SQ environment is up or not
-sqcheck -i 1 -d 1 > /dev/null 2>&1
-sq_stat=$?
-if [[ $sq_stat -eq 255 ]]; then
-    lv_msg="SQ environment is not up."
-    echo "$lv_msg"
-    LogIt "End $script_name $shutdowntype, exit code: 0, $lv_msg"
-    exit 0;
+if [[ $shutdowntype == "normal" ]]; then  
+    sqcheck -i 1 -d 1 > /dev/null 2>&1
+    sq_stat=$?
+    if [[ $sq_stat -eq 255 ]]; then
+       lv_msg="The Trafodion environment is not up. Please issue 'sqstop abrupt' or 'ckillall' to kill any orphan processes."
+       echo "$lv_msg"
+       LogIt "End $script_name $shutdowntype, exit code: 0, $lv_msg"
+       exit 0;
+    fi
 fi
 
 rm -f $SQSTOP_EXIT_STATUS
@@ -95,7 +97,7 @@ dcsstop
 #lobstop
 
 # Issue the shutdown request
-echoLog "Shutting down ($shutdowntype) the SQ environment!"
+echoLog "Shutting down ($shutdowntype) the Trafodion environment!"
 echoLog "`date`"
 sqshell -a <<eof
 ps
@@ -104,7 +106,6 @@ eof
 
 echoLog "Issued a 'shutdown $shutdowntype' request"
 
-
 sleep 2
 
 # Now check whether the SQ environment is still up or not
@@ -118,14 +119,17 @@ declare -i lv_process_count_curr
 declare -i lv_process_count_last
 declare -i lv_displayed_process_still_executing
 declare -i lv_exit_status
+declare -i lv_sleep_time
+declare -i lv_total_sleep_time
 
 let lv_num_checks=0
-let lv_max_checks=200
+let lv_max_checks=30
 let lv_done=0
 let lv_process_count_curr=0
 let lv_process_count_last=0
 let lv_displayed_process_still_executing=0
-
+let lv_sleep_time=5
+let lv_total_sleep_time=(lv_sleep_time '*' lv_max_checks)
 
 bFirst=1
 sq_stat=0
@@ -134,10 +138,9 @@ echoLog "Shutdown in progress";
 
 echoLog
 
-
 while [[ $sq_stat == 0 ]]; do
 
-    sleep 5
+    sleep ${lv_sleep_time}
 
     # Count the number of processes
     lv_process_count_curr=`cstat 2>/dev/null | grep -v "\-\-\-   \-\-\-\-" | grep -v 'pid   ppid' | wc -l`
@@ -165,19 +168,22 @@ while [[ $sq_stat == 0 ]]; do
         if [ $lv_displayed_process_still_executing '==' 0 ]; then
 	    let lv_displayed_process_still_executing=1
 	    echoLog 
-	    echoLog "These are the processes still running. Please check if any application process (such as sqlci) is still running that might hamper shutdown"
+	    echoLog "These are the processes still running. Please check if any application process (such as sqlci) is still running that might hamper shutdown. Please ctl-c within the next ${lv_total_sleep_time} seconds if you want those processes to continue..."
 	    cstat | tee -a $SQMON_LOG
+	    echoLog "Please check if any application process (such as sqlci) is still running that might hamper shutdown. Please ctl-c within the next ${lv_total_sleep_time} seconds if you want those processes to continue..."
 	    let lv_num_checks=0
 	else
 	    lv_shutdown_status=2
+	    echoLog
 	    echoLog "`date`"
 	    lv_msg="SQ Shutdown is taking longer than usual and seems to be stalled at $lv_process_count_curr processes. "
 	    echoLog "$lv_msg"
 	    cstat >> $SQMON_LOG
-	    echoLog "Exiting."
+	    echoLog "Issuing 'sqstop abrupt'."
 	    let lv_exit_status=1
 	    LogIt "End $script_name $shutdowntype, exit code: $lv_exit_status, $lv_msg"
 	    echo "$lv_exit_status" > $SQSTOP_EXIT_STATUS
+	    sqstop abrupt
 	    exit $lv_exit_status
 	fi
     fi

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/src/trafconf/Makefile
----------------------------------------------------------------------
diff --git a/core/sqf/src/trafconf/Makefile b/core/sqf/src/trafconf/Makefile
index 2c84dec..42e81bc 100644
--- a/core/sqf/src/trafconf/Makefile
+++ b/core/sqf/src/trafconf/Makefile
@@ -44,7 +44,7 @@ LIBS		= $(LIBTRAFCONFIG)
 LIBSX	+= -lrt
 
 # need -lsqlite3 for SQLite
-LIBSX	+=  -lsqlite3
+LIBSX	+=  -lsqlite3 -lpthread
 
 PROGS		= $(TRAFCONF)
 

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/src/trafconf/clusterconf.cpp
----------------------------------------------------------------------
diff --git a/core/sqf/src/trafconf/clusterconf.cpp b/core/sqf/src/trafconf/clusterconf.cpp
index e3d8848..d3938ce 100644
--- a/core/sqf/src/trafconf/clusterconf.cpp
+++ b/core/sqf/src/trafconf/clusterconf.cpp
@@ -376,9 +376,52 @@ bool CClusterConfig::LoadNodeConfig( void )
         return( false );
     }
 
+    bool lv_is_real_cluster = true;
+    if ( getenv( "SQ_VIRTUAL_NODES" ) )
+    {
+        lv_is_real_cluster = false;
+    }
+
     // Process logical nodes
     for (int i =0; i < nodeCount; i++ )
     {
+        char *tmpptr = nodeConfigData[i].node_name;
+        while ( *tmpptr )
+        {
+            *tmpptr = (char)tolower( *tmpptr );
+            tmpptr++;
+        }
+    
+        if (lv_is_real_cluster)
+        {
+            // Remove the domain portion of the name if any
+            char short_node_name[TC_PROCESSOR_NAME_MAX];
+            char str1[TC_PROCESSOR_NAME_MAX];
+            memset( str1, 0, TC_PROCESSOR_NAME_MAX );
+            memset( short_node_name, 0, TC_PROCESSOR_NAME_MAX );
+            strcpy (str1, nodeConfigData[i].node_name );
+
+            char *str1_dot = strchr( (char *) str1, '.' );
+            if ( str1_dot )
+            {
+                memcpy( short_node_name, str1, str1_dot - str1 );
+            }
+            else
+            {
+                strcpy (short_node_name, str1 );
+            }
+
+            strcpy(nodeConfigData[i].node_name, short_node_name);
+
+        }
+
+        if ( TcTraceSettings & TC_TRACE_INIT )
+        {
+            trace_printf( "%s@%d nodename=%s\n"
+                          , method_name, __LINE__
+                          , nodeConfigData[i].node_name);
+        }
+
         ProcessLNode( nodeConfigData[i], pnodeConfigInfo, lnodeConfigInfo );
         // We want to pick the first configured node so all monitors pick the same one
         // This only comes into play for a Trafodion start from scratch

http://git-wip-us.apache.org/repos/asf/trafodion/blob/cd4f7006/core/sqf/src/trafconf/tctrace.h
----------------------------------------------------------------------
diff --git a/core/sqf/src/trafconf/tctrace.h b/core/sqf/src/trafconf/tctrace.h
index 4d4d6a3..5d58e4d 100644
--- a/core/sqf/src/trafconf/tctrace.h
+++ b/core/sqf/src/trafconf/tctrace.h
@@ -82,7 +82,7 @@ private:
                             , const char *key_cmp );
 
     // The number of trace areas held in "traceAreaList"
-    int   numTraceAreas_;
+    long   numTraceAreas_;
     bool  tracingEnabled_;
 
     // Save area for retaining prior trace settings if tracing is


Mime
View raw message