Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Db corruption observed with powerloss #333
I have the following db that we can open for reads but every attempt to write fails with:
I am not sure which ldb file is corrupt (there does appear to be 1 0 sized file. But then leveldb code doesn't write ldb files to .ldbtmp and does rename, so in power loss cases, it's possible to end up with 0 sized ldb files).
Can you shed some light as to which ldb file is corrupt and why is it covered by the manifest?
The corrupt file is 001195.ldb - and it's an empty file. It is true that leveldb does not flush/sync/rename *.ldb files when writing, but it does do that when writing the MANIFEST - and that's what references the *.ldb files. The manifest is written afterwards, so this should ensure that the *.ldb files are safely on disk before being referenced.
So, yes; this could be a bug. It could be a hardware failure. It could be interference by another program (like antivirus/malware). etc. etc.
Have you been able to reproduce this? What version of leveldb? What OS?