krestenkrab / hanoidb

Erlang LSM BTree Storage
Apache License 2.0
307 stars 58 forks source link

hanoidb can't recover when one of the database files does not exists in merge process. #35

Open brigadier opened 9 years ago

brigadier commented 9 years ago

It looks like hanoidb can't recover when one of the database A or B files does not exists in merge process. When hanoidb files get damaged and hanoidb_merger:merge gets an error such as

23:09:07.647 [error] CRASH REPORT Process <0.8817.0> with 0 neighbours crashed with reason: no match of right hand value {error,enoent} in hanoidb_merger:merge/6 line 68
23:09:07.648 [error] Merger appears to have failed (reason: {badmatch,{error,enoent}}). Removing outfile database/client/data.hanoidb/X-9.data
23:09:07.648 [error] merge failed error:{badmatch,{error,enoent}} [{hanoidb_merger,merge,6,[{file,"src/hanoidb_merger.erl"},{line,68}]},{hanoidb_level,'-begin_merge/1-fun-0-',5,[{file,"src/hanoidb_level.erl"},{line,789}]},{proc_lib,init_p,3,[{file,"proc_lib.erl"},{line,224}]}]

it enters infinite loop in restart_merge_then_loop, keeps throwing this error and crashes the virtual machine by OOM.

To repeat the problem delete a couple of A/B database files while hanoidb runs and apply some load to the hanoidb to trigger merging