Richard, thank you for pointing to WAL. It seems interesting. On Wed, Jun 9, 2010 at 11:58 PM, Richard Hipp <d...@sqlite.org> wrote:
> On Wed, Jun 9, 2010 at 11:26 AM, Jay A. Kreibich <j...@kreibi.ch> wrote: > > > On Wed, Jun 09, 2010 at 01:40:30PM +0100, Simon Slavin scratched on the > > wall: > > > > > > On 9 Jun 2010, at 9:48am, Wei Kai wrote: > > > > > > > I have a problem here. As we know sqlite creates a journal every time > a > > > > write transaction happens. On a flash file system, when a write to > > database > > > > failed because of the lack of enough disk spac > > > > > > Sorry, but if your program crashes because you ran out of disk space, > > > you're out of luck. There's no way to have a program recover from > > > the situation because you have no space to put the recovered > > > information in. You need an intelligent human to decide what can > > > be deleted. > > > > I think the point he was making is that a developer cannot assume > > writing data to the middle of an existing file will not return an > > out-of-space error. > > > > I'd be very surprised if SQLite makes any such assumptions, however. > > > > SQLite makes no such assumption. > > On the other hand, if SQLite is unable to rollback a failed transaction, > then it is stuck until the error is resolved. Until sufficient space > becomes available on the device to complete the rollback, the database will > be unreadable. There isn't much one can do about this when using a > rollback > journal. > > The problem does not come up with http://www.sqlite.org/draft/wal.html - > the > database continues to be readable after a failed checkpoint. > > > > > > This condition is hardly unique to flash filesystems. Journaled > > filesystems can have the same issue, as do sparse files (although I > > doubt SQLite would ever create a sparse file). Reallocation of > > blocks and automatic defragmentation can also contribute to > > similar issues. > > > > > If you are concerned about this situation, make a file called > > > 'wasteofspace' which takes up 10 kilobytes of space. When you > > > need emergency space to recover from a crash, delete this file. > > > > That's not necessarily useful. See above. > > > > -j > > > > -- > > Jay A. Kreibich < J A Y @ K R E I B I.C H > > > > > "Intelligence is like underwear: it is important that you have it, > > but showing it to the wrong people has the tendency to make them > > feel uncomfortable." -- Angela Johnson > > _______________________________________________ > > sqlite-users mailing list > > sqlite-users@sqlite.org > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > > > > -- > --------------------- > D. Richard Hipp > d...@sqlite.org > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users