On some platforms sizeof(off_t)==8, sizeof(unsigned long) == 4 so the pos argument for read and write is half garbage.
keydir now tracks the oldest tstamp in a given data file so that it's possible to know when a merge needs to be triggered for expiration purposes. Expose this info via a new summary_info/1 call. status/1 is deprecated since it returns a big tuple instead of a tidy record.
…e unnecessary auxilary NIFs
Started incrementing pending_updates when keydir frozen. Cleaned up can_itr_keydir conditions and updated comments. Added extra unit test for updates.
Still needs to be hooked up to iterators and add code to update stats and merge back into keydir->entries.
Fixes: bz://1090 Fixes a beam-wide deadlock due to the keydir RW lock being held for read in fold_keys while the VM goes in and out of the NIF. If a merger thread tries to write it will try and write lock in the put_int call. If the key folder and writer are on the same scheduler the put from the merge will block completion of the fold. The RW locks have been replaced by a mutex and count of key folders. To write the put_int call must lock the mutex and check there are not key folders. If there are it releases the mutex and retries. Writes may be blocked for a long time if there are many key folders being started. A fairer wait/notification system should be implemented once we are happy this resolves the problem. There is a stub function bitcask_nifs:put_retries you can trace on to see the count.