Github user d2r commented on a diff in the pull request:
https://github.com/apache/storm/pull/921#discussion_r47702443
--- Diff:
storm-core/src/jvm/backtype/storm/scheduler/SupervisorDetails.java ---
@@ -119,10 +119,18 @@ private Double getTotalResource(String type) {
}
public Double getTotalMemory() {
- return getTotalResource(Config.SUPERVISOR_MEMORY_CAPACITY_MB);
+ Double totalMemory =
getTotalResource(Config.SUPERVISOR_MEMORY_CAPACITY_MB);
+ if (totalMemory == null) {
+ throw new IllegalStateException("default value for
supervisor.memory.capacity.mb is not set!");
+ }
+ return totalMemory;
}
public Double getTotalCPU() {
- return getTotalResource(Config.SUPERVISOR_CPU_CAPACITY);
+ Double totalCPU = getTotalResource(Config.SUPERVISOR_CPU_CAPACITY);
+ if (totalCPU == null) {
+ throw new IllegalStateException("default value for
supervisor.cpu.capacity is not set!");
+ }
+ return totalCPU;
--- End diff --
> Do we want to throw exceptions here? It is unclear to me that this means
the default was not set.
>
> If we need a default value, then we should add @NotNull to the validators
for these configs. Then we will see the error earlier.
Please disregard my first comment. This config does not need to be
specified, and defaults.yaml is not validated like storm.conf.
When we log, we should use the String defined in Config instead of the
literals.
---
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.
---