Kowshik Prakasam created KAFKA-12876:
----------------------------------------
Summary: Log.roll() could forever delete producer state snapshot
of empty active segment
Key: KAFKA-12876
URL: https://issues.apache.org/jira/browse/KAFKA-12876
Project: Kafka
Issue Type: Bug
Reporter: Kowshik Prakasam
In Log.scala, during roll, if there is an existing segment of 0 size with the
newOffsetToRoll then we end up
[deleting|https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/log/Log.scala#L1610]
the active segment asynchronously. This will also delete the producer state
snapshot. However, we also [take a producer
snapshot|https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/log/Log.scala#L1639]
on newOffsetToRoll before we add the new segment. This addition could race
with snapshot deletion and we can end up losing the snapshot forever. So, in
this case the fix is to not delete the snapshot because we end up recreating it
anyway.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)