Hi! Can you help me understand more exactly what the output parameters are from sqlite3_wal_checkpoint_v2()? Specifically:

1) What is the relationship between pnLog and pnCkpt: is pnLog>=pnCkpt always true?

2) Under what circumstances would pnLog>pnCkpt be true?


Also, can you confirm I understand the following correctly:

3) When using SQLITE_CHECKPOINT_PASSIVE, the WAL file will grow as needed, indefinitely, without ever shrinking.

4) When using a separate checkpointing thread, pnLog only goes down if the read/write thread has no active queries when the checkpoint runs. (Eg, if the checkpoint thread runs while the read/write thread has an active query, it'll still checkpoint, but it just won't reset the pnLog to 0.)


Finally, and I'm not sure if this is related, but I've read in several threads that sometimes you can get the SQLITE_CORRUPT error even if the database isn't corrupt, and the proper response is to just retry.

5) Is this considered to be a bug, or is it the result of some temporary hardware issue?

6) Is this aggravated by the use of WAL, or totally unrelated?


Some data about our setup is at the end of this email; I welcome you advice. Thanks!

-david

----------------------------------------------------------------------
We have a 3.7.7.1 database named "main.db", which is in WAL mode, with a corresponding "main.db-wal" file. The main.db file is 13519440896 bytes (about 13GB) while the WAL file is 25439184 bytes (about 25MB). Both threads open the database with "SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX" and SQLITE_CONFIG_MULTITHREAD, sqlite3_enable_shared_cache(0), and set "PRAGMA journal_mode = WAL;" We checkpoint the main.db database every 15 seconds using SQLITE_CHECKPOINT_PASSIVE, outputting pnLog and pnChkpt each time, with the results looking something like:

298     298
263     263
483     483
943     943
1171    1171
1653    1653
1947    1947
212     212
436     436
1011    1011
1277    1277
1611    1611
2035    2035
2408    2408
2703    2703
3128    3128
548     548
858     858
1338    1338
1839    1839
386     386
493     493
679     679
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to