On 11/25/15, T?r?k Edwin <edwin+sqlite3 at etorok.net> wrote:
> Hi,
>
> A user of our application (CC-ed) reported a corruption in an SQLite DB on
> FreeBSD (see below). There was no mmap used in this case, just a WAL DB with
> PRAGMA SYNCHRONOUS=NORMAL.
> From my reading of the SQLite docs this should not result in a corrupt DB,
> worst case some COMMITs could be lost/missing.
>

The database file "temp.db" and the WAL file "temp.db-wal" appear
unrelated to one another.  It as if they came from different places,
or from different points in time.

The database file contains 272 pages, but only the first 8 pages are
used for content.  The final 264 pages of the file are all "freelist"
pages, ready to be reused.

The WAL file contains 15 separate transactions.  But every single one
of those transactions says that the database is only 24 pages long.
Furthermore, 12 of the 15 transactions (including the first two and
the last one) only touch pages that are on the freelist of the
database, which is not really possible.

I don't know how this could come about.  It's like you took a random
database file and a random WAL file and paired them together by giving
them similar names.

Do you have any additional information about how this problem might have arisen?

-- 
D. Richard Hipp
drh at sqlite.org

Reply via email to