On 11/09/2013 06:47 PM, Simon Slavin wrote:
On 9 Nov 2013, at 10:07am, Dan Kennedy <[email protected]> wrote:
On 11/09/2013 04:58 PM, L. Wood wrote:
Richard Hipp <[email protected]> wrote:
Rollback journal files might be closed and reopened. [snip]
[snip]* But what about the next open() of a new journal file? Will it use the
new location of the database file or the old one?
The old one.
When it starts up, SQLite calculates the full paths
to the database and journal files and stores them
in memory. So if the journal file is opened, moved,
closed and then reopened, it will be the original
location that is opened both times.
Given that the journal file is closed-and-reopened only between transactions,
if SQLite is unable to reopen the journal file (because it was moved/deleted)
then it will either create a new one or return an error, right ? No corruption
of the database will result.
The problem is that you end up with the database and
journal files in separate directories. Which means that
if an application or power failure occurs during a
subsequent transaction, the next client to open the db
will be unable to find the journal file to roll it
back. If the failure occurred after the original process
started writing to the database, this means the database
file will likely be left in a corrupt state.
Dan.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users