From 35db13c0b75ef5d4f4afc4a8f7ba5a4442cc7fa0 Mon Sep 17 00:00:00 2001 From: Jungtaek Lim Date: Thu, 2 Mar 2017 18:54:18 +0900 Subject: [PATCH] STORM-2389 Avoid instantiating Event Logger when topology.eventlogger.executors=0 --- .../src/clj/org/apache/storm/daemon/common.clj | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/storm-core/src/clj/org/apache/storm/daemon/common.clj b/storm-core/src/clj/org/apache/storm/daemon/common.clj index 003cb553a8e..20e03a07f3f 100644 --- a/storm-core/src/clj/org/apache/storm/daemon/common.clj +++ b/storm-core/src/clj/org/apache/storm/daemon/common.clj @@ -359,11 +359,18 @@ :conf {TOPOLOGY-TASKS 0})] (.put_to_bolts topology SYSTEM-COMPONENT-ID system-bolt-spec))) +(defn has-ackers? [storm-conf] + (or (nil? (storm-conf TOPOLOGY-ACKER-EXECUTORS)) (> (storm-conf TOPOLOGY-ACKER-EXECUTORS) 0))) + +(defn has-eventloggers? [storm-conf] + (or (nil? (storm-conf TOPOLOGY-EVENTLOGGER-EXECUTORS)) (> (storm-conf TOPOLOGY-EVENTLOGGER-EXECUTORS) 0))) + (defn system-topology! [storm-conf ^StormTopology topology] (validate-basic! topology) (let [ret (.deepCopy topology)] (add-acker! storm-conf ret) - (add-eventlogger! storm-conf ret) + (if (has-eventloggers? storm-conf) + (add-eventlogger! storm-conf ret)) (add-metric-components! storm-conf ret) (add-system-components! storm-conf ret) (add-metric-streams! ret) @@ -372,12 +379,6 @@ ret )) -(defn has-ackers? [storm-conf] - (or (nil? (storm-conf TOPOLOGY-ACKER-EXECUTORS)) (> (storm-conf TOPOLOGY-ACKER-EXECUTORS) 0))) - -(defn has-eventloggers? [storm-conf] - (or (nil? (storm-conf TOPOLOGY-EVENTLOGGER-EXECUTORS)) (> (storm-conf TOPOLOGY-EVENTLOGGER-EXECUTORS) 0))) - (defn num-start-executors [component] (thrift/parallelism-hint (.get_common component)))