Discussion:
[leveldb] LevelDB data loss possibilities
pankaj goyal
2017-11-03 12:32:26 UTC
Permalink
Hi,

I am using LevelDb in an android application.

I faced a issue where some of the data got lost on one of the device.
Here is the list of incidents which happened with me.

I forced-stop my app as it hanged due to some issue.
I started using the app and everything was fine.
But after 5-6 hours when I launched the app again, some of the data on
which I worked after forced-stop is lost.

I am not able to explain the behavior of LevelDb in this case. Any data
loss should have been happened immediately after force-stop.

Is there any explanation of this defered loss of data ?

Is possible that app got killed during compaction and level0 or level1 file
got partially saved or got corrupted ?

Please let us know any other secenerio of losing data in level db.

Thanks
Pankaj
--
You received this message because you are subscribed to the Google Groups "leveldb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leveldb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Chris Mumford' via leveldb
2017-11-03 16:32:52 UTC
Permalink
So on the next db open after the force stop the data was there, but after
5-6 hours of db use the data was then deleted? I'm unaware of a bug that
would cause this. Are you using the POSIX env? If so be aware that it uses
POSIX streams (fopen/fwrite/fclose) which buffer I/O data in the
application heap, so unlike open/write/close data can be lost of the
application is killed before the buffer can be flushed.
--
You received this message because you are subscribed to the Google Groups "leveldb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leveldb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
pankaj goyal
2017-11-06 05:25:03 UTC
Permalink
Yes I am using Posix Env.
Post by 'Chris Mumford' via leveldb
So on the next db open after the force stop the data was there, but after
5-6 hours of db use the data was then deleted? I'm unaware of a bug that
would cause this. Are you using the POSIX env? If so be aware that it uses
POSIX streams (fopen/fwrite/fclose) which buffer I/O data in the
application heap, so unlike open/write/close data can be lost of the
application is killed before the buffer can be flushed.
--
You received this message because you are subscribed to the Google Groups "leveldb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leveldb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
pankaj goyal
2017-11-06 06:59:57 UTC
Permalink
Yes I am using the Posix env. But the AddRecord function calls
EmitPhysicalRecord which calls flush so the data is flushed with each
record write.
Post by 'Chris Mumford' via leveldb
So on the next db open after the force stop the data was there, but after
5-6 hours of db use the data was then deleted? I'm unaware of a bug that
would cause this. Are you using the POSIX env? If so be aware that it uses
POSIX streams (fopen/fwrite/fclose) which buffer I/O data in the
application heap, so unlike open/write/close data can be lost of the
application is killed before the buffer can be flushed.
--
You received this message because you are subscribed to the Google Groups "leveldb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leveldb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...