Dave Dyer <[EMAIL PROTECTED]> wrote:
> I don't understand why the following transaction
> behavior is correct or necessary.  The question
> involves two simultaneous transactions on the same
> database
>
> Process 1 Process 2
>
> BEGIN
>
> BEGIN
>
> insert...
>
> insert... fails "locked"
>
> end also fails "locked"
>
> It seems that the end of a transaction can
> fail even if all the intermediate actions
> succeeded.

Process 2 holds a SHARED lock on the database, by virtue of still having 
an open transaction. Process 1 cannot write to the database file while 
there are outstanding readers.

Note that your "intermediate actions succeeded" statement is somewhat 
misleading. SQLite holds as many modifications as possible in a memory 
cache, and only writes them to disk when a) transaction is committed, or 
b) the cache overflows and has to spill to disk. So while an insert 
performed by Process 1 nominally succeeded, it most likely didn't 
actually write anything to disk. It's the END statement that does this - 
of course it may fail.

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to