Skip to content
This repository has been archived by the owner on Jun 7, 2021. It is now read-only.

[TRAFODION-2821] Trafodion core code base needs to be thread safe #1493

Merged
merged 2 commits into from Mar 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/sql/arkcmp/CmpContext.cpp
Expand Up @@ -569,7 +569,7 @@ NABoolean CmpContext::execHiveSQL(const char* hiveSQL, ComDiagsArea *diags)

if (!result && diags)
*diags << DgSqlCode(-1214)
<< DgString0(GetCliGlobals()->getJniErrorStrPtr())
<< DgString0(GetCliGlobals()->getJniErrorStr())
<< DgString1(hiveSQL);
}

Expand Down
12 changes: 0 additions & 12 deletions core/sql/cli/Context.h
Expand Up @@ -630,18 +630,6 @@ class ContextCli : public ExGod {
xactAborted = udrXactAborted_;
}

inline void setJniErrorStr(NAString errorStr)
{ jniErrorStr_ = errorStr; }

inline void setJniErrorStr(const char *errorStr)
{ jniErrorStr_ = errorStr; }

inline NAString getJniErrorStr()
{ return jniErrorStr_; }

inline const char* getJniErrorStrPtr()
{ return (const char*)jniErrorStr_.data(); }

inline CLISemaphore *getSemaphore()
{
return cliSemaphore_;
Expand Down
20 changes: 0 additions & 20 deletions core/sql/cli/Globals.cpp
Expand Up @@ -921,26 +921,6 @@ void CliGlobals::getUdrErrorFlags(NABoolean &sqlViolation,
xactAborted);
}

void CliGlobals::setJniErrorStr(NAString errorStr)
{
currContext()->setJniErrorStr(errorStr);
}

void CliGlobals::setJniErrorStr(const char *errorStr)
{
currContext()->setJniErrorStr(errorStr);
}

NAString CliGlobals::getJniErrorStr()
{
return currContext()->getJniErrorStr();
}

const char* CliGlobals::getJniErrorStrPtr()
{
return currContext()->getJniErrorStrPtr();
}

void CliGlobals::updateTransMode(TransMode *transMode)
{
currContext()->getTransaction()->getTransMode()->
Expand Down
9 changes: 5 additions & 4 deletions core/sql/cli/Globals.h
Expand Up @@ -70,6 +70,8 @@
#include "ComExeTrace.h"
#include "ComRtUtils.h"
#include "ComSmallDefs.h"
#include "JavaObjectInterface.h"

class ContextCli;
class Statement;
class ComDiagsArea;
Expand Down Expand Up @@ -238,10 +240,9 @@ class CliGlobals : public NAAssertGlobals
inline void setUncProcess() { isUncProcess_ = TRUE; }
inline NABoolean isUncProcess() {return isUncProcess_;}
NAHeap *getCurrContextHeap();
void setJniErrorStr(NAString errorStr);
void setJniErrorStr(const char *errorStr);
NAString getJniErrorStr();
const char* getJniErrorStrPtr();
void setJniErrorStr(NAString errorStr) { setSqlJniErrorStr(errorStr); }
void setJniErrorStr(const char *errorStr) { setSqlJniErrorStr(errorStr); }
const char* getJniErrorStr() { return getSqlJniErrorStr(); }
void updateTransMode(TransMode *transMode);


Expand Down
4 changes: 2 additions & 2 deletions core/sql/executor/ExExeUtilLoad.cpp
Expand Up @@ -1259,7 +1259,7 @@ short ExExeUtilHBaseBulkLoadTcb::work()
&cliError, NULL,
" ",
getHbaseErrStr(retcode),
(char *)currContext->getJniErrorStr().data());
(char *)GetCliGlobals()->getJniErrorStr());
step_ = LOAD_END_ERROR_;
break;
}
Expand Down Expand Up @@ -1962,7 +1962,7 @@ void ExExeUtilHBaseBulkUnLoadTcb::createHdfsFileError(Int32 hdfsClientRetCode)
ComDiagsArea * diagsArea = NULL;
char* errorMsg = HdfsClient::getErrorText((HDFS_Client_RetCode)hdfsClientRetCode);
ExRaiseSqlError(getHeap(), &diagsArea, (ExeErrorCode)(8447), NULL,
NULL, NULL, NULL, errorMsg, (char *)GetCliGlobals()->currContext()->getJniErrorStr().data());
NULL, NULL, NULL, errorMsg, (char *)GetCliGlobals()->getJniErrorStr());
ex_queue_entry *pentry_up = qparent_.up->getTailEntry();
pentry_up->setDiagsArea(diagsArea);
}
Expand Down
4 changes: 2 additions & 2 deletions core/sql/executor/ExFastTransport.cpp
Expand Up @@ -1277,7 +1277,7 @@ void ExHdfsFastExtractTcb::createSequenceFileError(Int32 sfwRetCode)
(ExeErrorCode)(8447),
NULL, NULL, NULL, NULL,
errorMsg,
(char *)currContext->getJniErrorStr().data());
(char *)GetCliGlobals()->getJniErrorStr());
//ex_queue_entry *pentry_down = qParent_.down->getHeadEntry();
//pentry_down->setDiagsArea(diagsArea);
updateWorkATPDiagsArea(diagsArea);
Expand All @@ -1294,7 +1294,7 @@ void ExHdfsFastExtractTcb::createHdfsClientFileError(Int32 hdfsClientRetCode)
(ExeErrorCode)(8447),
NULL, NULL, NULL, NULL,
errorMsg,
(char *)currContext->getJniErrorStr().data());
(char *)GetCliGlobals()->getJniErrorStr());
updateWorkATPDiagsArea(diagsArea);
}

Expand Down
6 changes: 3 additions & 3 deletions core/sql/executor/ExHbaseAccess.cpp
Expand Up @@ -722,7 +722,7 @@ short ExHbaseAccessTcb::setupError(NAHeap *heap, ex_queue_pair &qparent, Lng32 r
(str ? (char*)str : (char*)" "),
getHbaseErrStr(retcode),
(str2 ? (char*)str2 :
(char *)currContext->getJniErrorStr().data()));
(char *)GetCliGlobals()->getJniErrorStr()));
pentry_down->setDiagsArea(diagsArea);
return -1;
}
Expand Down Expand Up @@ -752,7 +752,7 @@ short ExHbaseAccessTcb::setupError(Lng32 retcode, const char * str, const char *
(str ? (char*)str : (char*)" "),
getHbaseErrStr(retcode),
(str2 ? (char*)str2 :
(char *)currContext->getJniErrorStr().data()));
(char *)GetCliGlobals()->getJniErrorStr()));
pentry_down->setDiagsArea(diagsArea);
return -1;
}
Expand Down Expand Up @@ -3295,7 +3295,7 @@ void ExHbaseAccessTcb::handleException(NAHeap *heap,
loggingErrorDiags_ = ComDiagsArea::allocate(heap);
*loggingErrorDiags_ << DgSqlCode(EXE_ERROR_WHILE_LOGGING)
<< DgString0(loggingFileName_)
<< DgString1((char *)GetCliGlobals()->currContext()->getJniErrorStr().data());
<< DgString1((char *)GetCliGlobals()->getJniErrorStr());
}
return;
}
Expand Down
8 changes: 4 additions & 4 deletions core/sql/executor/ExHdfsScan.cpp
Expand Up @@ -570,7 +570,7 @@ ExWorkProcRetcode ExHdfsScanTcb::work()
hdfsStats_, hdfsScanRetCode);
if (hdfsScanRetCode != HDFS_SCAN_OK) {
setupError(EXE_ERROR_HDFS_SCAN, hdfsScanRetCode, "SETUP_HDFS_SCAN",
currContext->getJniErrorStr(), NULL);
GetCliGlobals()->getJniErrorStr(), NULL);
step_ = HANDLE_ERROR_AND_DONE;
break;
}
Expand All @@ -594,7 +594,7 @@ ExWorkProcRetcode ExHdfsScanTcb::work()
}
else if (hdfsScanRetCode != HDFS_SCAN_OK) {
setupError(EXE_ERROR_HDFS_SCAN, hdfsScanRetCode, "SETUP_HDFS_SCAN",
currContext->getJniErrorStr(), NULL);
GetCliGlobals()->getJniErrorStr(), NULL);
step_ = HANDLE_ERROR_AND_DONE;
break;
}
Expand Down Expand Up @@ -670,7 +670,7 @@ ExWorkProcRetcode ExHdfsScanTcb::work()
hdfsScanRetCode = hdfsScan_->stop();
if (hdfsScanRetCode != HDFS_SCAN_OK) {
setupError(EXE_ERROR_HDFS_SCAN, hdfsScanRetCode, "HdfsScan::stop",
currContext->getJniErrorStr(), NULL);
GetCliGlobals()->getJniErrorStr(), NULL);
step_ = HANDLE_ERROR_AND_DONE;
}
step_ = DONE;
Expand Down Expand Up @@ -2193,7 +2193,7 @@ void ExHdfsScanTcb::handleException(NAHeap *heap,
loggingErrorDiags_ = ComDiagsArea::allocate(heap);
*loggingErrorDiags_ << DgSqlCode(EXE_ERROR_WHILE_LOGGING)
<< DgString0(loggingFileName_)
<< DgString1((char *)GetCliGlobals()->currContext()->getJniErrorStr().data());
<< DgString1((char *)GetCliGlobals()->getJniErrorStr());
}
}

Expand Down