If doing a SQLITE_CHECKPOINT_RESTART, the docs [1] say that the
operation *ensures* the next writer will truncate the log:

"This mode works the same way as SQLITE_CHECKPOINT_FULL with the
addition that after checkpointing the log file it blocks (calls the
busy-handler callback) until all readers are reading from the database
file only. This ensures that the next writer will restart the log file
from the beginning."

This conflicts with [2]:

"Whenever a write operation occurs, the writer checks how much
progress the checkpointer has made, and if the entire WAL has been
transferred into the database and synced and if no readers are making
use of the WAL, then the writer will rewind the WAL back to the
beginning and start putting new transactions at the beginning of the
WAL. This mechanism prevents a WAL file from growing without bound."

So if a reader begins a transaction before the next writer, then the
log file will not be restarted? [I assume this is why
SQLITE_CHECKPOINT_TRUNCATE was added?]

[1] https://www.sqlite.org/c3ref/wal_checkpoint_v2.html
[2] https://www.sqlite.org/wal.html

-- 
Patrick Donnelly

Reply via email to