Den 2017-06-02 kl. 16:07, skrev Richard Hipp:
On 6/2/17, Daniel Polski <dan...@agelektronik.se> wrote:
I've found something weird in a log from a client.
Normally our WAL files are < 100kB, but in this log I noticed the file
was >40MB. This was totally unexpected since we run this call every minute:
int val = sqlite3_wal_checkpoint_v2(myDB->getDbPointer(), NULL,
SQLITE_CHECKPOINT_TRUNCATE, &wal_size, &wal_checkpointed);
and I thought that SQLITE_CHECKPOINT_TRUNCATE would force the checkpoint
to completion. We haven't turned off automatic checkpoints, just added
the above to make them happen more often than default, and be called
from a specific thread.
Do you have a busy callback handler registered
(https://sqlite.org/c3ref/busy_handler.html)
No busy callback is registered, but we do set the:
sqlite3_busy_timeout(db, 0)
We also register:
sqlite3_config(SQLITE_CONFIG_LOG, sqliteErrorLogCallback, NULL);
And we register 5 functions like this:
sqlite3_create_function(db, "function_x", 0, SQLITE_UTF8, NULL,
&function_x, NULL, NULL);
(the called functions called are extremely fast and simple, only
updating a bool and an int).
Other than the above I believe we use sqlite "out of the box", with no
special compiler flags or other changes.
and are you checking the
return code from sqlite3_wal_callback_v2()?
Unfortunately not in that version of the application (the return
variable was only used during development debugging).
What could the possible reasons be for it to fail, if using
SQLITE_CHECKPOINT_TRUNCATE?
Some more background information:
The growing WAL file has so far been reported from 1 out of more than a
hundred installations (others could have been affected without me
getting to know it though). But it has been seen twice in the logs from
that installation. The application where it's detected is under heavier
usage load than most other installations, but is not the only
application under high load.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users