trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject [3/7] trafodion git commit: [TRAFODION-3009] Streamline error handling in Executor utility commands
Date Fri, 06 Apr 2018 16:07:33 GMT
[TRAFODION-3009] Streamline error handling in Executor utility commands

Removed the need to allocate ComDiagsArea in advance for load command
by refactoring the ExeCliInterface::executeImmediate and
ExeCliInterface::executeImmediateExec methods.

Changes as per the review comments are also made in this commit


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

Branch: refs/heads/master
Commit: 37702da34e3c7f00735aaad0640d8f705caf19c8
Parents: 1f44166
Author: selvaganesang <selva.govindarajan@esgyn.com>
Authored: Thu Apr 5 05:43:35 2018 +0000
Committer: selvaganesang <selva.govindarajan@esgyn.com>
Committed: Thu Apr 5 05:43:35 2018 +0000

----------------------------------------------------------------------
 core/sql/bin/SqlciErrors.txt             |   2 +-
 core/sql/cli/Cli.cpp                     |   3 +-
 core/sql/cli/Context.cpp                 |   3 +-
 core/sql/executor/ExExeUtilCli.cpp       | 144 +++++++++++------------
 core/sql/executor/ExExeUtilCli.h         |   9 +-
 core/sql/executor/ExExeUtilCommon.cpp    |  33 +++---
 core/sql/executor/ExExeUtilExplain.cpp   |  28 ++---
 core/sql/executor/ExExeUtilGet.cpp       |  67 ++++-------
 core/sql/executor/ExExeUtilGetStats.cpp  |   6 +-
 core/sql/executor/ExExeUtilLoad.cpp      | 160 +++++++++-----------------
 core/sql/executor/ExExeUtilMisc.cpp      |  86 ++++++--------
 core/sql/executor/ExExeUtilVolTab.cpp    |   8 +-
 core/sql/executor/ExHdfsScan.cpp         |  14 ++-
 core/sql/executor/ExHdfsScan.h           |   1 +
 core/sql/sqlcomp/CmpDescribe.cpp         |   4 +-
 core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp |   3 +-
 core/sql/sqlcomp/CmpSeabaseDDLschema.cpp |  12 +-
 17 files changed, 254 insertions(+), 329 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/37702da3/core/sql/bin/SqlciErrors.txt
----------------------------------------------------------------------
diff --git a/core/sql/bin/SqlciErrors.txt b/core/sql/bin/SqlciErrors.txt
index e66e170..ceb95ea 100644
--- a/core/sql/bin/SqlciErrors.txt
+++ b/core/sql/bin/SqlciErrors.txt
@@ -2,7 +2,7 @@
 1000 42000 99999 BEGINNER INFRM LOGONLY A syntax error occurred.
 1001 ZZZZZ 99999 ADVANCED CRTCL DIALOUT An internal error occurred in module $0~String0 on line $1~Int0. Details($2~String1).
 1002 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Catalog $0~CatalogName does not exist.
-1003 ZZZZZ 99999 BEGINNER MINOR DBADMIN Schema $0~SchemaName does not exist.
+1003 ZZZZZ 99999 BEGINNER MINOR DBADMIN Schema $0~String0.$1~String1 does not exist.
 1004 ZZZZZ 99999 BEGINNER MINOR DBADMIN Object $0~TableName does not exist or object type is invalid for the current operation.
 1005 ZZZZZ 99999 BEGINNER MINOR DBADMIN Constraint $0~ConstraintName does not exist.
 1006 ZZZZZ 99999 BEGINNER MINOR DBADMIN Skipping authorization ID $0~Int0.

http://git-wip-us.apache.org/repos/asf/trafodion/blob/37702da3/core/sql/cli/Cli.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Cli.cpp b/core/sql/cli/Cli.cpp
index a6b5341..4a83a14 100644
--- a/core/sql/cli/Cli.cpp
+++ b/core/sql/cli/Cli.cpp
@@ -2375,9 +2375,10 @@ Lng32 SQLCLI_ProcessRetryQuery(
 				      SQLCHARSETCODE_UTF8,
 				      currContext,
 				      NULL);   
+                    ComDiagsArea *tmpDiagsArea = &diags;
 		  retcode =  cliInterface->
 		    executeImmediate( (char *) "SELECT TESTEXIT;", 
-				      NULL, NULL, TRUE, NULL, 0,&diags);
+				      NULL, NULL, TRUE, NULL, 0, &tmpDiagsArea);
 		  //ignore errors from this call.
 		  	    
 		}

http://git-wip-us.apache.org/repos/asf/trafodion/blob/37702da3/core/sql/cli/Context.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Context.cpp b/core/sql/cli/Context.cpp
index bfb043f..09f1783 100644
--- a/core/sql/cli/Context.cpp
+++ b/core/sql/cli/Context.cpp
@@ -1604,7 +1604,8 @@ void ContextCli::completeSetAuthID(
       ExeCliInterface *cliInterface = new (exHeap()) ExeCliInterface(exHeap(),
                                                                      SQLCHARSETCODE_UTF8
                                                                      ,this,NULL);   
-      cliInterface->executeImmediate((char *) "control query default * reset;", NULL, NULL, TRUE, NULL, 0,&diagsArea_);
+      ComDiagsArea *tmpDiagsArea = &diagsArea_;
+      cliInterface->executeImmediate((char *) "control query default * reset;", NULL, NULL, TRUE, NULL, 0, &tmpDiagsArea); 
    }
   
    if ((userID != databaseUserID_) ||

http://git-wip-us.apache.org/repos/asf/trafodion/blob/37702da3/core/sql/executor/ExExeUtilCli.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilCli.cpp b/core/sql/executor/ExExeUtilCli.cpp
index dc9c4e2..aa1553b 100644
--- a/core/sql/executor/ExExeUtilCli.cpp
+++ b/core/sql/executor/ExExeUtilCli.cpp
@@ -105,7 +105,6 @@ ExeCliInterface::ExeCliInterface(CollHeap * heap, Int32 isoMapping,
        input_desc_(NULL),
        output_desc_(NULL),
        rs_input_maxsize_desc_(NULL),
-       diagsArea_(NULL),
        outputBuf_(NULL),
        inputBuf_(NULL),
        currContext_(currContext),
@@ -993,22 +992,23 @@ Lng32 ExeCliInterface::executeImmediateExec(const char * stmtStr,
 					   Lng32 * outputBufLen,
 					   NABoolean nullTerminate,
 					   Int64 * rowsAffected,
-                                           ComDiagsArea *diagsArea)
+                                           ComDiagsArea **diagsArea)
 {
   Lng32 retcode = 0;
+  Lng32 diagsCount = 0;
 
   retcode = exec();
   if (retcode < 0)
     {
       deallocStuff(module_, stmt_, sql_src_, input_desc_, output_desc_);
-      return retcode;
+      goto ExecReturn;
     }
 
   retcode = fetch();
   if (retcode < 0)
     {
       deallocStuff(module_, stmt_, sql_src_, input_desc_, output_desc_);
-      return retcode;
+      goto ExecReturn;
     }
 
   if ((outputBuf) &&
@@ -1028,55 +1028,76 @@ Lng32 ExeCliInterface::executeImmediateExec(const char * stmtStr,
 	}
     }
 
-  Lng32 cliRetcode = -1;
+  Lng32 rc;
   if (retcode >= 0)
   {
-    cliRetcode = retcode;
     if (rowsAffected)
     {
       Int64 tmpRowsAffected = 0;
-      retcode = SQL_EXEC_GetDiagnosticsStmtInfo2(NULL, SQLDIAG_ROW_COUNT,
+      rc = SQL_EXEC_GetDiagnosticsStmtInfo2(NULL, SQLDIAG_ROW_COUNT,
         &tmpRowsAffected, NULL,
         0, NULL);
 
-      if(retcode == EXE_NUMERIC_OVERFLOW) 
+      if (rc == EXE_NUMERIC_OVERFLOW) 
       {
         GetRowsAffected(rowsAffected);
       }
       else
         *rowsAffected = tmpRowsAffected;
     }
+    rc = SQL_EXEC_GetDiagnosticsStmtInfo2(NULL, SQLDIAG_NUMBER,
+                       &diagsCount, NULL, 0, NULL);
+    // No need to passback the warnings of SQL_NO_DATA (100)
+    if (retcode == 100)
+       diagsCount--; 
   }
-  if (diagsArea != NULL) 
-     retcode = SQL_EXEC_MergeDiagnostics_Internal(*diagsArea);
-  clearGlobalDiags();
-
-  retcode = close();
-
+ExecReturn:
+  if (retcode < 0 ||  diagsCount > 0) 
+  {   
+     if (diagsArea != NULL) 
+     {
+         if (*diagsArea == NULL)
+            *diagsArea = ComDiagsArea::allocate(heap_); 
+         rc = SQL_EXEC_MergeDiagnostics_Internal(**diagsArea);
+     }
+     // if diagsArea is not passed in, retain the diagnostics info
+     // in ContextCli for it to be retrieved later 
+     // But, deallocate the statement
+     else
+     {
+        rc = close();
+        deallocStuff(module_, stmt_, sql_src_, input_desc_, output_desc_);
+        return retcode;
+     }
+  }
+  rc = close();
   deallocStuff(module_, stmt_, sql_src_, input_desc_, output_desc_);
-
   clearGlobalDiags();
-
-  return ((cliRetcode != -1) ? cliRetcode : retcode);
+  return retcode;
 }
-
-
-
+// When the globalDiags is not null, errors and warnings are
+// passed to the caller. If *globalsDiags points to NULL,
+// allocate ComDiagsArea and pass back the error or warnings
+// to the caller.
+// 
+// If *globalDiags points to ComDiagsArea already, pass back
+// the diagnostics conditions back to the caller after executing
+// the stmtStr along with new errors or warnings.
 Lng32 ExeCliInterface::executeImmediate(const char * stmtStr,
 				       char * outputBuf,
 				       Lng32 * outputBufLen,
 				       NABoolean nullTerminate,
 				       Int64 * rowsAffected,
 				       NABoolean monitorThis,
-				       ComDiagsArea *globalDiags)
+				       ComDiagsArea **globalDiags)
 {
   Lng32 retcode = 0;
 
   ComDiagsArea * tempDiags = NULL;
-  if (globalDiags)
+  if (globalDiags != NULL && *globalDiags != NULL)
   {
      tempDiags = ComDiagsArea::allocate(heap_);
-     tempDiags->mergeAfter(*globalDiags);
+     tempDiags->mergeAfter(**globalDiags);
   }
 
   clearGlobalDiags();
@@ -1094,17 +1115,22 @@ Lng32 ExeCliInterface::executeImmediate(const char * stmtStr,
 				 rowsAffected,
                                  globalDiags);
 ExecuteImmediateReturn:
-  if ((globalDiags) && (tempDiags))
+  if ((globalDiags))
     {
-      globalDiags->mergeAfter(*tempDiags);
+      // Allocate the diagnostics area if needed
+      // and populate the diagnostics conditions
+      if (*globalDiags == NULL && retcode != 0) {
+         *globalDiags = ComDiagsArea::allocate(getHeap());
+         SQL_EXEC_MergeDiagnostics_Internal(**globalDiags);
+      }
+      //  populate the diagnostics conditons passed in
+      if (tempDiags)
+         (*globalDiags)->mergeAfter(*tempDiags);
     }
 
   if (tempDiags)
-    {
-      tempDiags->clear();
       tempDiags->deAllocate();
-    }
-   return retcode;
+  return retcode;
 }
 
 short ExeCliInterface::fetchRowsPrologue(const char * sqlStrBuf, 
@@ -2085,11 +2111,6 @@ Lng32 ExeCliInterface::retrieveSQLDiagnostics(ComDiagsArea *toDiags)
 {
   Lng32 retcode;
   ex_assert(toDiags != NULL, "ComDiagsArea is null");
-  if (diagsArea_ != NULL)
-    {
-      diagsArea_->clear();
-      diagsArea_->deAllocate();
-    }
   retcode = SQL_EXEC_MergeDiagnostics_Internal(*toDiags);
   SQL_EXEC_ClearDiagnostics(NULL);
   return retcode;
@@ -2099,41 +2120,22 @@ Lng32 ExeCliInterface::retrieveSQLDiagnostics(ComDiagsArea *toDiags)
 ComDiagsArea *ExeCliInterface::allocAndRetrieveSQLDiagnostics(ComDiagsArea *&toDiags)
 {
   Lng32 retcode;
-
-  if (diagsArea_ != NULL)
-    {
-      diagsArea_->clear();
-      diagsArea_->deAllocate();
-    }
-  if (toDiags == NULL)
+  NABoolean daAllocated = FALSE; 
+  if (toDiags == NULL) { 
       toDiags = ComDiagsArea::allocate(heap_);
+      daAllocated = TRUE;
+  }
 
   retcode = SQL_EXEC_MergeDiagnostics_Internal(*toDiags);
   SQL_EXEC_ClearDiagnostics(NULL);
  
   if (retcode == 0)
      return toDiags;
-  else
+  else {
+     if (daAllocated)
+        toDiags->decrRefCount();
      return NULL;
-}
-
-void ExeCliInterface::retrieveOrSaveSQLDiagnostics(Lng32 cliRetcode, ComDiagsArea *diagsArea)
-{
-    Int32 rc;
-    Int32 diagsCondCount = 0;
-    rc = SQL_EXEC_GetDiagnosticsStmtInfo2(stmt_,
-                           SQLDIAG_NUMBER, &diagsCondCount,
-                           NULL, 0, NULL);
-    if (cliRetcode == 100)   
-       diagsCondCount--;
-    if (diagsCondCount > 0) { 
-       if (diagsArea == NULL) {
-          if (diagsArea_ == NULL) 
-             diagsArea_ = ComDiagsArea::allocate(heap_);
-          diagsArea = diagsArea_;
-       } 
-       SQL_EXEC_MergeDiagnostics_Internal(*diagsArea);
-    }
+  }
 }
 
 Lng32 ExeCliInterface::GetRowsAffected(Int64 *rowsAffected)
@@ -2177,7 +2179,7 @@ Lng32 ExeCliInterface::GetRowsAffected(Int64 *rowsAffected)
 
 } // GetRowsAffected()
 
-Lng32 ExeCliInterface::holdAndSetCQD(const char * defaultName, const char * defaultValue, ComDiagsArea * globalDiags)
+Lng32 ExeCliInterface::holdAndSetCQD(const char * defaultName, const char * defaultValue, ComDiagsArea *globalDiags)
 {
   Lng32 cliRC;
   
@@ -2188,7 +2190,7 @@ Lng32 ExeCliInterface::holdAndSetCQD(const char * defaultName, const char * defa
   strcat(buf, " hold;");
 
   // hold the current value for defaultName
-  cliRC = executeImmediate(buf, NULL, NULL, TRUE, NULL, 0,globalDiags);
+  cliRC = executeImmediate(buf, NULL, NULL, TRUE, NULL, 0,&globalDiags);
   if (cliRC < 0)
     {
       return cliRC;
@@ -2200,7 +2202,7 @@ Lng32 ExeCliInterface::holdAndSetCQD(const char * defaultName, const char * defa
   strcat(buf, " '");
   strcat(buf, defaultValue);
   strcat(buf, "';");
-  cliRC = executeImmediate(buf, NULL, NULL, TRUE, NULL, 0,globalDiags);
+  cliRC = executeImmediate(buf, NULL, NULL, TRUE, NULL, 0,&globalDiags);
   if (cliRC < 0)
     {
       return cliRC;
@@ -2209,7 +2211,7 @@ Lng32 ExeCliInterface::holdAndSetCQD(const char * defaultName, const char * defa
   return 0;
 }
 
-Lng32 ExeCliInterface::restoreCQD(const char * defaultName, ComDiagsArea * globalDiags)
+Lng32 ExeCliInterface::restoreCQD(const char * defaultName, ComDiagsArea *globalDiags)
 {
   Lng32 cliRC;
 
@@ -2219,7 +2221,7 @@ Lng32 ExeCliInterface::restoreCQD(const char * defaultName, ComDiagsArea * globa
   strcpy(buf, "control query default ");
   strcat(buf, defaultName);
   strcat(buf, " reset;");
-  cliRC = executeImmediate(buf, NULL, NULL, TRUE, NULL, 0,globalDiags);
+  cliRC = executeImmediate(buf, NULL, NULL, TRUE, NULL, 0,&globalDiags);
   if (cliRC < 0)
     {
       return cliRC;
@@ -2229,7 +2231,7 @@ Lng32 ExeCliInterface::restoreCQD(const char * defaultName, ComDiagsArea * globa
   strcpy(buf, "control query default ");
   strcat(buf, defaultName);
   strcat(buf, " restore;");
-  cliRC = executeImmediate(buf, NULL, NULL, TRUE, NULL, 0,globalDiags);
+  cliRC = executeImmediate(buf, NULL, NULL, TRUE, NULL, 0,&globalDiags);
   if (cliRC < 0)
     {
       return cliRC;
@@ -2240,7 +2242,7 @@ Lng32 ExeCliInterface::restoreCQD(const char * defaultName, ComDiagsArea * globa
 
 Lng32 ExeCliInterface::getCQDval(const char * defaultName, 
 				 char * val,
-				 ComDiagsArea * globalDiags)
+				 ComDiagsArea *globalDiags)
 {
   Lng32 cliRC;
 
@@ -2276,11 +2278,11 @@ Lng32 ExeCliInterface::getCQDval(const char * defaultName,
   return 0;
 }
 
-Lng32 ExeCliInterface::setCQS(const char * shape, ComDiagsArea * globalDiags)
+Lng32 ExeCliInterface::setCQS(const char * shape, ComDiagsArea *globalDiags)
 {
   Lng32 cliRC;
 
-  cliRC = executeImmediate(shape, NULL, NULL, TRUE, NULL, 0,globalDiags);
+  cliRC = executeImmediate(shape, NULL, NULL, TRUE, NULL, 0,&globalDiags);
   if (cliRC < 0)
     {
       return cliRC;
@@ -2297,7 +2299,7 @@ Lng32 ExeCliInterface::resetCQS(ComDiagsArea * globalDiags)
   char buf[400];
   
   strcpy(buf, "control query shape cut ");
-  cliRC = executeImmediate(buf, NULL, NULL, TRUE, NULL, 0,globalDiags);
+  cliRC = executeImmediate(buf, NULL, NULL, TRUE, NULL, 0,&globalDiags);
   if (cliRC < 0)
     {
       return cliRC;

http://git-wip-us.apache.org/repos/asf/trafodion/blob/37702da3/core/sql/executor/ExExeUtilCli.h
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilCli.h b/core/sql/executor/ExExeUtilCli.h
index ce33de4..963b567 100644
--- a/core/sql/executor/ExExeUtilCli.h
+++ b/core/sql/executor/ExExeUtilCli.h
@@ -76,7 +76,7 @@ private:
 			 NABoolean nullTerminate = TRUE,
 			 Int64 * rowsAffected = NULL,
 			 NABoolean monitorThis = FALSE,
-			 ComDiagsArea *globalDiags = NULL);
+			 ComDiagsArea **globalDiags = NULL);
 
   Lng32 executeImmediatePrepare(const char * stmt,
 				char * outputBuf = NULL,
@@ -100,7 +100,7 @@ private:
                             Lng32 * outputBufLen = NULL,
                             NABoolean nullTerminate = TRUE,
                             Int64 * rowsAffected = NULL,
-                            ComDiagsArea *diagsArea = NULL);
+                            ComDiagsArea **diagsArea = NULL);
  
   Lng32 prepare(const char * stmtStr,
 		SQLMODULE_ID * module,
@@ -247,12 +247,9 @@ private:
 
   Lng32 retrieveSQLDiagnostics(ComDiagsArea *toDiags);
   ComDiagsArea *allocAndRetrieveSQLDiagnostics(ComDiagsArea *&toDiags);
-  void retrieveOrSaveSQLDiagnostics(Lng32 cliRetCode, ComDiagsArea *toDiags);
 
   CollHeap * getHeap() { return heap_; }
 
-  ComDiagsArea * getDiagsArea() { return diagsArea_; }
-
   char * outputBuf() { return outputBuf_; };
   Int32  outputDatalen() { return outputDatalen_; };
 
@@ -374,8 +371,6 @@ private:
   Int32 numQuadFields_;
   struct SQLCLI_QUAD_FIELDS * quadFields_;
 
-  ComDiagsArea * diagsArea_;
-
   CollHeap * heap_;
 
   ContextCli * currContext_;

http://git-wip-us.apache.org/repos/asf/trafodion/blob/37702da3/core/sql/executor/ExExeUtilCommon.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilCommon.cpp b/core/sql/executor/ExExeUtilCommon.cpp
index 09f7126..450dd74 100644
--- a/core/sql/executor/ExExeUtilCommon.cpp
+++ b/core/sql/executor/ExExeUtilCommon.cpp
@@ -204,7 +204,6 @@ ExExeUtilTcb::ExExeUtilTcb(const ComTdbExeUtil & exe_util_tdb,
 					     parentQid);
 
   diagsArea_ = NULL;
-  //setDiagsArea(ComDiagsArea::allocate(getHeap()));
   
   pqStep_ = PROLOGUE_;
 
@@ -441,11 +440,10 @@ Lng32 ExExeUtilTcb::changeAuditAttribute(char * tableName,
     strcat(stmt, " no label update");
 
   strcat(stmt, ";");
-
+  ComDiagsArea *diagsArea = getDiagsArea();
   retcode = cliInterface()->executeImmediate
-    (stmt, NULL, NULL, TRUE, NULL, 0,
-     &(masterGlob->getStatement()->getContext()->diags()));
-
+    (stmt, NULL, NULL, TRUE, NULL, 0, &diagsArea); 
+  setDiagsArea(diagsArea);
   masterGlob->getStatement()->getContext()->resetSqlParserFlags(0x400); // ALLOW_AUDIT_CHANGE
   
   if (retcode < 0)
@@ -463,7 +461,7 @@ Lng32 ExExeUtilTcb::changeAuditAttribute(char * tableName,
 
 void ExExeUtilTcb::handleErrors(Lng32 rc)
 { 
-  setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+  cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 }
 
 short ExExeUtilTcb::initializeInfoList(Queue* &infoList)
@@ -669,7 +667,7 @@ short ExExeUtilTcb::executeQuery(char * task,
 	    char * stringParam1 = NULL;
 	    Lng32   intParam1 = ComDiags_UnInitialized_Int;
 
-            setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+            cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
             if (getDiagsArea() != NULL)
 	        retcode = 0;
 	    if (moveErrorRow)
@@ -858,7 +856,7 @@ Lng32 ExExeUtilTcb::setCS(const char * csName, char * csValue,
 
   cliRC = 
     cliInterface->executeImmediate(buf, NULL, NULL, TRUE, NULL,FALSE,
-				   globalDiags);
+				   &globalDiags);
   if (cliRC < 0)
     {
       return cliRC;
@@ -879,7 +877,7 @@ Lng32 ExExeUtilTcb::resetCS(const char * csName,
   strcat(buf, csName);
   strcat(buf, "' reset;");
   cliRC = cliInterface->executeImmediate(buf, NULL, NULL, TRUE, NULL,FALSE,
-					 globalDiags);
+					 &globalDiags);
   if (cliRC < 0)
     {
       return cliRC;
@@ -1052,7 +1050,7 @@ short ExExeUtilTcb::setSystemVersion()
 					 sysVersionStr_, &sysVersionStrLen_);
       if (cliRC < 0)
 	{
-          setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+          cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 	  return -1;
 	}
       
@@ -1121,7 +1119,7 @@ short ExExeUtilTcb::getObjectUid(char * catName, char * schName,
 				     uid, &uidLen);
   if (cliRC < 0)
     {
-      setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+      cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
       return -1;
     }
   uid[uidLen] = 0;
@@ -1459,12 +1457,21 @@ short ExExeUtilTcb::alterAuditFlag(NABoolean audited, char * tableName,
 
 short ExExeUtilTcb::handleError()
 {
-  return ex_tcb::handleError(&qparent_, getDiagsArea());
+  short rc = ex_tcb::handleError(&qparent_, getDiagsArea());
+  diagsArea_->deAllocate();
+  diagsArea_ = NULL;
+  return rc;
 }
 
 short ExExeUtilTcb::handleDone()
 {
-  return ex_tcb::handleDone(&qparent_, getDiagsArea());
+  short rc = ex_tcb::handleDone(&qparent_, getDiagsArea());
+  if (diagsArea_ != NULL)
+  { 
+     diagsArea_->deAllocate();
+     diagsArea_ = NULL;
+  }
+  return rc;
 }
     
 short ExExeUtilTcb::createServer(char *serverName,

http://git-wip-us.apache.org/repos/asf/trafodion/blob/37702da3/core/sql/executor/ExExeUtilExplain.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilExplain.cpp b/core/sql/executor/ExExeUtilExplain.cpp
index 7d9f99c..7e12a27 100644
--- a/core/sql/executor/ExExeUtilExplain.cpp
+++ b/core/sql/executor/ExExeUtilExplain.cpp
@@ -237,7 +237,7 @@ short ExExeUtilDisplayExplainTcb::work()
 	      executeImmediate("control session 'EXPLAIN' 'ON';");
 	    if (retcode < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		pstate.step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -249,7 +249,7 @@ short ExExeUtilDisplayExplainTcb::work()
 					 "__EXPL_STMT_NAME__");
 	    if (retcode < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		pstate.step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -272,7 +272,7 @@ short ExExeUtilDisplayExplainTcb::work()
 	    
 	    if (retcode < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		pstate.step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -362,7 +362,7 @@ short ExExeUtilDisplayExplainTcb::work()
 	    retcode = cliInterface()->fetchRowsPrologue(explainQuery_);
 	    if (retcode < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		pstate.step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -389,7 +389,7 @@ short ExExeUtilDisplayExplainTcb::work()
 	    retcode = cliInterface()->fetch();
 	    if (retcode < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		pstate.step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -452,7 +452,7 @@ short ExExeUtilDisplayExplainTcb::work()
 	    retcode = cliInterface()->fetch();
 	    if (retcode < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		pstate.step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -567,7 +567,7 @@ short ExExeUtilDisplayExplainTcb::work()
 	    retcode = cliInterface()->fetchRowsEpilogue(explainQuery_);
 	    if (retcode < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 	      }
 	    
 	    retcode = 
@@ -575,7 +575,7 @@ short ExExeUtilDisplayExplainTcb::work()
 					   input_desc_, output_desc_);
 	    if (retcode < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 	      }
 
 	    if (exeUtilTdb().getStmtName() == NULL)
@@ -593,7 +593,7 @@ short ExExeUtilDisplayExplainTcb::work()
 	      executeImmediate("control session reset 'EXPLAIN';");
 	    if (retcode < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 	      }
 	    
 	    if (pstate.step_ == FETCH_EPILOGUE_AND_RETURN_ERROR_)
@@ -3916,7 +3916,7 @@ short ExExeUtilDisplayExplainComplexTcb::work()
 		// Explain will return 'info not available' in its
 		// description field.
 		// All other errors are reported.
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		if (exeUtilTdb().loadIfExists() &&
 		     getDiagsArea()->contains(-1055))
 		  {
@@ -3986,7 +3986,7 @@ short ExExeUtilDisplayExplainComplexTcb::work()
 					 FALSE, exeUtilTdb().isVolatile());
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		step_ = DROP_AND_ERROR_;
 		break;
 	      }
@@ -4210,7 +4210,7 @@ short ExExeUtilDisplayExplainShowddlTcb::work()
 
 		if (cliRC < 0)
 		  {
-                    setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		    step_ = ERROR_;
 		    break;
 		  }
@@ -4226,7 +4226,7 @@ short ExExeUtilDisplayExplainShowddlTcb::work()
 
 		if (cliRC < 0)
 		  {
-                    setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		    step_ = ERROR_;
 		    break;
 		  }
@@ -4251,7 +4251,7 @@ short ExExeUtilDisplayExplainShowddlTcb::work()
 
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		step_ = ERROR_;
 		break;
 	      }

http://git-wip-us.apache.org/repos/asf/trafodion/blob/37702da3/core/sql/executor/ExExeUtilGet.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilGet.cpp b/core/sql/executor/ExExeUtilGet.cpp
index 2ce8607..c77260e 100644
--- a/core/sql/executor/ExExeUtilGet.cpp
+++ b/core/sql/executor/ExExeUtilGet.cpp
@@ -689,7 +689,7 @@ Lng32 ExExeUtilGetMetadataInfoTcb::getUsingView(Queue * infoList,
 	    cliRC = cliInterface()->fetchRowsPrologue(query);
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		vStep_ = VIEWS_ERROR_;
 		break;
 	      }
@@ -703,7 +703,7 @@ Lng32 ExExeUtilGetMetadataInfoTcb::getUsingView(Queue * infoList,
 	    cliRC = cliInterface()->fetch();
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		vStep_ = VIEWS_ERROR_;
 		break;
 	      }
@@ -731,7 +731,7 @@ Lng32 ExExeUtilGetMetadataInfoTcb::getUsingView(Queue * infoList,
 	    cliRC = cliInterface()->fetchRowsEpilogue(0);
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		vStep_ = VIEWS_ERROR_;
 		break;
 	      }
@@ -845,7 +845,7 @@ Lng32 ExExeUtilGetMetadataInfoTcb::getUsedObjects(Queue * infoList,
 	    cliRC = cliInterface()->fetchRowsPrologue(query);
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		vStep_ = VIEWS_ERROR_;
 		break;
 	      }
@@ -859,7 +859,7 @@ Lng32 ExExeUtilGetMetadataInfoTcb::getUsedObjects(Queue * infoList,
 	    cliRC = cliInterface()->fetch();
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		vStep_ = VIEWS_ERROR_;
 		break;
 	      }
@@ -887,7 +887,7 @@ Lng32 ExExeUtilGetMetadataInfoTcb::getUsedObjects(Queue * infoList,
 	    cliRC = cliInterface()->fetchRowsEpilogue(0);
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		vStep_ = VIEWS_ERROR_;
 		break;
 	      }
@@ -1419,7 +1419,7 @@ Int32 ExExeUtilGetMetadataInfoTcb::getAuthID(
   cliRC = fetchAllRows(infoList_, queryBuf_, numOutputEntries_, FALSE, rc);
   if (cliRC < 0) 
   {
-    setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
     return NA_UserIdDefault;
   }
 
@@ -1493,7 +1493,7 @@ char * ExExeUtilGetMetadataInfoTcb::getRoleList(
   cliRC = fetchAllRows(infoList_, queryBuf_, numOutputEntries_, FALSE, rc);
   if (cliRC < 0)
   {
-    setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
     return NULL;
   }
 
@@ -1813,9 +1813,7 @@ short ExExeUtilGetMetadataInfoTcb::work()
 	    {
                if (!CmpCommon::context()->isAuthorizationEnabled())
                {
-                  ComDiagsArea * diagsArea = getDiagsArea();
-                  ExRaiseSqlError(getHeap(), &diagsArea, -CAT_AUTHORIZATION_NOT_ENABLED);
-                  setDiagsArea(diagsArea);
+                  ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_AUTHORIZATION_NOT_ENABLED);
                   step_ = HANDLE_ERROR_;
                   break;
                }
@@ -2273,11 +2271,9 @@ short ExExeUtilGetMetadataInfoTcb::work()
                   // easier to just return with an error.
                   if (authID == 0)
                     { 
-                      ComDiagsArea * diagsArea = getDiagsArea();
-                      ExRaiseSqlError(getHeap(), &diagsArea, -8732,
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -8732,
                           NULL, NULL, NULL,
                           getMItdb().getParam1());
-                      setDiagsArea(diagsArea);
                       step_ = HANDLE_ERROR_;
                       break;
                     }
@@ -2288,11 +2284,9 @@ short ExExeUtilGetMetadataInfoTcb::work()
                        // error if authID is not a role
                        if (!CmpSeabaseDDLauth::isRoleID(authID) && authID != PUBLIC_USER)
                         {
-                          ComDiagsArea * diagsArea = getDiagsArea();
-                          ExRaiseSqlError(getHeap(), &diagsArea, -CAT_IS_NOT_A_ROLE, 
+                          ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_A_ROLE, 
                               NULL, NULL, NULL,
                               getMItdb().getParam1());
-                          setDiagsArea(diagsArea);
                           step_ = HANDLE_ERROR_;
                           break;
                         }
@@ -2303,11 +2297,9 @@ short ExExeUtilGetMetadataInfoTcb::work()
                       // Return an error if authID is not a user
                       if (!CmpSeabaseDDLauth::isUserID(authID))
                         {
-                          ComDiagsArea * diagsArea = getDiagsArea();
-                          ExRaiseSqlError(getHeap(), &diagsArea, -CAT_IS_NOT_A_USER, 
+                          ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_A_USER, 
                               NULL, NULL, NULL,
                               getMItdb().getParam1());
-                          setDiagsArea(diagsArea);
                           step_ = HANDLE_ERROR_;
                           break;
                         }
@@ -2636,7 +2628,7 @@ short ExExeUtilGetMetadataInfoTcb::work()
 	    if (fetchAllRows(infoList_, queryBuf_, numOutputEntries_,
 			     FALSE, retcode) < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -4239,7 +4231,7 @@ short ExExeUtilGetHiveMetadataInfoTcb::work()
 	    retcode = fetchAllHiveRows(infoList_, 1, rc);
 	    if (retcode < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -5069,10 +5061,8 @@ short ExExeUtilLobShowddlTcb::fetchRows(char * query, short &rc)
     fetchAllRows(infoList_, query, 1, FALSE, rc);
   if (cliRC < 0) 
     {
-      setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
-
+      cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
       step_ = HANDLE_ERROR_;
-
       return -1;
     }
   
@@ -5523,13 +5513,11 @@ short ExExeUtilHiveMDaccessTcb::work()
             if (!retStatus)
               {
                 Lng32 intParam1 =  hiveMD_->getErrCode();
-                ComDiagsArea *diagsArea =  getDiagsArea();
-                ExRaiseSqlError(getHeap(), &diagsArea, -1190, 
+                ExRaiseSqlError(getHeap(), &diagsArea_, -1190, 
                        &intParam1, NULL, NULL,
                        hiveMD_->getErrMethodName(),
                        hiveMD_->getErrCodeStr(),
                        hiveMD_->getErrDetail());
-                setDiagsArea(diagsArea);
                 step_ = HANDLE_ERROR_;
                 break;
               }
@@ -5546,13 +5534,11 @@ short ExExeUtilHiveMDaccessTcb::work()
                 HVC_RetCode retCode = HiveClient_JNI::getAllSchemas((NAHeap *)getHeap(), schNames_);
                 if ((retCode != HVC_OK) && (retCode != HVC_DONE)) 
                   {
-		    ComDiagsArea * diagsArea = getDiagsArea();
-		    ExRaiseSqlError(getHeap(), &diagsArea, -1190, 
+		    ExRaiseSqlError(getHeap(), &diagsArea_, -1190, 
                            (Lng32 *)&retCode, NULL, NULL, 
                            (char*)"HiveClient_JNI::getAllSchemas()",
                            HiveClient_JNI::getErrorText(retCode),
                            GetCliGlobals()->getJniErrorStr());
-                    setDiagsArea(diagsArea);
                     step_ = HANDLE_ERROR_;
                     break;
                   }
@@ -5607,23 +5593,20 @@ short ExExeUtilHiveMDaccessTcb::work()
                 HVC_RetCode retCode = HiveClient_JNI::getAllTables((NAHeap *)getHeap(), currSch, tblNames_);
                 if (retCode == HVC_ERROR_EXISTS_EXCEPTION)
                   {
-		    ComDiagsArea * diagsArea = getDiagsArea();
-		    ExRaiseSqlError(getHeap(), &diagsArea, -1003, 
+		    ExRaiseSqlError(getHeap(), &diagsArea_, -1003, 
                            NULL, NULL, NULL, 
-                           (NAString("hive") + "." + currSch).data());
-                    setDiagsArea(diagsArea);
+                           hiveCat_,
+                           hiveSch_);
                     step_ = HANDLE_ERROR_;
                     break;
                   }
                 else if ((retCode != HVC_OK) && (retCode != HVC_DONE)) 
                   {
-		    ComDiagsArea * diagsArea = getDiagsArea();
-		    ExRaiseSqlError(getHeap(), &diagsArea, -1190, 
+		    ExRaiseSqlError(getHeap(), &diagsArea_, -1190, 
                            (Lng32 *)&retCode, NULL, NULL, 
                            (char*)"HiveClient_JNI::getAllTables()",
                            HiveClient_JNI::getErrorText(retCode),
                            GetCliGlobals()->getJniErrorStr());
-                    setDiagsArea(diagsArea);
                     step_ = HANDLE_ERROR_;
                     break;
                   }
@@ -5807,11 +5790,9 @@ short ExExeUtilHiveMDaccessTcb::work()
 		char strP[300];
 		sprintf(strP, "Datatype %s is not supported.", 
                         (hcd ? hcd->type_ : hpd->type_));
-                ComDiagsArea *diagsArea = getDiagsArea();
-                ExRaiseSqlError(getHeap(), &diagsArea, -CLI_GET_METADATA_INFO_ERROR,
+                ExRaiseSqlError(getHeap(), &diagsArea_, -CLI_GET_METADATA_INFO_ERROR,
                       NULL, NULL, NULL,
                       strP);
-                setDiagsArea(diagsArea);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -7065,9 +7046,7 @@ short ExExeUtilClusterStatsTcb::work()
               }
             else if (retcode < 0)
               {
-                ComDiagsArea *diagsArea = getDiagsArea();
-                ExRaiseSqlError(getHeap(), &diagsArea, -8451);
-                setDiagsArea(diagsArea);
+                ExRaiseSqlError(getHeap(), &diagsArea_, -8451);
                 step_ = HANDLE_ERROR_;
                 break;
               }

http://git-wip-us.apache.org/repos/asf/trafodion/blob/37702da3/core/sql/executor/ExExeUtilGetStats.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilGetStats.cpp b/core/sql/executor/ExExeUtilGetStats.cpp
index bfd9db2..1f32971 100644
--- a/core/sql/executor/ExExeUtilGetStats.cpp
+++ b/core/sql/executor/ExExeUtilGetStats.cpp
@@ -979,7 +979,7 @@ short ExExeUtilGetStatisticsTcb::work()
 	    cliRC = cliInterface()->fetchRowsPrologue(statsQuery_);
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -994,7 +994,7 @@ short ExExeUtilGetStatisticsTcb::work()
 	    cliRC = cliInterface()->fetch();
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -1130,7 +1130,7 @@ short ExExeUtilGetStatisticsTcb::work()
 	    cliRC = cliInterface()->fetch();
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }

http://git-wip-us.apache.org/repos/asf/trafodion/blob/37702da3/core/sql/executor/ExExeUtilLoad.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilLoad.cpp b/core/sql/executor/ExExeUtilLoad.cpp
index 33a93f8..d3c5c8d 100644
--- a/core/sql/executor/ExExeUtilLoad.cpp
+++ b/core/sql/executor/ExExeUtilLoad.cpp
@@ -139,10 +139,8 @@ short ExExeUtilCreateTableAsTcb::work()
 	    // allow a user transaction if NO LOAD was specified
 	    if (xnAlreadyStarted && !ctaTdb().noLoad())
               {
-                ComDiagsArea *diagsArea = getDiagsArea();
-                ExRaiseSqlError(getHeap(), &diagsArea, -20123, NULL, NULL, NULL,
+                ExRaiseSqlError(getHeap(), &diagsArea_, -20123, NULL, NULL, NULL,
                                 "This DDL operation");
-                setDiagsArea(diagsArea);
                 step_ = ERROR_;
                 break;
               }
@@ -185,8 +183,7 @@ short ExExeUtilCreateTableAsTcb::work()
 		  }
 		else
 		  {
-		    setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
-		    
+		    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		    step_ = ERROR_;
 		    break;
 		  }
@@ -342,7 +339,7 @@ short ExExeUtilCreateTableAsTcb::work()
 		 &rowsAffected);
 	    if (cliRC < 0)
             {
-              setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+              cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
               step_ = HANDLE_ERROR_;
             }
             else
@@ -428,7 +425,7 @@ short ExExeUtilCreateTableAsTcb::work()
               cliInterface()->setIsoMapping(savedIsoMapping);
 	      if (cliRC < 0)
               {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
                 step_ = HANDLE_ERROR_;
               }
               else
@@ -447,7 +444,7 @@ short ExExeUtilCreateTableAsTcb::work()
 		 &rowsAffected);
 	    if (cliRC < 0)
 	    {
-              setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+              cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
               step_ = HANDLE_ERROR_;
             }
             else
@@ -481,7 +478,7 @@ short ExExeUtilCreateTableAsTcb::work()
 	    NADELETEBASIC(usQuery, getHeap());
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -796,7 +793,7 @@ ExWorkProcRetcode ExExeUtilAqrWnrInsertTcb::work()
 
         if (cliRC < 0)
         {
-          setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+          cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
           SETSTEP(ERROR_);
         }
         else
@@ -821,7 +818,7 @@ ExWorkProcRetcode ExExeUtilAqrWnrInsertTcb::work()
         NADELETEBASIC(query_, getMyHeap());
         if (cliRC < 0)
         {
-          setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+          cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
           SETSTEP(ERROR_);
         }
         else
@@ -960,7 +957,7 @@ ExWorkProcRetcode ExExeUtilAqrWnrInsertTcb::work()
         {
         // mjh - tbd - warning or EMS message to give context to error on
         // delete after error on the insert?
-          setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+          cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
         }
         else
           masterGlob->setAqrWnrInsertCleanedup();
@@ -1114,7 +1111,6 @@ short ExExeUtilHBaseBulkLoadTcb::work()
   short rc;
   Lng32 errorRowCount = 0;
   int len;
-  ComDiagsArea *diagsArea = NULL;
 
   // if no parent request, return
   if (qparent_.down->isEmpty())
@@ -1148,9 +1144,7 @@ short ExExeUtilHBaseBulkLoadTcb::work()
           !hblTdb().getIndexTableOnly())
       {
         //8111 - Transactions are not allowed with Bulk load.
-        ComDiagsArea * diagsArea = getDiagsArea();
-        ExRaiseSqlError(getHeap(), &diagsArea, -8111);
-        setDiagsArea(diagsArea);
+        ExRaiseSqlError(getHeap(), &diagsArea_, -8111);
         step_ = LOAD_ERROR_;
           break;
       }
@@ -1222,7 +1216,7 @@ short ExExeUtilHBaseBulkLoadTcb::work()
 
       if (cliRC < 0)
       {
-        setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+        cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
         step_ = LOAD_ERROR_;
         break;
       }
@@ -1251,14 +1245,12 @@ short ExExeUtilHBaseBulkLoadTcb::work()
       {
          Lng32 cliError = 0;
         Lng32 intParam1 = -retcode;
-        diagsArea = NULL;
-        ExRaiseSqlError(getHeap(), &diagsArea,
+        ExRaiseSqlError(getHeap(), &diagsArea_,
                           (ExeErrorCode)(8448), NULL, &intParam1,
                           &cliError, NULL,
                           " ",
                           getHbaseErrStr(retcode),
                           (char *)GetCliGlobals()->getJniErrorStr());
-        setDiagsArea(diagsArea);
         step_ = LOAD_END_ERROR_;
         break;
       }
@@ -1298,7 +1290,7 @@ short ExExeUtilHBaseBulkLoadTcb::work()
       clnpQuery = NULL;
       if (cliRC < 0)
       {
-        setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+        cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
         step_ = LOAD_END_ERROR_;
         break;
       }
@@ -1337,7 +1329,7 @@ short ExExeUtilHBaseBulkLoadTcb::work()
       diQuery = NULL;
       if (cliRC < 0)
       {
-        setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+        cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
         step_ = LOAD_END_ERROR_;
         break;
       }
@@ -1414,24 +1406,20 @@ short ExExeUtilHBaseBulkLoadTcb::work()
               masterGlob->getStatement()->getContext()->setSqlParserFlags(0x20000);
             }
           }
-        diagsArea = getDiagsArea();
-        if (diagsArea == NULL) {
-           diagsArea = ComDiagsArea::allocate(getHeap());
-           setDiagsArea(diagsArea);
-        }
+        ComDiagsArea *diagsArea = getDiagsArea();
         cliRC = cliInterface()->executeImmediate(loadQuery,
             NULL,
             NULL,
             TRUE,
             &rowsAffected_,
             FALSE,
-            diagsArea);
+            &diagsArea);
         if (parserFlagSet)
             masterGlob->getStatement()->getContext()->resetSqlParserFlags(0x20000);
+        setDiagsArea(diagsArea);
         if (cliRC < 0)
         {
           rowsAffected_ = 0;
-          setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
           step_ = LOAD_END_ERROR_;
           break;
         }
@@ -1469,7 +1457,7 @@ short ExExeUtilHBaseBulkLoadTcb::work()
         upsQuery = NULL;
         if (cliRC < 0)
         {
-          setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+          cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
           step_ = LOAD_ERROR_;
           break;
         }
@@ -1539,7 +1527,7 @@ short ExExeUtilHBaseBulkLoadTcb::work()
       if (cliRC < 0)
       {
         rowsAffected_ = 0;
-        setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+        cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
         setEndStatusMsg(" COMPLETION", len, TRUE);
         step_ = LOAD_END_ERROR_;
         break;
@@ -1586,7 +1574,7 @@ short ExExeUtilHBaseBulkLoadTcb::work()
 
       if (cliRC < 0)
       {
-        setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+        cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
         step_ = LOAD_END_ERROR_;
         break;
       }
@@ -1646,7 +1634,7 @@ short ExExeUtilHBaseBulkLoadTcb::work()
 
         if (cliRC < 0)
         {
-          setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+          cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
           step_ = LOAD_END_ERROR_;
         }
         else
@@ -1702,7 +1690,7 @@ short ExExeUtilHBaseBulkLoadTcb::work()
       up_entry->upState.setMatchNo(0);
       up_entry->upState.status = ex_queue::Q_NO_DATA;
 
-      diagsArea = up_entry->getDiagsArea();
+      ComDiagsArea *diagsArea = up_entry->getDiagsArea();
 
       if (diagsArea == NULL)
         diagsArea = ComDiagsArea::allocate(getMyHeap());
@@ -2017,12 +2005,12 @@ short ExExeUtilHBaseBulkUnLoadTcb::resetExplainSettings()
 {
   if (cliInterface()->executeImmediate("control session reset 'EXPLAIN';") < 0)
   {
-    setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
     return -1;
   }
   if (restoreCQD("generate_explain") < 0)
   {
-    setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
     return -1;
   }
   return 0;
@@ -2043,7 +2031,7 @@ short ExExeUtilHBaseBulkUnLoadTcb::getTrafodionScanTables()
 
   if (holdAndSetCQD("generate_explain", "ON") < 0)
   {
-    setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
     resetExplainSettings();
     return -1;
   }
@@ -2051,7 +2039,7 @@ short ExExeUtilHBaseBulkUnLoadTcb::getTrafodionScanTables()
   cliRC = cliInterface()->executeImmediate("control session 'EXPLAIN' 'ON';");
   if (cliRC < 0)
   {
-    setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
     resetExplainSettings();
     return cliRC;
   }
@@ -2059,7 +2047,7 @@ short ExExeUtilHBaseBulkUnLoadTcb::getTrafodionScanTables()
   cliRC = cliInterface()->allocStuff(module, stmt, sql_src, input_desc, output_desc, "__EXPL_STMT_NAME__");
   if (cliRC < 0)
   {
-    setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
     resetExplainSettings();
     return cliRC;
   }
@@ -2068,7 +2056,7 @@ short ExExeUtilHBaseBulkUnLoadTcb::getTrafodionScanTables()
   cliRC = cliInterface()->prepare(stmtStr, module, stmt, sql_src, input_desc, output_desc, NULL);
   if (cliRC < 0)
   {
-    setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
     cliInterface()->deallocStuff(module, stmt, sql_src, input_desc, output_desc);
     resetExplainSettings();
     return cliRC;
@@ -2100,7 +2088,7 @@ short ExExeUtilHBaseBulkUnLoadTcb::getTrafodionScanTables()
   cliRC = cliInterface()->fetchAllRows(tbls, (char*)qry_str.data(), 0, FALSE, FALSE, TRUE);
   if (cliRC < 0)
   {
-    setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
     cliInterface()->deallocStuff(module, stmt, sql_src, input_desc, output_desc);
     return cliRC;
   }
@@ -2113,7 +2101,7 @@ short ExExeUtilHBaseBulkUnLoadTcb::getTrafodionScanTables()
       cliRC = cliInterface()->deallocStuff(module, stmt, sql_src, input_desc, output_desc);
       if (cliRC < 0)
       {
-        setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+        cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
         return cliRC;
       }
     }
@@ -2139,7 +2127,7 @@ short ExExeUtilHBaseBulkUnLoadTcb::getTrafodionScanTables()
   cliRC = cliInterface()->deallocStuff(module, stmt, sql_src, input_desc, output_desc);
   if (cliRC < 0)
   {
-    setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
     return cliRC;
   }
   return snapshotsList_->entries();
@@ -2179,9 +2167,7 @@ short ExExeUtilHBaseBulkUnLoadTcb::work()
       if (xnAlreadyStarted  )
       {
         //8111 - Transactions are not allowed with Bulk unload.
-        ComDiagsArea * diagsArea = getDiagsArea();
-        ExRaiseSqlError(getHeap(), &diagsArea, -8111);
-        setDiagsArea(diagsArea);
+        ExRaiseSqlError(getHeap(), &diagsArea_, -8111);
         step_ = UNLOAD_ERROR_;
         break;
       }
@@ -2208,11 +2194,9 @@ short ExExeUtilHBaseBulkUnLoadTcb::work()
         if (exists)
         {
           //EXE_UNLOAD_FILE_EXISTS
-          ComDiagsArea * diagsArea = getDiagsArea();
-          ExRaiseSqlError(getHeap(), &diagsArea, -EXE_UNLOAD_FILE_EXISTS,
+          ExRaiseSqlError(getHeap(), &diagsArea_, -EXE_UNLOAD_FILE_EXISTS,
                   NULL, NULL, NULL,
                   hblTdb().getMergePath());
-          setDiagsArea(diagsArea);
           step_ = UNLOAD_END_ERROR_;
           break;
         }
@@ -2330,12 +2314,10 @@ short ExExeUtilHBaseBulkUnLoadTcb::work()
           hbcRetCode = ehi_->verifySnapshot(*snapshotsList_->at(i)->fullTableName, *snapshotsList_->at(i)->snapshotName, exist);
           if ( hbcRetCode == HBC_OK && !exist)
           {
-            ComDiagsArea * diagsArea = getDiagsArea();
-            ExRaiseSqlError(getHeap(), &diagsArea, -8112,
+            ExRaiseSqlError(getHeap(), &diagsArea_, -8112,
                   NULL, NULL, NULL,
                   snapshotsList_->at(i)->snapshotName->data(),
                   snapshotsList_->at(i)->fullTableName->data());
-            setDiagsArea(diagsArea);
             step_ = UNLOAD_END_ERROR_;
             break;
           }
@@ -2374,7 +2356,7 @@ short ExExeUtilHBaseBulkUnLoadTcb::work()
       if (cliRC < 0)
       {
         rowsAffected_ = 0;
-        setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+        cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
         step_ = UNLOAD_END_ERROR_;
         break;
       }
@@ -2881,11 +2863,9 @@ short ExExeUtilLobExtractTcb::work()
 		      Lng32 cliError = 0;
 		      
 		      Lng32 intParam1 = 0;
-		      ComDiagsArea * diagsArea = getDiagsArea();
-		      ExRaiseSqlError(getHeap(), &diagsArea, 
+		      ExRaiseSqlError(getHeap(), &diagsArea_, 
 				      (ExeErrorCode)(8444), NULL, &intParam1, 
 				      &cliError, NULL, NULL);
-
 		      step_ = HANDLE_ERROR_;
 		    }
 		}
@@ -3000,11 +2980,9 @@ short ExExeUtilLobExtractTcb::work()
 		     lobHandle_,
 		     lobHandleLen_))
 		  {
-		    ComDiagsArea * diagsArea = getDiagsArea();
 		    ExRaiseSqlError(getMyHeap(),
-				    &diagsArea,
+				    &diagsArea_,
 				    (ExeErrorCode)(EXE_INVALID_LOB_HANDLE));
-                    setDiagsArea(diagsArea);
 		    step_ = HANDLE_ERROR_;
 		    break;
 		  }
@@ -3264,12 +3242,10 @@ short ExExeUtilLobExtractTcb::work()
 		  {
 		    Lng32 intParam1 = -retcode;
 		    Lng32 cliError;
-		    ComDiagsArea * diagsArea = getDiagsArea();
-		    ExRaiseSqlError(getHeap(), &diagsArea, 
+		    ExRaiseSqlError(getHeap(), &diagsArea_, 
 				    (ExeErrorCode)(8442), NULL, &intParam1, 
 				    &cliError, NULL, (char*)"ExpLOBInterfaceSelect",
 				    getLobErrStr(intParam1));
-                    setDiagsArea(diagsArea);
 		    step_ = HANDLE_ERROR_;
 		    break;
 		  }
@@ -3312,12 +3288,10 @@ short ExExeUtilLobExtractTcb::work()
 		Lng32 cliError = 0;
 
 		Lng32 intParam1 = -retcode;
-		ComDiagsArea * diagsArea = getDiagsArea();
-		ExRaiseSqlError(getHeap(), &diagsArea, 
+		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceSelectCursor",
 				getLobErrStr(intParam1));
-                setDiagsArea(diagsArea);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -3367,12 +3341,10 @@ short ExExeUtilLobExtractTcb::work()
 		Lng32 cliError = 0;
 
 		Lng32 intParam1 = -retcode;
-		ComDiagsArea * diagsArea = getDiagsArea();
-		ExRaiseSqlError(getHeap(), &diagsArea, 
+		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceSelectCursor",
 				getLobErrStr(intParam1));
-                setDiagsArea(diagsArea);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -3440,12 +3412,10 @@ short ExExeUtilLobExtractTcb::work()
 		Lng32 cliError = 0;
 
 		Lng32 intParam1 = -retcode;
-		ComDiagsArea * diagsArea = getDiagsArea();
-		ExRaiseSqlError(getHeap(), &diagsArea, 
+		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceSelectCursor",
 				getLobErrStr(intParam1));
-                setDiagsArea(diagsArea);
 		step_ = HANDLE_ERROR_;
 		break;
 	      } 
@@ -3634,11 +3604,9 @@ short ExExeUtilLobUpdateTcb::work()
 		     lobHandle_,
 		     lobHandleLen_))
 		  {
-		    ComDiagsArea *diagsArea = getDiagsArea();
 		    ExRaiseSqlError(getMyHeap(),
-				    &diagsArea,
+				    &diagsArea_,
 				    (ExeErrorCode)(EXE_INVALID_LOB_HANDLE));
-                    setDiagsArea(diagsArea);
 		    step_ = HANDLE_ERROR_;
 		    break;
 		  }
@@ -3747,12 +3715,10 @@ short ExExeUtilLobUpdateTcb::work()
 		Lng32 cliError = 0;
 
 		Lng32 intParam1 = -retcode;
-		ComDiagsArea * diagsArea = getDiagsArea();
-		ExRaiseSqlError(getHeap(), &diagsArea, 
+		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceUpdate",
 				getLobErrStr(intParam1));
-                setDiagsArea(diagsArea);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }  
@@ -3844,12 +3810,10 @@ short ExExeUtilLobUpdateTcb::work()
 		Lng32 cliError = 0;
 
 		Lng32 intParam1 = -retcode;
-		ComDiagsArea * diagsArea = getDiagsArea();
-		ExRaiseSqlError(getHeap(), &diagsArea, 
+		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceUpdate",
 			 	getLobErrStr(intParam1));
-                setDiagsArea(diagsArea);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }  
@@ -3943,12 +3907,10 @@ short ExExeUtilLobUpdateTcb::work()
 		Lng32 cliError = 0;
 
 		Lng32 intParam1 = -retcode;
-		ComDiagsArea * diagsArea = getDiagsArea();
-		ExRaiseSqlError(getHeap(), &diagsArea, 
+		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceUpdate",
 				getLobErrStr(intParam1));
-                setDiagsArea(diagsArea);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }  
@@ -4111,12 +4073,10 @@ short ExExeUtilFileExtractTcb::work()
 		Lng32 cliError = 0;
 
 		Lng32 intParam1 = -retcode;
-		ComDiagsArea * diagsArea = getDiagsArea();
-		ExRaiseSqlError(getHeap(), &diagsArea, 
+		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceSelectCursor/open",
 				getLobErrStr(intParam1));
-                setDiagsArea(diagsArea);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -4159,12 +4119,10 @@ short ExExeUtilFileExtractTcb::work()
 		Lng32 cliError = 0;
 
 		Lng32 intParam1 = -retcode;
-		ComDiagsArea * diagsArea = getDiagsArea();
-		ExRaiseSqlError(getHeap(), &diagsArea, 
+		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceSelectCursor/read",
 				getLobErrStr(intParam1));
-                setDiagsArea(diagsArea);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -4216,12 +4174,10 @@ short ExExeUtilFileExtractTcb::work()
 		Lng32 cliError = 0;
 
 		Lng32 intParam1 = -retcode;
-		ComDiagsArea * diagsArea = getDiagsArea();
-		ExRaiseSqlError(getHeap(), &diagsArea, 
+		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceSelectCursor/close",
 				getLobErrStr(intParam1));
-                setDiagsArea(diagsArea);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -4353,12 +4309,10 @@ short ExExeUtilFileLoadTcb::work()
 		    Lng32 cliError = 0;
 		    
 		    Lng32 intParam1 = -retcode;
-		    ComDiagsArea * diagsArea = getDiagsArea();
-		    ExRaiseSqlError(getHeap(), &diagsArea, 
+		    ExRaiseSqlError(getHeap(), &diagsArea_, 
 				    (ExeErrorCode)(8442), NULL, &intParam1, 
 				    &cliError, NULL, (char*)"ExpLOBInterfaceCreate",
 				    getLobErrStr(intParam1));
-                    setDiagsArea(diagsArea);
 		    step_ = HANDLE_ERROR_;
 		    break;
 		  }
@@ -4385,11 +4339,9 @@ short ExExeUtilFileLoadTcb::work()
 		Lng32 cliError = 0;
 
 		Lng32 intParam1 = -1;
-		ComDiagsArea * diagsArea = getDiagsArea();
-		ExRaiseSqlError(getHeap(), &diagsArea, 
+		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"SourceFile open");
-                setDiagsArea(diagsArea);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -4429,11 +4381,9 @@ short ExExeUtilFileLoadTcb::work()
 		Lng32 cliError = 0;
 
 		Lng32 intParam1 = -1;
-		ComDiagsArea * diagsArea = getDiagsArea();
-		ExRaiseSqlError(getHeap(), &diagsArea, 
+		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"SourceFile read");
-                setDiagsArea(diagsArea);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -4474,12 +4424,10 @@ short ExExeUtilFileLoadTcb::work()
 		Lng32 cliError = 0;
 
 		Lng32 intParam1 = -retcode;
-		ComDiagsArea * diagsArea = getDiagsArea();
-		ExRaiseSqlError(getHeap(), &diagsArea, 
+		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceInsert",
 				getLobErrStr(intParam1));
-                setDiagsArea(diagsArea);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -4506,12 +4454,10 @@ short ExExeUtilFileLoadTcb::work()
 		Lng32 cliError = 0;
 		
 		Lng32 intParam1 = -retcode;
-		ComDiagsArea * diagsArea = getDiagsArea();
-		ExRaiseSqlError(getHeap(), &diagsArea, 
+		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceCloseFile",
 				getLobErrStr(intParam1));
-                setDiagsArea(diagsArea);
 		step_ = HANDLE_ERROR_;
 		break;
 	      }

http://git-wip-us.apache.org/repos/asf/trafodion/blob/37702da3/core/sql/executor/ExExeUtilMisc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilMisc.cpp b/core/sql/executor/ExExeUtilMisc.cpp
index 277d5e1..8ae7124 100644
--- a/core/sql/executor/ExExeUtilMisc.cpp
+++ b/core/sql/executor/ExExeUtilMisc.cpp
@@ -102,7 +102,7 @@ short ExExeUtilFastDeleteTcb::doPurgedataCat(char * stmt)
   cliRC = holdAndSetCQD("EXE_PARALLEL_PURGEDATA", "OFF");
   if (cliRC < 0)
     {
-      setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+      cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
       return -1;
     }
 
@@ -111,7 +111,7 @@ short ExExeUtilFastDeleteTcb::doPurgedataCat(char * stmt)
 
   if (cliRC < 0)
     {
-      setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+      cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
       restoreCQD("EXE_PARALLEL_PURGEDATA");
       return -1;
     }
@@ -156,7 +156,7 @@ short ExExeUtilFastDeleteTcb::doLabelPurgedata(char * objectName,
 
   if (cliRC < 0)
     {
-      setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+      cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
       retcode = -1;
       goto cleanUpAndReturn;
     }
@@ -214,7 +214,7 @@ short ExExeUtilFastDeleteTcb::doFastDelete(char * objectName,
     executeImmediate("control query shape hold;");
   if (cliRC < 0)
     {
-      setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+      cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
       retcode = -1;
       goto cleanUpAndReturn;
     }
@@ -223,7 +223,7 @@ short ExExeUtilFastDeleteTcb::doFastDelete(char * objectName,
     cliInterface()->executeImmediate("control query shape esp_exchange(cut);");
   if (cliRC < 0)
     {
-      setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+      cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
       retcode = -1;
       goto cleanUpAndReturn;
     }
@@ -235,7 +235,7 @@ short ExExeUtilFastDeleteTcb::doFastDelete(char * objectName,
 	executeImmediate("control query default mv_internal_ignore_uninitialized 'ON';");
       if (cliRC < 0)
 	{
-          setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+          cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 	  retcode = -1;
 	  goto cleanUpAndReturn;
 	}
@@ -275,7 +275,7 @@ short ExExeUtilFastDeleteTcb::doFastDelete(char * objectName,
 
   if (cliRC < 0)
     {
-      setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+      cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
       retcode = -1;
       goto cleanUpAndReturn;
     }
@@ -333,11 +333,9 @@ short ExExeUtilFastDeleteTcb::injectError(const char * val)
       ((e2) && (strcmp(e2, val) == 0)))
     {
       Lng32 errNumParam = ((Lng32)str_atoi(val, strlen(val)));
-      ComDiagsArea * diagsArea = getDiagsArea();
-      ExRaiseSqlError(getHeap(), &diagsArea, -EXE_ERROR_INJECTED,
+      ExRaiseSqlError(getHeap(), &diagsArea_, -EXE_ERROR_INJECTED,
           &errNumParam, NULL, NULL,   
 	  (e1 ? "SQLMX_TEST_POINT" : "SQLMX_PPD_ERR_TEST_POINT"));
-      setDiagsArea(diagsArea);
       return -EXE_ERROR_INJECTED;
     }
   return 0;
@@ -408,7 +406,7 @@ short ExExeUtilFastDeleteTcb::work()
 		    cliRC = cliInterface()->beginWork();
 		    if (cliRC < 0)
 		      {
-                        setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                        cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 			step_ = ERROR_;
 			break;
 		      }
@@ -443,7 +441,7 @@ short ExExeUtilFastDeleteTcb::work()
 	      {
 		if (cliRC < 0)
 		  {
-                    setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		    step_ = ERROR_;
 		    break;
 		  }
@@ -456,7 +454,7 @@ short ExExeUtilFastDeleteTcb::work()
 	    cliRC = cliInterface()->beginWork();
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		step_ = ERROR_;
 		break;
 	      }
@@ -506,7 +504,7 @@ short ExExeUtilFastDeleteTcb::work()
 	      rc = injectError("10");
 	    if (rc < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		// could not acquire a ddl lock.
 		// try to purgedata using catman sequential purgedata.
 
@@ -549,7 +547,7 @@ short ExExeUtilFastDeleteTcb::work()
 	      }
 	    if (rc < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		// security validation failed
 		if ((getDiagsArea()->contains(-1017)) ||
 		    (rollbackNoPDErr))
@@ -572,7 +570,7 @@ short ExExeUtilFastDeleteTcb::work()
 	      rc = injectError("12");
 	    if (rc < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		step_ = ROLLBACK_WORK_AND_ERROR_;
 		break;
 	      }
@@ -588,7 +586,7 @@ short ExExeUtilFastDeleteTcb::work()
 		  {
 		    strcpy(failReason_, "Error during commit work.");
 
-                    setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		    step_ = ROLLBACK_WORK_AND_ERROR_;
 		    break;
 		  }
@@ -603,7 +601,7 @@ short ExExeUtilFastDeleteTcb::work()
 		strcpy(buf, "SELECT TESTEXIT;");
 		cliRC = cliInterface()->executeImmediate(buf);
 		if (cliRC < 0)
-                  setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                  cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		  
 		strcpy(failReason_, " ");
 
@@ -621,7 +619,7 @@ short ExExeUtilFastDeleteTcb::work()
 	    cliRC = cliInterface()->beginWork();
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		step_ = ERROR_;
 		break;
 	      }
@@ -732,10 +730,9 @@ short ExExeUtilFastDeleteTcb::work()
 		ComDiagsArea * diagsArea = getDiagsArea();
 		// convert all errors into warnings
 		NegateAllErrors(diagsArea);
-                ExRaiseSqlError(getHeap(), &diagsArea, -EXE_PARALLEL_PURGEDATA_FAILED,
+                ExRaiseSqlError(getHeap(), &diagsArea_, -EXE_PARALLEL_PURGEDATA_FAILED,
                     NULL, NULL, NULL,
 		    failReason_);
-                setDiagsArea(diagsArea);
 	      }
 
 	    step_ = ERROR_;
@@ -758,7 +755,7 @@ short ExExeUtilFastDeleteTcb::work()
 		strcpy(buf, "SELECT TESTEXIT;");
 		cliInterface()->executeImmediate(buf);
 		if (cliRC < 0)
-                  setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                  cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		
 		step_ = ERROR_;
 		break;
@@ -769,11 +766,9 @@ short ExExeUtilFastDeleteTcb::work()
 		// raise a warning that parallel purgedata was performed.
 		if (fdTdb().returnPurgedataWarn())
 		  {
-		    ComDiagsArea * diagsArea = getDiagsArea();
-                    ExRaiseSqlError(getHeap(), &diagsArea, EXE_PURGEDATA_CAT,
+                    ExRaiseSqlError(getHeap(), &diagsArea_, EXE_PURGEDATA_CAT,
                         NULL, NULL, NULL,
 			"Parallel", "");
-                    setDiagsArea(diagsArea);
 		  }
 		step_ = DONE_;
 	      }
@@ -787,7 +782,7 @@ short ExExeUtilFastDeleteTcb::work()
 	    cliRC = cliInterface()->beginWork();
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		step_ = ERROR_;
 		break;
 	      }
@@ -802,7 +797,7 @@ short ExExeUtilFastDeleteTcb::work()
 
 	    if (rc < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		step_ = KILL_MXCMP_AND_ERROR_;
 		break;
 	      }
@@ -819,7 +814,7 @@ short ExExeUtilFastDeleteTcb::work()
 	      rc = injectError("16");
 	    if (rc < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		step_ = KILL_MXCMP_AND_ERROR_;
 		break;
 	      }
@@ -838,7 +833,7 @@ short ExExeUtilFastDeleteTcb::work()
 		  rc = injectError("17");
 		if (rc < 0)
 		  {
-                    setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		    step_ = KILL_MXCMP_AND_ERROR_;
 		    break;
 		  }
@@ -847,7 +842,7 @@ short ExExeUtilFastDeleteTcb::work()
 	    cliRC = cliInterface()->commitWork();
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		step_ = ERROR_;
 		break;
 	      }
@@ -857,11 +852,9 @@ short ExExeUtilFastDeleteTcb::work()
 	    // raise a warning that parallel purgedata was performed.
 	    if (fdTdb().returnPurgedataWarn())
 	      {
-		ComDiagsArea * diagsArea = getDiagsArea();
-                ExRaiseSqlError(getHeap(), &diagsArea, EXE_PURGEDATA_CAT,
+                ExRaiseSqlError(getHeap(), &diagsArea_, EXE_PURGEDATA_CAT,
                     NULL, NULL, NULL,
 		    "Parallel", "");
-                setDiagsArea(diagsArea);
 	      }
 	  }
 	break;
@@ -880,16 +873,14 @@ short ExExeUtilFastDeleteTcb::work()
 	    // for parallel purgedata, or because parallel purgedata failed.
 	    if (fdTdb().returnPurgedataWarn())
 	      {
-		ComDiagsArea * diagsArea = getDiagsArea();
 		if (fdTdb().doPurgedataCat())
-                  ExRaiseSqlError(getHeap(), &diagsArea, EXE_PURGEDATA_CAT,
+                  ExRaiseSqlError(getHeap(), &diagsArea_, EXE_PURGEDATA_CAT,
                      NULL, NULL, NULL,
                      "Regular", "Reason: Query or the object did not meet the criteria for parallel purgedata.");
 		else
-                  ExRaiseSqlError(getHeap(), &diagsArea, EXE_PURGEDATA_CAT,
+                  ExRaiseSqlError(getHeap(), &diagsArea_, EXE_PURGEDATA_CAT,
                      NULL, NULL, NULL,
                      "Regular", "Reason: Parallel purgedata failed.");
-                setDiagsArea(diagsArea);
 	      }
 
 	    rc = doPurgedataCat(fdTdb().purgedataStmt());
@@ -1363,7 +1354,7 @@ short ExExeUtilLongRunningTcb::executeLongRunningQuery()
         "control query default HIST_ON_DEMAND_STATS_SIZE '0'");
       if (cliRC < 0) 
         {
-          setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+          cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 	  return cliRC;
         }
       
@@ -1372,7 +1363,7 @@ short ExExeUtilLongRunningTcb::executeLongRunningQuery()
       short rtc = processInitial(rc);
       if ((rc != 0) && (rc != 100))
         {
-          setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+          cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
         }
 
       cliRC = 
@@ -1380,7 +1371,7 @@ short ExExeUtilLongRunningTcb::executeLongRunningQuery()
             "control query default HIST_ON_DEMAND_STATS_SIZE 'RESET'");
       if (cliRC < 0) 
         {
-          setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+          cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 	  return cliRC;
         }
       
@@ -1416,7 +1407,7 @@ short ExExeUtilLongRunningTcb::executeLongRunningQuery()
       short rtc = processContinuing(rc);
       if ((rc != 0) && (rc != 100))
         {
-          setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+          cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
         }
 
 #ifdef _DEBUG
@@ -1978,7 +1969,7 @@ short ExExeUtilPopulateInMemStatsTcb::work()
 	    
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		step_ = ERROR_;
 	      }
 	    else
@@ -2034,7 +2025,7 @@ short ExExeUtilPopulateInMemStatsTcb::work()
 	    
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		step_ = ERROR_;
 	      }
 	    else
@@ -2090,7 +2081,7 @@ short ExExeUtilPopulateInMemStatsTcb::work()
 	    
 	    if (cliRC < 0)
 	      {
-                setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
+                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
 		step_ = ERROR_;
 	      }
 	    else
@@ -2563,11 +2554,9 @@ short ExExeUtilHiveQueryTcb::work()
           {
             if (HiveClient_JNI::executeHiveSQL(htTdb().getHiveQuery()) != HVC_OK)
             {
-                ComDiagsArea * diagsArea = NULL;
-                ExRaiseSqlError(getHeap(), &diagsArea, -1214,
+                ExRaiseSqlError(getHeap(), &diagsArea_, -1214,
                         NULL, NULL, NULL,
                         getSqlJniErrorStr(), htTdb().getHiveQuery()); 
-                setDiagsArea(diagsArea);
                 step_ = ERROR_;
                 break;
             }
@@ -2579,9 +2568,6 @@ short ExExeUtilHiveQueryTcb::work()
           {
             if (handleError())
               return WORK_OK;
-            if (getDiagsArea() != NULL)
-	       getDiagsArea()->clear();
-            
             step_ = DONE_;
           }
           break;

http://git-wip-us.apache.org/repos/asf/trafodion/blob/37702da3/core/sql/executor/ExExeUtilVolTab.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilVolTab.cpp b/core/sql/executor/ExExeUtilVolTab.cpp
index 365b9cd..f3db9d3 100644
--- a/core/sql/executor/ExExeUtilVolTab.cpp
+++ b/core/sql/executor/ExExeUtilVolTab.cpp
@@ -517,9 +517,7 @@ short ExExeUtilCleanupVolatileTablesTcb::work()
 	      {
 		// cannot have a transaction running.
 		// Return error.
-                ComDiagsArea * diagsArea = getDiagsArea();
-                ExRaiseSqlError(getHeap(), &diagsArea, -EXE_BEGIN_TRANSACTION_ERROR);
-                setDiagsArea(diagsArea);
+                ExRaiseSqlError(getHeap(), &diagsArea_, -EXE_BEGIN_TRANSACTION_ERROR);
 		step_ = ERROR_;
 		break;
 	      }
@@ -592,11 +590,9 @@ short ExExeUtilCleanupVolatileTablesTcb::work()
 	      {
 		// add a warning to indicate that some schemas were not
 		// dropped.
-                ComDiagsArea * diagsArea = getDiagsArea();
-                ExRaiseSqlError(getHeap(), &diagsArea, 1069,
+                ExRaiseSqlError(getHeap(), &diagsArea_, 1069,
                        NULL, NULL, NULL,
                        errorSchemas_);
-                setDiagsArea(diagsArea);
 	      }
 	    step_ = CLEANUP_HIVE_TABLES_;
 	  }

http://git-wip-us.apache.org/repos/asf/trafodion/blob/37702da3/core/sql/executor/ExHdfsScan.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExHdfsScan.cpp b/core/sql/executor/ExHdfsScan.cpp
index 91bdc62..f77d714 100644
--- a/core/sql/executor/ExHdfsScan.cpp
+++ b/core/sql/executor/ExHdfsScan.cpp
@@ -124,6 +124,7 @@ ExHdfsScanTcb::ExHdfsScanTcb(
   , hdfsScan_(NULL)
   , hdfsStats_(NULL)
   , hdfsFileInfoListAsArray_(glob->getDefaultHeap(), hdfsScanTdb.getHdfsFileInfoList()->numEntries())
+  , errBuf_(NULL)
   
 {
   Space * space = (glob ? glob->getSpace() : 0);
@@ -317,7 +318,10 @@ void ExHdfsScanTcb::freeResources()
      NADELETE(logFileHdfsClient_, HdfsClient, getHeap());
   if (hdfsScan_ != NULL) 
      NADELETE(hdfsScan_, HdfsScan, getHeap());
+  if (errBuf_ != NULL)
+     NADELETEBASIC(errBuf_, getHeap());
 }
+
 NABoolean ExHdfsScanTcb::needStatsEntry()
 {
   // stats are collected for ALL and OPERATOR options.
@@ -778,14 +782,16 @@ ExWorkProcRetcode ExHdfsScanTcb::work()
                     ComDiagsArea * diagsArea = NULL;
                     if (hdfsErrorDetail == ENOENT)
                       {
-                        char errBuf[strlen(hdfsScanTdb().tableName()) + 
-                                    strlen(hdfsFileName_) + 100];
-                        snprintf(errBuf, sizeof(errBuf),"%s (fileLoc: %s)",
+                        if (errBuf_ != NULL)
+                           NADELETEBASIC(errBuf_, getHeap());
+                        Lng32 len = strlen(hdfsScanTdb().tableName()) + strlen(hdfsFileName_) + 100;
+                           errBuf_ = new (getHeap()) char[len];
+                        snprintf(errBuf_, len, "%s (fileLoc: %s)",
                                  hdfsScanTdb().tableName(), hdfsFileName_);
                         ExRaiseSqlError(getHeap(), &diagsArea, 
                                       (ExeErrorCode)(EXE_TABLE_NOT_FOUND), NULL,
                                       NULL, NULL, NULL,
-                                      errBuf);
+                                      errBuf_);
                       }
                     else
                       ExRaiseSqlError(getHeap(), &diagsArea, 

http://git-wip-us.apache.org/repos/asf/trafodion/blob/37702da3/core/sql/executor/ExHdfsScan.h
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExHdfsScan.h b/core/sql/executor/ExHdfsScan.h
index aa01b6e..c11329f 100644
--- a/core/sql/executor/ExHdfsScan.h
+++ b/core/sql/executor/ExHdfsScan.h
@@ -376,6 +376,7 @@ protected:
   int prevRangeNum_;
   int extraBytesRead_;
   NABoolean recordSkip_;
+  char *errBuf_;
 };
 
 class ExOrcScanTcb  : public ExHdfsScanTcb

http://git-wip-us.apache.org/repos/asf/trafodion/blob/37702da3/core/sql/sqlcomp/CmpDescribe.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpDescribe.cpp b/core/sql/sqlcomp/CmpDescribe.cpp
index 1aef61a..1cd7aff 100644
--- a/core/sql/sqlcomp/CmpDescribe.cpp
+++ b/core/sql/sqlcomp/CmpDescribe.cpp
@@ -633,8 +633,8 @@ short CmpDescribe(const char *query, const RelExpr *queryExpr,
               CmpCommon::diags()->clear();
 
               *CmpCommon::diags() << DgSqlCode(-CAT_SCHEMA_DOES_NOT_EXIST_ERROR)
-                                  << DgSchemaName(objQualName.getCatalogName() +
-                                                  "." +  objQualName.getSchemaName());
+                                  << DgString0(objQualName.getCatalogName())
+                                  << DgString1(objQualName.getSchemaName());
 
               rc = -1;
               goto finally;

http://git-wip-us.apache.org/repos/asf/trafodion/blob/37702da3/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
index 6fc1863..b5db51b 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
@@ -4505,7 +4505,8 @@ void CmpSeabaseDDL::handleDDLCreateAuthorizationError(
       case CAT_SCHEMA_DOES_NOT_EXIST_ERROR:
       {
          *CmpCommon::diags() << DgSqlCode(-CAT_SCHEMA_DOES_NOT_EXIST_ERROR)
-                             << DgSchemaName(catalogName + "." + schemaName);
+                                  << DgString0(catalogName)
+                                  << DgString1(schemaName);
          break;
       }
       case CAT_NOT_AUTHORIZED:

http://git-wip-us.apache.org/repos/asf/trafodion/blob/37702da3/core/sql/sqlcomp/CmpSeabaseDDLschema.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLschema.cpp b/core/sql/sqlcomp/CmpSeabaseDDLschema.cpp
index dcc7971..1bfe3cd 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLschema.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLschema.cpp
@@ -410,7 +410,8 @@ Int64 schemaUID = getObjectTypeandOwner(&cliInterface,
  if (schemaUID < 0)
    {
       *CmpCommon::diags() << DgSqlCode(-CAT_SCHEMA_DOES_NOT_EXIST_ERROR)
-                          << DgSchemaName(catalogName + "." + schemaName);
+                                  << DgString0(catalogName)
+                                  << DgString1(schemaName);
       cmpSBD.switchBackCompiler();
       return false;
    }
@@ -547,7 +548,8 @@ void CmpSeabaseDDL::dropSeabaseSchema(StmtDDLDropSchema * dropSchemaNode)
       // A Trafodion schema does not exist if the schema object row is not
       // present: CATALOG-NAME.SCHEMA-NAME.__SCHEMA__.
       *CmpCommon::diags() << DgSqlCode(-CAT_SCHEMA_DOES_NOT_EXIST_ERROR)
-                          << DgSchemaName(schemaName.getExternalName().data());
+                                  << DgString0(catName.data())
+                                  << DgString1(schName.data());
       goto label_error;
    }
 
@@ -1107,7 +1109,8 @@ void CmpSeabaseDDL::alterSeabaseSchema(StmtDDLAlterSchema * alterSchemaNode)
       // A Trafodion schema does not exist if the schema object row is not
       // present: CATALOG-NAME.SCHEMA-NAME.__SCHEMA__.
       *CmpCommon::diags() << DgSqlCode(-CAT_SCHEMA_DOES_NOT_EXIST_ERROR)
-                          << DgSchemaName(schemaName.getExternalName().data());
+                                  << DgString0(catName.data())
+                                  << DgString1(schName.data());
       goto label_error;
    }
 
@@ -1337,7 +1340,8 @@ Int64 schemaUID = getObjectTypeandOwner(&cliInterface,catalogName.data(),
       // A Trafodion schema does not exist if the schema object row is not
       // present: CATALOG-NAME.SCHEMA-NAME.__SCHEMA__.
       *CmpCommon::diags() << DgSqlCode(-CAT_SCHEMA_DOES_NOT_EXIST_ERROR)
-                          << DgSchemaName(schemaName.data());
+                                  << DgString0(catalogName.data())
+                                  << DgString1(schemaName.data());
       return;
    }
    


Mime
View raw message