liuis / leveldb

Automatically exported from code.google.com/p/leveldb
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

CURRENT file is not synced #68

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open an existing database.
2. Within 30 seconds force off the computer.
3. Reboot computer. CURRENT file is corrupt. Database can't be opened.

What is the expected output? What do you see instead?

The CURRENT file is corrupt. It contains 16 null bytes instead of the expected 
content.

What version of the product are you using? On what operating system?

Ubuntu Server 10.10.
The leveldb version included in Riak 1.0.2. Probably the one found here:
https://github.com/basho/eleveldb/tree/master/c_src/leveldb

Please provide any additional information below.

It doesn't matter if the sync option is true or false. Tests indicate that the 
CURRENT file is never explicitly synced to disk. Since this is a memory mapped 
file, it can take quite a long time before it is synced. If we wait a minute 
between opening the database and forcing off the server no corruption occurs.

Original issue reported on code.google.com by thomas.b...@gmail.com on 16 Jan 2012 at 4:25

GoogleCodeExporter commented 9 years ago
Thanks for the report.  You are correct.  I have a fix in the works.

I hope you didn't lose any data.  If you did, you should be able
to recover it by replacing the corrupted CURRENT file with one
that contains a single line of the form:
  MANIFEST-000002
Replace the "000002" with the name of the newest MANIFEST file
that doesn't seem empty.  Though to be safe, try it in a copy of
the leveldb directory first.

Original comment by san...@google.com on 18 Jan 2012 at 6:05

GoogleCodeExporter commented 9 years ago
Fixed in change 3c8be108bfb5

Original comment by san...@google.com on 25 Jan 2012 at 11:13