basho/bitcask — pull request #152 by engelsanchez (2014-03-25 00:31:10+00:00)
Title: Latest timestamp for entry not recorded correctly

When updating an entry that has already been written to the current file, the timestamp stats are not updated:

https://github.com/basho/bitcask/blob/1.6.6/c_src/bitcask_nifs.c#L668

Zero is passed in that case instead of the actual timestamp. This is likely a cut and paste error from the block above that dates back to the first commit of the timestamp stats feature.

This was discovered at a customer that updated the same key heavily, producing entire files with the same key and different timestamps. The newest timestamp of the file matched the oldest of the entries, not the newest. Come merge time, the entire file was deleted because it was considered older than the expiration threshold, when in fact the newest entry was newer.