More p2p fixes.

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

Branch: refs/heads/master
Commit: 297681c6e8b29cbee3e8a5ad9fd72ce39eb29e86
Parents: 1584dc4
Author: Zalo Correa <[email protected]>
Authored: Fri Apr 6 14:17:47 2018 -0700
Committer: Zalo Correa <[email protected]>
Committed: Fri Apr 6 14:17:47 2018 -0700

----------------------------------------------------------------------
 core/sqf/monitor/linux/process.cxx   |   8 +--
 core/sqf/monitor/linux/ptpclient.cxx |   4 +-
 core/sqf/monitor/linux/reqopen.cxx   | 100 +++++++++++++-----------------
 core/sqf/monitor/linux/reqqueue.cxx  |  10 ++-
 4 files changed, 52 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/297681c6/core/sqf/monitor/linux/process.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/process.cxx 
b/core/sqf/monitor/linux/process.cxx
index b599840..7cce388 100644
--- a/core/sqf/monitor/linux/process.cxx
+++ b/core/sqf/monitor/linux/process.cxx
@@ -5290,6 +5290,7 @@ void CProcessContainer::Exit_Process (CProcess *process, 
bool abend, int downNod
                 if (!process->IsClone() && !MyNode->isInQuiesceState())
                 {
                     // Replicate the exit to other nodes
+                    if (!NameServerEnabled)
                     {
                         // Replicate the exit to other nodes
                         CReplExit *repl = new CReplExit(process->GetNid(),
@@ -5325,12 +5326,7 @@ void CProcessContainer::Exit_Process (CProcess *process, 
bool abend, int downNod
                    process->IsAbended() &&
                    MyNode->GetShutdownLevel() == ShutdownLevel_Undefined) )
             {
-//TRK-TODO
-      //        if (NameServerEnabled)
-                {
-                    //message to monitor
-                }
-        //        else
+                if (!NameServerEnabled)
                 {
                     // Replicate the exit to other nodes
                     CReplExit *repl = new CReplExit(process->GetNid(),

http://git-wip-us.apache.org/repos/asf/trafodion/blob/297681c6/core/sqf/monitor/linux/ptpclient.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/ptpclient.cxx 
b/core/sqf/monitor/linux/ptpclient.cxx
index 0593498..03ca514 100644
--- a/core/sqf/monitor/linux/ptpclient.cxx
+++ b/core/sqf/monitor/linux/ptpclient.cxx
@@ -397,7 +397,7 @@ int CPtpClient::ProcessInit( CProcess *process
     {
         if (trace_settings & (TRACE_REQUEST | TRACE_PROCESS))
         {
-            trace_printf( "%s@%d - Not Sending InternalType_Clone request to 
parentNid=%d\n"
+            trace_printf( "%s@%d - Not Sending InternalType_Clone request to 
parentNid=%d"
                           ", process=%s (%d,%d:%d)\n"
                         , method_name, __LINE__
                         , process->GetParentNid()
@@ -411,7 +411,7 @@ int CPtpClient::ProcessInit( CProcess *process
 
     if (trace_settings & (TRACE_REQUEST | TRACE_PROCESS))
     {
-        trace_printf( "%s@%d" " - Sending InternalType_ProcessInit to parent 
node %s, parentNid=%d\n"
+        trace_printf( "%s@%d" " - Sending InternalType_ProcessInit to parent 
node %s, parentNid=%d"
                     ", for process %s (%d,%d:%d)\n"
                     , method_name, __LINE__
                     , parentLNode->GetNode()->GetName()

http://git-wip-us.apache.org/repos/asf/trafodion/blob/297681c6/core/sqf/monitor/linux/reqopen.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/reqopen.cxx 
b/core/sqf/monitor/linux/reqopen.cxx
index a84e55f..379049f 100644
--- a/core/sqf/monitor/linux/reqopen.cxx
+++ b/core/sqf/monitor/linux/reqopen.cxx
@@ -78,11 +78,6 @@ void CExtOpenReq::performRequest()
     const char method_name[] = "CExtOpenReq::performRequest";
     TRACE_ENTRY;
 
-    int target_nid = -1;
-    int target_pid = -1;
-    Verifier_t target_verifier = -1;
-    string target_process_name;
-
     // Record statistics (sonar counters)
     if (sonar_verify_state(SONAR_ENABLED | SONAR_MONITOR_ENABLED))
        MonStats->req_type_open_Incr();
@@ -108,62 +103,17 @@ void CExtOpenReq::performRequest()
     CProcess *opener = ((CReqResourceProc *) resources_[0])->getProcess();
     CProcess *opened = ((CReqResourceProc *) resources_[1])->getProcess();
 
-    
     // check for the process object as it could have been deleted by the time 
this request gets to perform.
     if (opened == NULL) 
     {
-        if (!NameServerEnabled)
+        if (trace_settings & (TRACE_REQUEST | TRACE_PROCESS))
         {
-            if (trace_settings & (TRACE_REQUEST | TRACE_PROCESS))
-            {
-                  trace_printf("%s@%d request #%ld: Open process failed. 
Process already exited.",
-                           method_name, __LINE__, id_);
-            }
-            errorReply( MPI_ERR_NAME );
-            TRACE_EXIT;
-            return;
-        }
-        else
-        {
-            target_nid = msg_->u.request.u.open.target_nid;
-            target_pid = msg_->u.request.u.open.target_pid;
-            target_verifier  = msg_->u.request.u.open.target_verifier;
-            target_process_name = (const char *) 
msg_->u.request.u.open.target_process_name;
-
-            if ( target_process_name.size() )
-            { // Name Server find by name:verifier
-                if (trace_settings & TRACE_REQUEST)
-                    trace_printf( "%s@%d" " - Getting targetProcess from Name 
Server (%s:%d)" "\n"
-                                , method_name, __LINE__
-                                , target_process_name.c_str()
-                                , target_verifier );
-                opened = Nodes->GetProcessNs( target_process_name.c_str()
-                                            , target_verifier );
-            }     
-            else
-            { // Name Server find by nid,pid:verifier
-                if (trace_settings & TRACE_REQUEST)
-                    trace_printf( "%s@%d" " - Getting targetProcess from Name 
Server (%d,%d:%d)\n"
-                                , method_name, __LINE__
-                                , target_nid
-                                , target_pid
-                                , target_verifier );
-                opened = Nodes->GetProcessNs( target_nid
-                                            , target_pid
-                                            , target_verifier );
-            }
-            if (opened == NULL) 
-            {
-                if (trace_settings & (TRACE_REQUEST | TRACE_PROCESS))
-                {
-                      trace_printf("%s@%d request #%ld: Open process failed. 
Process already exited.",
-                               method_name, __LINE__, id_);
-                }
-                errorReply( MPI_ERR_NAME );
-                TRACE_EXIT;
-                return;
-            }
+              trace_printf("%s@%d request #%ld: Open process failed. Process 
already exited.",
+                       method_name, __LINE__, id_);
         }
+        errorReply( MPI_ERR_NAME );
+        TRACE_EXIT;
+        return;
     }
 
     // check the verifier
@@ -254,6 +204,9 @@ bool CExtOpenReq::prepare()
     TRACE_ENTRY;
 
     int target_nid = -1;
+    int target_pid = -1;
+    Verifier_t target_verifier = -1;
+    string target_process_name;
     CLNode *target_lnode = NULL;
 
     if ( prepared_ == true )
@@ -322,6 +275,41 @@ bool CExtOpenReq::prepare()
                                          , true, false, true );
     }
 
+    if ( openedProcess == NULL )
+    {
+        if (NameServerEnabled)
+        {
+            target_nid = msg_->u.request.u.open.target_nid;
+            target_pid = msg_->u.request.u.open.target_pid;
+            target_verifier  = msg_->u.request.u.open.target_verifier;
+            target_process_name = (const char *) 
msg_->u.request.u.open.target_process_name;
+
+            if ( target_process_name.size() )
+            { // Name Server find by name:verifier
+                if (trace_settings & TRACE_REQUEST)
+                    trace_printf( "%s@%d" " - Getting targetProcess from Name 
Server (%s:%d)" "\n"
+                                , method_name, __LINE__
+                                , target_process_name.c_str()
+                                , target_verifier );
+                openedProcess = Nodes->GetProcessNs( 
target_process_name.c_str()
+                                                   , target_verifier );
+            }     
+            else
+            { // Name Server find by nid,pid:verifier
+                if (trace_settings & TRACE_REQUEST)
+                    trace_printf( "%s@%d" " - Getting targetProcess from Name 
Server (%d,%d:%d)\n"
+                                , method_name, __LINE__
+                                , target_nid
+                                , target_pid
+                                , target_verifier );
+                openedProcess = Nodes->GetProcessNs( target_nid
+                                                   , target_pid
+                                                   , target_verifier );
+            }
+        }
+        
+    }
+
     if ( openedProcess )
     {
         if ( openedProcess->IsBackup() )

http://git-wip-us.apache.org/repos/asf/trafodion/blob/297681c6/core/sqf/monitor/linux/reqqueue.cxx
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/reqqueue.cxx 
b/core/sqf/monitor/linux/reqqueue.cxx
index 184c694..530b096 100644
--- a/core/sqf/monitor/linux/reqqueue.cxx
+++ b/core/sqf/monitor/linux/reqqueue.cxx
@@ -1408,11 +1408,7 @@ void CIntNewProcReq::performRequest()
                     MyNode->AddToNameMap( newProcess );
                     MyNode->AddToPidMap( newProcess->GetPid(),  newProcess );
 
-                    // Successfully forked process.  Replicate actual process
-                    // id and process name.
-
-//TRK-TODO
-              /*      if (NameServerEnabled)
+                    if (NameServerEnabled)
                     {
                         // Send actual pid and process name back to parent
                         PtpClient->ProcessInit( newProcess
@@ -1421,7 +1417,9 @@ void CIntNewProcReq::performRequest()
                                               , parentNid_ );
                     }
                     else
-             */       {
+                    {
+                        // Successfully forked process.  Replicate actual 
process
+                        // id and process name.
                         CReplProcInit *repl
                             = new CReplProcInit(newProcess, reqTag_, 0, 
parentNid_);
                         Replicator.addItem(repl);

Reply via email to