On Thu, Apr 26, 2012 at 3:34 PM, Brad House <b...@monetra.com> wrote:

>
> I've got 2 threads with different connections to the same database.
>
> This is approximately what I am seeing:
>  Thread 1:   SELECT bar,baz FROM foo WHERE ...;
>  Thread 2:   BEGIN IMMEDIATE TRANSACTION;
>              INSERT INTO foo VALUES (...);
>                  **sqlite3_step returns 6 (SQLITE_LOCKED)
>              ROLLBACK TRANSACTION
>  Thread 1:   **sqlite3_step returns 4 (SQLITE_ABORT): abort due to ROLLBACK
>
>
> So why, if Thread 2 rolls back does Thread 1 get aborted?
>

A rollback deletes content out from under other queries.  So if you have a
query pending in thread 1 and thread 2 tries to rollback, there are two
options:  (A) The rollback fails  (B) The pending query is aborted.  It
used to be that we did (A).  (If you had checked the return codes from your
"ROLLBACK TRANSACTION" statement you would have been seeing it fail.)  The
latest code does (B) instead.

Your software depends upon behavior (A).  Other users prefer behavior (B).
I don't know how to make everyone happy....



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

Reply via email to