gaurav-narula commented on PR #17425:
URL: https://github.com/apache/kafka/pull/17425#issuecomment-2462146077

   > Have we considered the other alternative of making flush() in Indices and 
FileRecords check for existence?
   
   I'm not quite sure if I quite understand the "check for existence" bit. A 
couple of points for clarification
   
   Are you proposing an explicit check in `FileRecords#flush` and 
`Indices#flush`? If so, I think that would be racey - consider thread 
preemption right after the check. We can protect it by acquiring a lock but 
then the lock needs to be the same as the one acquired when [deleting the 
log](https://github.com/apache/kafka/blob/0181073d49b5a23ecdd493cd72c880a2cfc9c416/core/src/main/scala/kafka/log/UnifiedLog.scala#L1786).
 It seems a bit overkill, considering the file to be flushed may be due for 
deletion anyway.
   
   On the other hand, perhaps we can have a `maybeFlush()` in `Indices` and 
`FileRecords` which does a flush but swallows the exception, similar to what we 
do in `FileRecords.deleteIfExists` and its caller? I think it's also closer to 
how we handle things currently and avoids dealing with locks.


-- 
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.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

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

Reply via email to