You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by su...@apache.org on 2017/05/31 18:47:34 UTC
[33/50] [abbrv] incubator-trafodion git commit: Trafodion
configuration API changes
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/04040d30/core/sqf/monitor/linux/pstartd.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/pstartd.cxx b/core/sqf/monitor/linux/pstartd.cxx
index 4f36e11..63ac28e 100644
--- a/core/sqf/monitor/linux/pstartd.cxx
+++ b/core/sqf/monitor/linux/pstartd.cxx
@@ -27,14 +27,15 @@
#include <stdlib.h>
#include <unistd.h>
-#include "pstartd.h"
+
+#include "SCMVersHelp.h"
#include "clio.h"
#include "monlogging.h"
#include "msgdef.h"
#include "seabed/trace.h"
#include "montrace.h"
+#include "pstartd.h"
-#include "SCMVersHelp.h"
const char *MyName;
char ga_ms_su_c_port[MPI_MAX_PORT_NAME] = {0}; // connection port - not used
@@ -52,7 +53,6 @@ bool shuttingDown = false;
CMonUtil monUtil;
CPStartD *pStartD;
CMonLog *MonLog = NULL;
-CMonLog *SnmpLog = NULL;
DEFINE_EXTERN_COMP_DOVERS(pstartd)
DEFINE_EXTERN_COMP_PRINTVERS(pstartd)
@@ -237,7 +237,7 @@ void localIONoticeCallback(struct message_def *recv_msg, int )
shuttingDown = true;
snprintf( buf, sizeof(buf), "Received 'Shutdown' event.\n");
- monproc_log_write( PSTARTD_INFO, SQ_LOG_INFO, buf );
+ monproc_log_write( LIO_NOTICE_CALLBACK_1, SQ_LOG_INFO, buf );
CShutdownReq * reqShutdown;
reqShutdown = new CShutdownReq();
@@ -278,7 +278,7 @@ void localIONoticeCallback(struct message_def *recv_msg, int )
snprintf( buf, sizeof(buf),
"[%s], Unexpected callback notice, type=%d\n",
method_name, recv_msg->type );
- monproc_log_write( PSTARTD_UNEXP_NOTICE, SQ_LOG_ERR, buf );
+ monproc_log_write( LIO_NOTICE_CALLBACK_2, SQ_LOG_ERR, buf );
}
}
@@ -311,7 +311,7 @@ void localIOEventCallback(struct message_def *recv_msg, int )
snprintf( buf, sizeof(buf),
"[%s], Unable to convert event data [%s] to node id\n",
method_name, recv_msg->u.request.u.event_notice.data );
- monproc_log_write( PSTARTD_BAD_EVENT, SQ_LOG_ERR, buf );
+ monproc_log_write( LIO_EVENT_CALLBACK_1, SQ_LOG_ERR, buf );
return;
}
@@ -335,7 +335,7 @@ void localIOEventCallback(struct message_def *recv_msg, int )
snprintf( buf, sizeof(buf),
"[%s], Unexpected event id=%d (ignored)\n",
method_name, eventId );
- monproc_log_write( PSTARTD_BAD_EVENT, SQ_LOG_ERR, buf );
+ monproc_log_write( LIO_EVENT_CALLBACK_2, SQ_LOG_ERR, buf );
}
if ( req != NULL )
@@ -409,7 +409,7 @@ bool CMonUtil::requestGet ( ConfigType type,
char buf[MON_STRING_BUF_SIZE];
snprintf( buf, sizeof(buf), "[%s], Unable to acquire message buffer\n",
method_name );
- monproc_log_write( PSTARTD_ACQUIRE_ERROR, SQ_LOG_ERR, buf );
+ monproc_log_write( MONUTIL_REQUEST_GET_1, SQ_LOG_ERR, buf );
return result;
}
@@ -457,7 +457,7 @@ bool CMonUtil::requestGet ( ConfigType type,
"[%s] Get reply message invalid. Reply tag=%d, count=%d "
"(expected %d)\n", method_name, msg->reply_tag,
count, (int) sizeof (struct message_def) );
- monproc_log_write( PSTARTD_MONCALL_ERROR, SQ_LOG_ERR, buf );
+ monproc_log_write( MONUTIL_REQUEST_GET_2, SQ_LOG_ERR, buf );
}
@@ -486,7 +486,7 @@ void CMonUtil::requestExit ( void )
char buf[MON_STRING_BUF_SIZE];
snprintf( buf, sizeof(buf), "[%s], Unable to acquire message buffer\n",
method_name );
- monproc_log_write( PSTARTD_ACQUIRE_ERROR, SQ_LOG_ERR, buf );
+ monproc_log_write( MONUTIL_REQUEST_EXIT_1, SQ_LOG_ERR, buf );
return;
}
@@ -517,7 +517,7 @@ void CMonUtil::requestExit ( void )
"[%s], exit process failed, rc=%d (%s)\n",
method_name, msg->u.reply.u.generic.return_code,
MPIErrMsg(msg->u.reply.u.generic.return_code));
- monproc_log_write( PSTARTD_MONCALL_ERROR, SQ_LOG_ERR, buf );
+ monproc_log_write( MONUTIL_REQUEST_EXIT_2, SQ_LOG_ERR, buf );
}
}
else
@@ -526,7 +526,7 @@ void CMonUtil::requestExit ( void )
snprintf( buf, sizeof(buf),
"[%s], Invalid MsgType(%d)/ReplyType(%d) for Exit "
"message\n", method_name, msg->type, msg->u.reply.type );
- monproc_log_write( PSTARTD_MONCALL_ERROR, SQ_LOG_ERR, buf );
+ monproc_log_write( MONUTIL_REQUEST_EXIT_3, SQ_LOG_ERR, buf );
}
}
else
@@ -537,7 +537,7 @@ void CMonUtil::requestExit ( void )
"count=%d (expected %d)\n",
method_name, msg->reply_tag,
count, (int) sizeof (struct message_def) );
- monproc_log_write( PSTARTD_MONCALL_ERROR, SQ_LOG_ERR, buf );
+ monproc_log_write( MONUTIL_REQUEST_EXIT_4, SQ_LOG_ERR, buf );
}
gp_local_mon_io->release_msg(msg);
@@ -571,7 +571,7 @@ bool CMonUtil::requestNewProcess (int nid, PROCESSTYPE type,
char buf[MON_STRING_BUF_SIZE];
snprintf( buf, sizeof(buf), "[%s], Unable to acquire message buffer\n",
method_name );
- monproc_log_write( PSTARTD_ACQUIRE_ERROR, SQ_LOG_ERR, buf );
+ monproc_log_write( MONUTIL_REQUEST_NEWPROC_1, SQ_LOG_ERR, buf );
return result;
}
@@ -635,7 +635,7 @@ bool CMonUtil::requestNewProcess (int nid, PROCESSTYPE type,
"[%s], new process failed to spawn, rc=%d (%s)\n",
method_name, msg->u.reply.u.new_process.return_code,
MPIErrMsg(msg->u.reply.u.new_process.return_code) );
- monproc_log_write( PSTARTD_MONCALL_ERROR, SQ_LOG_ERR, buf );
+ monproc_log_write( MONUTIL_REQUEST_NEWPROC_2, SQ_LOG_ERR, buf );
}
}
else
@@ -644,7 +644,7 @@ bool CMonUtil::requestNewProcess (int nid, PROCESSTYPE type,
snprintf( buf, sizeof(buf),
"[%s], Invalid MsgType(%d)/ReplyType(%d) for Exit "
"message\n", method_name, msg->type, msg->u.reply.type );
- monproc_log_write( PSTARTD_MONCALL_ERROR, SQ_LOG_ERR, buf );
+ monproc_log_write( MONUTIL_REQUEST_NEWPROC_3, SQ_LOG_ERR, buf );
}
}
else
@@ -654,7 +654,7 @@ bool CMonUtil::requestNewProcess (int nid, PROCESSTYPE type,
" Reply tag=%d, count=%d (expected %d)\n",
method_name, msg->reply_tag,
count, (int) sizeof (struct message_def));
- monproc_log_write( PSTARTD_MONCALL_ERROR, SQ_LOG_ERR, buf );
+ monproc_log_write( MONUTIL_REQUEST_NEWPROC_4, SQ_LOG_ERR, buf );
}
gp_local_mon_io->release_msg(msg);
@@ -678,7 +678,7 @@ bool CMonUtil::requestProcInfo( const char *processName, int &nid, int &pid )
char buf[MON_STRING_BUF_SIZE];
snprintf( buf, sizeof(buf), "[%s], Unable to acquire message buffer\n",
method_name );
- monproc_log_write( PSTARTD_ACQUIRE_ERROR, SQ_LOG_ERR, buf );
+ monproc_log_write( MONUTIL_REQUEST_PROCINFO_1, SQ_LOG_ERR, buf );
return result;
}
@@ -743,7 +743,7 @@ bool CMonUtil::requestProcInfo( const char *processName, int &nid, int &pid )
"[%s] ProcessInfo failed, rc=%d (%s)\n",
method_name, msg->u.reply.u.process_info.return_code,
MPIErrMsg(msg->u.reply.u.process_info.return_code));
- monproc_log_write( PSTARTD_MONCALL_ERROR, SQ_LOG_ERR, buf );
+ monproc_log_write( MONUTIL_REQUEST_PROCINFO_2, SQ_LOG_ERR, buf );
}
}
else
@@ -753,7 +753,7 @@ bool CMonUtil::requestProcInfo( const char *processName, int &nid, int &pid )
"[%s], Invalid MsgType(%d)/ReplyType(%d) for "
"ProcessInfo\n", method_name, msg->type,
msg->u.reply.type );
- monproc_log_write( PSTARTD_MONCALL_ERROR, SQ_LOG_ERR, buf );
+ monproc_log_write( MONUTIL_REQUEST_PROCINFO_3, SQ_LOG_ERR, buf );
}
}
@@ -765,7 +765,7 @@ bool CMonUtil::requestProcInfo( const char *processName, int &nid, int &pid )
"count=%d (expected %d)\n",
method_name, msg->reply_tag,
count, (int) sizeof (struct message_def) );
- monproc_log_write( PSTARTD_MONCALL_ERROR, SQ_LOG_ERR, buf );
+ monproc_log_write( MONUTIL_REQUEST_PROCINFO_4, SQ_LOG_ERR, buf );
}
gp_local_mon_io->release_msg(msg);
@@ -789,7 +789,7 @@ void CMonUtil::requestStartup ( )
char buf[MON_STRING_BUF_SIZE];
snprintf( buf, sizeof(buf), "[%s], Unable to acquire message buffer\n",
method_name );
- monproc_log_write( PSTARTD_ACQUIRE_ERROR, SQ_LOG_ERR, buf );
+ monproc_log_write( MONUTIL_REQUEST_STARTUP_1, SQ_LOG_ERR, buf );
return;
}
@@ -873,7 +873,7 @@ void CNodeUpReq::performRequest()
char buf[MON_STRING_BUF_SIZE];
snprintf( buf, sizeof(buf), "Received 'Node Up' event for node %d, "
"requires DTM flag=%d\n", nid_, requiresDTM_);
- monproc_log_write( PSTARTD_INFO, SQ_LOG_INFO, buf );
+ monproc_log_write( MONUTIL_PERFORM_REQUEST_1, SQ_LOG_INFO, buf );
// [ todo: need to check if nid_ is any one of the logical nodes in
// the physical node ]
@@ -896,60 +896,22 @@ void CNodeUpReq::performRequest()
}
CPStartD::CPStartD()
- : db_(NULL)
+ :trafConfigInitialized_(false)
{
const char method_name[] = "CPStartD::CPStartD";
- // Open the configuration database file
- char dbase[MAX_PROCESS_PATH];
- snprintf(dbase, sizeof(dbase), "%s/sql/scripts/sqconfig.db",
- getenv("MY_SQROOT"));
- int rc = sqlite3_open_v2(dbase, &db_, SQLITE_OPEN_READONLY, NULL);
-
+ int rc = tc_initialize( tracing );
if ( rc )
{
- db_ = NULL;
-
- // See if have database in current directory
- int rc2 = sqlite3_open_v2("sqconfig.db", &db_,
- SQLITE_OPEN_READWRITE | SQLITE_OPEN_FULLMUTEX,
- NULL);
- if ( rc2 )
- {
- // failed to open database
- char buf[MON_STRING_BUF_SIZE];
- snprintf( buf, sizeof(buf), "[%s] Can't open database: %s, %s\n",
- method_name, dbase, sqlite3_errmsg(db_) );
- monproc_log_write( PSTARTD_DATABASE_ERROR, SQ_LOG_ERR, buf );
-
- abort();
- }
- }
-
- if ( db_ != NULL )
+ char buf[MON_STRING_BUF_SIZE];
+ snprintf( buf, sizeof(buf)
+ , "[%s], Can't initialize configuration!\n"
+ , method_name );
+ monproc_log_write( PSTARTD_PSTARTD_1, SQ_LOG_CRIT, buf );
+ }
+ else
{
- rc = sqlite3_busy_timeout(db_, 500);
-
- if ( rc )
- {
- char buf[MON_STRING_BUF_SIZE];
- snprintf( buf, sizeof(buf), "[%s] Can't set busy timeout for "
- "database %s: %s (%d)\n",
- method_name, dbase, sqlite3_errmsg(db_), rc );
- monproc_log_write( PSTARTD_DATABASE_ERROR, SQ_LOG_ERR, buf );
- }
-
- char *sErrMsg = NULL;
- sqlite3_exec(db_, "PRAGMA synchronous = OFF", NULL, NULL, &sErrMsg);
- if (sErrMsg != NULL)
- {
- char buf[MON_STRING_BUF_SIZE];
- snprintf( buf, sizeof(buf), "[%s] Can't set PRAGMA synchronous for "
- "database %s: %s\n",
- method_name, dbase, sErrMsg );
- monproc_log_write( PSTARTD_DATABASE_ERROR, SQ_LOG_ERR, buf );
- }
-
+ trafConfigInitialized_ = true;
}
}
@@ -987,9 +949,9 @@ void CPStartD::waitForEvent( void )
}
-void CPStartD::startProcess( const char * pName
- , string prefix
- , map<string,string> * persistMap)
+void CPStartD::startProcess( const char *pName
+ , const char *prefix
+ , persist_configuration_t &persistConfig )
{
const char method_name[] = "CPStartD::startProcess";
@@ -1006,43 +968,32 @@ void CPStartD::startProcess( const char * pName
int okMask = 0;
int argBegin[MAX_ARGS];
int argLen[MAX_ARGS];
- map<string,string>::iterator fIt;
- fIt = persistMap->find(prefix + "_PROCESS_TYPE");
- if (fIt != persistMap->end())
- {
- string value = fIt->second;
- okMask |= 0x1;
- if (value.compare("DTM") == 0)
- progType = ProcessType_DTM;
- else if (value.compare("GENERIC") == 0)
- progType = ProcessType_Generic;
- else if (value.compare("PERSIST") == 0)
- progType = ProcessType_PERSIST;
- else if (value.compare("PSD") == 0)
- progType = ProcessType_PSD;
- else if (value.compare("SPX") == 0)
- progType = ProcessType_SPX;
- else if (value.compare("SSMP") == 0)
- progType = ProcessType_SSMP;
- else if (value.compare("SMS") == 0)
- progType = ProcessType_SMS;
- else if (value.compare("TMID") == 0)
- progType = ProcessType_TMID;
- else if (value.compare("WDG") == 0)
- progType = ProcessType_Watchdog;
- }
- fIt = persistMap->find(prefix + "_STDOUT");
- if (fIt != persistMap->end())
- {
- okMask |= 0x2;
- progStdout = fIt->second;
- }
- fIt = persistMap->find(prefix + "_PROGRAM_NAME");
- if (fIt != persistMap->end())
- {
- okMask |= 0x4;
- progProgram = fIt->second;
- }
+
+ string value = persistConfig.process_type;
+ okMask |= 0x1;
+ if (value.compare("DTM") == 0)
+ progType = ProcessType_DTM;
+ else if (value.compare("GENERIC") == 0)
+ progType = ProcessType_Generic;
+ else if (value.compare("PERSIST") == 0)
+ progType = ProcessType_PERSIST;
+ else if (value.compare("PSD") == 0)
+ progType = ProcessType_PSD;
+ else if (value.compare("SPX") == 0)
+ progType = ProcessType_SPX;
+ else if (value.compare("SSMP") == 0)
+ progType = ProcessType_SSMP;
+ else if (value.compare("SMS") == 0)
+ progType = ProcessType_SMS;
+ else if (value.compare("TMID") == 0)
+ progType = ProcessType_TMID;
+ else if (value.compare("WDG") == 0)
+ progType = ProcessType_Watchdog;
+
+ okMask |= 0x2;
+ progStdout = persistConfig.std_out;
+ okMask |= 0x4;
+ progProgram = persistConfig.program_name;
if ( okMask & 0x7 )
{
@@ -1058,7 +1009,7 @@ void CPStartD::startProcess( const char * pName
char buf[MON_STRING_BUF_SIZE];
snprintf( buf, sizeof(buf), "Starting process %s on nid=%d, program="
"%s, type=%d\n", pName, progNid, progProgram.c_str(), progType);
- monproc_log_write( PSTARTD_INFO, SQ_LOG_INFO, buf );
+ monproc_log_write( PSTARTD_START_PROCESS_1, SQ_LOG_INFO, buf );
result = monUtil.requestNewProcess(progNid,
progType, pName,
@@ -1116,189 +1067,104 @@ void CPStartD::startProcs ( int nid, bool requiresDTM )
list<string> prefixToStart;
list<string> keys;
map<string,string> persistDataMap;
+ persist_configuration_t persistConfig;
+
+ // Get persistent process keys
int rc;
- const char *selStmt;
- selStmt = "select keyName,valueName from monRegPersistData";
-
- sqlite3_stmt *prepStmt;
-
- rc = sqlite3_prepare_v2( db_, selStmt, strlen(selStmt)+1, &prepStmt, NULL);
- if ( rc != SQLITE_OK )
+ char persistProcessKeys[TC_PERSIST_KEYS_VALUE_MAX];
+ rc = tc_get_persist_keys( persistProcessKeys );
+ if ( rc )
{
char buf[MON_STRING_BUF_SIZE];
- snprintf( buf, sizeof(buf), "[%s] prepare failed: %s (%d)\n",
- method_name, sqlite3_errmsg(db_), rc );
- monproc_log_write( PSTARTD_DATABASE_ERROR, SQ_LOG_ERR, buf );
+ snprintf( buf, sizeof(buf)
+ , "[%s] Persist keys configuration does not exist!\n"
+ , method_name );
+ monproc_log_write( PSTARTD_STARTPROCS_1, SQ_LOG_CRIT, buf );
return; // no keys, no work
}
- while ( 1 )
+ if ( strlen( persistProcessKeys ) )
{
- rc = sqlite3_step( prepStmt );
- if ( rc == SQLITE_ROW )
- { // Process row
- const char *key = (const char *) sqlite3_column_text(prepStmt, 0);
- const char *value = (const char *) sqlite3_column_text(prepStmt, 1);
- if ( tracing )
- trace_printf("%s@%d monRegPersistData key=%s, value=%s\n", method_name, __LINE__, key, value);
- if (strcmp(key, "PERSIST_PROCESS_KEYS") == 0)
- {
- processKeys(value, keys);
- }
- else if (strstr(key, "_PERSIST_ZONES") != NULL)
- {
- char zones[1000];
- strcpy(zones, value);
- replaceZid(zones);
- persistDataMap.insert(map<string,string>::value_type(key, zones));
- }
- else if (strstr(key, "_PROCESS_NAME") != NULL)
- {
- char process_name[1000];
- strcpy(process_name, value);
- replaceNid(process_name);
- persistDataMap.insert(map<string,string>::value_type(key, process_name));
- }
- else if (strstr(key, "_STDOUT") != NULL)
- {
- char stdout_str[1000];
- strcpy(stdout_str, value);
- replaceNid(stdout_str);
- persistDataMap.insert(map<string,string>::value_type(key, stdout_str));
- }
- else
- persistDataMap.insert(map<string,string>::value_type(key, value));
- }
- else if ( rc == SQLITE_DONE )
- {
- if ( tracing )
- {
- trace_printf("%s@%d Finished processing all rows.\n",
- method_name, __LINE__);
- }
-
- break;
- }
- else
- {
- char buf[MON_STRING_BUF_SIZE];
- snprintf( buf, sizeof(buf),
- "[%s] step failed: %s (%d)\n",
- method_name, sqlite3_errmsg(db_), rc );
- monproc_log_write( PSTARTD_DATABASE_ERROR, SQ_LOG_ERR, buf );
- break;
- }
+ processKeys( persistProcessKeys, keys );
}
+ // Get persistent process configuration for each key
list<string>::iterator keyIt;
for (keyIt = keys.begin(); keyIt != keys.end(); ++keyIt)
{
string procName = "";
string procType = "";
- string requiresDtm = "";
string zones = "";
string prefix = (*keyIt);
- string keyProcName = prefix + "_PROCESS_NAME";
- map<string,string>::iterator fIt;
- fIt = persistDataMap.find(keyProcName);
- if (fIt != persistDataMap.end())
+ rc = tc_get_persist_process( prefix.c_str(), &persistConfig );
+ if ( rc )
{
- procName = fIt->second;
+ char buf[MON_STRING_BUF_SIZE];
+ snprintf( buf, sizeof(buf)
+ , "[%s] Persist configuration for %s does not exist!\n"
+ , method_name, prefix.c_str() );
+ monproc_log_write( PSTARTD_STARTPROCS_2, SQ_LOG_ERR, buf );
+ continue;
}
- string keyRequiresDtm = prefix + "_REQUIRES_DTM";
- fIt = persistDataMap.find(keyRequiresDtm);
- if (fIt != persistDataMap.end())
+ if ( tracing )
{
- requiresDtm = fIt->second;
- if ( tracing )
- {
- trace_printf("%s@%d %s = %s, requiresDTM = %d\n",
- method_name, __LINE__,
- keyRequiresDtm.c_str(),
- requiresDtm.c_str(),
- requiresDTM);
- }
- if ((requiresDtm.compare("Y") == 0) && !requiresDTM)
- {
- if ( tracing )
- {
- trace_printf("%s@%d Persist type %s NOT targeted for restart DTM not ready\n",
- method_name, __LINE__, prefix.c_str());
- }
- continue;
- }
- else if ((requiresDtm.compare("N") == 0) && requiresDTM)
- {
- if ( tracing )
- {
- trace_printf("%s@%d Persist type %s NOT targeted for restart DTM ready\n",
- method_name, __LINE__, prefix.c_str());
- }
- continue;
- }
+ trace_printf( "%s@%d Persist Prefix =%s\n"
+ "\t\tProcess Name = %s\n"
+ "\t\tProcess Type = %s\n"
+ "\t\tProgram Name = %s\n"
+ "\t\tSTDOUT = %s\n"
+ "\t\tRequires DTM = %s\n"
+ "\t\tPersist Retries = %d\n"
+ "\t\tPersist Window = %d\n"
+ "\t\tPersist Zones = %s\n"
+ , method_name, __LINE__
+ , persistConfig.persist_prefix
+ , persistConfig.process_name
+ , persistConfig.process_type
+ , persistConfig.program_name
+ , persistConfig.std_out
+ , persistConfig.requires_DTM ? "Y" : "N"
+ , persistConfig.persist_retries
+ , persistConfig.persist_window
+ , persistConfig.persist_zones );
}
- string keyProcessType = prefix + "_PROCESS_TYPE";
- fIt = persistDataMap.find(keyProcessType);
- if (fIt != persistDataMap.end())
+ procName = persistConfig.process_name;
+
+ if ( persistConfig.requires_DTM && !requiresDTM )
{
- string procType = fIt->second;
if ( tracing )
{
- trace_printf("%s@%d %s = %s\n",
- method_name, __LINE__,
- keyProcessType.c_str(), procType.c_str());
- }
- if (procType.compare("PERSIST") == 0)
- {
- if ( tracing )
- {
- trace_printf("%s@%d Persist %s process type %s targeted for restart\n",
- method_name, __LINE__,
- prefix.c_str(), procType.c_str());
- }
- }
- else if (procType.compare("SSMP") == 0)
- {
- if ( tracing )
- {
- trace_printf("%s@%d Persist %s process type %s targeted for restart\n",
- method_name, __LINE__,
- prefix.c_str(), procType.c_str());
- }
+ trace_printf("%s@%d Persist type %s NOT targeted for restart DTM not ready\n",
+ method_name, __LINE__, persistConfig.persist_prefix );
}
- else if (procType.compare("TMID") == 0)
- {
- if ( tracing )
- {
- trace_printf("%s@%d Persist %s process type %s targeted for restart\n",
- method_name, __LINE__,
- prefix.c_str(), procType.c_str());
- }
- }
- else
+ continue;
+ }
+ else if ( persistConfig.requires_DTM && requiresDTM )
+ {
+ if ( tracing )
{
- if ( tracing )
- {
- trace_printf("%s@%d Persist %s process type %s NOT targeted for restart\n",
- method_name, __LINE__,
- prefix.c_str(), procType.c_str());
- }
- continue;
+ trace_printf("%s@%d Persist type %s NOT targeted for restart DTM ready\n",
+ method_name, __LINE__, persistConfig.persist_prefix );
}
+ continue;
}
- string keyZones = prefix + "_PERSIST_ZONES";
- fIt = persistDataMap.find(keyZones);
- if (fIt != persistDataMap.end())
+ procType = persistConfig.process_type;
+ zones = persistConfig.persist_zones;
+
+ if ( tracing )
{
- zones = fIt->second;
+ trace_printf("%s@%d Persist %s process type %s targeted for restart\n",
+ method_name, __LINE__,
+ prefix.c_str(), persistConfig.process_type );
}
+
- if ((procName.length() != 0) && (requiresDtm.length() != 0) && (zones.length() != 0))
+ if ((procName.length() != 0) && (zones.length() != 0))
{
int procNid = -1;
int procPid = -1;
@@ -1317,7 +1183,7 @@ void CPStartD::startProcs ( int nid, bool requiresDTM )
snprintf( buf, sizeof(buf), "Not starting process %s "
"because it is already running\n",
procName.c_str());
- monproc_log_write( PSTARTD_INFO, SQ_LOG_INFO, buf );
+ monproc_log_write( PSTARTD_STARTPROCS_3, SQ_LOG_INFO, buf );
if ( tracing )
{
@@ -1341,7 +1207,7 @@ void CPStartD::startProcs ( int nid, bool requiresDTM )
trace_printf("%s@%d Will start process %s for zone %d\n",
method_name, __LINE__, procName, nid);
}
- startProcess( procName, prefix, &persistDataMap );
+ startProcess( procName, prefix, persistConfig );
}
procsToStart.clear();
}
@@ -1514,7 +1380,7 @@ int main (int argc, char *argv[])
{
char buf[MON_STRING_BUF_SIZE];
sprintf( buf, "[%s - main], pthread_sigmask error=%d\n", MyName, rc );
- monproc_log_write( MON_PSTARTD_MAIN_1, SQ_LOG_ERR, buf );
+ monproc_log_write( PSTARTD_MAIN_1, SQ_LOG_ERR, buf );
}
// This process does not use MPI. But unless MPI is initialized
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/04040d30/core/sqf/monitor/linux/pstartd.h
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/pstartd.h b/core/sqf/monitor/linux/pstartd.h
index a02f2f4..81c60ed 100644
--- a/core/sqf/monitor/linux/pstartd.h
+++ b/core/sqf/monitor/linux/pstartd.h
@@ -35,7 +35,7 @@ using namespace std;
#include "msgdef.h"
#include "lock.h"
-#include <sqlite3.h>
+#include "trafconfig.h"
class CMonUtil
{
@@ -141,8 +141,8 @@ class CPStartD : public CLock
void waitForEvent( void ) ;
void startProcess( const char *pName
- , string prefix
- , map<string, string> *persistMap );
+ , const char *prefix
+ , persist_configuration_t &persistConfig );
void startProcs ( int nid, bool requiresDTM );
@@ -158,7 +158,7 @@ class CPStartD : public CLock
list<CRequest *> workQ_;
- sqlite3 *db_;
+ bool trafConfigInitialized_;
};
#endif
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/04040d30/core/sqf/monitor/linux/reqget.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/reqget.cxx b/core/sqf/monitor/linux/reqget.cxx
index d5df11c..fe8bab9 100644
--- a/core/sqf/monitor/linux/reqget.cxx
+++ b/core/sqf/monitor/linux/reqget.cxx
@@ -134,7 +134,9 @@ void CExtGetReq::performRequest()
break;
default:
char buf[MON_STRING_BUF_SIZE];
- sprintf(buf, "[CMonitor::Get_Configuration], Invalid ConfigType=%d.\n", msg_->u.request.u.get.type);
+ sprintf( buf, "%s@%d - Invalid ConfigType=%d.\n"
+ , method_name, __LINE__
+ , msg_->u.request.u.get.type);
mon_log_write(MON_MONITOR_GETCONF_1, SQ_LOG_ERR, buf);
group = NULL;
}
@@ -212,7 +214,9 @@ void CExtGetReq::performRequest()
else
{
char buf[MON_STRING_BUF_SIZE];
- sprintf(buf, "[CMonitor::Get_Configuration], Can't find group(%s).\n", msg_->u.request.u.get.group);
+ 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);
msg_->u.reply.type = ReplyType_Get;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/04040d30/core/sqf/monitor/linux/reqnodeadd.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/reqnodeadd.cxx b/core/sqf/monitor/linux/reqnodeadd.cxx
index 6a21163..8ecccc3 100644
--- a/core/sqf/monitor/linux/reqnodeadd.cxx
+++ b/core/sqf/monitor/linux/reqnodeadd.cxx
@@ -74,6 +74,8 @@ void CExtNodeAddReq::performRequest()
TRACE_ENTRY;
int rc = MPI_SUCCESS;
+ pnodeConfigInfo_t pnodeConfigInfo;
+ lnodeConfigInfo_t lnodeConfigInfo;
CClusterConfig *clusterConfig = NULL;
CLNodeConfig *lnodeConfig = NULL;
CPNodeConfig *pnodeConfig = NULL;
@@ -107,25 +109,37 @@ void CExtNodeAddReq::performRequest()
pnodeConfig = clusterConfig->GetPNodeConfig( msg_->u.request.u.node_add.node_name );
if (!pnodeConfig)
{
+ pnodeConfigInfo.pnid = -1;
+ strncpy( pnodeConfigInfo.nodename
+ , msg_->u.request.u.node_add.node_name
+ , sizeof(pnodeConfigInfo.nodename) );
+ pnodeConfigInfo.excludedFirstCore = -1;
+ pnodeConfigInfo.excludedLastCore = -1;
+ clusterConfig->SetCoreMask( pnodeConfigInfo.excludedFirstCore
+ , pnodeConfigInfo.excludedLastCore
+ , pnodeConfigInfo.excludedCoreMask );
+ pnodeConfigInfo.spareCount = 0;
+ memset( pnodeConfigInfo.sparePNid
+ , -1
+ , sizeof(pnodeConfigInfo.sparePNid) );
pnodeConfig = new CPNodeConfig( NULL // pnodesConfig
- , -1 // pnid
- , -1 // excludedFirstCore
- , -1 // excludedLastCore
- , msg_->u.request.u.node_add.node_name
- );
+ , pnodeConfigInfo );
if (pnodeConfig)
{
- clusterConfig->SetCoreMask( msg_->u.request.u.node_add.first_core
- , msg_->u.request.u.node_add.last_core
- , coreMask );
+ lnodeConfigInfo.nid = -1;
+ lnodeConfigInfo.pnid = -1;
+ strncpy( lnodeConfigInfo.nodename
+ , msg_->u.request.u.node_add.node_name
+ , sizeof(lnodeConfigInfo.nodename) );
+ lnodeConfigInfo.lastCore = msg_->u.request.u.node_add.first_core;
+ lnodeConfigInfo.firstCore = msg_->u.request.u.node_add.last_core;
+ lnodeConfigInfo.processor = msg_->u.request.u.node_add.processors;
+ clusterConfig->SetCoreMask( lnodeConfigInfo.lastCore
+ , lnodeConfigInfo.firstCore
+ , lnodeConfigInfo.coreMask );
+ lnodeConfigInfo.zoneType = (ZoneType)msg_->u.request.u.node_add.roles;
lnodeConfig = new CLNodeConfig( pnodeConfig
- , -1 // nid
- , coreMask
- , msg_->u.request.u.node_add.first_core
- , msg_->u.request.u.node_add.last_core
- , msg_->u.request.u.node_add.processors
- , (ZoneType)msg_->u.request.u.node_add.roles
- );
+ , lnodeConfigInfo );
if (lnodeConfig)
{
// Tell all monitors to add this node to the configuration database
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/04040d30/core/sqf/monitor/linux/shell.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/shell.cxx b/core/sqf/monitor/linux/shell.cxx
index bc4fc74..4a954ad 100644
--- a/core/sqf/monitor/linux/shell.cxx
+++ b/core/sqf/monitor/linux/shell.cxx
@@ -616,7 +616,7 @@ void TraceOpen ( void )
// Initialize tracing
trace_init(traceFileName,
false, // don't append pid to file name
- NULL, // prefix
+ "shell", // prefix
false);
if (traceFileFb > 0)
{
@@ -634,6 +634,7 @@ void TraceUpdate ( int flags )
if ( flags & 2 )
{
trace_settings |= TRACE_INIT;
+ trace_settings |= TRACE_TRAFCONFIG;
}
if ( flags & 4 )
{
@@ -696,6 +697,7 @@ void TraceInit( int & argc, char **&argv )
if (envVar && atoi (envVar) != 0 )
{
trace_settings |= TRACE_INIT;
+ trace_settings |= TRACE_TRAFCONFIG;
}
envVar = getenv("SHELL_TRACE_LIO");
@@ -739,7 +741,7 @@ void TraceInit( int & argc, char **&argv )
}
}
- if ( trace_settings & TRACE_SHELL_CMD)
+ if ( trace_settings & TRACE_SHELL_CMD )
{
printf("traceFileName=%s, trace_settings=%lX, traceFileFb=%d\n",
traceFileName, trace_settings, traceFileFb);
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/04040d30/core/sqf/monitor/linux/trafconf.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/trafconf.cxx b/core/sqf/monitor/linux/trafconf.cxx
index 2505da1..7128967 100644
--- a/core/sqf/monitor/linux/trafconf.cxx
+++ b/core/sqf/monitor/linux/trafconf.cxx
@@ -137,8 +137,10 @@ void DisplayUsage( void )
" -wname Displays all node names in configuration prefixed with '-w'\n"
" - Name is as stored in configuration, which could be in short host name or FQDN form.\n"
" -wshort Displays all node names in configuration short host name form prefixed with '-w'.\n"
-" -node Displays node configuration (bracketed with begin/end).\n"
-" -persist Displays persist configuration (bracketed with begin/end).\n\n"
+" -node Displays node configuration (without begin/end brackets).\n"
+" -persist Displays persist configuration (without begin/end brackets).\n\n"
+" --node Displays node configuration (with begin/end brackets).\n"
+" --persist Displays persist configuration (with begin/end brackets).\n\n"
);
}
@@ -270,7 +272,7 @@ int DisplayNodeConfig( char *nodeName )
if ( DisplayBeginEnd && TrafConfType == TrafConfType_NodeConfig )
{
- printf( "begin node\n\n" );
+ printf( "BEGIN NODE\n\n" );
}
else if ( TrafConfType == TrafConfType_NodeConfig )
{
@@ -310,7 +312,7 @@ int DisplayNodeConfig( char *nodeName )
if ( DisplayBeginEnd && TrafConfType == TrafConfType_NodeConfig )
{
- printf( "\nend node\n" );
+ printf( "\nEND NODE\n" );
}
else if ( TrafConfType == TrafConfType_NodeConfig )
{
@@ -343,6 +345,7 @@ int DisplayPersistKeys( void )
{
strcat( persist_config_str, "," );
}
+ rc = 0;
}
printf ("%s\n\n", persist_config_str);
}
@@ -375,7 +378,7 @@ int DisplayPersistConfig( char *key )
if ( DisplayBeginEnd )
{
- printf( "begin persist\n\n" );
+ printf( "BEGIN PERSIST\n\n" );
}
else
{
@@ -464,6 +467,7 @@ int DisplayPersistConfig( char *key )
{
printf ("%s", persist_config_buf);
}
+ rc = 0;
}
}
}
@@ -474,7 +478,7 @@ int DisplayPersistConfig( char *key )
if ( DisplayBeginEnd )
{
- printf( "\nend persist\n" );
+ printf( "\nEND PERSIST\n" );
}
else
{
@@ -569,6 +573,16 @@ int main( int argc, char *argv[] )
{
TrafConfType = TrafConfType_PersistConfig;
}
+ else if ( strcasecmp( argv [argx], "--node" ) == 0 )
+ {
+ DisplayBeginEnd = true;
+ TrafConfType = TrafConfType_NodeConfig;
+ }
+ else if ( strcasecmp( argv [argx], "--persist" ) == 0 )
+ {
+ DisplayBeginEnd = true;
+ TrafConfType = TrafConfType_PersistConfig;
+ }
else
{
DisplayUsage();
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/04040d30/core/sqf/monitor/linux/watchdog.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/watchdog.cxx b/core/sqf/monitor/linux/watchdog.cxx
index be3c7b1..9875e68 100644
--- a/core/sqf/monitor/linux/watchdog.cxx
+++ b/core/sqf/monitor/linux/watchdog.cxx
@@ -70,7 +70,6 @@ bool genSnmpTrapEnabled = false;
class CWatchdog;
CMonLog *MonLog = NULL;
-CMonLog *SnmpLog = NULL;
CWatchdog *Watchdog = NULL;
CProcessMonitor *ProcessMonitor = NULL;
@@ -754,7 +753,6 @@ int main (int argc, char *argv[])
MyPid = atoi (argv[4]);
gv_ms_su_verif = MyVerifier = atoi(argv[9]);
- SnmpLog = new CMonLog( "log4cxx.monitor.wdg.snmp.config", "WDG-SNMP", "alt.wdg.snmp", MyPNID, MyNid, MyPid, MyName );
MonLog = new CMonLog( "log4cxx.monitor.wdg.config", "WDG", "alt.wdg", MyPNID, MyNid, MyPid, MyName );
Watchdog = new CWatchdog();
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/04040d30/core/sqf/monitor/linux/zclient.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/zclient.cxx b/core/sqf/monitor/linux/zclient.cxx
index 33f9499..c850eea 100644
--- a/core/sqf/monitor/linux/zclient.cxx
+++ b/core/sqf/monitor/linux/zclient.cxx
@@ -68,7 +68,6 @@ extern CNodeContainer *Nodes;
extern CReqQueue ReqQueue;
extern CZClient *ZClient;
extern CMonLog *MonLog;
-extern CMonLog *SnmpLog;
extern bool debugFlag;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/04040d30/core/sqf/monitor/linux/zootest.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/zootest.cxx b/core/sqf/monitor/linux/zootest.cxx
index 1536e98..43cb4ff 100644
--- a/core/sqf/monitor/linux/zootest.cxx
+++ b/core/sqf/monitor/linux/zootest.cxx
@@ -52,7 +52,6 @@ int MyPid = -1;
CZClient *ZClient = NULL;
CMonLog *MonLog = NULL;
-CMonLog *SnmpLog = NULL;
void HandleZSessionExpiration( void )
{