ivankelly commented on issue #913: Refactor FileInfo locking and refcounting out IndexPersistenceMgr URL: https://github.com/apache/bookkeeper/pull/913#issuecomment-354166855 there are two race conditions here. the original one I pointed out, and the "fence and release" one. > For example, when we call release and decide to close the file, we also check if we need to flush the header or not. > Or can we flush the fence bit header right in the setFence function? This may not be a bad idea, but there would still be races. If the FileInfo which setFenced is called on has been evicted just before setFenced is called, and loaded in again, then the FileInfo for that ledger would not have the fenced bit, even though it exists on disk. We can get around the race you highlighted on this PR by doing a check on the refcount when we do a retain. On eviction from the backing cache, we do a compareAndSet(0, -0xdeadbeef). On getting from the cache, retain does a increment and get. If the refcount is positive, it will block it being deleted from the backing cache. This doesn't fill me with confidence though.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
