Tino Lange wrote:
> Hi Marcus,
> 
> I have no problem when the reading application gets a lock error because the 
> writing application has a lock.
> 
> But the problem is the other way around:
> -> The writing application gets a lock error because someone reads!

well... since the writer blocks the database for read and write access he has
to somehow verify that no read is ongoing before he will be able to
lock the database. hence if the write locks the database it will
indirectly cause that a read locks the db for writers as well.

so, the only thing that does not block are read against reads.

as I said the shared cache and the read_uncommitted pragma
increases this sort of concurrency and I use it regulary in my
server application.

> 
> This is what I can't understand and what I didn't expect. I would expect 
> that the writing application is undisturbed by any readers that open with 
> SQLITE_OPEN_READONLY.

I'm not familiar with that option but as far as I understand it will only
prevent that connection to apply any write operation and as I tried to
explain: a simple read may very well cause a timeout on a write attempt.

Marcus


> 
> Thanks
> 
> Tino
> 
> ------------------
> 
> 
> Marcus Grimm wrote:
> 
>> I'm afraid this is by design of sqlite: Sqlite will lock
>> the database during a writing transaction, I think no matter
>> if you open a 2nd connection using the readonly flag.
>>
>> the typical solutions are:
>> a) retry your read attempt after you receive a busy error code until
>>     it proceeds.
>> b) consider shared cache mode and pragma read_uncommitted = True;
>>
>> hope this helps
>>
>> Marcus
> 
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 

-- 
Marcus Grimm, MedCom GmbH Darmstadt, Rundeturmstr. 12, 64283 Darmstadt
Tel: +49(0)6151-95147-10
Fax: +49(0)6151-95147-20
--------------------------------------------------
MedCom slogans of the month:
"Vacation ? -- Every day at MedCom is a paid vacation!"
"Friday I have monday in my mind."
"MedCom -- Every week a vacation, every day an event, every hour a cliffhanger,
            every minute a climax."
"Damned, it's weekend again!"
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to