Thanks Simon. My application has synchronous set to FULL. It seems sqlite tries 
to do fsync for read operations as well since I also got this error when 
executing "select * from db".
My application currently treat this error 1034(disk io error) as catastrophic 
error and dies.

Do you think if sqlite3_step or sqlite3_open fail with this error, we should 
treat this as transaction committed and ignore the fsync error and it will be 
retried with the next commit or read and eventually will sync unless I see this 
error continuously in which case we can treat this as catastrophic.

Also I wanted to know if fsync requires space on the filesystem since in our 
case nvram has little space(200mb), do you think fsync could fail because of 
that as well?

Thanks
mayank


-----Original Message-----
From: sqlite-users-bounces at mailinglists.sqlite.org 
[mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Simon Slavin
Sent: Monday, June 22, 2015 6:11 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] sqlite error code 1034


On 23 Jun 2015, at 1:33am, Mayank Kumar (mayankum) <mayankum at cisco.com> 
wrote:

> We once in a while see the following errors returns by sqlite for a database 
> created on nvram. I am trying to understand, how are other users handling 
> this error ? if fsync fails and sqlite api fails because of this issue, does 
> sqlite internally retry before declaring it cannot commit a transaction 
> because of this and should the application retry or this is a non recoverable 
> error ?
> I know if the os fsync fails, we cannot guarantee the db remains sane and 
> uncorrupted, in case of os crash or shutdown, but just trying to see what 
> others are doing for their applications in this scenario.

There's no easy way to retry the operation which failed, but you probably don't 
have to.

I have not encountered fsync() failure as part of SQLite, but to a unix user it 
is the same as 'IO Error'.  There is no point in retrying it since it will 
effectively be retried on the next operation of the file, including when the 
file handle is closed.  So there is a good chance that the file will eventually 
be synchronised anyway.  Problems may, however, occur if you have multiple 
apps/users trying to access the file at once.

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

Reply via email to