[arch-dev-public] [signoff] sqlite3 -

Andreas Radke a.radke at arcor.de
Thu May 19 15:37:50 EDT 2011

Minor upstream release. Please give signoffs.


2011-May-19 - Version

    SQLite version is a patch release that fixes a single bug
    associated with WAL mode. The bug has been in SQLite ever since WAL
    was added, but the problem is very obscure and so nobody has
    noticed before now. Nevertheless, all users are encouraged to
    upgrade to version or later.

    The bug is this: If the cache_size is set very small (less than 10)
    and SQLite comes under memory pressure and if a multi-statement
    transaction is started in which the last statement prior to COMMIT
    is a SELECT statement and if a checkpoint occurs right after the
    transaction commit, then it might happen that the transaction will
    be silently rolled back instead of being committed.

    The default setting for cache_size is 2000. So in most situations,
    this bug will never appear. But sometimes programmers set
    cache_size to very small values on gadgets and other low-memory
    devices in order to save memory space. Such applications are
    vulnerable. Note that this bug does not cause database corruption.
    It is as if ROLLBACK were being run instead of COMMIT in some cases.

    Bug Details

    Transactions commit in WAL mode by adding a record onto the end of
    the WAL (the write-ahead log) that contains a "commit" flag. So to
    commit a transaction, SQLite takes all the pages that have changed
    during that transaction, appends them to the WAL, and sets the
    commit flag on the last page. Now, if SQLite comes under memory
    pressure, it might try to free up memory space by writing changed
    pages to the WAL prior to the commit. We call this "spilling" the
    cache to WAL. There is nothing wrong with spilling cache to WAL.
    But if the memory pressure is severe, it might be that by the time
    COMMIT is run, all changed pages for the transaction have already
    been spilled to WAL and there are no pages left to be written to
    WAL. And with no unwritten pages, there was nothing to put the
    commit flag on. And without a commit flag, the transaction would
    end up being rolled back.

    The fix to this problem was that if all changed pages has already
    been written to the WAL when the commit was started, then page 1 of
    the database will be written to the WAL again, so that there will
    always be a page available on which to set the commit flag. 

2011-April-17 - Version

    SQLite version adds a one-line bug fix to that
    enables pthreads to work correctly on NetBSD. The problem was a
    faulty function signature for the open system call. The problem
    does not appear to have any adverse impact on any system other than

    Upgrading from version is only needed on NetBSD. 

More information about the arch-dev-public mailing list