You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by se...@apache.org on 2018/08/02 18:32:30 UTC

[3/5] trafodion git commit: changes to address additonal review comments.

changes to address additonal review comments.


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

Branch: refs/heads/master
Commit: 3c7212e9ed48d78c32a9323ab0749dbcf887c1cc
Parents: 0a1bb2a
Author: Prashant Vasudev <pr...@esgyn.com>
Authored: Wed Aug 1 19:25:45 2018 +0000
Committer: Prashant Vasudev <pr...@esgyn.com>
Committed: Wed Aug 1 19:25:45 2018 +0000

----------------------------------------------------------------------
 core/sql/executor/ExSequence.cpp | 17 +++++++----------
 core/sql/executor/cluster.cpp    | 24 ++++++++++++++----------
 2 files changed, 21 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/3c7212e9/core/sql/executor/ExSequence.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExSequence.cpp b/core/sql/executor/ExSequence.cpp
index 7ba414a..e66551c 100644
--- a/core/sql/executor/ExSequence.cpp
+++ b/core/sql/executor/ExSequence.cpp
@@ -1481,17 +1481,14 @@ void ExSequenceTcb::updateDiagsArea(ex_queue_entry * centry)
 
 void ExSequenceTcb::updateDiagsArea(ComDiagsArea *da)
 {
-    if (da) 
+    if (workAtp_->getDiagsArea())
+    {     
+      workAtp_->getDiagsArea()->mergeAfter(*da);
+    }
+    else
     {
-      if (workAtp_->getDiagsArea())
-      {     
-        workAtp_->getDiagsArea()->mergeAfter(*da);
-      }
-      else
-      {
-        workAtp_->setDiagsArea(da);
-        da->incrRefCount();
-      }
+      workAtp_->setDiagsArea(da);
+      da->incrRefCount();
     }
 }
 

http://git-wip-us.apache.org/repos/asf/trafodion/blob/3c7212e9/core/sql/executor/cluster.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/cluster.cpp b/core/sql/executor/cluster.cpp
index 14b150b..e986ad7 100644
--- a/core/sql/executor/cluster.cpp
+++ b/core/sql/executor/cluster.cpp
@@ -1621,7 +1621,9 @@ NABoolean Cluster::flush(ComDiagsArea *&da, CollHeap *heap) {
   //if rc != EXE_OK then it is error. 
   if(!flush(&rc)) {
     if(rc != EXE_OK) {
-      da = ComDiagsArea::allocate(heap);
+      if(da == NULL) {
+        da = ComDiagsArea::allocate(heap);
+      }
       *da << DgSqlCode(-rc);
       
       char msg[512];
@@ -1631,20 +1633,20 @@ NABoolean Cluster::flush(ComDiagsArea *&da, CollHeap *heap) {
         Lng32 scratchSysError = 0;
         Lng32 scratchSysErrorDetail = 0;
 
-        if(clusterDb_) {
+        if(clusterDb_ != NULL) {
           clusterDb_->getScratchErrorDetail(scratchError,
                                  scratchSysError,
                                  scratchSysErrorDetail,
                                  errorMsg);
 
-          str_sprintf(msg, "Scratch IO Error occurred. Scratch Error: %d, System Error: %d, System Error Detail: %d, Details: %s",
+          snprintf(msg, sizeof(msg), "Scratch IO Error occurred. Scratch Error: %d, System Error: %d, System Error Detail: %d, Details: %s",
               scratchError, scratchSysError, scratchSysErrorDetail, errorMsg);
         }
         else {
-          str_sprintf(msg, "Scratch IO Error occurred. clusterDb_ is NULL" );
+          snprintf(msg, sizeof(msg), "Scratch IO Error occurred. clusterDb_ is NULL" );
         }
       } else {
-        str_sprintf(msg, "Cluster Flush Error occurred."); 
+        snprintf(msg, sizeof(msg), "Cluster Flush Error occurred."); 
       }
       
       *da << DgString0(msg);
@@ -2378,8 +2380,10 @@ NABoolean Cluster::read(ComDiagsArea *&da, CollHeap *heap) {
   //if rc != EXE_OK then it is error. 
   if(!read(&rc)) {
     if(rc != EXE_OK) {
+      if(da == NULL) {
        da = ComDiagsArea::allocate(heap);
-       *da << DgSqlCode(-rc);
+      }
+      *da << DgSqlCode(-rc);
       
       char msg[512];
       if(rc == EXE_SORT_ERROR) {
@@ -2388,20 +2392,20 @@ NABoolean Cluster::read(ComDiagsArea *&da, CollHeap *heap) {
         Lng32 scratchSysError = 0;
         Lng32 scratchSysErrorDetail = 0;
   
-        if(clusterDb_) {
+        if(clusterDb_ != NULL) {
           clusterDb_->getScratchErrorDetail(scratchError,
                                  scratchSysError,
                                  scratchSysErrorDetail,
                                  errorMsg);
   
-          str_sprintf(msg, "Cluster::read Scratch IO Error occurred. Scratch Error: %d, System Error: %d, System Error Detail: %d, Details: %s",
+          snprintf(msg, sizeof(msg), "Cluster::read Scratch IO Error occurred. Scratch Error: %d, System Error: %d, System Error Detail: %d, Details: %s",
               scratchError, scratchSysError, scratchSysErrorDetail, errorMsg);
         }
         else {
-          str_sprintf(msg, "Cluster::read Scratch IO Error occurred. clusterDb_ is NULL" );
+          snprintf(msg, sizeof(msg), "Cluster::read Scratch IO Error occurred. clusterDb_ is NULL" );
         }
       } else {
-        str_sprintf(msg, "Cluster::read Error occurred."); 
+        snprintf(msg, sizeof(msg), "Cluster::read Error occurred."); 
       }
       
       *da << DgString0(msg);