On 10/29/2016 06:08, Simon Slavin wrote:
On 29 Oct 2016, at 8:05am, Yuri<y...@rawbw.com>  wrote:

>The application is synchronizing the in-memory key-value table with the disk 
one using insert/update/delete statements using that key. The in-memory table was 
full at the moment of reboot,
You're going to have to explain that.  There can be no such thing as an 
in-memory table when you reboot.  Booting involved having nothing in memory.

By "in-memory table" I mean the app-level STL std::map<string,string> that the app saves as an SQLite table. That map had data at the time of the app shutdown. The code in question has been working fine for over a year. https://github.com/yurivict/qt-additions/blob/master/QSqlSqliteSettingsFormat It is the SQLite Qt QSettings backend. I wrote it to specifically safeguard against this kind of situation. (Not in Qt yet.)

>[snip]
>
>SQLite should preserve data in such case, it should fail operations that can't 
be performed, but the old data should absolutely stay intact.
It should do.  But bad programming can prevent things from happening properly.

For instance, does the program which makes changes to the database check the 
result values returned by each operation ?  And does it correctly crash if the 
return value indicates something went wrong with the operation ?  Many 
quickly-written simple programs just proceed with the next operation.


It does check error codes, and it prints warnings, but errors don't fail the overall app. It will keep updating/inserting again and again later.


Now I created the small in-memory disk with disk-full condition for testing. The same program keeps printing 'update/insert failed' but it never issues 'delete' statements. I also can't reproduce the table erasure. I am still at a loss what went wrong, what erased the table in the file.


Yuri

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to