Samuel Neff <[EMAIL PROTECTED]>
wrote:
> using BEGIN IMMEDIATE would prevent this situation from happening,
> right?

Not in all cases. BEGIN IMMEDIATE acquires a RESERVED lock, which 
doesn't prevent another connection from acquiring a SHARED lock. The 
writer may still be unable to promote to EXCLUSIVE.

> Process 2 would get the lock error when it tries to begin the
> transaction

Yes, if it also does BEGIN IMMEDIATE.

> and thus never obtain a reserved lock which prevented process 1 from
> promoting to an exclusive lock for commit.

In the original scenario, process 2 never got the RESERVED lock in the 
first place (process 1 got it first, and only one connection can have 
it). It did get a SHARED lock, which did prevent process 1 from 
promoting its lock to EXCLUSIVE.

Igor Tandetnik



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

Reply via email to