On 4/27/16, Albert Banaszkiewicz <Albert.Banaszkiewicz at tomtom.com> wrote: > Hello. > > I am new here, thus I would like to apologize in advance if the question I > am going to rise was already asked in the past. > > I am using SQLite 3.11.1 (actually it is a NDS consortium customized version > based on it). > > According to documentation, in case of WAL mode enabled databases, final > check-pointing is being done when the last connection to DB is about to be > closed. > > We are running into the scenario, where we would like to have a complete > control over the moment when check-pointing happens. This is easy in case of > auto-check-pointing, where it can be completely disabled or customized (via > hooks). > However, it is possible that during the component life-time there is going > to be no 'appropriate' moment to schedule it and if the user powers device > down, we still want to avoid it since modern OSes typically expect running > applications to terminate within the specified (several seconds usually) > time intervals. Of course, we don't want to loose any data contained in the > WAL journal as well and ideally, we would like to be still able to schedule > check-pointing in the 'appropriate' time after reboot. > > So finally, the questions: > > 1. Is there a way to control (i.e. disable) check-pointing happening at DB > closure ? (personally, I could not find anything like this in the code but > perhaps I missed something) > 2. If not, are there any plans to introduce it ? Or is it not feasible at > all ?
There is no documented and supported way of preventing a checkpoint when the last DB connection closes. But you can work around that simply by killing the process without ever calling sqlite3_close(). When you do that, it leaves the -wal and -shm files on disk. The next time any process connects to the database, it will read the entire -wal file from beginning to end in order to reconstruct the -shm file. -- D. Richard Hipp drh at sqlite.org

