gardnervickers commented on pull request #7929:
URL: https://github.com/apache/kafka/pull/7929#issuecomment-640691697


   In 6152847, I changed the approach taken in this PR to move away from 
managing the producer state snapshot file as part of the segment lifecycle. 
This was done for two reasons, first it turned out to be a bit difficult to 
reason about producer state snapshot files which did not have a corresponding 
segment file (such as the snapshot taken during shutdown). Second, moving the 
management of deletion to the LogSegment ended up splitting ownership of the 
producer state snapshot file between the `LogSegment` and the 
`ProducerStateManager`, which seemed to complicate when things like truncation 
could happen.
   
   Instead, a call is made to the `ProducerStateManager` to delete any matching 
producer snapshot files when `LogSegment`'s are deleted. This occurs during 
retention and as a result of log cleaning (compaction). For producer state 
snapshot files which do not have a corresponding segment, they will be cleaned 
up on restart (unless they are the latest snapshot file).
   
   I think this ends up being simpler while more closely matching the current 
set of responsibilities, where the `ProducerStateManager` "owns" 
creating/reading/deleting snapshot files, but I'd be interested in hearing 
other opinions 😄.  
   
   cc/ @junrao


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to