[ https://issues.apache.org/jira/browse/STORM-592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14246413#comment-14246413 ]
zhangjinlong edited comment on STORM-592 at 12/15/14 9:05 AM: -------------------------------------------------------------- (defrecord RollingWindow [updater merger extractor bucket-size-secs num-buckets buckets]) I think that the "bucket-size-secs" of RollingWindow is 20, and the "num-buckets" of RollingWindow is 30/540/4320. if not exchange the real argument ”num-buckets“ and "s" of “rolling-window” function, then the "bucket-size-secs" of RollingWindow is 30/540/4320, and the "num-buckets" of RollingWindow is 20. creating CommonStats under not exchange the real argument ”num-buckets“ and "s" of “rolling-window” function: (def NUM-STAT-BUCKETS 20) ;; 10 minutes, 3 hours, 1 day (def STAT-BUCKETS [30 540 4320]) (defn- mk-common-stats [rate] (CommonStats. (atom (apply keyed-counter-rolling-window-set NUM-STAT-BUCKETS STAT-BUCKETS)) (atom (apply keyed-counter-rolling-window-set NUM-STAT-BUCKETS STAT-BUCKETS)) rate)) "mk-common-stats" call " keyed-counter-rolling-window-set" ==>(apply keyed-counter-rolling-window-set 20 [30 540 4320]) (defn keyed-counter-rolling-window-set [num-buckets & bucket-sizes] (apply rolling-window-set incr-val (partial merge-with +) counter-extract num-buckets bucket-sizes)) "keyed-counter-rolling-window-set" call "rolling-window-set" ==>(apply rolling-window-set incr-val (partial merge-with +) counter-extract 20 [30 540 4320]) (defn rolling-window-set [updater merger extractor num-buckets & bucket-sizes] (RollingWindowSet. updater extractor (dofor [s bucket-sizes] (rolling-window updater merger extractor s num-buckets)) nil) ) "rolling-window-set" call constructor of "RollingWindowSet" ==>(RollingWindowSet. updater extractor (dofor [s [30 540 4320]] (rolling-window updater merger extractor s 20)) nil) constructor of "RollingWindowSet" call "rolling-window" ==>(rolling-window updater merger extractor 30 20) ==>(rolling-window updater merger extractor 540 20) ==>(rolling-window updater merger extractor 4320 20) (defn rolling-window [updater merger extractor bucket-size-secs num-buckets] (RollingWindow. updater merger extractor bucket-size-secs num-buckets {})) "rolling-window" call constructor of "RollingWindow" ==>(RollingWindow. updater merger extractor 30 20 {}) ==>(RollingWindow. updater merger extractor 540 20 {}) ==>(RollingWindow. updater merger extractor 4320 20 {}) if not exchange the real argument ”num-buckets“ and "s" of “rolling-window” function, then the "bucket-size-secs" of RollingWindow is 30/540/4320, and the "num-buckets" of RollingWindow is 20. creating CommonStats under exchange the real argument ”num-buckets“ and "s" of “rolling-window” function: ==>(RollingWindow. updater merger extractor 20 30 {}) ==>(RollingWindow. updater merger extractor 20 540 {}) ==>(RollingWindow. updater merger extractor 20 4320 {}) I think the "bucket-size-secs" should represent the size of bucket not the count of bucket; the ”num-buckets“ should represent the count of bucket not the size of bucket. so it is necessary to exchange the real argument ”num-buckets“ and "s" of “rolling-window” function https://github.com/apache/storm/pull/348 was (Author: zhangjinlong): (defrecord RollingWindow [updater merger extractor bucket-size-secs num-buckets buckets]) I think that the "bucket-size-secs" of RollingWindow is 20, and the "num-buckets" of RollingWindow is 30/540/4320. if not exchange the real argument ”num-buckets“ and "s" of “rolling-window” function, then the "bucket-size-secs" of RollingWindow is 30/540/4320, and the "num-buckets" of RollingWindow is 20. creating CommonStats under not exchange the real argument ”num-buckets“ and "s" of “rolling-window” function: (def NUM-STAT-BUCKETS 20) ;; 10 minutes, 3 hours, 1 day (def STAT-BUCKETS [30 540 4320]) (defn- mk-common-stats [rate] (CommonStats. (atom (apply keyed-counter-rolling-window-set NUM-STAT-BUCKETS STAT-BUCKETS)) (atom (apply keyed-counter-rolling-window-set NUM-STAT-BUCKETS STAT-BUCKETS)) rate)) "mk-common-stats" call " keyed-counter-rolling-window-set" ==>(apply keyed-counter-rolling-window-set 20 [30 540 4320]) (defn keyed-counter-rolling-window-set [num-buckets & bucket-sizes] (apply rolling-window-set incr-val (partial merge-with +) counter-extract num-buckets bucket-sizes)) "keyed-counter-rolling-window-set" call "rolling-window-set" ==>(apply rolling-window-set incr-val (partial merge-with +) counter-extract 20 [30 540 4320]) (defn rolling-window-set [updater merger extractor num-buckets & bucket-sizes] (RollingWindowSet. updater extractor (dofor [s bucket-sizes] (rolling-window updater merger extractor s num-buckets)) nil) ) "rolling-window-set" call constructor of "RollingWindowSet" ==>(RollingWindowSet. updater extractor (dofor [s [30 540 4320]] (rolling-window updater merger extractor s 20)) nil) constructor of "RollingWindowSet" call "rolling-window" ==>(rolling-window updater merger extractor 30 20) ==>(rolling-window updater merger extractor 540 20) ==>(rolling-window updater merger extractor 4320 20) (defn rolling-window [updater merger extractor bucket-size-secs num-buckets] (RollingWindow. updater merger extractor bucket-size-secs num-buckets {})) "rolling-window" call constructor of "RollingWindow" ==>(RollingWindow. updater merger extractor 30 20 {}) ==>(RollingWindow. updater merger extractor 540 20 {}) ==>(RollingWindow. updater merger extractor 4320 20 {}) if not exchange the real argument ”num-buckets“ and "s" of “rolling-window” function, then the "bucket-size-secs" of RollingWindow is 30/540/4320, and the "num-buckets" of RollingWindow is 20. creating CommonStats under exchange the real argument ”num-buckets“ and "s" of “rolling-window” function: ==>(RollingWindow. updater merger extractor 20 30 {}) ==>(RollingWindow. updater merger extractor 20 540 {}) ==>(RollingWindow. updater merger extractor 20 4320 {}) I think the "bucket-size-secs" should represent the size of bucket not the count of bucket; the ”num-buckets“ should represent the count of bucket not the size of bucket. so it is necessary to exchange the real argument ”num-buckets“ and "s" of “rolling-window” function https://github.com/BuDongDong/storm/commit/69af505fa002550e952129372ed88a298cea7fea > Update stats.clj "rolling-window-set" function, exchange the real argument > "num-buckets" and "s" of "rolling-window" function > ----------------------------------------------------------------------------------------------------------------------------- > > Key: STORM-592 > URL: https://issues.apache.org/jira/browse/STORM-592 > Project: Apache Storm > Issue Type: Bug > Affects Versions: 0.9.3-rc2 > Reporter: zhangjinlong > Assignee: zhangjinlong > > (defn rolling-window-set [updater merger extractor num-buckets & bucket-sizes] > (RollingWindowSet. updater extractor (dofor [s bucket-sizes] > (rolling-window updater merger extractor s num-buckets)) nil) > ) > (defrecord RollingWindow [updater merger extractor bucket-size-secs > num-buckets buckets]) > if not exchange the real argument ”num-buckets“ and "s" of “rolling-window” > function, then the "bucket-size-secs" of RollingWindow is 30/540/4320, and > the "num-buckets" of RollingWindow is 20 > I think that the "bucket-size-secs" of RollingWindow is 20, and the > "num-buckets" of RollingWindow is 30/540/4320. -- This message was sent by Atlassian JIRA (v6.3.4#6332)