Github user zellerh commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/25#discussion_r34482687
--- Diff: core/sql/generator/GenProbeCache.cpp ---
@@ -361,6 +361,38 @@ short ProbeCache::codeGen(Generator *generator)
// that there is room enough for one row.
}
+ double memoryLimitPerCpu =
+
ActiveSchemaDB()->getDefaults().getAsLong(EXE_MEMORY_FOR_PROBE_CACHE_IN_MB) *
1024 * 1024;
+ double estimatedMemory;
+
+ if (numInnerTuples_ > 0) {
+ estimatedMemory = numInnerTuples_ * innerRecLength;
+ if (estimatedMemory > memoryLimitPerCpu) {
+ numInnerTuples_ = memoryLimitPerCpu / innerRecLength;
+ queue_index pUpSize_calc;
+ queue_index pDownSize_calc;
+
+ pUpSize_calc = numInnerTuples_ * pUpSize / (pUpSize + pDownSize);
+ pDownSize_calc = numInnerTuples_ * pDownSize / (pUpSize +
pDownSize);
+ queue_index pq2 = 1;
+ queue_index bits = pUpSize_calc;
+ while (bits && pq2 < pUpSize_calc) {
+ bits = bits >> 1;
+ pq2 = pq2 << 1;
+ }
+ pUpSize = pq2;
--- End diff --
The code on lines 350-356 makes sure that numInnerTuples_ is greater or
equal pUpSize. This while loop seems to me to be doing the opposite, make sure
that pUpSize (and pDownSize) below are greater or equal numInnerTuples_. Should
this say: pUpSize = pq2 / 2 instead?
---
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 [email protected] or file a JIRA ticket
with INFRA.
---