Skip to content

Commit 4862bf6

Browse files
committed
Fix scan error deadlock
If a file scan error happens during a Bitcask open operation, remember to release the newly created keydir. Before, that keydir was left behind. Subsequent open operations would see it, see that it was not ready yet and try to wait for it to load. But this would never happen, alas. If a scan error happens on opening a new directory, please release the newly created keydir so other open operations have a chance to succeed.
1 parent 8370dbf commit 4862bf6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/bitcask.erl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,7 @@ init_keydir(Dirname, WaitTime, ReadWriteModeP, KT) ->
12411241

12421242
case ScanResult of
12431243
{error, _} ->
1244+
ok = bitcask_nifs:keydir_release(KeyDir),
12441245
ScanResult;
12451246
_ ->
12461247
%% Now that we loaded all the data, mark the keydir as ready

0 commit comments

Comments
 (0)