Hello,

I have been trying to verify SQLite's Multi-file Atomic commit
functionality, but unfortunately have been unable to do so.

My test scenario is as follows:

SQLite 3.7.4 (amalgamation) built into a C library.
Fedora 12.
Two databases residing on an ext4 filesystem.
One database attached to the other using the ATTACH command.

A function in my C library code which creates and calls an SQL command
similar to the following:

BEGIN TRANSACTION;
REPLACE INTO main.Table values (X,Y,Z);
REPLACE INTO attachedDbName.Table values (X,Y,Z);
COMMIT TRANSACTION;

Using GDB, I put a breakpoint on the unixSync() function and then call my C
library function.
When the breakpoint gets hit, which it does 7 times until my C library
function runs to completion, I look for the existence of the Master Journal,
which I find as expected in the same directory as my 'main' database.

I then use 'rm' from a Bash shell to remove the attached DB's database file
and corresponding rollback journal.  Then, I let my function run to
completion.  Afterwards, I open up the 'main' database and examine the row
which I 'updated'.  Unfortunately, it has been updated using the above
mentioned REPLACE statement.  I have repeated this test by deleting the
attached DB after the first breakpoint was hit and also before the last
breakpoint was hit and found the results to be the same.

This appears to contradict the Atomic Commit document in section 5.0 where
it states: "In other words, either all of the database files are updated or
else none of them are."

The reason that I am trying to verify this behaviour is that I plan to store
the attached DB on a RAM disk and therefore need to verify data integrity in
the case of a system crash.

So, am I performing my test incorrectly, or is there something wrong with
SQLite?

Thanks in advance for any and all responses to my query.

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

Reply via email to