You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by se...@apache.org on 2017/07/28 00:14:43 UTC

[2/3] incubator-trafodion git commit: [TRAFODION-2695] SSMP process ($ZSMxxx) sees too many opens from the master process

[TRAFODION-2695] SSMP process ($ZSMxxx) sees too many opens from the master process

To avoid hanging deadlocks in the IPC layer a SQL Error warning 2026
is now returned when the application attempts to have more than 14
statements opened at the same time from a JDBC/ODBC connection

Maximum Nowait depth is 16. We need to spare 2 slots - One to send query
finished message and the other to get the response for the pending
nowaited query started message.


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

Branch: refs/heads/master
Commit: 5d9e066f0fa5506e5aefc4ae9383cdbb35676ec8
Parents: e311ab6
Author: selvaganesang <se...@esgyn.com>
Authored: Thu Jul 27 20:44:24 2017 +0000
Committer: selvaganesang <se...@esgyn.com>
Committed: Thu Jul 27 20:44:24 2017 +0000

----------------------------------------------------------------------
 core/sql/bin/SqlciErrors.txt      |  2 +-
 core/sql/common/Ipc.cpp           |  4 ++--
 core/sql/common/Ipc.h             |  1 +
 core/sql/executor/ex_root.cpp     | 32 ++++++++++++++++++++++++--------
 core/sql/runtimestats/ssmpipc.cpp | 18 ++++++++++++++++--
 5 files changed, 44 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5d9e066f/core/sql/bin/SqlciErrors.txt
----------------------------------------------------------------------
diff --git a/core/sql/bin/SqlciErrors.txt b/core/sql/bin/SqlciErrors.txt
index 828d3f3..fa6ce82 100644
--- a/core/sql/bin/SqlciErrors.txt
+++ b/core/sql/bin/SqlciErrors.txt
@@ -543,7 +543,7 @@
 2023 ZZZZZ 99999 ADVANCED MAJOR DIALOUT Server process $0~string0 could not be created - $1~string1.
 2024 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Server Process $0~string0 is not running or could not be created. Operating System Error $1~int0 was returned.
 2025 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Server process $0~string0 could not be created - CPU is unavailable; $1~string1.
-2026 ZZZZZ 99999 UUUUUUUU UUUUU UUUUUUU ****Filler for IPC error.
+2026 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Server Process $0~string0 has reached allowed depth for nowait operation from the process $1~int0,$2~int1.
 2027 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Operating system error $0~int0 while sending a startup message to process $1~string0.
 2028 ZZZZZ 99999 ADVANCED MAJOR DIALOUT OSS server process $0~string0 could not be created on $1~string1 - insufficient resources.
 2029 ZZZZZ 99999 BEGINNER MINOR DBADMIN The new min value is greater than the current max value $0~int0.

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5d9e066f/core/sql/common/Ipc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/Ipc.cpp b/core/sql/common/Ipc.cpp
index 5c65fd8..2d989ee 100644
--- a/core/sql/common/Ipc.cpp
+++ b/core/sql/common/Ipc.cpp
@@ -4892,13 +4892,13 @@ IpcServer * IpcServerClass::allocateServerProcess(ComDiagsArea **diags,
     case IPC_SQLSSCP_SERVER:
       className = "sscp";
       lv_usesTransactions = FALSE;
-      lv_maxNowaitRequests =  FS_MAX_NOWAIT_DEPTH-1;   
+      lv_maxNowaitRequests =  FS_MAX_NOWAIT_DEPTH;   
       overridingDefineName = "=_MX_SSCP_PROCESS_PREFIX"; 
       break;
     case IPC_SQLSSMP_SERVER:
       className = "ssmp";
       lv_usesTransactions = FALSE;
-      lv_maxNowaitRequests =  FS_MAX_NOWAIT_DEPTH-1;   
+      lv_maxNowaitRequests =  FS_MAX_NOWAIT_DEPTH;   
       overridingDefineName = "=_MX_SSMP_PROCESS_PREFIX";
       break;
     default:

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5d9e066f/core/sql/common/Ipc.h
----------------------------------------------------------------------
diff --git a/core/sql/common/Ipc.h b/core/sql/common/Ipc.h
index 47df2db..c8a1e8e 100644
--- a/core/sql/common/Ipc.h
+++ b/core/sql/common/Ipc.h
@@ -1145,6 +1145,7 @@ public:
 
  inline Int32 getOpenRetries() const { return openRetries_; }
  inline void setOpenRetries(Int32 num) { openRetries_ =  num; }
+ inline unsigned short getNowaitDepth() { return nowaitDepth_; }
  void openRetryCleanup();
 
   // struct is public only to make the compiler happy

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5d9e066f/core/sql/executor/ex_root.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_root.cpp b/core/sql/executor/ex_root.cpp
index 9b024d9..5bc62c7 100644
--- a/core/sql/executor/ex_root.cpp
+++ b/core/sql/executor/ex_root.cpp
@@ -2807,18 +2807,34 @@ void ex_root_tcb::registerCB(ComDiagsArea *&diagsArea)
       return;
     }
   }
+  NABoolean diagsAreaAllocated = FALSE;
 
-  ExExeStmtGlobals * exe_glob = getGlobals()->castToExExeStmtGlobals();
-  ComDiagsArea *tempDiagsArea = exe_glob->getDiagsArea();
-  
+  if (diagsArea == NULL)
+  {
+     diagsAreaAllocated = TRUE;
+     diagsArea = ComDiagsArea::allocate(getHeap());
+  }
   ExSsmpManager *ssmpManager = context->getSsmpManager();
   cbServer_ = ssmpManager->getSsmpServer(
                                  cliGlobals->myNodeName(), 
-                                 cliGlobals->myCpu(), tempDiagsArea);
-  if (cbServer_ == NULL)
-    return ;
+                                 cliGlobals->myCpu(), diagsArea);
+  if (cbServer_ == NULL || cbServer_->getControlConnection() == NULL)		
+  {		
+      // We could not get a phandle for the cancel broker.  However,		
+      // let the query run (on the assumption that it will not need to 		
+      // be canceled) and convert any error conditions to warnings.		
+
+      // tbd - figure a way retry registration later, as the query progresses.		
+      if (diagsArea != NULL)		
+         NegateAllErrors(diagsArea);		
+      return;
+  }
+  else if (diagsAreaAllocated)
+  {
+     diagsArea->decrRefCount();
+     diagsArea = NULL;
+  }
 
-  
   // The stream's actOnSend method will delete (or call decrRefCount()) 
   // for this object.
   RtsQueryId *rtsQueryId = new (context->getIpcHeap()) 
@@ -2869,7 +2885,7 @@ void ex_root_tcb::deregisterCB()
   // Let MXSSMP know this query can no longer be suspended.  Also, here
   // is where we handle one possibilty:  the query can be suspended after
   // the ExScheduler::work method has made its final check of the root
-
+  // oper stats isSuspended_ flag, but before we get to this code where
   // we change ExMasterStats::readyToSuspend_ from READY to NOT_READY.
   // To handle this, the subject master will obtain the Stats semaphore
   // and test ExMasterStats::isSuspended_.  If set to true, it will

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5d9e066f/core/sql/runtimestats/ssmpipc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/runtimestats/ssmpipc.cpp b/core/sql/runtimestats/ssmpipc.cpp
index 1d7b0e5..52ee689 100755
--- a/core/sql/runtimestats/ssmpipc.cpp
+++ b/core/sql/runtimestats/ssmpipc.cpp
@@ -95,7 +95,20 @@ IpcServer *ExSsmpManager::getSsmpServer(char *nodeName, short cpuNum,
    {
      if (str_cmp(ssmpServer->castToIpcGuardianServer()->getProcessName(),
             tmpProcessName, processNameLen) == 0)
-        return ssmpServer;
+     {
+        GuaConnectionToServer *cbGCTS = ssmpServer->getControlConnection()->castToGuaConnectionToServer();
+
+        // We need to keep 2 entries free - To send QueryFinishedMessage and to get the response for query started message
+       if (cbGCTS->numReceiveCallbacksPending()+2 == cbGCTS->getNowaitDepth())
+       {
+          *diagsArea << DgSqlCode(-2026)
+            << DgString0(tmpProcessName)
+            << DgInt0(GetCliGlobals()->myCpu())
+            << DgInt1(GetCliGlobals()->myPin()); 
+          return NULL;
+       }
+       return ssmpServer;
+     }
      ssmpServer = (IpcServer *) ssmps_->getNext();
    }
 
@@ -119,7 +132,8 @@ IpcServer *ExSsmpManager::getSsmpServer(char *nodeName, short cpuNum,
        ssmpServer = NULL;
      }
    }
-
+   
+   
    return ssmpServer;
 }