> On April 30, 2015, 10:45 p.m., Onur Karaman wrote: > > core/src/main/scala/kafka/server/DelayedOperation.scala, line 224 > > <https://reviews.apache.org/r/33731/diff/2/?file=946502#file946502line224> > > > > We can put the key inside Watchers and just use the watchersForKey > > that's already in the scope of the Watchers to avoid these call-by-name > > calls.
This approach still isn't right. Say thread t1 calls purgatory.tryCompleteElseWatch(op, Seq(k)) passes the line: val watchers = watchersFor(key) Another thread t2 calls checkAndComplete(k), hits watchers.tryCompleteWatched, completes all of its items, and removes the watcher from watchersForKey. t1 now tries to watchers.watch(operation) on the watcher which has been removed from watchersFromKey. - Onur ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/33731/#review82217 ----------------------------------------------------------- On April 30, 2015, 10:20 p.m., Guozhang Wang wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/33731/ > ----------------------------------------------------------- > > (Updated April 30, 2015, 10:20 p.m.) > > > Review request for kafka. > > > Bugs: KAFKA-2160 > https://issues.apache.org/jira/browse/KAFKA-2160 > > > Repository: kafka > > > Description > ------- > > Remove key from purgatory watchers pool when its watcher list is empty > > > Diffs > ----- > > core/src/main/scala/kafka/server/DelayedOperation.scala > 2ed9b467c2865e5717d7f6fd933cd09a5c5b22c0 > core/src/main/scala/kafka/utils/timer/Timer.scala > b8cde820a770a4e894804f1c268b24b529940650 > core/src/test/scala/unit/kafka/log/LogConfigTest.scala > f3546adee490891e0d8d0214bef00b1dd7f42227 > core/src/test/scala/unit/kafka/server/DelayedOperationTest.scala > f3ab3f4ff8eb1aa6b2ab87ba75f72eceb6649620 > > Diff: https://reviews.apache.org/r/33731/diff/ > > > Testing > ------- > > > Thanks, > > Guozhang Wang > >