[ https://issues.apache.org/jira/browse/STORM-1616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15190501#comment-15190501 ]
ASF GitHub Bot commented on STORM-1616: --------------------------------------- Github user satishd commented on a diff in the pull request: https://github.com/apache/storm/pull/1199#discussion_r55792423 --- Diff: storm-core/src/jvm/org/apache/storm/trident/TridentTopology.java --- @@ -431,6 +459,52 @@ public StormTopology build() { return builder.buildTopology(); } + + private static Map<String, Number> mergeDefaultResources(Map<String, Number> res, Map defaultConfig) { + Map<String, Number> ret = new HashMap<String, Number>(); + + Number onHeapDefault = (Number)defaultConfig.get(Config.TOPOLOGY_COMPONENT_RESOURCES_ONHEAP_MEMORY_MB); + Number offHeapDefault = (Number)defaultConfig.get(Config.TOPOLOGY_COMPONENT_RESOURCES_OFFHEAP_MEMORY_MB); + Number cpuLoadDefault = (Number)defaultConfig.get(Config.TOPOLOGY_COMPONENT_CPU_PCORE_PERCENT); + + if(res == null) { + ret.put(Config.TOPOLOGY_COMPONENT_RESOURCES_ONHEAP_MEMORY_MB, onHeapDefault); + ret.put(Config.TOPOLOGY_COMPONENT_RESOURCES_OFFHEAP_MEMORY_MB, offHeapDefault); + ret.put(Config.TOPOLOGY_COMPONENT_CPU_PCORE_PERCENT, cpuLoadDefault); + return ret; + } + + Number onHeap = res.get(Config.TOPOLOGY_COMPONENT_RESOURCES_ONHEAP_MEMORY_MB); + Number offHeap = res.get(Config.TOPOLOGY_COMPONENT_RESOURCES_OFFHEAP_MEMORY_MB); + Number cpuLoad = res.get(Config.TOPOLOGY_COMPONENT_CPU_PCORE_PERCENT); + + if(onHeap == null) { + onHeap = onHeapDefault; + } + else { + onHeap = Math.max(onHeap.doubleValue(), onHeapDefault.doubleValue()); --- End diff -- ``` java /** * The maximum amount of memory an instance of a spout/bolt will take on heap. This enables the scheduler * to allocate slots on machines with enough available memory. A default value will be set for this config if user does not override */ @isPositiveNumber(includeZero = true) public static final String TOPOLOGY_COMPONENT_RESOURCES_ONHEAP_MEMORY_MB = "topology.component.resources.onheap.memory.mb"; ``` Default value should be taken into account if load configuration is not set. It can be considered default value is over ridden when these resource load configuration values are set on stream operations. So, it should take that value instead of taking cap from the default value. > Add RAS API for Trident > ----------------------- > > Key: STORM-1616 > URL: https://issues.apache.org/jira/browse/STORM-1616 > Project: Apache Storm > Issue Type: Bug > Reporter: Kyle Nusbaum > Assignee: Kyle Nusbaum > -- This message was sent by Atlassian JIRA (v6.3.4#6332)