> On April 6, 2015, 10:35 p.m., Jun Rao wrote: > > core/src/main/scala/kafka/server/DelayedOperation.scala, lines 104-105 > > <https://reviews.apache.org/r/31568/diff/3/?file=912738#file912738line104> > > > > We probably should call forceComplete() first and only if it returns > > true, run onExpiration(). > > Yasuhiro Matsuda wrote: > This came from the original ExpiredOperationReaper.expireNext(). Also the > comment on onExpiration says, "Call-back to execute when a delayed operation > expires, but before completion." So, I cannot call forceComplete before > onExpiration. I think we can do a little refactoring to clean this up later.
Yeah I think this is actually an old bug rather than introduced by this patch: if the task is already completed before it is timed out we should not mark it as "expired". We should change the comment of onExpiration to "Call-back to execute when a delayed operation gets expired and hence forced to complete." > On April 6, 2015, 10:35 p.m., Jun Rao wrote: > > core/src/main/scala/kafka/utils/timer/TimingWheel.scala, lines 40-44 > > <https://reviews.apache.org/r/31568/diff/3/?file=912743#file912743line40> > > > > For the hierachical part, let's say that u is 1 and n is 2. If current > > time is c, then the buckets at different levels are: > > > > level buckets > > 1 [c,c] [c+1,c+1] > > 2 [c,c+1] [c+2,c+3] > > 3 [c,c+3] [c+4,c+7] > > > > So, at any given point of time, [c,c+1] at level 2 and [c,c+3] at level > > 3 will never be used since those buckets are already covered in the lower > > level. > > > > This seems a bit wasteful. To remove that waste, we could choose to > > statt the 2nd level at c+2 and the 3rd level at c+6, etc. Do we choose to > > use the same currernt time as the start time at all levels for simplicity? > > If so, this is probably fine since the larger the n, the less the waste. > > However, it's probably worth documenting that the buckets at different > > levels can overlap? > > Yasuhiro Matsuda wrote: > Yes, the code is simpler this way. I'll add more comments. I think the levels in this case should be: level buckets 1 [c,c+1) [c+1,c+2) 2 [c,c+2) [c+2,c+4) 3 [c,c+4) [c+4,c+8) - Guozhang ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/31568/#review78668 ----------------------------------------------------------- On April 7, 2015, 9:59 p.m., Yasuhiro Matsuda wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/31568/ > ----------------------------------------------------------- > > (Updated April 7, 2015, 9:59 p.m.) > > > Review request for kafka. > > > Bugs: KAFKA-1989 > https://issues.apache.org/jira/browse/KAFKA-1989 > > > Repository: kafka > > > Description > ------- > > new purgatory implementation > > > Diffs > ----- > > core/src/main/scala/kafka/server/DelayedOperation.scala > e317676b4dd5bb5ad9770930e694cd7282d5b6d5 > core/src/main/scala/kafka/server/ReplicaManager.scala > b06f00bc10acb90083714edb5815306d1f646ddc > core/src/main/scala/kafka/utils/timer/Timer.scala PRE-CREATION > core/src/main/scala/kafka/utils/timer/TimerTask.scala PRE-CREATION > core/src/main/scala/kafka/utils/timer/TimerTaskList.scala PRE-CREATION > core/src/main/scala/kafka/utils/timer/TimingWheel.scala PRE-CREATION > core/src/test/scala/unit/kafka/server/DelayedOperationTest.scala > 7a37617395b9e4226853913b8989f42e7301de7c > core/src/test/scala/unit/kafka/utils/timer/TimerTaskListTest.scala > PRE-CREATION > core/src/test/scala/unit/kafka/utils/timer/TimerTest.scala PRE-CREATION > > Diff: https://reviews.apache.org/r/31568/diff/ > > > Testing > ------- > > > Thanks, > > Yasuhiro Matsuda > >