Repository: trafodion Updated Branches: refs/heads/master c52b07c14 -> 9f70ab325
http://git-wip-us.apache.org/repos/asf/trafodion/blob/4f3b0e8c/core/sql/common/Ipc.h ---------------------------------------------------------------------- diff --git a/core/sql/common/Ipc.h b/core/sql/common/Ipc.h index 85a4edb..8e69930 100644 --- a/core/sql/common/Ipc.h +++ b/core/sql/common/Ipc.h @@ -424,6 +424,7 @@ public: const GuaProcessHandle &getPhandle() const; IpcNodeName getNodeName() const; IpcCpuNum getCpuNum() const; + std::string toString() const; Int32 toAscii(char *outBuf, Int32 outBufLen) const; void addProcIdToDiagsArea(ComDiagsArea &diags, Int32 stringno = 0) const; http://git-wip-us.apache.org/repos/asf/trafodion/blob/4f3b0e8c/core/sql/executor/ExScheduler.cpp ---------------------------------------------------------------------- diff --git a/core/sql/executor/ExScheduler.cpp b/core/sql/executor/ExScheduler.cpp index 76cb9be..8ceba9d 100644 --- a/core/sql/executor/ExScheduler.cpp +++ b/core/sql/executor/ExScheduler.cpp @@ -37,6 +37,7 @@ */ +#include <dlfcn.h> #include "Platform.h" #include "ex_stdh.h" #include "ComTdb.h" @@ -54,6 +55,7 @@ #include "ExCextdecs.h" #include "ComRtUtils.h" +#include "ComSqlcmpdbg.h" const char *TraceDesc = "SubTask state trace in Scheduler"; @@ -75,6 +77,8 @@ ExScheduler::ExScheduler(ex_globals *glob) suspended_ = false; subtaskLoopCnt_ = 32; maxSubtaskLoops_ = 32; + localRootTcb_ = NULL; + pExpFuncs_ = NULL; Int32 i; for (i = 0; i < NumLastCalled; i++) { @@ -133,6 +137,9 @@ ExWorkProcRetcode ExScheduler::work(Int64 prevWaitTime) Space *space = glob_->getSpace(); CollHeap *heap = glob_->getDefaultHeap(); ExTimeStats *timer = NULL; +#ifdef NA_DEBUG_GUI + ExSubtask *subtaskSetInGui = NULL; +#endif if (suspended_) return WORK_OK; @@ -206,27 +213,18 @@ ExWorkProcRetcode ExScheduler::work(Int64 prevWaitTime) #ifdef NA_DEBUG_GUI //------------------------------------------------------ - // GSH : If using tdm_sqlexedbg dll then use the + // If using the GUI dll then use the // appropriate dll function to display the TCB tree. //------------------------------------------------------ if (msGui_) { - ExSubtask *savedSubtask = subtask; + subtaskSetInGui = subtask; - // to turn the GUI on in the debugger, set msGui_ above - // and reset it to 0 again before entering startGui(). - startGui(); + pExpFuncs_->fpDisplayExecution(&subtaskSetInGui, this); - pExpFuncs_->fpDisplayTCBTree(&subtask, this); - - if (subtask != savedSubtask) - { - // GUI changed the subtask to be executed, set - // an indicator that we have done work, otherwise - // the scheduler might exit because it thinks that - // it has finished an entire round through all subtasks - listHadWork = 1; - } + if (subtaskSetInGui == subtask) + // GUI did not alter the subtask + subtaskSetInGui = NULL; } #endif @@ -410,6 +408,22 @@ ExWorkProcRetcode ExScheduler::work(Int64 prevWaitTime) // subtasks) subtask = subtask->getNext(); + +#ifdef NA_DEBUG_GUI + if (msGui_ && subtaskSetInGui && subtaskSetInGui->getNext() != subtask) + { + // if the user clicked on a task in the GUI, then + // schedule and execute that task next + subtask = subtaskSetInGui; + subtask->schedule(); + subtaskSetInGui = NULL; + // the GUI changed the subtask to be executed, set + // an indicator that we have done work, otherwise + // the scheduler might exit because it thinks that + // it has finished an entire round through all subtasks + listHadWork = 1; + } +#endif // ----------------------------------------------------------------- // Each time we reach the end of the list, check whether any of the @@ -557,6 +571,74 @@ Int32 ExScheduler::hasActiveEvents(ex_tcb *tcb) /////////////////////////////////////////////////////////////////////////// void ExScheduler::startGui() { + msGui_ = TRUE; + + if (!pExpFuncs_ && getenv("DISPLAY")) + { + void* dlptr = dlopen("libSqlCompilerDebugger.so",RTLD_NOW); + if(dlptr != NULL) + { + fpGetSqlcmpdbgExpFuncs GetExportedFunctions; + + GetExportedFunctions = (fpGetSqlcmpdbgExpFuncs) dlsym( + dlptr, "GetSqlcmpdbgExpFuncs"); + if (GetExportedFunctions) + pExpFuncs_ = GetExportedFunctions(); + if (pExpFuncs_ == NULL) + dlclose(dlptr); + } + else // dlopen() failed + { + char *msg = dlerror(); + } + msGui_ = (pExpFuncs_ != NULL); + } +} + +void ExScheduler::stopGui() +{ + msGui_ = FALSE; + if (pExpFuncs_) + pExpFuncs_->fpDisplayExecution(NULL, this); +} + +void ExScheduler::getProcInfoForGui(int &frag, + int &inst, + int &numInst, + int &nid, + int &pid, + char *procNameBuf, + int procNameBufLen) +{ + ExExeStmtGlobals *glob = glob_->castToExExeStmtGlobals(); + MyGuaProcessHandle myh; + Int32 myCpu, myPin, myNodeNum; + SB_Int64_Type mySeqNum; + + frag = glob->getMyFragId(); + inst = glob->getMyInstanceNumber(); + numInst = glob->getNumOfInstances(); + myh.decompose(myCpu, myPin, myNodeNum, mySeqNum); + nid = myCpu; + pid = myPin; + myh.toAscii(procNameBuf, procNameBufLen); +} + +int ExScheduler::getFragInstIdForGui() +{ + ExExeStmtGlobals *stmtGlobals = glob_->castToExExeStmtGlobals(); + + ex_assert(stmtGlobals, "GUI not in master or ESP"); + + ExMasterStmtGlobals *masterGlobals = stmtGlobals->castToExMasterStmtGlobals(); + ExEspStmtGlobals *espGlobals = stmtGlobals->castToExEspStmtGlobals(); + + if (masterGlobals) + // assume there is only one active fragment instance in the master + return 0; + ex_assert(espGlobals, "stmt globals in GUI inconsistent"); + + return espGlobals->getMyFragInstanceHandle(); } ExSubtask * ExScheduler::addOrFindSubtask( http://git-wip-us.apache.org/repos/asf/trafodion/blob/4f3b0e8c/core/sql/executor/ExScheduler.h ---------------------------------------------------------------------- diff --git a/core/sql/executor/ExScheduler.h b/core/sql/executor/ExScheduler.h index c6f4af5..c8bcd31 100644 --- a/core/sql/executor/ExScheduler.h +++ b/core/sql/executor/ExScheduler.h @@ -43,7 +43,7 @@ #include "ex_god.h" -#include "ComSqlexedbg.h" +#include "ComSqlcmpdbg.h" #include "Platform.h" #include "ComExeTrace.h" @@ -135,11 +135,6 @@ struct TraceEntry { class ExScheduler : public ExGod { - //--------------------------------------------------------------------- - // GSH: These classes are defined in tdm_sqlexedbg component. - //--------------------------------------------------------------------- - friend class CSqlexedbgTCBView; - friend class CSqlexedbgTaskView; public: @@ -265,6 +260,14 @@ public: // (this method can also be called from the debugger)!!! // --------------------------------------------------------------------- void startGui(); + void stopGui(); + void getProcInfoForGui(int &frag, int &inst, int &numInst, + int &nid, int &pid, char *procNameBuf, + int procNameBufLen); + ExSubtask *getSubtasksForGui() { return subtasks_; } + ex_tcb *getLocalRootTcbForGui() { return localRootTcb_; } + int getFragInstIdForGui(); + // --------------------------------------------------------------------- // Method to aid in diagnosing looping problems // --------------------------------------------------------------------- @@ -314,8 +317,8 @@ private: // should the GUI be displayed? NABoolean msGui_; - // function pointers for Microsoft GUI - SqlexedbgExpFuncs *pExpFuncs_; + // function pointers for GUI + SqlcmpdbgExpFuncs *pExpFuncs_; // root TCB ex_tcb *localRootTcb_; @@ -359,13 +362,6 @@ private: class ExSubtask { friend class ExScheduler; - //--------------------------------------------------------------------- - // GSH: These classes are defined in tdm_sqlexedbg component. - //--------------------------------------------------------------------- - friend class CSqlexedbgTCBView; - friend class CSqlexedbgTaskView; - friend class CSqlexedbgApp; - public: @@ -379,9 +375,10 @@ public: // inline Int32 getBreakPoint() const { return breakPoint_; } inline void setBreakPoint(Int32 val) { breakPoint_ = val; } - inline const char * getTaskName() const { return taskName_; } + inline const char * getTaskName() const { return taskName_; } inline Int32 * getScheduledAddr() { return &scheduled_; } - + inline ExSubtask *getNextForGUI() { return next_; } + protected: ExSubtask( http://git-wip-us.apache.org/repos/asf/trafodion/blob/4f3b0e8c/core/sql/executor/ex_esp_frag_dir.cpp ---------------------------------------------------------------------- diff --git a/core/sql/executor/ex_esp_frag_dir.cpp b/core/sql/executor/ex_esp_frag_dir.cpp index e0205f0..6825ec0 100644 --- a/core/sql/executor/ex_esp_frag_dir.cpp +++ b/core/sql/executor/ex_esp_frag_dir.cpp @@ -715,7 +715,7 @@ void ExEspFragInstanceDir::work(Int64 prevWaitTime) case ACTIVE: #ifdef NA_DEBUG_GUI - if (instances_[currInst]->displayInGui_ == 2) + if (instances_[currInst]->displayInGui_ == 1) instances_[currInst]->globals_->getScheduler()->startGui(); #endif // To help debugging (dumps): Put current SB TCB in cli globals @@ -764,6 +764,11 @@ void ExEspFragInstanceDir::work(Int64 prevWaitTime) loopAgain = TRUE; } } +#ifdef NA_DEBUG_GUI + if (instances_[currInst]->fiState_ != ACTIVE && + instances_[currInst]->displayInGui_ == 1) + instances_[currInst]->globals_->getScheduler()->stopGui(); +#endif break; case WAIT_TO_RELEASE: http://git-wip-us.apache.org/repos/asf/trafodion/blob/4f3b0e8c/core/sql/executor/ex_esp_frag_dir.h ---------------------------------------------------------------------- diff --git a/core/sql/executor/ex_esp_frag_dir.h b/core/sql/executor/ex_esp_frag_dir.h index b494227..df7ebd8 100644 --- a/core/sql/executor/ex_esp_frag_dir.h +++ b/core/sql/executor/ex_esp_frag_dir.h @@ -41,7 +41,6 @@ // ----------------------------------------------------------------------- #include "Ex_esp_msg.h" -#include "ComSqlexedbg.h" #include "Globals.h" // ----------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafodion/blob/4f3b0e8c/core/sql/executor/ex_exe_stmt_globals.h ---------------------------------------------------------------------- diff --git a/core/sql/executor/ex_exe_stmt_globals.h b/core/sql/executor/ex_exe_stmt_globals.h index bd46988..fdfb0c6 100644 --- a/core/sql/executor/ex_exe_stmt_globals.h +++ b/core/sql/executor/ex_exe_stmt_globals.h @@ -683,6 +683,7 @@ public: virtual void getMyNodeLocalInstanceNumber( Lng32 &myNodeLocalInstanceNumber, Lng32 &numOfLocalInstances) const; + ExFragInstanceHandle getMyFragInstanceHandle() const { return myHandle_; } // Virtual methods to retrieve SeaMonster settings // http://git-wip-us.apache.org/repos/asf/trafodion/blob/4f3b0e8c/core/sql/executor/ex_globals.cpp ---------------------------------------------------------------------- diff --git a/core/sql/executor/ex_globals.cpp b/core/sql/executor/ex_globals.cpp index 673690f..c5d53b5 100644 --- a/core/sql/executor/ex_globals.cpp +++ b/core/sql/executor/ex_globals.cpp @@ -170,6 +170,11 @@ ExEidStmtGlobals * ex_globals::castToExEidStmtGlobals() return NULL; } +ExEspStmtGlobals * ex_globals::castToExEspStmtGlobals() +{ + return NULL; +} + /* void * ex_globals::seqGen() { http://git-wip-us.apache.org/repos/asf/trafodion/blob/4f3b0e8c/core/sql/executor/ex_globals.h ---------------------------------------------------------------------- diff --git a/core/sql/executor/ex_globals.h b/core/sql/executor/ex_globals.h index f6b3a94..a1bdf1a 100644 --- a/core/sql/executor/ex_globals.h +++ b/core/sql/executor/ex_globals.h @@ -49,6 +49,7 @@ class ExScheduler; class ExExeStmtGlobals; class ExMasterStmtGlobals; class ExEidStmtGlobals; +class ExEspStmtGlobals; class SqlSessionData; class ExStatisticsArea; class ex_tcb; @@ -100,6 +101,7 @@ public: virtual ExExeStmtGlobals * castToExExeStmtGlobals(); virtual ExEidStmtGlobals * castToExEidStmtGlobals(); + virtual ExEspStmtGlobals * castToExEspStmtGlobals(); inline void setStatsArea(ExStatisticsArea * statsArea) { statsArea_ = statsArea; } http://git-wip-us.apache.org/repos/asf/trafodion/blob/4f3b0e8c/core/sql/executor/ex_root.cpp ---------------------------------------------------------------------- diff --git a/core/sql/executor/ex_root.cpp b/core/sql/executor/ex_root.cpp index aa1b870..ef4dffd 100644 --- a/core/sql/executor/ex_root.cpp +++ b/core/sql/executor/ex_root.cpp @@ -111,7 +111,8 @@ ex_tcb * ex_root_tdb::build(CliGlobals *cliGlobals, ex_globals * glob) ExRtFragTable(master_glob, fragDir_, (char *) this); // if this tdb is displayed in the GUI then enable GUI display for ESPs - rtFragTable->displayGuiForESPs(displayExecution()); + if (displayExecution() > 0) + rtFragTable->displayGuiForESPs(TRUE); // remember the fragment table in the globals master_glob->setRtFragTable(rtFragTable); @@ -421,12 +422,10 @@ ex_root_tcb::ex_root_tcb( #ifdef NA_DEBUG_GUI //------------------------------------------------------------- - // GSH: If user has requested use of MS windows based GUI - // display then load the tdm_sqlexedbg dll and SetRootTcb. - // Note: displayExecution() return 2 if MS windows based GUI - // was requested. + // if the user has requested use of the executor GUI + // display then load the dll and set it up //----------------------------------------------------------- - if (root_tdb.displayExecution() == 2) + if (root_tdb.displayExecution() == 1) getGlobals()->getScheduler()->startGui(); #endif @@ -518,9 +517,9 @@ void ex_root_tcb::registerSubtasks() // there is only one queue pair to the child, no parent queue, and // the work procedure does actually no work except interrupting // the work procedure immediately when a row can be returned - sched->registerUnblockSubtask(sWork,this,qchild.down); + sched->registerUnblockSubtask(sWork,this,qchild.down,"WK"); sched->registerInsertSubtask(sWork,this,qchild.up); - asyncCancelSubtask_ = sched->registerNonQueueSubtask(sWork,this,"WK"); + asyncCancelSubtask_ = sched->registerNonQueueSubtask(sWork,this); // the frag table has its own event and work procedure, but its // work procedure is called through a method of the root TCB @@ -1451,6 +1450,8 @@ Int32 ex_root_tcb::fetch(CliGlobals *cliGlobals, stats->setStatsEnabled(getGlobals()->statsEnabled()); #ifdef NA_DEBUG_GUI + if (root_tdb().displayExecution() > 0) + getGlobals()->getScheduler()->stopGui(); ex_tcb::objectCount = 0; #endif // Make the rowset handle available http://git-wip-us.apache.org/repos/asf/trafodion/blob/4f3b0e8c/core/sql/executor/ex_root.h ---------------------------------------------------------------------- diff --git a/core/sql/executor/ex_root.h b/core/sql/executor/ex_root.h index 61e04fd..cf1ccc6 100644 --- a/core/sql/executor/ex_root.h +++ b/core/sql/executor/ex_root.h @@ -44,7 +44,6 @@ #include "ex_exe_stmt_globals.h" #include "exp_expr.h" -#include "ComSqlexedbg.h" #include "SqlTableOpenInfo.h" #include "Ipc.h" #include "rts_msg.h" http://git-wip-us.apache.org/repos/asf/trafodion/blob/4f3b0e8c/core/sql/executor/ex_send_bottom.cpp ---------------------------------------------------------------------- diff --git a/core/sql/executor/ex_send_bottom.cpp b/core/sql/executor/ex_send_bottom.cpp index 1f115f7..702641e 100644 --- a/core/sql/executor/ex_send_bottom.cpp +++ b/core/sql/executor/ex_send_bottom.cpp @@ -399,7 +399,8 @@ void ex_send_bottom_tcb::registerSubtasks() // top node. getGlobals()->getScheduler()->registerUnblockSubtask(sWork, this, - qSplit_.down); + qSplit_.down, + "WK"); getGlobals()->getScheduler()->registerInsertSubtask(sWork, this, qSplit_.up); http://git-wip-us.apache.org/repos/asf/trafodion/blob/4f3b0e8c/core/sql/executor/ex_send_top.cpp ---------------------------------------------------------------------- diff --git a/core/sql/executor/ex_send_top.cpp b/core/sql/executor/ex_send_top.cpp index c4a1ec9..d6a3241 100644 --- a/core/sql/executor/ex_send_top.cpp +++ b/core/sql/executor/ex_send_top.cpp @@ -321,8 +321,8 @@ void ex_send_top_tcb::registerSubtasks() // register events for parent queues ex_assert(qParent_.down && qParent_.up,"Parent queues must exist"); - sched->registerInsertSubtask(ex_tcb::sWork, this, qParent_.down); - sched->registerCancelSubtask(sCancel, this, qParent_.down); + sched->registerInsertSubtask(ex_tcb::sWork, this, qParent_.down, "WK"); + sched->registerCancelSubtask(sCancel, this, qParent_.down,"CN"); sched->registerUnblockSubtask(ex_tcb::sWork,this, qParent_.up); // register a non-queue event for the IPC with the send top node http://git-wip-us.apache.org/repos/asf/trafodion/blob/4f3b0e8c/core/sql/executor/ex_split_top.cpp ---------------------------------------------------------------------- diff --git a/core/sql/executor/ex_split_top.cpp b/core/sql/executor/ex_split_top.cpp index 248b336..7c5030b 100644 --- a/core/sql/executor/ex_split_top.cpp +++ b/core/sql/executor/ex_split_top.cpp @@ -359,7 +359,7 @@ void ex_split_top_tcb::registerSubtasks() // BertBert VVV // The GET_NEXT command causes the WorkDown function to be called. - sched->registerNextSubtask(sWorkDown, this, qParent_.down, "GN"); + sched->registerNextSubtask(sWorkDown, this, qParent_.down, "DN"); // BertBert ^^^ // sometimes it is necessary to schedule the workDown/Up tasks explicitly http://git-wip-us.apache.org/repos/asf/trafodion/blob/4f3b0e8c/core/sql/nskgmake/executor/Makefile ---------------------------------------------------------------------- diff --git a/core/sql/nskgmake/executor/Makefile b/core/sql/nskgmake/executor/Makefile index 691c1d2..6b128db 100755 --- a/core/sql/nskgmake/executor/Makefile +++ b/core/sql/nskgmake/executor/Makefile @@ -21,6 +21,10 @@ # @@@ END COPYRIGHT @@@ ####################################################################### +ifeq ($(FLAVOR),debug) + CXXFLAGS += -DNA_DEBUG_GUI +endif + CPPSRC := Allocator.cpp \ BufferList.cpp \ BufferReference.cpp \ http://git-wip-us.apache.org/repos/asf/trafodion/blob/4f3b0e8c/core/sql/optimizer/RelExpr.cpp ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/RelExpr.cpp b/core/sql/optimizer/RelExpr.cpp index da3a7c6..7308bba 100644 --- a/core/sql/optimizer/RelExpr.cpp +++ b/core/sql/optimizer/RelExpr.cpp @@ -10764,6 +10764,7 @@ RelRoot::RelRoot(RelExpr *input, trueRoot_(FALSE), subRoot_(FALSE), displayTree_(FALSE), + exeDisplay_(FALSE), outputVarCnt_(-1), inputVarTree_(NULL), outputVarTree_(NULL), @@ -10835,6 +10836,7 @@ RelRoot::RelRoot(RelExpr *input, trueRoot_(FALSE), subRoot_(FALSE), displayTree_(FALSE), + exeDisplay_(FALSE), outputVarCnt_(-1), inputVarTree_(NULL), outputVarTree_(NULL), @@ -10902,6 +10904,7 @@ RelRoot::RelRoot(const RelRoot & other) trueRoot_(other.trueRoot_), subRoot_(other.subRoot_), displayTree_(other.displayTree_), + exeDisplay_(other.exeDisplay_), outputVarCnt_(other.outputVarCnt_), inputVarTree_(other.inputVarTree_), outputVarTree_(other.outputVarTree_), http://git-wip-us.apache.org/repos/asf/trafodion/blob/4f3b0e8c/core/sql/optimizer/RelMisc.h ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/RelMisc.h b/core/sql/optimizer/RelMisc.h index 9275cac..6c51f02 100644 --- a/core/sql/optimizer/RelMisc.h +++ b/core/sql/optimizer/RelMisc.h @@ -337,9 +337,11 @@ public: // get a printable string that identifies the operator virtual const NAString getText() const; - // set display on/off. + // set display on/off. void setDisplayTree(NABoolean val) {displayTree_ = val;} NABoolean getDisplayTree() const {return displayTree_;} + void setExeDisplay(NABoolean val) {exeDisplay_ = val;} + NABoolean getExeDisplay() const {return exeDisplay_;} ExplainTuple *addSpecificExplainInfo(ExplainTupleMaster *explainTuple, ComTdb * tdb, @@ -624,9 +626,9 @@ public: // at bind time from the child update/delete node. ItemExpr * currOfCursorName_; - // contains the NABoolean displayTree_; // if set, this tree needs to be displayed. // Set by parser on seeing a DISPLAY command. + NABoolean exeDisplay_; // if set, display query execution in the GUI // this flag is set to TRUE if this is an update, delete or insert // query. This information is needed at runtime to rollback/abort http://git-wip-us.apache.org/repos/asf/trafodion/blob/4f3b0e8c/core/sql/optimizer/opt.cpp ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/opt.cpp b/core/sql/optimizer/opt.cpp index ffe2359..ceee395 100644 --- a/core/sql/optimizer/opt.cpp +++ b/core/sql/optimizer/opt.cpp @@ -319,12 +319,12 @@ if (CURRSTMT_OPTDEFAULTS->optimizerHeuristic2()) {//#ifdef _DEBUG #ifdef NA_DEBUG_GUI CMPASSERT(gpClusterInfo != NULL); if (CmpMain::msGui_ && CURRENTSTMT->displayGraph() ) - CmpMain::pExpFuncs_->fpSqldbgSetPointers(CURRSTMT_OPTGLOBALS->memo - ,CURRSTMT_OPTGLOBALS->task_list - ,QueryAnalysis::Instance() - ,cmpCurrentContext - ,gpClusterInfo - ); + CmpMain::pExpFuncs_->fpSqldbgSetCmpPointers(CURRSTMT_OPTGLOBALS->memo + ,CURRSTMT_OPTGLOBALS->task_list + ,QueryAnalysis::Instance() + ,cmpCurrentContext + ,gpClusterInfo + ); #endif // --------------------------------------------------------------------- @@ -634,11 +634,12 @@ if (CURRSTMT_OPTDEFAULTS->optimizerHeuristic2()) {//#ifdef _DEBUG if (CmpMain::msGui_ && CURRENTSTMT->displayGraph()) { CMPASSERT(gpClusterInfo != NULL); - CmpMain::pExpFuncs_->fpSqldbgSetPointers(CURRSTMT_OPTGLOBALS->memo, CURRSTMT_OPTGLOBALS->task_list, - QueryAnalysis::Instance(), - cmpCurrentContext, - gpClusterInfo - ); + CmpMain::pExpFuncs_->fpSqldbgSetCmpPointers( + CURRSTMT_OPTGLOBALS->memo, + CURRSTMT_OPTGLOBALS->task_list, + QueryAnalysis::Instance(), + cmpCurrentContext, + gpClusterInfo); CmpMain::pExpFuncs_->fpDisplayQueryTree(optPass, NULL, (void*) context->getSolution()); @@ -7222,12 +7223,12 @@ void QueryOptimizerDriver::DEBUG_GUI_SET_POINTERS() #ifdef NA_DEBUG_GUI CMPASSERT(gpClusterInfo != NULL); if (CmpMain::msGui_ && CURRENTSTMT->displayGraph() ) - CmpMain::pExpFuncs_->fpSqldbgSetPointers( CURRSTMT_OPTGLOBALS->memo - ,CURRSTMT_OPTGLOBALS->task_list - ,QueryAnalysis::Instance() - ,cmpCurrentContext - ,gpClusterInfo - ); + CmpMain::pExpFuncs_->fpSqldbgSetCmpPointers( + CURRSTMT_OPTGLOBALS->memo, + CURRSTMT_OPTGLOBALS->task_list, + QueryAnalysis::Instance(), + cmpCurrentContext, + gpClusterInfo); #endif } @@ -7272,12 +7273,12 @@ DEBUG_GUI_DISPLAY_AFTER_OPTIMIZATION(Context *context) if (CmpMain::msGui_ && CURRENTSTMT->displayGraph()) { CMPASSERT(gpClusterInfo != NULL); - CmpMain::pExpFuncs_->fpSqldbgSetPointers( CURRSTMT_OPTGLOBALS->memo, - CURRSTMT_OPTGLOBALS->task_list, - QueryAnalysis::Instance(), - cmpCurrentContext, - gpClusterInfo - ); + CmpMain::pExpFuncs_->fpSqldbgSetCmpPointers( + CURRSTMT_OPTGLOBALS->memo, + CURRSTMT_OPTGLOBALS->task_list, + QueryAnalysis::Instance(), + cmpCurrentContext, + gpClusterInfo); CmpMain::pExpFuncs_->fpDisplayQueryTree( optPass, NULL, (void*) context->getSolution()); http://git-wip-us.apache.org/repos/asf/trafodion/blob/4f3b0e8c/core/sql/sqlcomp/CmpMain.cpp ---------------------------------------------------------------------- diff --git a/core/sql/sqlcomp/CmpMain.cpp b/core/sql/sqlcomp/CmpMain.cpp index 650d181..da25eaf 100644 --- a/core/sql/sqlcomp/CmpMain.cpp +++ b/core/sql/sqlcomp/CmpMain.cpp @@ -454,6 +454,7 @@ void CmpMain::sqlcompCleanup(const char *input_str, int ret = dlclose(dlptr); dlptr = NULL; CmpMain::msGui_ = NULL; + CmpMain::pExpFuncs_ = NULL; } CURRENTSTMT->clearDisplayGraph(); @@ -2566,7 +2567,7 @@ CmpMain::ReturnStatus CmpMain::compile(const char *input_str, //IN if (((RelRoot *)queryExpr)->getDisplayTree() && CmpMain::msGui_ == CmpCommon::context() ) { - if (CmpMain::pExpFuncs_->fpDisplayExecution()) + if (CmpMain::pExpFuncs_->fpExecutionDisplayIsEnabled()) { //------------------------------------------------------------ // GSH: User has set a breakpoint for display in execution @@ -2575,7 +2576,7 @@ CmpMain::ReturnStatus CmpMain::compile(const char *input_str, //IN //------------------------------------------------------------ ComTdbRoot * originalRootTdb = (ComTdbRoot *) generator.getFragmentDir()->getTopObj(0); - originalRootTdb->setDisplayExecution(2); + originalRootTdb->setDisplayExecution(1); } else { @@ -2586,6 +2587,7 @@ CmpMain::ReturnStatus CmpMain::compile(const char *input_str, //IN NADELETEBASIC(cb, heap); *gen_code = 0; *gen_code_len = 0; + *CmpCommon::diags() << DgSqlCode(1032); retval = DISPLAYDONE; } } // display TCB tree @@ -2846,7 +2848,7 @@ void ExprNode::displayTree() { GetExportedFunctions = (fpGetSqlcmpdbgExpFuncs) dlsym(dlptr, "GetSqlcmpdbgExpFuncs"); if (GetExportedFunctions) - CmpMain::pExpFuncs_ = GetExportedFunctions(); + CmpMain::pExpFuncs_ = GetExportedFunctions(); if ( CmpMain::pExpFuncs_ == NULL ) { int ret = dlclose(dlptr); @@ -2855,7 +2857,9 @@ void ExprNode::displayTree() } else // dlopen() failed { - char *msg = dlerror(); + char *msg = dlerror(); + *CmpCommon::diags() << DgSqlCode(-2245) + << DgString0(msg); } if ( dlptr == NULL ) CmpMain::msGui_ = NULL ; //This Compiler Instance cannot use debugger @@ -2894,6 +2898,8 @@ void CascadesPlan::displayTree() else // dlopen() failed { char *msg = dlerror(); + *CmpCommon::diags() << DgSqlCode(-2245) + << DgString0(msg); } if ( dlptr == NULL ) CmpMain::msGui_ = NULL ; //This Compiler Instance cannot use debugger @@ -2917,12 +2923,11 @@ void initializeGUIData(SqlcmpdbgExpFuncs* expFuncs) } // Pass information about the plan to be displayed to the GUI: - expFuncs->fpSqldbgSetPointers(CURRSTMT_OPTGLOBALS->memo - ,CURRSTMT_OPTGLOBALS->task_list - ,QueryAnalysis::Instance() - ,cmpCurrentContext - ,gpClusterInfo - ); + expFuncs->fpSqldbgSetCmpPointers(CURRSTMT_OPTGLOBALS->memo, + CURRSTMT_OPTGLOBALS->task_list, + QueryAnalysis::Instance(), + cmpCurrentContext, + gpClusterInfo); } // initializeGUIData(...) #endif