trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From selvaganesang <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #1228: [TRAFODION-2733] Provide an improved...
Date Wed, 13 Sep 2017 00:23:15 GMT
Github user selvaganesang commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/1228#discussion_r138499177
  
    --- Diff: core/sql/generator/GenProbeCache.cpp ---
    @@ -470,30 +463,38 @@ CostScalar ProbeCache::getEstimatedRunTimeMemoryUsage(NABoolean
perCPU)
       }
       const double outputBufferSize = resultSize * numBufferPoolEntries;  // in bytes
     
    -  // totalMemory is perCPU at this point of time.
    +  // totalMemory is perNode at this point of time.
       double totalMemory = cacheSize + outputBufferSize;
    -
    -  if ( perCPU == FALSE ) {
    -     const PhysicalProperty* const phyProp = getPhysicalProperty();
    -
    -     if (phyProp != NULL)
    -     {
    -       PartitioningFunction * partFunc = phyProp -> getPartitioningFunction() ;
    -       totalMemory *= partFunc->getCountOfPartitions();
    -     }
    +  Lng32 numOfStreams = 1;
    +  const PhysicalProperty* const phyProp = getPhysicalProperty();
    +  if (phyProp)
    +  {
    +     PartitioningFunction * partFunc = phyProp -> getPartitioningFunction() ;
    +     numOfStreams = partFunc->getCountOfPartitions();
    +     if (numOfStreams <= 0)
    +        numOfStreams = 1;
    +     double  memoryLimitPerInstance =
    +          ActiveSchemaDB()->getDefaults().getAsLong(EXE_MEMORY_FOR_PROBE_CACHE_IN_MB)
* 1024 * 1024;
    +     if (totalMemory > memoryLimitPerInstance)
    +        totalMemory = memoryLimitPerInstance;          
    +     totalMemory *= numOfStreams;
       }
    -
    -  double  memoryLimitPerCpu =
    -      ActiveSchemaDB()->getDefaults().getAsLong(EXE_MEMORY_FOR_PROBE_CACHE_IN_MB)
* 1024 * 1024;
    -  if (totalMemory > memoryLimitPerCpu)
    -     totalMemory = memoryLimitPerCpu;          
    +  if (numStreams != NULL)
    +     *numStreams = numOfStreams;
    +  if ( perNode == TRUE ) 
    --- End diff --
    
    I am curious why is it unsafe? Can you please give some details so that I can modify it
accordingly.


---

Mime
View raw message