Closed janskrz closed 7 years ago
This is fixed by also fixing https://github.com/basho/bitcask/issues/251. We need to bring NIF/Erlang mode into lock step with options passed into the open call.
[posted via JIRA by Brian Sparrow]
Addressed by adding O_CREAT flag to open_file in NIF mode and educating CSE's on the needs_merge logic which cleans up left over file descriptors.
[posted via JIRA by Brian Sparrow]
I am using bitcask without riak with bitcasks default configuration. I noticed that file descriptors of deleted files are not closed whenever I call bitcask:merge/1. I have tested this for Erlang OTP 18.1 and 17.5.
The following snipped fills bitcask with random binaries and calls merge:
lsof output after running the snipped:
Repeatedly filling and merging bitcask will accumulate more and more such FDs, which are not released until bitcask:close/1 is called.
UPDATE: It seems like I can work around this problem by manually retrieving the open files from bitcasks bc_state process dictionary and calling bitcask_fileops:close_all/1.
UPDATE 2: I just noticed that bitcask:needs_merge/2 already closes file descriptors that were left open from a previous merge. This fixes my problem without relying on stupid hacks. But maybe this should be documented somewhere in case someone runs into the same problem.
Thanks, Jan