On Thu, Jun 6, 2013 at 6:04 PM, Jerry Krinock <je...@ieee.org> wrote:
> > On 2013 Jun 06, at 13:28, Richard Hipp <d...@sqlite.org> wrote: > > > My guess is that App1 never actually committed the transaction. Are you > > sure that you ran COMMIT? And are you sure that the COMMIT was > successful? > > Thank you, Richard. I didn't have a scope on App 1, and it's much more > complicated. It's possible that it did not successfully COMMIT. > > Let's retell the story, calling them processes instead of apps. The > command-line tool is Process 3. The App2, which misses the new record at > first, is Process 2, then Process 4. > > • Launch Process 2. > • Launch Process 1. > • Add a record in Process 1. Possibly does not COMMIT. > • Launch Process 3. > • In Process 3, run the query, then terminate. New record is PRESENT. > • In Process 2, open database, run the query, checkpoint, and close. New > record is ABSENT. > • Terminate Process 2, relaunch as Process 4. > • Process 4 opens database, runs the query, checkpoints, and closes. New > record is PRESENT. > > Examining my code carefully, I'm sure that Process 2/4 does *not* keep the > database open. It opens the database when it needs to do a query, does the > query, checkpoints, closes it, and forgets the database connection handle. > > It don't see how Process 3 could get the new record, but Process 2 would > not get it until a relaunch. > It might be that Process2 started a read transaction before process3 even launched. This might happen accidentally because of a prepared statement that you neglected to sqlite3_reset() or sqlite3_finalize(), for example. Since process2 is holding a read transaction open, it is looking at a snapshot of an historical version of the database from before the changes of process3 and it continues to see that historical version even after process3 commits. > > Is the story as I told it possible, or must I have gotten something wrong? > > Jerry > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users