Hi,
The issue appeared with the following scenario: - using SQLite v3.8.4.3 -
the DB is in WAL mode and running with multi-thread mode - every thread has
a read-only DB connection (using thread-local-storage) - a single DB
connection is shared between threads to write     - this write DB
connection, at any given time, can only be used by one thread (it's
essentially a connection pool with only one entry) - the read-only DB
connections have SQLITE_OPEN_SHAREDCACHE while the write DB connection has
SQLITE_OPEN_PRIVATECACHE
What happens is this: - a thread acquires the write DB connection - that
thread inserts a new row in a table and gets its id - the thread releases
the write DB connection (so that other threads can use it) - the same
thread acquires (its own) read-only DB connection - thread tries to read
the row it just inserted and it returns NULL
And no, no one is deleting rows from this table and the new row appears
eventually.I was able to fix this by making the read-only DB connections
SQLITE_OPEN_PRIVATECACHE, and nothing else.
I checked the documentation and I didn't find anything that would suggests
that I'm doing anything wrong. Any data change after a successful commit
should bevisible to any transaction that starts after it, correct? The
cache mode (or any other setting for that matter) shouldn't influence this.
I can't give you any example code (the project where I detected this is
rather big and private), so if necessary I would have to create a small
example where I would try to simulate this (I'm rather hopping I won't have
to :).
Thank you,João
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to