basho/leveldb — pull request #77 by matthewvon (2013-04-07 15:04:04+00:00)
Title: Mv cache revert

This code reverts to Google's original cache implementation. The code for cache.cc is used twice, once for a file cache and once for a block cache. I had previously made changes that yielded nice, incremental performance improvements to the block cache. No real attempt made to check impact to file cache. Recent testing shows a file cache miss has 10x or larger impact to performance compared to block cache miss. The original Google code performs much better for the file cache. Hence I am reverting to Google's code.

There is one small adjustment. Google's code tests for "space" in the cache upon insertion of new object. The code will delete the least recently used cache items until enough space is recovered. This logic fails if the least recently used item is active. The measure of available space does not change when deleting an active cache item. The code then loops to delete the next least recently used item. The loop can end up deleting a large section of the file cache if the files are active in iterators. My adjustment only deletes non-active cache items. This adjustment was previously shipped in my cache replacement code and believed stable / tested.