You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2016/11/16 17:10:59 UTC

[2/7] incubator-trafodion git commit: [TRAFODION-2326] feedback comments fixed.

[TRAFODION-2326] feedback comments fixed.


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

Branch: refs/heads/master
Commit: a00f7bd213f4fe58a34345654834869c31f05691
Parents: ea03e81
Author: Prashant Vasudev <pr...@esgyn.com>
Authored: Fri Nov 4 22:00:02 2016 +0000
Committer: Prashant Vasudev <pr...@esgyn.com>
Committed: Fri Nov 4 22:00:02 2016 +0000

----------------------------------------------------------------------
 core/sql/executor/ex_sort.cpp | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a00f7bd2/core/sql/executor/ex_sort.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_sort.cpp b/core/sql/executor/ex_sort.cpp
index 0509831..3ae5bd2 100644
--- a/core/sql/executor/ex_sort.cpp
+++ b/core/sql/executor/ex_sort.cpp
@@ -160,6 +160,13 @@ void ExSortTcb::setupPoolBuffers(ex_queue_entry *pentry_down)
   else
     receivePool_ = sortPool_;
   
+  //CIF defrag option only if NOT topNSortPool_
+  defragTd_ = NULL;
+  if (considerBufferDefrag() && (topNSortPool_ != NULL))
+  {
+    defragTd_ = sortPool_->addDefragTuppDescriptor(sortTdb().sortRecLen_);
+  }
+  
 }
 
 //
@@ -217,7 +224,11 @@ ExSortTcb::ExSortTcb(const ExSortTdb & sort_tdb,
   topNSortPool_ = NULL;
   regularSortPool_ = NULL;
   partialSortPool_ = NULL;
-
+  
+  //pool reference handles. Initialized in SORT_PREP phase.
+  sortPool_ = NULL;
+  receivePool_ = NULL;
+  
   *(short *)&sortType_ = 0;
 
   sortType_.doNotAllocRec_ = 1;
@@ -327,11 +338,7 @@ ExSortTcb::ExSortTcb(const ExSortTdb & sort_tdb,
   sortCfg_->setEspInstance(espInstance);
   sortCfg_->setIpcEnvironment(glob->castToExExeStmtGlobals()->getIpcEnvironment());
 
-  defragTd_ = NULL;
-  if (considerBufferDefrag())
-  {
-    defragTd_ = sortPool_->addDefragTuppDescriptor(sortTdb().sortRecLen_);
-  }
+  
 
   nfDiags_ = NULL;
   sortUtil_->setupComputations(*sortCfg_);
@@ -387,9 +394,12 @@ void ExSortTcb::freeResources()
     delete topNSortPool_;
     topNSortPool_ = NULL;
   }
-  if (sortPool_ && (sortPool_ != receivePool_))
+  if (sortPool_)
   {
-    delete sortPool_;
+    if(sortPool_ != receivePool_)
+    {
+      delete sortPool_;
+    }
     sortPool_ = NULL;
   }
   if (receivePool_)