On 01/10/2013 07:11 PM, Michael Schlenker wrote:
Hi everyone,
I'm trying to track down some lost commits for SQLite 3.7.7.1 via the
APSW Python wrapper. Pagesize etc. are all left at defaults for the APSW
wrapper.
The following probablematic scenario:
The sqlite db file and WAL/SHM files are on some automounted linux SAN
filesystem (probably NFS beneath it), pretty old SLES 9 system with
kernel 2.6.5-7.244-smp and pretty normal mount options for the filesystem.
I now have SAN snapshots of two sets of sqlite.db and sqlite.db-wal/shm
files from two consecutive days. The only change is in the WAL file, the
sqlite.db file is totally unchanged (checked via md5sum and fs timestamps).
In the snapshot form day 1 i see a commit, when executing a query.
In the snapshot from day 2 the same entry is gone.
I'm pretty sure there was no DELETE for the missing object, but want to
verify what happend by comparing the WAL files.
Now i checked the wal with the tool/showwal.c program from the source
distribution and see differences in the frames 50-91 of 288 total
frames, so basically in the middle of the file.
Now my questions:
Is it a sign of file corruption that some frames in the middle of the
WAL file are differing between those two snapshots?
Possibly. But also possibly not.
Normally, new frames are appended to the WAL file. However, after a
checkpoint occurs (copying the contents of the WAL into the database
file), SQLite wraps around and starts writing at the start of the
WAL file again. So you can get into a situation where you have a large
WAL file on disk with only a small number of valid frames at the
start of it.
If a crash occurs and SQLite needs to read the WAL file (database
recovery), it can tell the difference between the valid frames at
the start of the WAL and the trailing garbage using the running
checksum embedded in each frame.
However, it looks like showwal.c assumes the entire WAL file consists
of valid frames (it does not verify the checksums). So, it is possible
that on day 1 your WAL file may have contained just 49 valid frames -
not the 288 indicated by showwal. And that between day 1 and day 2
42 extra frames were appended to the WAL.
Dan.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users