[
https://issues.apache.org/jira/browse/TRAFODION-2326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15633736#comment-15633736
]
ASF GitHub Bot commented on TRAFODION-2326:
-------------------------------------------
Github user DaveBirdsall commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/815#discussion_r86406998
--- 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 --
So, if numBuffs is set to 3 at line 111, then line 118 will set
numSortBuffs to 2 and numBuffs to 2, exceeding the limit of 3. Was that your
intent?
> TopN sort consumes more memory than needed.
> -------------------------------------------
>
> Key: TRAFODION-2326
> URL: https://issues.apache.org/jira/browse/TRAFODION-2326
> Project: Apache Trafodion
> Issue Type: Bug
> Components: sql-exe
> Affects Versions: 2.1-incubating
> Reporter: Prashanth Vasudev
> Assignee: Prashanth Vasudev
>
> Records that get discarded , those that do not belong to TopN rows, release
> reference to the tupp descriptor, however the released tuple memory does not
> get reused for new records from child nodes.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)