[TRAFODION-2853] memory leak of ComDiagsArea in CmpContext heap of mxosrvr Fixes for the regression failures seen with b97982c4494e078c5de2d883442d86265f24dadc
This includes the change to report the error at the time of compilation for invoke, showddl commands. Earlier errors were ignored during prepare time and reported only at the time of execute for these commands Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/07f41ddb Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/07f41ddb Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/07f41ddb Branch: refs/heads/master Commit: 07f41ddb3042ac039252bd09955fb59bb80c8f9a Parents: b97982c Author: selvaganesang <selva.govindara...@esgyn.com> Authored: Mon Mar 12 23:53:49 2018 +0000 Committer: selvaganesang <selva.govindara...@esgyn.com> Committed: Mon Mar 12 23:53:49 2018 +0000 ---------------------------------------------------------------------- core/sql/arkcmp/CmpContext.cpp | 3 +-- core/sql/cli/Context.cpp | 29 +++++++++++++------- core/sql/cli/Context.h | 3 +++ core/sql/executor/ex_ddl.cpp | 8 ++++++ core/sql/generator/GenRelScan.cpp | 2 +- core/sql/optimizer/BindRelExpr.cpp | 38 ++++++++++----------------- core/sql/optimizer/RelScan.h | 15 ++++++----- core/sql/parser/SqlParserAux.cpp | 4 +-- core/sql/parser/sqlparser.y | 18 ++++++------- core/sql/regress/core/EXPECTED116 | 6 +++-- core/sql/regress/executor/EXPECTED001 | 3 ++- core/sql/regress/executor/EXPECTED013.SB | 3 ++- core/sql/regress/seabase/EXPECTED022 | 3 ++- core/sql/regress/seabase/EXPECTED026 | 9 ++++--- core/sql/sqlcomp/CmpDescribe.cpp | 7 +++-- core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp | 9 ++++--- 16 files changed, 91 insertions(+), 69 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafodion/blob/07f41ddb/core/sql/arkcmp/CmpContext.cpp ---------------------------------------------------------------------- diff --git a/core/sql/arkcmp/CmpContext.cpp b/core/sql/arkcmp/CmpContext.cpp index 5734b77..a915081 100644 --- a/core/sql/arkcmp/CmpContext.cpp +++ b/core/sql/arkcmp/CmpContext.cpp @@ -714,8 +714,6 @@ void CmpContext::switchContext() ActiveSchemaDB()->getDefaults().getSqlParser_NADefaults_Ptr(); gpClusterInfo = clusterInfo_; SqlParser_Diags = diags(); - if (CmpCommon::diags()) - CmpCommon::diags()->clear(); cmpMemMonitor = cmpMemMonitor_; } @@ -1088,6 +1086,7 @@ CmpContext::compileDirect(char *data, UInt32 data_len, CollHeap *outHeap, if (diagsArea == NULL) diagsArea = ComDiagsArea::allocate(outHeap); diagsArea->mergeAfter(*compileDiagsArea); + compileDiagsArea->clear(); } // cleanup and return if (cmpStatement && cmpStatement->readyToDie()) http://git-wip-us.apache.org/repos/asf/trafodion/blob/07f41ddb/core/sql/cli/Context.cpp ---------------------------------------------------------------------- diff --git a/core/sql/cli/Context.cpp b/core/sql/cli/Context.cpp index 5f369f8..ab84711 100644 --- a/core/sql/cli/Context.cpp +++ b/core/sql/cli/Context.cpp @@ -159,6 +159,7 @@ ContextCli::ContextCli(CliGlobals *cliGlobals) dropInProgress_(FALSE), isEmbeddedArkcmpInitialized_(FALSE), embeddedArkcmpContext_(NULL), + prevCmpContext_(NULL), ddlStmtsExecuted_(FALSE), numCliCalls_(0), jniErrorStr_(&exHeap_), @@ -4653,22 +4654,31 @@ Int32 ContextCli::switchToCmpContext(void *cmpCntxt) return (cmpCntxtInfo->getUseCount() == 1? 0: 1); // success } -Int32 ContextCli::switchBackCmpContext(void) +void ContextCli::copyDiagsAreaToPrevCmpContext() { ex_assert(cmpContextInUse_.entries(), "Invalid use of switch back call"); - // switch back CmpContext *curr = embeddedArkcmpContext_; - CmpContext *prevCmpCntxt; - if (cmpContextInUse_.getLast(prevCmpCntxt) == FALSE) - return -1; // failed to get previous CmpContext, should not have happened. + if (cmpContextInUse_.getLast(prevCmpContext_) == FALSE) + return; + if (curr->diags()->getNumber() > 0) + prevCmpContext_->diags()->mergeAfter(*curr->diags()); +} - embeddedArkcmpContext_ = prevCmpCntxt; - cmpCurrentContext = prevCmpCntxt; // restore the thread global +Int32 ContextCli::switchBackCmpContext(void) +{ + if (prevCmpContext_ == NULL) + { + ex_assert(cmpContextInUse_.entries(), "Invalid use of switch back call"); + if (cmpContextInUse_.getLast(prevCmpContext_) == FALSE) + return -1; + } + // switch back + CmpContext *curr = embeddedArkcmpContext_; - // merge diags to previous CmpContext - prevCmpCntxt->diags()->mergeAfter(*curr->diags()); + embeddedArkcmpContext_ = prevCmpContext_; + cmpCurrentContext = prevCmpContext_; // restore the thread global // book keeping CmpContextInfo *cmpCntxtInfo; @@ -4686,6 +4696,7 @@ Int32 ContextCli::switchBackCmpContext(void) cmpCurrentContext->switchBackContext(); deinitializeArkcmp(); + prevCmpContext_ = NULL; return 0; // success } http://git-wip-us.apache.org/repos/asf/trafodion/blob/07f41ddb/core/sql/cli/Context.h ---------------------------------------------------------------------- diff --git a/core/sql/cli/Context.h b/core/sql/cli/Context.h index f2da6c8..66ddc5b 100644 --- a/core/sql/cli/Context.h +++ b/core/sql/cli/Context.h @@ -305,6 +305,8 @@ private: NABoolean isEmbeddedArkcmpInitialized_; CmpContext * embeddedArkcmpContext_; + CmpContext * prevCmpContext_; + // pointer to the array of server versions used to communicate with ARKCMP. ARRAY(ExSqlComp *) arkcmpArray_; @@ -810,6 +812,7 @@ public: Int32 switchToCmpContext(Int32 cmpCntxtType); Int32 switchToCmpContext(void *cmpCntxt); Int32 switchBackCmpContext(void); + void copyDiagsAreaToPrevCmpContext(); NABoolean isDropInProgress() { return dropInProgress_; } void setDropInProgress() { dropInProgress_ = TRUE; }; http://git-wip-us.apache.org/repos/asf/trafodion/blob/07f41ddb/core/sql/executor/ex_ddl.cpp ---------------------------------------------------------------------- diff --git a/core/sql/executor/ex_ddl.cpp b/core/sql/executor/ex_ddl.cpp index 45673ef..ed04c04 100644 --- a/core/sql/executor/ex_ddl.cpp +++ b/core/sql/executor/ex_ddl.cpp @@ -947,6 +947,7 @@ short ExDescribeTcb::work() ComDiagsArea *da = NULL; ComDiagsArea *diagsArea; NAHeap *arkcmpHeap = currContext()->exHeap(); // same heap, see cli/Context.h + NABoolean deleteTmpDa = FALSE; while (1) { switch (pstate.step_) @@ -1015,6 +1016,9 @@ short ExDescribeTcb::work() { pstate.step_ = HANDLE_ERROR_; } + // ComDiagsDa is allocated in compileDirect, needs to be deallocated + if (da != NULL) + deleteTmpDa = TRUE; } else if (getArkcmp()) // regular arkcmp exists { @@ -1144,6 +1148,8 @@ short ExDescribeTcb::work() up_entry->setDiagsArea(da); up_entry->getAtp()->getDiagsArea()->incrRefCount(); // Reset the da for the next error/warning. + if (deleteTmpDa) + da->decrRefCount(); da = NULL; } @@ -1188,6 +1194,8 @@ short ExDescribeTcb::work() // insert into parent qparent_.up->insert(); + if (deleteTmpDa) + da->decrRefCount(); // reset the diagsArea for the next error to be set properly. da = NULL; pstate.step_ = DONE_; http://git-wip-us.apache.org/repos/asf/trafodion/blob/07f41ddb/core/sql/generator/GenRelScan.cpp ---------------------------------------------------------------------- diff --git a/core/sql/generator/GenRelScan.cpp b/core/sql/generator/GenRelScan.cpp index df4b303..827b94c 100644 --- a/core/sql/generator/GenRelScan.cpp +++ b/core/sql/generator/GenRelScan.cpp @@ -102,7 +102,7 @@ short Describe::codeGen(Generator * generator) else if (format_ == SHOWSTATS_) type = ComTdbDescribe::SHOWSTATS_; else if (format_ == TRANSACTION_) type = ComTdbDescribe::TRANSACTION_; else if (format_ == SHORT_) type = ComTdbDescribe::SHORT_; - else if (format_ == LONG_) type = ComTdbDescribe::LONG_; + else if (format_ == SHOWDDL_) type = ComTdbDescribe::LONG_; else if (format_ == PLAN_) type = ComTdbDescribe::PLAN_; else if (format_ == LABEL_) type = ComTdbDescribe::LABEL_; else if (format_ == SHAPE_) type = ComTdbDescribe::SHAPE_; http://git-wip-us.apache.org/repos/asf/trafodion/blob/07f41ddb/core/sql/optimizer/BindRelExpr.cpp ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/BindRelExpr.cpp b/core/sql/optimizer/BindRelExpr.cpp index 6c34fca..046989c 100644 --- a/core/sql/optimizer/BindRelExpr.cpp +++ b/core/sql/optimizer/BindRelExpr.cpp @@ -14698,12 +14698,9 @@ RelExpr *Describe::bindNode(BindWA *bindWA) if (! describedTableName_.getQualifiedNameObj().getObjectName().isNull()) { - if ((getFormat() >= CONTROL_FIRST_) && - (getFormat() <= CONTROL_LAST_)) - { + if (getIsControl()) describedTableName_.applyDefaults(bindWA, bindWA->getDefaultSchema()); - } - else + if (NOT getIsControl()) { // do not override schema for showddl bindWA->setToOverrideSchema(FALSE); @@ -14712,27 +14709,20 @@ RelExpr *Describe::bindNode(BindWA *bindWA) // describedTableName_ is qualified by getNATable if (describedTableName_.getQualifiedNameObj().getSchemaName().isNull()) setToTryPublicSchema(TRUE); - - bindWA->getNATable(describedTableName_); - if (bindWA->errStatus()) + + if ((getFormat() == Describe::INVOKE_) || + (getFormat() == Describe::SHOWDDL_) && + (getLabelAnsiNameSpace() == COM_TABLE_NAME) && + (NOT getIsSchema())) { - // if volatile related error, return it. - // Otherwise, clear diags and let this error be caught - // when describe is executed. - if ((CmpCommon::diags()->mainSQLCODE() == -4190) || - (CmpCommon::diags()->mainSQLCODE() == -4191) || - (CmpCommon::diags()->mainSQLCODE() == -4192) || - (CmpCommon::diags()->mainSQLCODE() == -4193) || - (CmpCommon::diags()->mainSQLCODE() == -4155) || // define not supported - (CmpCommon::diags()->mainSQLCODE() == -4086) || // catch Define Not Found error - (CmpCommon::diags()->mainSQLCODE() == -30044)|| // default schema access error - (CmpCommon::diags()->mainSQLCODE() == -4261) || // reserved schema - (CmpCommon::diags()->mainSQLCODE() == -1398)) // uninit hbase - return this; - - CmpCommon::diags()->clear(); - bindWA->resetErrStatus(); + bindWA->getNATable(describedTableName_); + if (bindWA->errStatus()) + { + return this; + } } + else + describedTableName_.applyDefaults(bindWA, bindWA->getDefaultSchema()); } if (pUUDFName_ NEQ NULL AND NOT pUUDFName_->getObjectName().isNull()) { http://git-wip-us.apache.org/repos/asf/trafodion/blob/07f41ddb/core/sql/optimizer/RelScan.h ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/RelScan.h b/core/sql/optimizer/RelScan.h index cc36f79..c026914 100644 --- a/core/sql/optimizer/RelScan.h +++ b/core/sql/optimizer/RelScan.h @@ -1615,7 +1615,7 @@ public: INVOKE_, // describe sql/mp INVOKE style SHOWSTATS_, //display histograms for specified table SHORT_, // just show ddl for table - LONG_, // show everything about this table (ddl, indexes, views, etc) + SHOWDDL_, // show everything about this table (ddl, indexes, views, etc) PLAN_, // return information about runtime plan. Currently, details // about expressions and clauses are the only info returned. // For internal debugging use only. Not externalized to users. @@ -1658,7 +1658,7 @@ public: Describe(char * originalQuery, const CorrName &describedTableName, - Format format = LONG_, + Format format = SHOWDDL_, ComAnsiNameSpace labelAnsiNameSpace = COM_TABLE_NAME, ULng32 flags = 0, NABoolean header = TRUE) @@ -1689,7 +1689,7 @@ public: Describe(char * originalQuery, const SchemaName &schemaName, - Format format = LONG_, + Format format = SHOWDDL_, ULng32 flags = 0, NABoolean header = TRUE) : Scan(REL_DESCRIBE), @@ -1732,7 +1732,7 @@ public: Describe(char * originalQuery, ComIdClass authIDClass, const NAString &authIDName, - Format format = LONG_, + Format format = SHOWDDL_, ULng32 flags = 0, NABoolean header = TRUE) : Scan(REL_DESCRIBE), @@ -1765,7 +1765,7 @@ public: // constructor used for SHOWDDL USER and SHOWDDL ROLE Describe(char * originalQuery, const NAString &componentName, - Format format = LONG_, + Format format = SHOWDDL_, ULng32 flags = 0, NABoolean header = TRUE) : Scan(REL_DESCRIBE), @@ -1874,6 +1874,9 @@ public: return labelAnsiNameSpace_; } + NABoolean getIsControl() const { return ((getFormat() >= CONTROL_FIRST_) && + (getFormat() <= CONTROL_LAST_)); } + // TRUE => output detail (long) label info // FALSE => output short label info NABoolean getLabelDetail() const @@ -2008,7 +2011,7 @@ public: format_ == INVOKE_ || format_ == SHOWSTATS_ || format_ == SHORT_ || - format_ == LONG_ || + format_ == SHOWDDL_ || format_ == LABEL_) ; } http://git-wip-us.apache.org/repos/asf/trafodion/blob/07f41ddb/core/sql/parser/SqlParserAux.cpp ---------------------------------------------------------------------- diff --git a/core/sql/parser/SqlParserAux.cpp b/core/sql/parser/SqlParserAux.cpp index c73d78d..02f595c 100644 --- a/core/sql/parser/SqlParserAux.cpp +++ b/core/sql/parser/SqlParserAux.cpp @@ -3231,7 +3231,7 @@ SqlParserAux_buildDescribeForFunctionAndAction pDescribe = new (PARSERHEAP()) Describe ( SQLTEXT() , *optional_showddl_action_name_clause // in - const CorrName & - deep copy - , Describe::LONG_ + , Describe::SHOWDDL_ , COM_UUDF_ACTION_NAME // in - ComAnsiNameSpace labelAnsiNameSpace_ , optional_showddlroutine_options // in - long optional_showddlroutine_options ); @@ -3242,7 +3242,7 @@ SqlParserAux_buildDescribeForFunctionAndAction pDescribe = new (PARSERHEAP()) Describe ( SQLTEXT() , *actual_routine_name_of_udf_or_uudf // in - const CorrName & - deep copy - , Describe::LONG_ + , Describe::SHOWDDL_ , COM_UDF_NAME // in - ComAnsiNameSpace labelAnsiNameSpace_ , optional_showddlroutine_options // in - long optional_showddlroutine_options ); http://git-wip-us.apache.org/repos/asf/trafodion/blob/07f41ddb/core/sql/parser/sqlparser.y ---------------------------------------------------------------------- diff --git a/core/sql/parser/sqlparser.y b/core/sql/parser/sqlparser.y index 69df367..d7ea7f2 100755 --- a/core/sql/parser/sqlparser.y +++ b/core/sql/parser/sqlparser.y @@ -22695,7 +22695,7 @@ show_statement: { $$ = new (PARSERHEAP()) RelRoot(new (PARSERHEAP()) - Describe(SQLTEXT(), *$2, Describe::LONG_, + Describe(SQLTEXT(), *$2, Describe::SHOWDDL_, COM_TABLE_NAME, $3/*optional_sqlmp_option*/), REL_ROOT, new (PARSERHEAP()) @@ -22711,7 +22711,7 @@ show_statement: { $$ = new (PARSERHEAP()) RelRoot(new (PARSERHEAP()) - Describe(SQLTEXT(), *$3, Describe::LONG_, + Describe(SQLTEXT(), *$3, Describe::SHOWDDL_, COM_TABLE_NAME, $4/*optional_sqlmp_option*/), REL_ROOT, new (PARSERHEAP()) @@ -22724,7 +22724,7 @@ show_statement: ->getQualifiedNameObj().setObjectNameSpace(COM_UDF_NAME); $$ = new (PARSERHEAP()) RelRoot(new (PARSERHEAP()) - Describe(SQLTEXT(), *$3/*actual_routine_name*/, Describe::LONG_, + Describe(SQLTEXT(), *$3/*actual_routine_name*/, Describe::SHOWDDL_, COM_UDF_NAME, $4/*optional_showddl_options_lsit*/), REL_ROOT, new (PARSERHEAP()) @@ -22734,7 +22734,7 @@ show_statement: { $$ = new (PARSERHEAP()) RelRoot(new (PARSERHEAP()) - Describe(SQLTEXT(), *$3, Describe::LONG_, $4), + Describe(SQLTEXT(), *$3, Describe::SHOWDDL_, $4), REL_ROOT, new (PARSERHEAP()) ColReference(new (PARSERHEAP()) ColRefName(TRUE, PARSERHEAP()))); @@ -22743,7 +22743,7 @@ show_statement: { $$ = new (PARSERHEAP()) RelRoot(new (PARSERHEAP()) - Describe(SQLTEXT(), COM_USER_CLASS, *$3, Describe::LONG_), + Describe(SQLTEXT(), COM_USER_CLASS, *$3, Describe::SHOWDDL_), REL_ROOT, new (PARSERHEAP()) ColReference(new (PARSERHEAP()) ColRefName(TRUE, PARSERHEAP()))); @@ -22753,7 +22753,7 @@ show_statement: { $$ = new (PARSERHEAP()) RelRoot(new (PARSERHEAP()) - Describe(SQLTEXT(), COM_ROLE_CLASS, *$2, Describe::LONG_, $3), + Describe(SQLTEXT(), COM_ROLE_CLASS, *$2, Describe::SHOWDDL_, $3), REL_ROOT, new (PARSERHEAP()) ColReference(new (PARSERHEAP()) ColRefName(TRUE, PARSERHEAP()))); @@ -22776,7 +22776,7 @@ show_statement: ->getQualifiedNameObj().setObjectNameSpace(COM_LIBRARY_NAME); $$ = new (PARSERHEAP()) RelRoot(new (PARSERHEAP()) - Describe(SQLTEXT(), *$2, Describe::LONG_, COM_LIBRARY_NAME, $3), + Describe(SQLTEXT(), *$2, Describe::SHOWDDL_, COM_LIBRARY_NAME, $3), REL_ROOT, new (PARSERHEAP()) ColReference(new (PARSERHEAP()) ColRefName(TRUE, PARSERHEAP()))); delete $2; // CorrName * qualified_name @@ -22786,7 +22786,7 @@ show_statement: { $$ = new (PARSERHEAP()) RelRoot(new (PARSERHEAP()) - Describe(SQLTEXT(), *$2, Describe::LONG_, + Describe(SQLTEXT(), *$2, Describe::SHOWDDL_, COM_SEQUENCE_GENERATOR_NAME, $3), REL_ROOT, new (PARSERHEAP()) @@ -22803,7 +22803,7 @@ show_statement: ->getQualifiedNameObj().setObjectNameSpace(COM_UDF_NAME); // SPJ $$ = new (PARSERHEAP()) RelRoot(new (PARSERHEAP()) - Describe(SQLTEXT(), *$3, Describe::LONG_, COM_UDF_NAME, $4), + Describe(SQLTEXT(), *$3, Describe::SHOWDDL_, COM_UDF_NAME, $4), REL_ROOT, new (PARSERHEAP()) ColReference(new (PARSERHEAP()) ColRefName(TRUE, PARSERHEAP()))); http://git-wip-us.apache.org/repos/asf/trafodion/blob/07f41ddb/core/sql/regress/core/EXPECTED116 ---------------------------------------------------------------------- diff --git a/core/sql/regress/core/EXPECTED116 b/core/sql/regress/core/EXPECTED116 index fe69776..0d65c19 100644 --- a/core/sql/regress/core/EXPECTED116 +++ b/core/sql/regress/core/EXPECTED116 @@ -710,7 +710,8 @@ T116T1 *** ERROR[4082] Object TRAFODION.SCH.T116T2 does not exist or is inaccessible. ---- SQL operation failed with errors. +*** ERROR[8822] The statement was not prepared. + >>create table t116t2 (a int); --- SQL operation complete. @@ -732,7 +733,8 @@ T116T1 *** ERROR[4082] Object TRAFODION.SCH.T116T2 does not exist or is inaccessible. ---- SQL operation failed with errors. +*** ERROR[8822] The statement was not prepared. + >>create table t116t2 (a int); --- SQL operation complete. http://git-wip-us.apache.org/repos/asf/trafodion/blob/07f41ddb/core/sql/regress/executor/EXPECTED001 ---------------------------------------------------------------------- diff --git a/core/sql/regress/executor/EXPECTED001 b/core/sql/regress/executor/EXPECTED001 index 38fd155..39ac8ac 100755 --- a/core/sql/regress/executor/EXPECTED001 +++ b/core/sql/regress/executor/EXPECTED001 @@ -50,7 +50,8 @@ *** ERROR[4082] Object TRAFODION.SCH.T001TN does not exist or is inaccessible. ---- SQL operation failed with errors. +*** ERROR[8822] The statement was not prepared. + >>invoke t001t2; -- Definition of Trafodion table TRAFODION.SCH.T001T2 http://git-wip-us.apache.org/repos/asf/trafodion/blob/07f41ddb/core/sql/regress/executor/EXPECTED013.SB ---------------------------------------------------------------------- diff --git a/core/sql/regress/executor/EXPECTED013.SB b/core/sql/regress/executor/EXPECTED013.SB index 5c0011a..db07760 100644 --- a/core/sql/regress/executor/EXPECTED013.SB +++ b/core/sql/regress/executor/EXPECTED013.SB @@ -801,7 +801,8 @@ CREATE VOLATILE TABLE T013T1 *** ERROR[4082] Object TRAFODION.T013SCH1.T013T1 does not exist or is inaccessible. ---- SQL operation failed with errors. +*** ERROR[8822] The statement was not prepared. + >> >> >>-- store by a, 4 partns http://git-wip-us.apache.org/repos/asf/trafodion/blob/07f41ddb/core/sql/regress/seabase/EXPECTED022 ---------------------------------------------------------------------- diff --git a/core/sql/regress/seabase/EXPECTED022 b/core/sql/regress/seabase/EXPECTED022 index 2a0251d..b1efc0f 100644 --- a/core/sql/regress/seabase/EXPECTED022 +++ b/core/sql/regress/seabase/EXPECTED022 @@ -801,7 +801,8 @@ a2 ? ? *** ERROR[4082] Object TRAFODION.SCH.T022HBM1 does not exist or is inaccessible. ---- SQL operation failed with errors. +*** ERROR[8822] The statement was not prepared. + >>create external table t022hbm1 ("cf".a varchar(4) not null, +> b int) +> primary key (a) http://git-wip-us.apache.org/repos/asf/trafodion/blob/07f41ddb/core/sql/regress/seabase/EXPECTED026 ---------------------------------------------------------------------- diff --git a/core/sql/regress/seabase/EXPECTED026 b/core/sql/regress/seabase/EXPECTED026 index 219b4ab..fb16c30 100644 --- a/core/sql/regress/seabase/EXPECTED026 +++ b/core/sql/regress/seabase/EXPECTED026 @@ -37,7 +37,8 @@ *** ERROR[4082] Object TRAFODION.SCH026.T026T1 does not exist or is inaccessible. ---- SQL operation failed with errors. +*** ERROR[8822] The statement was not prepared. + >>drop table t026t1; *** ERROR[4254] Object TRAFODION.SCH026.T026T1 has invalid state and cannot be accessed. Use cleanup command to drop it. @@ -105,12 +106,14 @@ *** ERROR[4082] Object TRAFODION.SCH026.T026T0 does not exist or is inaccessible. ---- SQL operation failed with errors. +*** ERROR[8822] The statement was not prepared. + >>invoke t026t1; *** ERROR[4082] Object TRAFODION.SCH026.T026T1 does not exist or is inaccessible. ---- SQL operation failed with errors. +*** ERROR[8822] The statement was not prepared. + >> >>set parserflags 131072; http://git-wip-us.apache.org/repos/asf/trafodion/blob/07f41ddb/core/sql/sqlcomp/CmpDescribe.cpp ---------------------------------------------------------------------- diff --git a/core/sql/sqlcomp/CmpDescribe.cpp b/core/sql/sqlcomp/CmpDescribe.cpp index 26b9b3c..1aef61a 100644 --- a/core/sql/sqlcomp/CmpDescribe.cpp +++ b/core/sql/sqlcomp/CmpDescribe.cpp @@ -824,8 +824,7 @@ short CmpDescribe(const char *query, const RelExpr *queryExpr, goto finally; // we are done } - if (d->getFormat() >= Describe::CONTROL_FIRST_ && - d->getFormat() <= Describe::CONTROL_LAST_) + if (d->getIsControl()) { rc = CmpDescribeControl(d, outbuf, outbuflen, heap); goto finally; // we are done @@ -865,7 +864,7 @@ short CmpDescribe(const char *query, const RelExpr *queryExpr, // For now, schemaName of HIVE indicates a hive table. // Need to fix that at a later time when multiple hive schemas are supported. if (((d->getFormat() == Describe::INVOKE_) || - (d->getFormat() == Describe::LONG_)) && + (d->getFormat() == Describe::SHOWDDL_)) && (d->getDescribedTableName().isHive()) && (!d->getDescribedTableName().isSpecialTable())) { @@ -886,7 +885,7 @@ short CmpDescribe(const char *query, const RelExpr *queryExpr, // check if this is an hbase/seabase table. If so, describe using info from NATable. if (((d->getFormat() == Describe::INVOKE_) || - (d->getFormat() == Describe::LONG_)) && + (d->getFormat() == Describe::SHOWDDL_)) && ((d->getDescribedTableName().isHbase()) || (d->getDescribedTableName().isSeabase()))) { http://git-wip-us.apache.org/repos/asf/trafodion/blob/07f41ddb/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp ---------------------------------------------------------------------- diff --git a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp index 219b2e8..c9229af 100644 --- a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp +++ b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp @@ -175,14 +175,15 @@ short CmpSeabaseDDL::switchCompiler(Int32 cntxtType) return 0; } + short CmpSeabaseDDL::switchBackCompiler() { Lng32 diagsMark = 0; if (cmpSwitched_) { - if (CmpCommon::diags() != NULL) - diagsMark = CmpCommon::diags()->mark(); + GetCliGlobals()->currContext()->copyDiagsAreaToPrevCmpContext(); + CmpCommon::diags()->clear(); } // do restore here even though switching may not have happened, i.e. // when switchToCompiler() was not called by the embedded CI, see above. @@ -190,8 +191,8 @@ short CmpSeabaseDDL::switchBackCompiler() if (cmpSwitched_) { - // ignore new (?) from restore call but restore old diags - CmpCommon::diags()->rewind(diagsMark, TRUE); + // Clear the diagnostics area of the current CmpContext + CmpCommon::diags()->clear(); // switch back to the original commpiler, ignore return error SQL_EXEC_SWITCH_BACK_COMPILER();