Github user prashanth-vasudev commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/815#discussion_r86497128
  
    --- Diff: core/sql/executor/ex_sort.cpp ---
    @@ -96,6 +96,72 @@ ExOperStats * ExSortTcb::doAllocateStatsEntry(CollHeap 
*heap,
       return stat;
     }
     
    +void ExSortTcb::setupPoolBuffers(ex_queue_entry *pentry_down)
    +{
    +  CollHeap  *space = getGlobals()->getSpace();
    +  
    +  // Allocate the buffer pool.
    +  // Note that when memoryQuota system is enabled, we initialize the
    +  // pool with atleast 2 buffer. This is to accomodate sort to progress
    +  // even under extremely loaded environment(memory pressure)irrespective
    +  // of memory quota system. The buffer size is calculated taking into
    +  // account the estimate number of rows by the compiler and limited by
    +  // maximum of GEN_SORT_MAX_BUFFER_SIZE. The memory quota system will
    +  // come into force for additional buffers following this initial buffer.
    +  Lng32 numBuffs = (sortTdb().sortOptions_->memoryQuotaMB()<= 
0)?sortTdb().numBuffers_:2;
    +  Lng32 numSortBuffs = 0;
    +
    +  // need separate pools for sorting and saving result rows
    +  if (sortTdb().partialSort())
    +  {
    +     // give result pool and sort pool each half of the space
    +     numSortBuffs = numBuffs = (numBuffs + 1)/2;
    --- End diff --
    
    numBuffs is the initial number to start with. There is another constant 
max_num_buffs that determine the max buffers that can be used, controlled by 
cqd.  In the current case, the thinking is to divide the numbuffs to two halfs. 
This is done only for partialSort feature which is not enabled by default.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to