[
https://issues.apache.org/jira/browse/TRAFODION-3009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16424360#comment-16424360
]
ASF GitHub Bot commented on TRAFODION-3009:
-------------------------------------------
Github user zellerh commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1504#discussion_r178900839
--- Diff: core/sql/executor/ExExeUtilExplain.cpp ---
@@ -237,8 +237,7 @@ short ExExeUtilDisplayExplainTcb::work()
executeImmediate("control session 'EXPLAIN' 'ON';");
if (retcode < 0)
{
- cliInterface()->retrieveSQLDiagnostics(getDiagsArea());
-
+
setDiagsArea(cliInterface()->allocAndRetrieveSQLDiagnostics(getDiagsArea()));
--- End diff --
From what I can tell, ExExeUtilTcb::getDiagsArea() returns a ComDiagsArea
*. The compiler then makes a reference of this temporary value and passes it to
allocAndRetrieveSQLDiagnostics(). That method may allocate a new diags area. If
we then encounter an error when merging the diags area in
allocAndRetrieveSQLDiagnostics(), it will return NULL and the allocated diags
area is leaked. See also comment above. I think it would be better to create an
ExExeUtilTcb member function like this:
```
void retrieveCliDiags() {
cliInterface_->allocAndRetrieveSQLDiagnistics(diagsArea_); }
```
Then, the line here could be replace by a call to retrieveCliDiags() and we
wouldn't have to deal with all the potential complications mentioned in this
and a previous comment.
> Streamline error handling in Executor utility commands
> ------------------------------------------------------
>
> Key: TRAFODION-3009
> URL: https://issues.apache.org/jira/browse/TRAFODION-3009
> Project: Apache Trafodion
> Issue Type: Improvement
> Components: -exe, sql-exe
> Reporter: Selvaganesan Govindarajan
> Assignee: Selvaganesan Govindarajan
> Priority: Major
>
> Executor utility commands are the commands that issue sql statements during
> its execution to complete its task. These operators are derived from
> ExExeUtilTcb operator in Trafodion. These commands assume ComDiagsArea is
> allocated in advance. This is not in accordance with the design as outlined in
> [https://cwiki.apache.org/confluence/display/TRAFODION/SQL+Diagnostics+Architecture+and+Design]
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)