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 2018/01/08 21:55:03 UTC

[1/2] trafodion git commit: [TRAFODION-2888] Streamline setjmp/longjmp concepts in Trafodion

Repository: trafodion
Updated Branches:
  refs/heads/master 85690dece -> 7814a0a0d


[TRAFODION-2888] Streamline setjmp/longjmp concepts in Trafodion

First set of changes to streamline setjmp/longjmp.
   a) Removed the setjmp in heap management within Trafodion.
   b) Removed obsolete code related to No-wait operation concepts in SQL


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

Branch: refs/heads/master
Commit: 6b6cbf93f9d51a3d605695d1f1c5f9a6c40e4578
Parents: 33325b6
Author: selvaganesang <se...@gmail.com>
Authored: Mon Jan 8 01:31:05 2018 +0000
Committer: selvaganesang <se...@gmail.com>
Committed: Mon Jan 8 01:31:05 2018 +0000

----------------------------------------------------------------------
 core/sql/arkcmp/CmpContext.cpp          |   5 -
 core/sql/arkcmp/CmpStatement.cpp        |   2 -
 core/sql/bin/ex_sscp_main.cpp           |   4 -
 core/sql/bin/ex_ssmp_main.cpp           |   4 -
 core/sql/cli/Cli.cpp                    |   4 -
 core/sql/cli/Context.cpp                |   1 -
 core/sql/cli/Globals.h                  |  10 +-
 core/sql/cli/NoWaitOp.cpp               | 264 ------------
 core/sql/cli/NoWaitOp.h                 |  89 -----
 core/sql/cli/QuasiFileManager.cpp       | 577 ---------------------------
 core/sql/cli/QuasiFileManager.h         | 159 --------
 core/sql/cli/Statement.cpp              |   3 -
 core/sql/common/BaseTypes.cpp           |   3 -
 core/sql/common/NAMemory.cpp            |  44 --
 core/sql/common/NAMemory.h              |  11 -
 core/sql/executor/ExSimpleSqlBuffer.cpp |   3 -
 core/sql/executor/ex_ex.cpp             |   8 -
 core/sql/executor/ex_ex.h               |   7 -
 core/sql/executor/ex_globals.cpp        |   1 -
 core/sql/executor/ex_globals.h          |  10 -
 core/sql/executor/ex_mj.cpp             |   3 +-
 core/sql/executor/ex_root.cpp           | 122 ------
 core/sql/executor/ex_sort.cpp           |  16 -
 core/sql/optimizer/BindItemExpr.cpp     |   1 -
 core/sql/optimizer/BindRelExpr.cpp      |   1 -
 core/sql/sort/Qsort.cpp                 |   1 -
 core/sql/sort/Record.cpp                |   2 -
 core/sql/sort/TourTree.cpp              |   1 -
 core/sql/sqlcomp/QCache.cpp             |   1 -
 core/sql/sqlcomp/parser.cpp             |   1 -
 core/sql/udrserv/udrserv.cpp            |  10 -
 31 files changed, 3 insertions(+), 1365 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/arkcmp/CmpContext.cpp
----------------------------------------------------------------------
diff --git a/core/sql/arkcmp/CmpContext.cpp b/core/sql/arkcmp/CmpContext.cpp
index e5c179e..1b30b3d 100644
--- a/core/sql/arkcmp/CmpContext.cpp
+++ b/core/sql/arkcmp/CmpContext.cpp
@@ -151,9 +151,6 @@ CmpContext::CmpContext(UInt32 f, CollHeap * h)
   cmpCurrentContext = this;
   CMPASSERT(heap_ != NULL);
 
-  // For embedded arkcmp, the CmpInternalErrorJmpBuf will be populated
-  // later but the buffer location and pointer are valid
-  heap_->setJmpBuf(CmpInternalErrorJmpBufPtr);
   heap_->setErrorCallback(&CmpErrLog::CmpErrLogCallback);
 
   // Reserve memory that can be used for out-of-memory reporting.
@@ -219,8 +216,6 @@ CmpContext::CmpContext(UInt32 f, CollHeap * h)
                                  initHeapSize,
                                  memLimit);
 
-    histogramCacheHeap->setJmpBuf(CmpInternalErrorJmpBufPtr);
-
     // Setting up the cache for histogram
     histogramCache_ = new(histogramCacheHeap) HistogramCache(histogramCacheHeap, 107);
 

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/arkcmp/CmpStatement.cpp
----------------------------------------------------------------------
diff --git a/core/sql/arkcmp/CmpStatement.cpp b/core/sql/arkcmp/CmpStatement.cpp
index e16ff5c..f352876 100644
--- a/core/sql/arkcmp/CmpStatement.cpp
+++ b/core/sql/arkcmp/CmpStatement.cpp
@@ -169,8 +169,6 @@ CmpStatement::CmpStatement(CmpContext* context,
                        context_->heap(),
                        (Lng32)32768,
                        memLimit);
-
-    heap_->setJmpBuf(&ExportJmpBuf);
     heap_->setErrorCallback(&CmpErrLog::CmpErrLogCallback);
   }
 

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/bin/ex_sscp_main.cpp
----------------------------------------------------------------------
diff --git a/core/sql/bin/ex_sscp_main.cpp b/core/sql/bin/ex_sscp_main.cpp
index 6ddb549..a1f1f2b 100644
--- a/core/sql/bin/ex_sscp_main.cpp
+++ b/core/sql/bin/ex_sscp_main.cpp
@@ -156,7 +156,6 @@ Int32 main(Int32 argc, char **argv)
 void runServer(Int32 argc, char **argv)
 {
   Int32 shmid;
-  jmp_buf sscpJmpBuf;
   StatsGlobals *statsGlobals = NULL;
   void *statsGlobalsAddr;
   NABoolean createStatsGlobals = FALSE;
@@ -275,9 +274,6 @@ void runServer(Int32 argc, char **argv)
   }
   XPROCESSHANDLE_GETMINE_(statsGlobals->getSscpProcHandle());
   NAHeap *sscpHeap = cliGlobals->getExecutorMemory();
-  cliGlobals->setJmpBufPtr(&sscpJmpBuf);
-  if (setjmp(sscpJmpBuf))
-    NAExit(1); // Abend
   IpcEnvironment  *sscpIpcEnv = new (sscpHeap) IpcEnvironment(sscpHeap, cliGlobals->getEventConsumed(),
       FALSE, IPC_SQLSSCP_SERVER, FALSE, TRUE);
 

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/bin/ex_ssmp_main.cpp
----------------------------------------------------------------------
diff --git a/core/sql/bin/ex_ssmp_main.cpp b/core/sql/bin/ex_ssmp_main.cpp
index 2f17b95..cfbe07b 100755
--- a/core/sql/bin/ex_ssmp_main.cpp
+++ b/core/sql/bin/ex_ssmp_main.cpp
@@ -145,7 +145,6 @@ Int32 main(Int32 argc, char **argv)
 
 void runServer(Int32 argc, char **argv)
 {
-  jmp_buf ssmpJmpBuf;
   Int32 shmId;
   StatsGlobals *statsGlobals = (StatsGlobals *)shareStatsSegment(shmId);
   Int32 r = 0;
@@ -209,9 +208,6 @@ void runServer(Int32 argc, char **argv)
   XPROCESSHANDLE_GETMINE_(statsGlobals->getSsmpProcHandle());
 
   NAHeap *ssmpHeap = cliGlobals->getExecutorMemory();
-  cliGlobals->setJmpBufPtr(&ssmpJmpBuf);
-  if (setjmp(ssmpJmpBuf))
-    NAExit(1); // Abend
 
   IpcEnvironment       *ssmpIpcEnv = new (ssmpHeap) IpcEnvironment(ssmpHeap,
             cliGlobals->getEventConsumed(), FALSE, IPC_SQLSSMP_SERVER,

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/cli/Cli.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Cli.cpp b/core/sql/cli/Cli.cpp
index be9181a..4086a6e 100644
--- a/core/sql/cli/Cli.cpp
+++ b/core/sql/cli/Cli.cpp
@@ -74,12 +74,8 @@
 
 #include <time.h>
 
-#include <setjmp.h>
-
-
 #include "fs/feerrors.h"
 
-
 #include "csconvert.h"
 
 #include "ExRsInfo.h"

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/cli/Context.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Context.cpp b/core/sql/cli/Context.cpp
index 6eef48f..b7cfd08 100644
--- a/core/sql/cli/Context.cpp
+++ b/core/sql/cli/Context.cpp
@@ -174,7 +174,6 @@ ContextCli::ContextCli(CliGlobals *cliGlobals)
     numRoles_(0),
     unusedBMOsMemoryQuota_(0)
 {
-  exHeap_.setJmpBuf(cliGlobals->getJmpBuf());
   cliSemaphore_ = new (&exHeap_) CLISemaphore();
   ipcHeap_ = new (cliGlobals_->getProcessIpcHeap())
                   NAHeap("IPC Context Heap",

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/cli/Globals.h
----------------------------------------------------------------------
diff --git a/core/sql/cli/Globals.h b/core/sql/cli/Globals.h
index ca498fa..ce9ecb0 100644
--- a/core/sql/cli/Globals.h
+++ b/core/sql/cli/Globals.h
@@ -64,7 +64,6 @@
 
 #include "NAMemory.h"
 #include "sqlcli.h"
-#include "QuasiFileManager.h"
 #include "Ipc.h"
 #include "ComQueue.h"
 #include "logmxevent.h"
@@ -72,14 +71,13 @@
 #include "ComRtUtils.h"
 #include "ComSmallDefs.h"
 class ContextCli;
-class Statement;  // $$$ possibly a stub for QuasiFileberManager
-class ComDiagsArea; // $$$ possibly a stub for QuasiFileberManager
+class Statement;  
+class ComDiagsArea; 
 class ExEspManager;
 class ExSsmpManager;
 class ExSqlComp;
 class IpcEnvironment;
 class MemoryMonitor;
-class QuasiFileManager;
 class HashQueue;
 class ExUdrServerManager;
 class ExControlArea;
@@ -159,7 +157,6 @@ public:
   ExUdrServerManager *getUdrServerManager();
   inline MemoryMonitor * getMemoryMonitor()     { return memMonitor_; }
   inline void setMemoryMonitor(MemoryMonitor *memMon) { memMonitor_ = memMon; }
-  inline QuasiFileManager * getQuasiFileManager() { return quasiFileManager_; }
 
   inline NAHeap * getExecutorMemory()      { return &executorMemory_; }
   inline NAHeap * getNoWaitHeap()  { return noWaitSQLHeap_; }
@@ -455,9 +452,6 @@ private:
   // heap used by no-wait SQL procedures
   NAHeap * noWaitSQLHeap_;
 
-  // quasi file manager for this process
-  QuasiFileManager * quasiFileManager_;
-
   // Cache of descriptive table information from resource forks. Used
   // in the audit reading CLI procedures called by utilities and by
   // TMFARLB2. Code for these audit reading procedures is in

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/cli/NoWaitOp.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/NoWaitOp.cpp b/core/sql/cli/NoWaitOp.cpp
deleted file mode 100644
index f6dc8d2..0000000
--- a/core/sql/cli/NoWaitOp.cpp
+++ /dev/null
@@ -1,264 +0,0 @@
-/**********************************************************************
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-**********************************************************************/
-/* -*-C++-*-
- *****************************************************************************
- *
- * File:         NoWaitOp.cpp
- * Description:  Functions of NowaitOp class.
- *               
- * Created:      3/26/2002
- * Language:     C++
- *
- *
- *
- *
- *****************************************************************************
- */
-
-#include "Platform.h"
-#include "ComCextdecs.h"
-
-#include "cextdecs/cextdecs.h"
-
-#include <stdlib.h>
-#include "cli_stdh.h"
-#include "Ipc.h"
-#include "ex_stdh.h"
-#include "SQLCLI.h"
-#include "NoWaitOp.h"
-#include "Statement.h"
-#include "Descriptor.h"
-#include "ExStats.h"
-#include "ex_exe_stmt_globals.h"
-
-// Methods for class NoWaitOp
-
-NoWaitOp::NoWaitOp(Statement * stmt,
-             Descriptor * inputDesc, Descriptor * outputDesc,
-             Lng32 tag, NoWaitOp::opType op, NABoolean initiated)
-             : stmt_(stmt), inputDesc_(inputDesc),
-             outputDesc_(outputDesc),tag_(tag),op_(op),
-             initiated_(initiated)
-  {
-  // lock Descriptors ($$$ what happens if already locked?)
-  if (inputDesc)
-    inputDesc->lockForNoWaitOp(); // $$$ ignores possible error return code
-
-  if (outputDesc)
-    outputDesc->lockForNoWaitOp(); // $$$ ignores possible error return code
-  }
-
-NoWaitOp::~NoWaitOp(void)
-  {
-  // unlock Descriptors ($$$ what happens if already unlocked?)
-  if (inputDesc_)
-    inputDesc_->unlockForNoWaitOp(); // $$$ ignores possible error return code
-  
-  if (outputDesc_)
-    outputDesc_->unlockForNoWaitOp(); // $$$ ignores possible error return code
-  }
-
-
-RETCODE NoWaitOp::awaitIox(Lng32 * tag)
-  {
-
-  RETCODE rc = NOT_FINISHED;  // assume not finished yet
-  RETCODE rc1;
-
-  // set current context to that of this Statement
-
-  // $$$ note that the diagsArea might be from a different context;
-  // I think this is OK, but it bears closer inspection.
-
-  // $$$ this code should be bracketed with a try-catch block to
-  // restore the original context in the event of an exception.
-  
-  ContextCli * stmtContext = stmt_->getContext();
-  ComDiagsArea &diagsArea = stmtContext->diags();
-  CliGlobals * cliGlobals = stmtContext->getCliGlobals();
-  ContextCli * oldCurrentContext = cliGlobals->currContext();
-  cliGlobals->setCurrentContext(stmtContext);
-  jmp_buf jmpBuf, *oldJmpBufPtr;
-  oldJmpBufPtr = cliGlobals->getJmpBufPtr();
-
-  cliGlobals->setJmpBufPtr(&jmpBuf);
-  Lng32 jmpRetcode;
-  Int32 jmpRc = setjmp(jmpBuf);
-  if (jmpRc)
-    {
-    if (jmpRc == MEMALLOC_FAILURE)
-      jmpRetcode = -EXE_NO_MEM_TO_EXEC;
-    else
-    {
-      stmt_->resetNoWaitOpPending();
-      jmpRetcode = -CLI_INTERNAL_ERROR;
-    }
-    *tag = tag_;
-    diagsArea << DgSqlCode(jmpRetcode);
-    rc = ERROR;
-    }
-  else
-    {
-    Int64 startTime = NA_JulianTimestamp();
-  
-    switch (op_)
-      {
-      case FETCH:
-      case FETCH_CLOSE:
-	{
-	// drive the fetch with a zero time limit (since we drive
-	// the IPC wait in this layer instead of in the Executor
-	// layer), but drive it only if there is dispatchable work
-	// to do
-	if (stmt_->mightHaveWorkToDo()) //Do this for fetch but not prepare
-	  {
-	  // redrive the fetch (FALSE indicates not a new fetch)
-
-	  rc = stmt_->fetch(cliGlobals,outputDesc_,diagsArea,FALSE);
-        
-	  // $$$ for the moment, assume at most one no-wait op per
-	  // Statement; can relax this later
-	  if (rc != NOT_FINISHED)
-	    {
-	    stmt_->resetNoWaitOpPending();
-	    *tag = tag_;
-
-	    // Fixup the diags area and outputDesc.
-	    // if bulk move was done, remember the statement it was done for.
-	    if ((outputDesc_) && (NOT outputDesc_->bulkMoveDisabled()))
-	      {
-	      //if (getenv("BULKMOVEWARN"))
-	      //	diags << DgSqlCode(EXE_ERROR_NOT_IN_USE_8350);
-
-	      outputDesc_->bulkMoveStmt() = stmt_;
-	      }
-
-	    // if select into query, then make sure that atmost one
-	    // row is returned by executor. More than one would
-	    // result in an error.
-	    if ((stmt_->isSelectInto()) &&
-		(rc == SUCCESS))
-	      {
-		// BertBert VV
-	      if (stmt_->isEmbeddedUpdateOrDelete() || stmt_->isStreamScan())
-		{
-		// For streams and destructive selects, we don't want the
-		// abovebehavior,instead, we should just return the first row.
-		}
-	      // BertBert ^^
-	      else
-		{
-		// select into and a row was returned.
-		// See if we can get one more row.
-		// Do not send in an output desc. We want
-		// to return the first row to application.
-		// This is being consistent with SQL/MP behavior.
-		stmt_->resetNoWaitOpEnabled();  // waited mode
-		rc = stmt_->fetch(cliGlobals, 0 /*no output desc*/,
-				  diagsArea, TRUE);
-
-		if (rc == SUCCESS)
-		  {
-		  diagsArea << DgSqlCode(-CLI_SELECT_INTO_ERROR);
-		  if (op_ == FETCH)
-		    stmt_->close(diagsArea);
-		  rc = ERROR;
-		  }
-	    
-		if (rc == SQL_EOF)
-		  {
-		  // remove warning 100 from diags.
-		  diagsArea.removeFinalCondition100();
-
-		  rc = SUCCESS;
-		  }
-		}
-	      }
-
-	    if ((rc == SQL_EOF) && (outputDesc_ == NULL))
-	      {
-	      // remove warning 100 from diags.
-	      diagsArea.removeFinalCondition100();
-	  
-	      rc = SUCCESS;
-	      }
-	    }   // end if rc != NOT_FINISHED
-
-	  }
-
-	  if (rc != NOT_FINISHED && op_ == FETCH_CLOSE)
-	  {
-	    rc1 = stmt_->close(diagsArea);
-	    if (rc1 == ERROR)
-		rc = rc1;
-	  }
-
-	  if ((op_ == FETCH_CLOSE) &&
-	      (rc != NOT_FINISHED) && 
-	      (rc != ERROR) &&
-	      (stmt_->noRowsAffected(diagsArea)))
-	    {
-	      rc = 
-		((diagsArea.getNumber(DgSqlCode::WARNING_) > 0) ? SUCCESS : SQL_EOF);
-	      // move EOF warning to diags area.
-	      if (rc == SQL_EOF)
-		diagsArea << DgSqlCode(SQL_EOF);
-	    }
-
-	break;
-	}
-
-      case PREPARE:
-	{
-	// drive the prepare with a zero time limit
-	ULng32 flags = PREPARE_NOT_A_NEW_OPERATION;
-	rc = stmt_->prepare(NULL,diagsArea,NULL,0,0,TRUE,flags);
-      
-	// $$$ for the moment, assume at most one no-wait op per
-	// Statement; can relax this later
-	if (rc != NOT_FINISHED)
-	  {
-          stmt_->issuePlanVersioningWarnings (diagsArea);
-	  stmt_->resetNoWaitOpPending();
-	  *tag = tag_;
-	  }
-	break;
-	}
-
-      default:
-	{
-	// $$$ operation invalid or not supported yet
-	rc = ERROR;
-	diagsArea << DgSqlCode(-EXE_INTERNAL_ERROR); 
-	break;
-	}
-      }
-    }
-
-
-  // restore original current context
-  cliGlobals->setCurrentContext(oldCurrentContext);
-  cliGlobals->setJmpBufPtr(oldJmpBufPtr);
-  return rc;
-  }
-

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/cli/NoWaitOp.h
----------------------------------------------------------------------
diff --git a/core/sql/cli/NoWaitOp.h b/core/sql/cli/NoWaitOp.h
deleted file mode 100644
index 9879d8e..0000000
--- a/core/sql/cli/NoWaitOp.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/**********************************************************************
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-**********************************************************************/
-#ifndef NOWAITOP_H
-#define NOWAITOP_H
-
-/* -*-C++-*-
-******************************************************************************
-*
-* File:         NoWaitOp.h
-* Description:  Definition of NowaitOp class.
-*               
-* Created:      3/26/2002
-* Language:     C++
-*
-*
-*
-******************************************************************************
-*/
-
-//#include "Statement.h"
-//#include "Descriptor.h"
-
-class Statement;
-class Descriptor;
-class NoWaitOp;
-
-#ifdef EX_GOD_H    // compile the following only if ex_god.h also included
-#ifdef CLI_STDH_H  // compile the following only if CliDefs.h also included
-
-class NoWaitOp : public NABasicObject
-{
-  public:
-
-    enum opType { FETCH, EXECUTE, PREPARE, FETCH_CLOSE };
-
-    NoWaitOp(Statement * stmt, 
-             Descriptor * inputDesc, Descriptor * outputDesc,
-             Lng32 tag, opType op, NABoolean initiated);
-
-    ~NoWaitOp(void);
-
-    RETCODE awaitIox(Lng32 *tag);
-
-    inline Statement * getStatement(void)
-      { return stmt_; };
-    inline Lng32 * getTagAddr(void)
-      { return &tag_; };
-
-    static inline Lng32 getTagSize()
-      { return sizeof(Lng32); }
-
-  private:
-
-    Statement * stmt_;        // Statement object of no-wait op
-    Descriptor * inputDesc_;  // input Descriptor for no-wait op
-    Descriptor * outputDesc_; // output Descriptor for no-wait op
-    Lng32 tag_;                // tag to be returned on operation completion
-    opType op_;               // type of operation (e.g. Fetch, Execute, ...)
-    NABoolean initiated_;     // true if operation has been started in
-                              // the Executor
-
-} ;
-
-
-#endif // CLI_STDH_H
-#endif // EX_GOD_H
-
-#endif /* NOWAITOP_H */
-

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/cli/QuasiFileManager.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/QuasiFileManager.cpp b/core/sql/cli/QuasiFileManager.cpp
deleted file mode 100644
index 7e1b8a3..0000000
--- a/core/sql/cli/QuasiFileManager.cpp
+++ /dev/null
@@ -1,577 +0,0 @@
-/**********************************************************************
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-**********************************************************************/
-/* -*-C++-*-
- *****************************************************************************
- *
- * File:         QuasiFileManager.cpp
- * Description:  Functions of QuasiFileManager and QuasiFileber.
- *               
- * Created:      3/26/2002
- * Language:     C++
- *
- *
- *
- *
- *****************************************************************************
- */
-
-// -----------------------------------------------------------------------
-
-
-#include "Platform.h"
-
-
-#include <stdlib.h>
-#include "cli_stdh.h"
-#include "Ipc.h"
-#include "ex_stdh.h"
-#include "QuasiFileManager.h"
-#include "NoWaitOp.h"
-
-#define SQL_QFO_FUNCTION_ATTRIBUTES __declspec(dllexport)
-#include "cextdecs/cextdecs.h"
-#include "guardian/dpcbz.h"
-
-
-SQL_QFO_FUNCTION_ATTRIBUTES short Sql_Qfo_IOComp(short quasi_file_number /*in*/,
-				     Lng32 *tag /*out*/,
-				     unsigned short *waitmask /*out*/,
-				     short userstop /*in*/);
-SQL_QFO_FUNCTION_ATTRIBUTES short Sql_Qfo_Close(short quasi_file_number /*in*/);
-
-//*************************************************************
-// Methods of QuasiFileManager
-//*************************************************************
- 
-QuasiFileManager::QuasiFileManager(NAHeap * noWaitHeap,
-                               IpcEnvironment * ipcEnv) : 
-pendingNoWaitOperations_(0), ipcEnv_(ipcEnv), noWaitHeap_(noWaitHeap)
-  {
-  quasiFileList_ = new(noWaitHeap_) Queue(noWaitHeap_);
-  }
-
-QuasiFileManager::~QuasiFileManager(void)
-  {
-  // delete quasiFile list
-  assert (quasiFileList_->isEmpty());
-
-  //  delete quasiFileList_;
-  NADELETE(quasiFileList_, Queue, noWaitHeap_);
-
-
-  // $$$ need to think about policy here... do we do disassociates
-  // on all Statements? Or do we assume we only get called after
-  // contexts and statements are destroyed?
-  }
-
-RETCODE QuasiFileManager::assocFileNumber(ComDiagsArea &diagsArea,
-                                           short fileNumber,
-                                           Statement * statement)
-  {
-  RETCODE rc = SUCCESS; 
-  QuasiFile *fn = NULL;
-
-  if (statement->getFileNumber() != -1)
-    {
-    // Statement is already associated with some file number --
-    // generate error
-    rc = ERROR;
-    // $$$ for now, just raise an internal error
-    diagsArea << DgSqlCode(-CLI_STATEMENT_ASSOCIATED_WITH_QFO);
-    }
-  else 
-    {
-    if ((fn = getQuasiFile(fileNumber)) == NULL)  // quasiFile entry not exist
-       {
-       
-       // first check if filename is $QFO
-
-
-	// add new quasiFile to list
-	fn = new (noWaitHeap_) 
-	        QuasiFile (noWaitHeap_, fileNumber, this);
-	quasiFileList_ -> insert((void *)fn);
-	} // create a new entry
-       
-    // associate this statement with this file number
-    fn->associateStatement(statement);
-   
-    } // else
-   
-  return rc;
-  }
-
-
-
-RETCODE QuasiFileManager::disassocFileNumber(ComDiagsArea &diagsArea,
-					     Statement * statement,
-					     NABoolean force)
-  { 
-  RETCODE rc = SUCCESS;  // assume success
-
-  short fileNumber = statement->getFileNumber();
-
-  if (fileNumber == -1)
-    {
-    diagsArea << DgSqlCode(-CLI_STATEMENT_WITH_NO_QFO);
-    rc = ERROR;
-    }
-  else
-  {
-    if (statement->noWaitOpPending() && force)
-      deleteNoWaitOps(diagsArea, fileNumber, statement);
-  
-    if (statement->noWaitOpPending())
-      {
-      // Statement has an incompleted no-wait op
-      // $$$ Later can consider cancelling or completing, or raising
-      // a user error but for now raise an internal error in this case
-      diagsArea << DgSqlCode(-CLI_OPERATION_WITH_PENDING_OPS);
-      rc = ERROR;
-      }
-    else
-      {
-      QuasiFile * fn = getQuasiFile (fileNumber);
-
-      if (fn == NULL)
-	{
-	diagsArea << DgSqlCode(-CLI_INVALID_QFO_NUMBER);
-	rc = ERROR;
-	}
-      else
-	{
-	if (fn->disassociateStatement(statement))
-	  {
-	  // last associated statement
-	  quasiFileList_->remove((void *)fn);
-	  delete fn;
-	  }
-	}
-      }
-  }
-
-  return rc;
-  }
-
-
-RETCODE QuasiFileManager::deleteNoWaitOps(ComDiagsArea &diagsArea,
-					short fileNumber, 
-					Statement * stmt)
-  {
-  RETCODE rc = SUCCESS;  // assume success
-
-  QuasiFile * fn = getQuasiFile(fileNumber);
-    
-  if (fn == NULL)
-    {
-    // trying to delete no-wait ops for a file number that is not allocated --
-    // generate error
-    rc = ERROR;
-    diagsArea << DgSqlCode(-CLI_INVALID_QFO_NUMBER);
-    }
-  else
-    {
-    // delete outstanding nowait ops
-    fn->deleteNoWaitOps(stmt);
-    }
-  return rc;
-  }
-
-RETCODE QuasiFileManager::awaitIox(Lng32 fileNumber,
-				 Lng32 * tag,
-				 short * feError)
-  {
-  RETCODE rc = NOT_FINISHED;  // show no completions yet
-  QuasiFile *quasiFile;
- 
-  quasiFile = getQuasiFile(fileNumber);
-  if (quasiFile != NULL)
-    rc = quasiFile->awaitIox(ipcEnv_, tag, feError);
-  else
-    *feError = FEBADPARMVALUE; // shouldn't be called with this file number
-
-  return rc;
-  }
-
-
-
-QuasiFile * QuasiFileManager::getQuasiFile(short fileNumber)
-  {
-  QuasiFile * fn = NULL; // assume failure
-  quasiFileList_->position();
-  fn = (QuasiFile *)quasiFileList_->getNext();
-
-  // go through the quasiFileList and find a match.
-  while (fn)
-    {
-    if (fileNumber == fn->getFileNumber())
-      return fn;
-    else
-      fn = (QuasiFile *)quasiFileList_->getNext();
-    }
-  return fn;
-  }
-
-
-void QuasiFileManager::notifyOfNewNoWaitOp(void)
-  {
-  pendingNoWaitOperations_++;
-  }
-
-void QuasiFileManager::closeQuasiFile(short fileNumber)
-  {
-  QuasiFile *quasiFile = getQuasiFile(fileNumber);
-  if (quasiFile)
-    {
-    quasiFile->closeNoWaitOpsPending();
-    quasiFileList_->remove((void *)quasiFile);
-    delete quasiFile;
-    }
-  }
-
-//***************************************************************************
-// Methods for class QuasiFile
-//***************************************************************************
-
-QuasiFile::QuasiFile(NAHeap * noWaitHeap,
-		       short fileNumber,
-		       QuasiFileManager *fnm) 
-  : fileNumber_(fileNumber), noWaitHeap_(noWaitHeap),
-     quasiFileManager_(fnm)
-  {
-  associatedStatements_ = new(noWaitHeap_) HashQueue(noWaitHeap_);
-  pendingNoWaitOps_ = new(noWaitHeap_) Queue(noWaitHeap_);
-  }
-
-QuasiFile::~QuasiFile(void)
-  {
-  assert(pendingNoWaitOps_->isEmpty());
-
-  // cannot use 'delete pendingNoWaitOps_' since it is not an NABasicObject.
-  // Need to add a Queue::cleanup method that will deallocate all the local
-  // members of Queue. Call that first and then call deallocateMemory.  TBD.
-  noWaitHeap_->deallocateMemory((void *)pendingNoWaitOps_);
-  //  delete pendingNoWaitOps_;
-  
-  // iterate through all associated Statements, disassociating them
-  
-  associatedStatements_->position();
-  Statement * stmt = (Statement *)associatedStatements_->getNext();
-  while (stmt)
-    {
-    // Disassociate statement, but without removing it from the list
-    
-    // We do this to defer calling Queue::remove(). Calling it
-    // now would force us to do another Queue::position() call.
-    // Also, the Queue destructor already contains logic to
-    // remove queue entries, so just deleting the Queue will
-    // do the trick.
-    stmt->resetFileNumber();
-    stmt->resetNoWaitOpEnabled();
-       
-    stmt = (Statement *)associatedStatements_->getNext();
-    }
-  delete associatedStatements_;
-  }
-
-// Note: These methods assume the caller has already validated that
-// the operation is a valid thing to do.
-
-void QuasiFile::associateStatement(Statement * stmt)
-  {
-  // associate this statement with this file number
-  stmt->setFileNumber(fileNumber_);
-  associatedStatements_->insert((char*)&stmt, 
-				sizeof(char *), 
-				(void *)stmt);
-  // Set the nowait enabled state in the Statement object
-  // stmt->setNoWaitOpEnableStatus(TRUE);
-  }
-
-NABoolean QuasiFile::disassociateStatement(Statement * stmt)
-  {
-  // disassociate this statement with this file number
-  stmt->resetFileNumber();
-  stmt->resetNoWaitOpEnabled();
-  associatedStatements_->position((char*)&stmt,
-                                  sizeof(char *));
-  associatedStatements_->getNext();
-  associatedStatements_->remove((void *)stmt);
-  // nothing to delete because the statement remains
-  return associatedStatements_->isEmpty();
-  }
-
-void QuasiFile::disableNoWaitOps(void)
-  {
-  // disable no-wait operations (updating cached flags in Statement 
-  // objects too)
-  associatedStatements_->position();
-  Statement * stmt = (Statement *)associatedStatements_->getNext();
-  while (stmt)
-    {
-    stmt->resetNoWaitOpEnabled();
-    stmt = (Statement *)associatedStatements_->getNext();
-    }
-  }
-
-
-void QuasiFile::deleteNoWaitOps(Statement * stmt)
-  {
-  // delete no-wait operations associated with the current statement
-  // (this is done when Statement level methods are about to do a cancel)
-
-  // $$$ at the moment, the code deletes all no-wait ops; it probably should
-  // only delete no-wait fetches. It works, though, because at the moment,
-  // the only no-wait ops *are* fetches.
-  
-  pendingNoWaitOps_->position();
-  NoWaitOp * nwo = (NoWaitOp *)pendingNoWaitOps_->getNext();
-  while (nwo)
-    {
-    if (stmt == nwo->getStatement())
-      {
-      // this no-wait op is on the current statement
-      pendingNoWaitOps_->remove((void *)nwo); // remove it
-      pendingNoWaitOps_->position();          // position to beginning
-      delete nwo;  // destroy it
-      quasiFileManager_->notifyOfDeletedNoWaitOp();
-      }
-    nwo = (NoWaitOp *)pendingNoWaitOps_->getNext();      
-    }
-
-  // indicate no no-wait ops pending now
-  stmt->resetNoWaitOpPending();
-  }
-
-void QuasiFile::closeNoWaitOpsPending()
-  {
-  // remove any pending nowait objects and set the flag in the statement 
-  // object to indicate that the QFO file was closed while a nowait
-  // operation was incomplete
-
-  pendingNoWaitOps_->position();
-  NoWaitOp * noWaitOp = (NoWaitOp *)pendingNoWaitOps_->getNext();
-  while (noWaitOp)
-    {
-    noWaitOp->getStatement()->setNoWaitOpIncomplete(); // mark the statement
-    noWaitOp->getStatement()->resetNoWaitOpPending(); // mark the statement
-    pendingNoWaitOps_->remove((void *)noWaitOp); // remove it
-    pendingNoWaitOps_->position();               // position to beginning
-    delete noWaitOp;  // destroy it
-    quasiFileManager_->notifyOfDeletedNoWaitOp();
-    noWaitOp = (NoWaitOp *)pendingNoWaitOps_->getNext();     
-    }
-  }
-
-RETCODE QuasiFile::awaitIox(IpcEnvironment * ipcEnv,
-			    Lng32 * tag,
-			    short * feError)
-  {
-
-  RETCODE rc = NOT_FINISHED;  // assume nothing finished
-  
-  pendingNoWaitOps_->position();
-  NoWaitOp * noWaitOp = (NoWaitOp *)pendingNoWaitOps_->getNext();
-  
-  if (noWaitOp == NULL)
-    {
-    // This can happen if awaitiox is called with this filenum (user error),
-    // or filenum -1 (might be normal usage)
-    *feError = FENONEOUT;
-    }
-  else
-    {
-
-    //Future: Will mark statement dispatchable if a message "is done"
-    ipcEnv->getAllConnections()->waitOnAll(0);
-
-    // clean up the completed MasterEspMessages
-    ipcEnv->deleteCompletedMessages();
-
-    while (noWaitOp)
-      {
-      Lng32 numPendingBeforeRedrive =
-	quasiFileManager_->getPendingNowaitOps();
-      rc = noWaitOp->awaitIox(tag);
-      if (rc == NOT_FINISHED)
-        {
-        noWaitOp = (NoWaitOp *)pendingNoWaitOps_->getNext();
-        }
-      else // it completed
-        {       
-        // remove NoWaitOp object from our list and destroy it and
-	// decr the pending count, if the redrive hasn't done it all
-	if (!pendingNoWaitOps_->remove((void *)noWaitOp))
-	  {
-	  assert(quasiFileManager_->getPendingNowaitOps() ==
-	         numPendingBeforeRedrive - 1);
-	  }
-	else
-	  {
-	  delete noWaitOp;
-	  quasiFileManager_->notifyOfDeletedNoWaitOp();
-	  }
-
-        noWaitOp = NULL;  // to exit loop without further processing
-        }
-      }
-    }      
-
-  return rc;
-  }
-
-
-RETCODE QuasiFile::queueNoWaitOp(ComDiagsArea &diagsArea,
-				 Statement * stmt,
-				 Descriptor * inputDesc,
-				 Descriptor * outputDesc,
-				 NoWaitOp::opType op,
-				 NABoolean operationStarted,
-				 Lng32 tag )
-  {
-  RETCODE rc = SUCCESS; // assume we are successful
-  
-    // Create a NoWaitOp object to represent the incompleted operation
-    // and queue it
-    
-  NoWaitOp * nwo = new(noWaitHeap_)
-    NoWaitOp(stmt,
-    inputDesc,
-    outputDesc,
-    tag, 
-    op, 
-    operationStarted);
-
-  pendingNoWaitOps_->insert((void *)nwo);
-  quasiFileManager_->notifyOfNewNoWaitOp();
-  return rc;
-  }
-
-// Code that does SEGMENT_REVEAL_ appears in three places:
-//   switchToPriv() in cli/CliLayerForNsk.cpp
-//   QfoRevealSegs() in QuasiFileManager.cpp
-//   stopCatcher() in cli/CliLayerForNsk.cpp
-short QfoRevealSegs(CliGlobals *&cliGlobals)
-  {
-  cliGlobals = GetCliGlobals();
-  cliGlobals->incrNumOfCliCalls();
-  return 0;
-  }
-
-//Code that does SEGMENT_HIDE_ appears in two places
-//  switchToNonPriv() in cli/CliLayerForNsk.cpp
-//  QfoHideSegs() in cli/CliLayerForNsk.cpp
-short QfoHideSegs(CliGlobals *cliGlobals)
-  {
-
-  cliGlobals->decrNumOfCliCalls();
-
-  return 0;
-  }
-
-SQL_QFO_FUNCTION_ATTRIBUTES short Sql_Qfo_IOComp(short quasi_file_number /*in*/,
-				     Lng32 *tag /*out*/,
-				     unsigned short *waitmask /*out*/,
-				     short userstop /*in*/)
-  {
-  short retVal, feError = FEOK;
-  RETCODE retcode;
-  QuasiFileManager *quasiFileManager;
-  *waitmask = LDONE;
-  CliGlobals *cliGlobals;
-  if (QfoRevealSegs(cliGlobals) != 0)
-    return FEBADPARMVALUE;
-  jmp_buf jmpBuf;
-  short oldStop;
-  oldStop = SETSTOP(1);
-  cliGlobals->setJmpBufPtr(&jmpBuf);
-  Int32 jmpRc = setjmp(jmpBuf);
-  if (jmpRc)
-    {
-    QfoHideSegs(cliGlobals);
-    SETSTOP(oldStop);
-    return FEBADPARMVALUE; // longjmp not associated with statement
-    }
-  quasiFileManager = cliGlobals->getQuasiFileManager();
-  if (quasiFileManager->getPendingNowaitOps() > 0)
-    retcode = quasiFileManager->awaitIox(quasi_file_number, tag, &feError);
-  else
-    {
-    QfoHideSegs(cliGlobals);
-    SETSTOP(oldStop);
-    return FENONEOUT;
-    }
-  if (feError != FEOK)
-    retVal = feError; // May be FEBADPARMVALUE, or FENONEOUT
-  else
-    {
-    if (1) // Not used but is compiled on NT
-      retVal = FEQFOEVENTCONSUMED;
-    else
-      switch (retcode)
-      {
-      case SUCCESS:
-	retVal = FEOK;
-	break;
-      case ERROR:
-	retVal = FESQLERR;
-	break;
-      case SQL_EOF:
-      case WARNING:
-	retVal = FESQLWARN;
-	break;
-      case NOT_FINISHED:
-	retVal = FEQFONOTCOMPLETE;
-	break;
-      default:
-	retVal = FEBADPARMVALUE;
-      }
-    }
-  QfoHideSegs(cliGlobals);
-  SETSTOP(oldStop);
-  return retVal;
-  }
-
-
-SQL_QFO_FUNCTION_ATTRIBUTES short Sql_Qfo_Close(short quasi_file_number)
-  {
-  CliGlobals *cliGlobals;
-  if (QfoRevealSegs(cliGlobals) != 0)
-    return 0;
-  cliGlobals->setLogEmsEvents(FALSE);
-  jmp_buf jmpBuf;
-  cliGlobals->setJmpBufPtr(&jmpBuf);
-  Int32 jmpRc = setjmp(jmpBuf);
-  if (jmpRc)
-    {
-    cliGlobals->setLogEmsEvents(TRUE);
-    QfoHideSegs(cliGlobals);
-    return 0;
-    }
-  QuasiFileManager *quasiFileManager = cliGlobals->getQuasiFileManager();
-  quasiFileManager->closeQuasiFile(quasi_file_number);
-  cliGlobals->setLogEmsEvents(TRUE);
-  QfoHideSegs(cliGlobals);
-  return 0;
-  }
-

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/cli/QuasiFileManager.h
----------------------------------------------------------------------
diff --git a/core/sql/cli/QuasiFileManager.h b/core/sql/cli/QuasiFileManager.h
deleted file mode 100644
index b30f2ee..0000000
--- a/core/sql/cli/QuasiFileManager.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/**********************************************************************
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-**********************************************************************/
-#ifndef QUASIFILEMANAGER_H
-#define QUASIFILEMANAGER_H
-
-/* -*-C++-*-
-******************************************************************************
-*
-* File:         QuasiFile.h
-* Description:  This file contains definitions of the QuasiFileManager class
-*               and QuasiFile class. 
-*               
-* Created:      3/26/2002
-* Language:     C++
-*
-*
-*
-******************************************************************************
-*/
-#include "NoWaitOp.h"
-
-class Statement;
-class IpcEnvironment;
-class ComDiagsArea;
-class HashQueue;
-class NoWaitOp;
-class QuasiFile;
-class QuasiFileManager;
-
-// ------------------------------------------------------------------
-// Classes that keep state for no-wait SQL operations
-//
-// One QuasiFileManager object keeps track of all SQL pseudo-files
-// used by a process.
-//
-// One QuasiFile object exists for each SQL pseudo-file.
-//
-// One NoWaitOp object exists for each pending no-wait SQL operation.
-//
-// ------------------------------------------------------------------
-#ifdef EX_GOD_H    // compile the following only if ex_god.h also included
-#ifdef CLI_STDH_H  // compile the following only if CliDefs.h also included
-
-class QuasiFileManager : public NABasicObject 
-  {
-  public:
-
-    QuasiFileManager(NAHeap * noWaitHeap,IpcEnvironment * ipcEnv);
-    virtual ~QuasiFileManager(void);
-
-    RETCODE assocFileNumber(ComDiagsArea &diagsArea,short fileNumber,
-			    Statement * statement);
-    RETCODE disassocFileNumber(ComDiagsArea &diagsArea,
-			       Statement * statement,
-			       NABoolean force = FALSE);
-    RETCODE deleteNoWaitOps(ComDiagsArea &diagsArea,short fileNumber,
-			    Statement * statement);
-    RETCODE awaitIox(Lng32 fileNumber, Lng32 * tag, short * feError);
-
-    // returns QuasiFile object if one exists, 0 otherwise
-    QuasiFile * getQuasiFile(short fileNumber);
-
-    // get the QuasiFile if it exists, call QuasiFile::closeNoWaitOpsPending,
-    // removes the QuasiFile from quasiFileList_, and deletes the QuasiFile
-    void closeQuasiFile(short fileNumber);
-
-    // called whenever a new NoWaitOp object is created
-    void notifyOfNewNoWaitOp(void);
-
-    // called whenever a NowaitOp is destroyed
-    inline void notifyOfDeletedNoWaitOp(void)
-      { pendingNoWaitOperations_--; };
-    inline Lng32 getPendingNowaitOps() { return pendingNoWaitOperations_; }
-  
-  private:
-
-    Lng32 pendingNoWaitOperations_; // number of pending operations
-
-    // list of QuasiFile objects 
-    Queue * quasiFileList_; 
-
-    // Ipc environment
-    IpcEnvironment * ipcEnv_;
-
-    // heap used by no-wait SQL procedures
-    NAHeap * noWaitHeap_;
-
-  };
-
-// Where methods in the QuasiFile class do not raise errors, they assume
-// that the QuasiFileManager (their caller) has done all necessary
-// validation.
-
-class QuasiFile : public NABasicObject
-  {
-  public:
-
-    QuasiFile(NAHeap * noWaitHeap,short fileNumber,QuasiFileManager * fnm);
-    ~QuasiFile(void);
-
-    void associateStatement(Statement * stmt);
-    NABoolean disassociateStatement(Statement * stmt);
-    void disableNoWaitOps(void);
-    void deleteNoWaitOps(Statement * stmt);
-    void closeNoWaitOpsPending();
-
-    RETCODE awaitIox(IpcEnvironment * ipcEnv, Lng32 * tag, short * feError);
-
-    RETCODE queueNoWaitOp(ComDiagsArea &diagsArea,
-      Statement * stmt,
-      Descriptor * inputDesc,
-      Descriptor * outputDesc,
-      NoWaitOp::opType op,
-      NABoolean operationStarted,
-      Lng32 tag);
-
-    inline short getFileNumber() {return fileNumber_;};
-    inline NABoolean noWaitOpsPending(void)
-      { return !pendingNoWaitOps_->isEmpty(); } ;
-
-  private:
-
-    short fileNumber_;
-    NAHeap * noWaitHeap_;
-    QuasiFileManager * quasiFileManager_;
-
-    // a list of Statement objects associated with this QuasiFile
-    // in no particular order
-    HashQueue * associatedStatements_;
-    
-    // a list of NoWaitOp objects (representing pending no-wait
-    // operations), in order of initiation
-    Queue * pendingNoWaitOps_;
-
-  } ;
-
-#endif // CLI_STDH_H
-#endif // EX_GOD_H
-#endif /* QUASIFILEMANAGER_H */

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/cli/Statement.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Statement.cpp b/core/sql/cli/Statement.cpp
index 6d847f0..10be536 100644
--- a/core/sql/cli/Statement.cpp
+++ b/core/sql/cli/Statement.cpp
@@ -218,9 +218,6 @@ Statement::Statement(SQLSTMT_ID * statement_id_,
 {
   cliLevel_ = context_->getNumOfCliCalls();
 
-  space_.setJmpBuf(cliGlobals_->getJmpBuf());
-  heap_.setJmpBuf(cliGlobals_->getJmpBuf());
-
 #ifdef _DEBUG
   stmtDebug_ = FALSE;
   stmtListDebug_ = FALSE;

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/common/BaseTypes.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/BaseTypes.cpp b/core/sql/common/BaseTypes.cpp
index 2dfe75b..0b22550 100644
--- a/core/sql/common/BaseTypes.cpp
+++ b/core/sql/common/BaseTypes.cpp
@@ -47,9 +47,6 @@
 #endif
 
 #include <stdlib.h>		// exit(), in NAExit()
-//#include <setjmp.h>
-
-
 
 #include "seabed/fs.h"
 #include "seabed/ms.h"

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/common/NAMemory.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/NAMemory.cpp b/core/sql/common/NAMemory.cpp
index 8b50a2e..d96351a 100644
--- a/core/sql/common/NAMemory.cpp
+++ b/core/sql/common/NAMemory.cpp
@@ -868,7 +868,6 @@ NAMemory::NAMemory(const char * name)
     memoryList_(NULL),
     lastListEntry_(NULL),
     nextEntry_(NULL),
-    heapJumpBuf_(0),
     exhaustedMem_(FALSE),
     errorsMask_(0),
     crowdedTotalSize_(0ll)
@@ -920,7 +919,6 @@ NAMemory::NAMemory(const char * name, NAHeap * parent, size_t blockSize,
    memoryList_(NULL),
    lastListEntry_(NULL),
    nextEntry_(NULL),
-   heapJumpBuf_(0),
    exhaustedMem_(FALSE),
    errorsMask_(0),
     crowdedTotalSize_(0ll)
@@ -978,7 +976,6 @@ NAMemory::NAMemory(const char * name, NAMemoryType type, size_t blockSize,
     memoryList_(NULL),
     lastListEntry_(NULL),
     nextEntry_(NULL),
-    heapJumpBuf_(0),
     exhaustedMem_(FALSE),
     errorsMask_(0),
     crowdedTotalSize_(0ll)
@@ -1034,7 +1031,6 @@ NAMemory::NAMemory(const char * name,
     memoryList_(NULL),
     lastListEntry_(NULL),
     nextEntry_(NULL),
-    heapJumpBuf_(0),
     exhaustedMem_(FALSE),
     errorsMask_(0),
     crowdedTotalSize_(0ll)
@@ -2413,43 +2409,9 @@ void
 NAMemory::handleExhaustedMemory()
 {
   exhaustedMem_ = TRUE;
-  if (heapJumpBuf_)
-    {
-      ARKCMP_EXCEPTION_EPILOGUE("NAMemory");
-      longjmp(*heapJumpBuf_, MEMALLOC_FAILURE);
-    }
 }
 #endif // MUSE
 
-void
-NAMemory::logAllocateError(short error, SEG_ID segmentId, Lng32 blockSize, short errorDetail)
-{
-  char msg[128], msgErrorDetail[32];
-  if (error != 0 && error != 15)
-  {
-    unsigned short errorMask = 1 << error - 1;
-    if (!(errorsMask_ & errorMask))
-    {
-      errorsMask_ |= errorMask;
-      str_sprintf(msg, "SEGMENT_ALLOCATE_ for segment-id %u, segment-size %u returned error %u",
-                  segmentId, blockSize, error);
-      if (error == 1 || error == 2 || error == 3 || error == 14)
-      {
-        str_sprintf(msgErrorDetail, ", error-detail %u", errorDetail);
-        str_cat_c(msg, msgErrorDetail);
-      }
-      SQLMXLoggingArea::logExecRtInfo(__FILE__, __LINE__, msg, 0);
-    }
-  }
-}
-
-void NAMemory::setJmpBuf( jmp_buf *newJmpBuf )
-{ 
-  if (derivedClass_ == NAHEAP_CLASS)
-    assert(((NAHeap*)this)->getThreadSafe() == false);
-  heapJumpBuf_ = newJmpBuf;
-}
-
 
 NABoolean NAMemory::getUsage(size_t * lastBlockSize, size_t * freeSize, size_t * totalSize)
 {
@@ -2769,7 +2731,6 @@ NAHeap::~NAHeap()
 
 void NAHeap::setThreadSafe()
 {
-  assert(((NAMemory*)this)->getJmpBuf() == NULL);
   int rc;
   pthread_mutexattr_t attr;
   rc = pthread_mutexattr_init(&attr);
@@ -3163,11 +3124,7 @@ void * NAHeap::allocateHeapMemory(size_t userSize, NABoolean failureIsFatal)
         (*errCallback_)(this, userSize);
 
       if (failureIsFatal) {
-        // Might never return...
         handleExhaustedMemory();
-        // If we return from this call it means that the caller wanted
-        // a memory allocation failure to be fatal yet did not set the
-        // the jump buffer.  This is not good.
         abort();
       }
 
@@ -4103,7 +4060,6 @@ void * DefaultIpcHeap::allocateIpcHeapMemory(size_t size, NABoolean failureIsFat
   if (rc) return rc;
   if (failureIsFatal) 
     {
-      // Might never return...
       handleExhaustedMemory();
       abort();
     }

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/common/NAMemory.h
----------------------------------------------------------------------
diff --git a/core/sql/common/NAMemory.h b/core/sql/common/NAMemory.h
index a58461f..78ad279 100644
--- a/core/sql/common/NAMemory.h
+++ b/core/sql/common/NAMemory.h
@@ -52,7 +52,6 @@
 #include "Platform.h"
 #include "NAStringDefGlobals.h"
 #include <stddef.h>
-#include <setjmp.h>
 
 #include "NAError.h"
 #include "HeapID.h"
@@ -339,19 +338,10 @@ public:
   // It is used to deallocate the above arrays.
   void deallocateMemory(void * addr);
 
-  // this method is used to set the upper limit - currently only used for testing
-  // setjmp and longjmp
   void setUpperLimit ( size_t newUpperLimit ) { upperLimit_ = newUpperLimit; };
   
-  // these four methods used to reside in class CollHeap 
-  void setJmpBuf( jmp_buf *newJmpBuf );
-
-  inline jmp_buf * getJmpBuf()                { return heapJumpBuf_; }
-
   inline NABoolean getWasMemoryExhausted()    { return exhaustedMem_; }
 
-  void logAllocateError(short error, SEG_ID segmentId, Lng32 blockSize, short errorDetail);
-
   void handleExhaustedMemory();
 
 #if (defined(_DEBUG) || defined(NSK_MEMDEBUG))
@@ -473,7 +463,6 @@ private:
 
   // these data members used to be in class CollHeap
 protected:
-  jmp_buf *heapJumpBuf_;      // Setjmp() buffer for handing memory failures
   NABoolean exhaustedMem_;    // Set to true if cannot satisfy memory request
   unsigned short errorsMask_; // SEGMENT_ALLOCATE_ errors that have occurred
   HeapID heapID_;             // For tracking leaks.  (eric)

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/executor/ExSimpleSqlBuffer.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExSimpleSqlBuffer.cpp b/core/sql/executor/ExSimpleSqlBuffer.cpp
index d62e781..1405586 100644
--- a/core/sql/executor/ExSimpleSqlBuffer.cpp
+++ b/core/sql/executor/ExSimpleSqlBuffer.cpp
@@ -214,9 +214,6 @@ ExSimpleSQLBuffer::init(CollHeap *heap)
 #endif
     }
 
-  // If we could not get enough memory for at least one tuple, let the
-  // memory manager do a longjmp by requesting the original number of 
-  // tuples to be allocated while passing true for failureIsFatal.
   if (!data_)
     {
       nBytes = tuplesRequested * allocationSize_;

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/executor/ex_ex.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_ex.cpp b/core/sql/executor/ex_ex.cpp
index da1a411..8e5b7a1 100644
--- a/core/sql/executor/ex_ex.cpp
+++ b/core/sql/executor/ex_ex.cpp
@@ -646,11 +646,3 @@ NABoolean ExExprComputeSpace(ex_tcb * tcb)
 {
   return tcb->getGlobals()->computeSpace();
 }
-
-void ex_log_ems( const char *f, Int32 l, const char * m)
-{
-}
-void assert_botch_longjmp( const char *f, Int32 l, const char * m)
-{
-
-}

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/executor/ex_ex.h
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_ex.h b/core/sql/executor/ex_ex.h
index 421cb3c..75ba99f 100644
--- a/core/sql/executor/ex_ex.h
+++ b/core/sql/executor/ex_ex.h
@@ -38,20 +38,13 @@
  */
 
 // -----------------------------------------------------------------------
-#include <setjmp.h>
 #include "Platform.h"
 
-extern jmp_buf ExeBuf;
-
 //typedef	int		(*funcptr) (void *);
 typedef	Int32	funcptr;    // for now
 
 #define logInternalError(r) ((short)r)
 
-void ex_log_ems( const char *f, Int32 l, const char * m);
-
-void assert_botch_longjmp( const char *f, int l, const char * m);
-
 #define ex_assert(p, msg) if (!(p)) { assert_botch_abend( __FILE__ , __LINE__ , msg); };
 
 class	ex_expr;	// to be defined

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/executor/ex_globals.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_globals.cpp b/core/sql/executor/ex_globals.cpp
index 0c81fdc..b3c8ba3 100644
--- a/core/sql/executor/ex_globals.cpp
+++ b/core/sql/executor/ex_globals.cpp
@@ -61,7 +61,6 @@ ex_globals::ex_globals(short num_temps,
        injectErrorAtQueueFreq_(0),
        flags_(0),
        planVersion_(0),
-       jmpInScope_(FALSE),
        sharedPool_(NULL),
        rowNum_(1),
        exLobGlobals_(NULL)

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/executor/ex_globals.h
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_globals.h b/core/sql/executor/ex_globals.h
index eeed8df..8ec9d76 100644
--- a/core/sql/executor/ex_globals.h
+++ b/core/sql/executor/ex_globals.h
@@ -38,8 +38,6 @@
 ******************************************************************************
 */
 
-#include <setjmp.h>
-
 #include "Platform.h"
 #include "ExCollections.h"
 #include "Int64.h"
@@ -114,10 +112,6 @@ public:
   ExStatisticsArea* getOrigStatsArea() 
   { return statsArea_; }
 
-  inline jmp_buf *getJmpBuf()             { return &longJmpTgt_; }
-  inline void setJmpInScope(NABoolean jmpInScope)
-    { jmpInScope_ = jmpInScope; }
-  inline NABoolean IsJmpInScope() { return jmpInScope_; }
 
   inline void setEventConsumed(UInt32 *eventConsumed)
     { eventConsumedAddr_ = eventConsumed; }
@@ -235,10 +229,6 @@ private:
   // pointer to the statsArea (if statistics are collected)
   ExStatisticsArea * statsArea_;
 
-  // for handling tcb-build-time errors, and memory alloc errors.
-  jmp_buf  longJmpTgt_;
-  NABoolean jmpInScope_;
-
   // for cleanup.
   LIST(ex_tcb *) tcbList_;
 

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/executor/ex_mj.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_mj.cpp b/core/sql/executor/ex_mj.cpp
index e00b769..05e8227 100644
--- a/core/sql/executor/ex_mj.cpp
+++ b/core/sql/executor/ex_mj.cpp
@@ -441,8 +441,7 @@ bool ex_mj_tcb::reacquireResources(void)
     {
 
       
-      tspace_->reacquireResources();  // failure will invoke longjmp handler
-
+      tspace_->reacquireResources();  
 
       if (mjTdb().getLogDiagnostics())
         {

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/executor/ex_root.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_root.cpp b/core/sql/executor/ex_root.cpp
index e8b264f..3b3a4d0 100644
--- a/core/sql/executor/ex_root.cpp
+++ b/core/sql/executor/ex_root.cpp
@@ -66,10 +66,6 @@
 #include "ExSMGlobals.h"
 #include "ExSMCommon.h"
 #include "ExpHbaseInterface.h"
-// this contains the location where a longjmp is done after
-// an assertion failure in executor. See file ex_ex.h.
-jmp_buf ExeBuf;
-
 
 ////////////////////////////////////////////////////////////////////////
 //  TDB procedures
@@ -97,19 +93,9 @@ ex_tcb * ex_root_tdb::build(CliGlobals *cliGlobals, ex_globals * glob)
     }
   }
 
-  Int32 jmpRc;
-
-  
   // set this plan version in the statement globals.
   glob->setPlanVersion(planVersion_);
 
-  jmp_buf *jmpBufPtr;
-  if (setjmp(ExeBuf))
-    {
-      // an error may be stored in the global diags area
-      return NULL;
-    }
-
   // set the fragment directory in glob. This will be passed
   // to the build of all tdb's and used by them, if needed.
   master_glob->setFragDir(fragDir_);
@@ -165,22 +151,6 @@ ex_tcb * ex_root_tdb::build(CliGlobals *cliGlobals, ex_globals * glob)
     return NULL;
   }
 
-  exe_glob->getSpace()->setJmpBuf(exe_glob->getJmpBuf());
-  // TBD -- do the same (as above) for master_glob->getDefaultHeap ????
-
-//#ifndef NA_YOS
-   jmpBufPtr = exe_glob->getJmpBuf();
-   jmpRc =  setjmp(*jmpBufPtr);
-//#endif // NA_YOS
-
-  if (jmpRc)
-    {
-      exe_glob->cleanupTcbs();
-      if (exe_glob->getSpace()->getWasMemoryExhausted())
-        exe_glob->makeMemoryCondition(-EXE_NO_MEM_TO_BUILD); 
-      return NULL;
-    }
-
   if (getQueryUsesSM() && cliGlobals->getEnvironment()->smEnabled())
   {
     // Assign a SeaMonster ID to the query
@@ -673,43 +643,8 @@ Int32 ex_root_tcb::execute(CliGlobals *cliGlobals,
 {
   Int32 jmpRc = 0;
 
-  // This setjmp is for assertion failure.  It won't work when the 
-  // executor is multi-threaded.
-  jmpRc = setjmp(ExeBuf);
-  if (jmpRc)
-   {
-      fatalError_ = TRUE;
-      if (jmpRc == MEMALLOC_FAILURE)
-      {
-         if (diagsArea == NULL)
-            diagsArea = ComDiagsArea::allocate(getHeap());
-         *diagsArea << DgSqlCode(-EXE_NO_MEM_TO_EXEC);
-         return -EXE_NO_MEM_TO_EXEC; 
-      }
-      else
-         return -1;
-    }
 
   ExMasterStmtGlobals *master_glob = glob->castToExMasterStmtGlobals();
-  master_glob->getSpace()->setJmpBuf(master_glob->getJmpBuf());
-
-//#ifndef NA_YOS
-  jmpRc =  setjmp(*master_glob->getJmpBuf());
-//#endif // NA_YOS
-  if (jmpRc)
-    {
-      fatalError_ = TRUE;
-      if (master_glob->getSpace()->getWasMemoryExhausted())
-      {
-        glob->makeMemoryCondition(-EXE_NO_MEM_TO_EXEC);
-        if (diagsArea == NULL) 
-           diagsArea = ComDiagsArea::allocate(getHeap());
-        *diagsArea << DgSqlCode(-EXE_NO_MEM_TO_EXEC);
-        return -EXE_NO_MEM_TO_EXEC; 
-      }
-      else
-         return -1;
-    }
 
   if (fatalError_)
     {
@@ -1126,19 +1061,6 @@ Int32 ex_root_tcb::fetch(CliGlobals *cliGlobals,
   // processing once the queue becomes empty.
   //
 
-  // Much of the "catastropic error" handling code (especially the 
-  // code that tries to handle longjmps) assumes that the diagsArea 
-  // passed in is NULL.  As of now, all of the Statement's calls 
-  // to this method do send in NULL, but if this ever changes, a 
-  // memory leak will result.  Hence the assertion:
-  // The assertion was removed by Gil Siegel because:
-  // a) fetchMultiple can call with a diagsArea if a warning  occurred
-  // b) longjmp is no longer done in the master executor or mxesp so a leak
-  //    is no longer a possibility
-
-//  ex_assert( diagsArea == NULL, 
-//    "Non-null diagsArea sent to ex_root_tcb::fetch can cause memory leaks.");
-
   // For the GET_NEXT_N protocol, we should only return when a Q_GET_DONE is
   //  received.  In addition, due to the incomplete implementation of the 
   //  GET_NEXT_N protocol, it is possible to receive a Q_GET_DONE without
@@ -1151,50 +1073,8 @@ Int32 ex_root_tcb::fetch(CliGlobals *cliGlobals,
   NABoolean nextIsQNoData         = FALSE;
   if (newOperation)
     time_of_fetch_call_usec_      = NA_JulianTimestamp();
-  Int32 jmpRc = 0;
-
-  // enable executor exception handling
-  // (ExeBuf should be moved to executor globals, except that would 
-  // mean that globals would need to be available to any code that
-  // does an assertion.) $$$$
-  // This is for assertion failure.  It might not work when the executor
-  // is multi-threaded.
-  jmpRc = setjmp(ExeBuf);
-  if (jmpRc)
-    {
-      fatalError_ = TRUE;
-      if (jmpRc == MEMALLOC_FAILURE)
-      {
-         if (diagsArea == NULL)
-            diagsArea = ComDiagsArea::allocate(getHeap());
-         *diagsArea << DgSqlCode(-EXE_NO_MEM_TO_EXEC);
-         return -EXE_NO_MEM_TO_EXEC; 
-      }
-      else
-      return -1;
-    }
 
   ExMasterStmtGlobals *master_glob = glob->castToExMasterStmtGlobals();
-  master_glob->getSpace()->setJmpBuf(master_glob->getJmpBuf());
- 
-//#ifndef NA_YOS 
-  jmpRc =  setjmp(*master_glob->getJmpBuf());
-//#endif // NA_YOS
-
-  if (jmpRc)
-    {
-      fatalError_ = TRUE;
-      if (master_glob->getSpace()->getWasMemoryExhausted())
-      {
-         glob->makeMemoryCondition(-EXE_NO_MEM_TO_EXEC);
-         if (diagsArea == NULL) 
-            diagsArea = ComDiagsArea::allocate(getHeap());
-         *diagsArea << DgSqlCode(-EXE_NO_MEM_TO_EXEC);
-         return -EXE_NO_MEM_TO_EXEC; 
-      }
-      else
-         return -1;
-    }
 
   // start off by calling the scheduler (again)
   ExWorkProcRetcode schedRetcode = WORK_CALL_AGAIN;
@@ -2009,8 +1889,6 @@ Int32 ex_root_tcb::oltExecute(ExExeStmtGlobals * glob,
 			    Descriptor * output_desc,
 			    ComDiagsArea*& diagsArea)
 {
-  // $$TBD: put in code to do setjmp's
-
   ExMasterStmtGlobals *master_glob = getGlobals()->
 	            castToExExeStmtGlobals()->castToExMasterStmtGlobals(); 
 

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/executor/ex_sort.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_sort.cpp b/core/sql/executor/ex_sort.cpp
index d7358d4..cbc8935 100644
--- a/core/sql/executor/ex_sort.cpp
+++ b/core/sql/executor/ex_sort.cpp
@@ -749,14 +749,6 @@ short ExSortTcb::workUp()
   ExSortPrivateState &pstate = *((ExSortPrivateState*) pentry_down->pstate);
   ex_queue::down_request request = pentry_down->downState.request;
 
-  //A jump handler is introduced here as safty measure to handle any
-  //memory allocation failures(from sortHeap_). If NAHeap fails
-  //to allocate memory, it calls handleExhaustedMemory that performs
-  //a longjmp to this location. Basically pstate is set to error
-  //and cleanup is performed. This feature is only enabled in calls
-  //to allocateMemory by setting the failureIsFatal flag which is 
-  //always set by default.
-   
   //while there are requests in the parent down queue, process them
   while (qparent_.down->getHeadIndex() != processedInputs_)
     {
@@ -1944,14 +1936,6 @@ short ExSortFromTopTcb::work()
   
   ex_queue_entry *pentry_down = qparent_.down->getHeadEntry();
 
-  //A jump handler is introduced here as safty measure to handle any
-  //memory allocation failures(from sortHeap_). If NAHeap fails
-  //to allocate memory, it calls handleExhaustedMemory that performs
-  //a longjmp to this location. Basically pstate is set to error
-  //and cleanup is performed. This feature is only enabled in calls
-  //to allocateMemory by setting the failureIsFatal flag which is 
-  //always set by default.
-
   if (pentry_down->downState.request == ex_queue::GET_NOMORE)
     {
       // cancel request

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/optimizer/BindItemExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/BindItemExpr.cpp b/core/sql/optimizer/BindItemExpr.cpp
index dcd6897..a4f296b 100644
--- a/core/sql/optimizer/BindItemExpr.cpp
+++ b/core/sql/optimizer/BindItemExpr.cpp
@@ -9496,7 +9496,6 @@ ItemExpr *UDFunction::bindNode(BindWA *bindWA)
       // track the size of this object.  Otherwise we might use the context heap.
       const Lng32 size = 16 * 1024;  // The initial size
       routineHeap = new CTXTHEAP NAHeap("NARoutine Heap", (NAHeap *)CTXTHEAP, size);
-      routineHeap->setJmpBuf(CmpInternalErrorJmpBufPtr);
     }
     // If not caching, put NARoutine on statement heap.
     else routineHeap=CmpCommon::statementHeap(); 

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/optimizer/BindRelExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/BindRelExpr.cpp b/core/sql/optimizer/BindRelExpr.cpp
index 527c029..53abc71 100644
--- a/core/sql/optimizer/BindRelExpr.cpp
+++ b/core/sql/optimizer/BindRelExpr.cpp
@@ -1354,7 +1354,6 @@ NARoutine *BindWA::getNARoutine ( const QualifiedName &name )
        const Lng32 size = 16 * 1024;  // The initial size
        routineHeap = new CTXTHEAP NAHeap("NARoutine Heap", (NAHeap *)CTXTHEAP, 
                                          size);
-       routineHeap->setJmpBuf(CmpInternalErrorJmpBufPtr);
      }
      else 
        routineHeap=CmpCommon::statementHeap(); 

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/sort/Qsort.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sort/Qsort.cpp b/core/sql/sort/Qsort.cpp
index a98dd14..d35cd7c 100644
--- a/core/sql/sort/Qsort.cpp
+++ b/core/sql/sort/Qsort.cpp
@@ -83,7 +83,6 @@ Qsort::Qsort(ULng32 runsize, ULng32 sortmaxmem, ULng32  recsize,
   rootRecord_ = (Record *)heap_->allocateMemory(sizeof(Record) * allocRunSize_);  
   recKeys_    = (RecKeyBuffer *)heap_->allocateMemory(sizeof(RecKeyBuffer) * allocRunSize_);  
  
-  // Below asserts useful in debug mode. Also asserts if longjmp did not happen.
   ex_assert(rootRecord_!= NULL, "Sort: Initial rootRecord_ allocation failed"); 
   ex_assert(recKeys_  != NULL, "Sort: Initial recKeys_ allocation failed");  
 

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/sort/Record.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sort/Record.cpp b/core/sql/sort/Record.cpp
index cf4bf07..7d3e1a9 100644
--- a/core/sql/sort/Record.cpp
+++ b/core/sql/sort/Record.cpp
@@ -48,7 +48,6 @@ Record::Record(ULng32 size, NABoolean doNotallocRec, CollHeap* heap)
     allocatedRec_ = FALSE_L;  
   }
   else{
-    //Allocation failure will cause longjmp to jmp handler in ex_sort.
     rec_  = new (heap_) char[recSize_+1];
     ex_assert(rec_ != NULL, "Record::Record: rec_ is NULL");
     allocatedRec_ = TRUE_L;
@@ -93,7 +92,6 @@ void Record::initialize(ULng32 recsize, NABoolean doNotallocRec,
     allocatedRec_ = FALSE_L; 
  }
  else {
-    //Allocation failure will cause longjmp to jmp handler in ex_sort.
     rec_  = new (heap_) char[recsize+1];
     ex_assert(rec_ != NULL, "Record::initialize: rec_ is NULL");
     allocatedRec_ = TRUE_L;

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/sort/TourTree.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sort/TourTree.cpp b/core/sql/sort/TourTree.cpp
index 9b523d4..071da8d 100644
--- a/core/sql/sort/TourTree.cpp
+++ b/core/sql/sort/TourTree.cpp
@@ -85,7 +85,6 @@ Tree::Tree(ULng32 numruns, ULng32 runsize, ULng32 recsize,
       assert(scratch_ != NULL);
     }
 
-   //Allocation failure will cause longjmp to jmp handler in ex_sort.
    rootNode_ = (TreeNode*)heap_->allocateMemory(numRuns_ * sizeof(TreeNode));
    rootRecord_ = (Record*)heap_->allocateMemory(numRuns_ * sizeof(Record));
    keyOfLastWinner_ = (char*)heap_->allocateMemory(sizeof(char) * keysize);

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/sqlcomp/QCache.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/QCache.cpp b/core/sql/sqlcomp/QCache.cpp
index cf958cd..81c9869 100644
--- a/core/sql/sqlcomp/QCache.cpp
+++ b/core/sql/sqlcomp/QCache.cpp
@@ -1912,7 +1912,6 @@ QCache::QCache(QueryCache & qc, ULng32 maxSize, ULng32 maxVictims, ULng32 avgPla
   nOfCacheHits_[A_PREPARSE] =
   nOfCacheHits_[A_PARSE] =
   nOfCacheHits_[A_BIND] = 0;  
-  heap_->setJmpBuf(CmpInternalErrorJmpBufPtr);
   heap_->setErrorCallback(&CmpErrLog::CmpErrLogCallback);
 
 #ifdef DBG_QCACHE

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/sqlcomp/parser.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/parser.cpp b/core/sql/sqlcomp/parser.cpp
index 1c84c84..0112901 100644
--- a/core/sql/sqlcomp/parser.cpp
+++ b/core/sql/sqlcomp/parser.cpp
@@ -132,7 +132,6 @@ Parser::Parser(const CmpContext* cmpContext)
                         NAMemory::DERIVED_FROM_SYS_HEAP,
                         524288,
                         memLimit);
-    wHeap_->setJmpBuf(CmpInternalErrorJmpBufPtr);
     wHeap_->setErrorCallback(&CmpErrLog::CmpErrLogCallback);
   }
 

http://git-wip-us.apache.org/repos/asf/trafodion/blob/6b6cbf93/core/sql/udrserv/udrserv.cpp
----------------------------------------------------------------------
diff --git a/core/sql/udrserv/udrserv.cpp b/core/sql/udrserv/udrserv.cpp
index a118b1c..7dcb30c 100644
--- a/core/sql/udrserv/udrserv.cpp
+++ b/core/sql/udrserv/udrserv.cpp
@@ -425,11 +425,6 @@ static void runServer(Int32 argc, char **argv)
                                256 * 1024 // 256K block size
                                );
 
-  udrHeap->setJmpBuf(&UdrHeapLongJmpTgt);
-  Int32 udrJmpRc = setjmp(UdrHeapLongJmpTgt);
-  if (udrJmpRc)
-     UDR_ABORT("udrHeap allocation failed.");
-
   NAHeap *ipcHeap = new NAHeap("UDR IPC Heap",
                                NAMemory::DERIVED_FROM_SYS_HEAP,
                                256 * 1024 // 256K block size
@@ -440,11 +435,6 @@ static void runServer(Int32 argc, char **argv)
     HeapLogRoot::control(LOG_START);
 #endif
 
-  ipcHeap->setJmpBuf(&IpcHeapLongJmpTgt);
-  Int32 ipcJmpRc = setjmp(IpcHeapLongJmpTgt);
-  if (ipcJmpRc)
-     UDR_ABORT("ipcHeap allocation failed.");
-
   UDR_GLOBALS = new (udrHeap) UdrGlobals(udrHeap, ipcHeap);
 
   // Move environment settings into the global LmJavaOptions object


[2/2] trafodion git commit: Merge PR 1376 [TRAFODION-2888] Streamline setjmp/longjmp concepts in Trafodion

Posted by se...@apache.org.
Merge PR 1376 [TRAFODION-2888] Streamline setjmp/longjmp concepts in Trafodion


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

Branch: refs/heads/master
Commit: 7814a0a0d6646b73e9540a6a2d45e45d7ac1d573
Parents: 85690de 6b6cbf9
Author: selvaganesang <se...@apache.org>
Authored: Mon Jan 8 21:54:24 2018 +0000
Committer: selvaganesang <se...@apache.org>
Committed: Mon Jan 8 21:54:24 2018 +0000

----------------------------------------------------------------------
 core/sql/arkcmp/CmpContext.cpp          |   5 -
 core/sql/arkcmp/CmpStatement.cpp        |   2 -
 core/sql/bin/ex_sscp_main.cpp           |   4 -
 core/sql/bin/ex_ssmp_main.cpp           |   4 -
 core/sql/cli/Cli.cpp                    |   4 -
 core/sql/cli/Context.cpp                |   1 -
 core/sql/cli/Globals.h                  |  10 +-
 core/sql/cli/NoWaitOp.cpp               | 264 ------------
 core/sql/cli/NoWaitOp.h                 |  89 -----
 core/sql/cli/QuasiFileManager.cpp       | 577 ---------------------------
 core/sql/cli/QuasiFileManager.h         | 159 --------
 core/sql/cli/Statement.cpp              |   3 -
 core/sql/common/BaseTypes.cpp           |   3 -
 core/sql/common/NAMemory.cpp            |  44 --
 core/sql/common/NAMemory.h              |  11 -
 core/sql/executor/ExSimpleSqlBuffer.cpp |   3 -
 core/sql/executor/ex_ex.cpp             |   8 -
 core/sql/executor/ex_ex.h               |   7 -
 core/sql/executor/ex_globals.cpp        |   1 -
 core/sql/executor/ex_globals.h          |  10 -
 core/sql/executor/ex_mj.cpp             |   3 +-
 core/sql/executor/ex_root.cpp           | 122 ------
 core/sql/executor/ex_sort.cpp           |  16 -
 core/sql/optimizer/BindItemExpr.cpp     |   1 -
 core/sql/optimizer/BindRelExpr.cpp      |   1 -
 core/sql/sort/Qsort.cpp                 |   1 -
 core/sql/sort/Record.cpp                |   2 -
 core/sql/sort/TourTree.cpp              |   1 -
 core/sql/sqlcomp/QCache.cpp             |   1 -
 core/sql/sqlcomp/parser.cpp             |   1 -
 core/sql/udrserv/udrserv.cpp            |  10 -
 31 files changed, 3 insertions(+), 1365 deletions(-)
----------------------------------------------------------------------