the timing to truncate WAL file to journal_size_limit

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

the timing to truncate WAL file to journal_size_limit

Nick
I noticed that,
“The journal_size_limit pragma may be used to limit the size of WAL files
left in the file-system after transactions or checkpoints. Each time a WAL
file resets, SQLite compares the size of the WAL file left in the
file-system to the size limit.”

But I think only when the first transaction commits AFTER a checkpoint will
WAL file truncate to the limit. As the src code is,
if( isCommit && pWal->truncateOnCommit && pWal->mxWalSize>=0 ).

Which means WAL file may still consume a large amount of space after
checkpoints, unless a new transaction commits. Is that right?



--
Sent from: http://sqlite.1065341.n5.nabble.com/
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: the timing to truncate WAL file to journal_size_limit

Richard Hipp-3
On 12/14/17, advancenOO <[hidden email]> wrote:

> I noticed that,
> “The journal_size_limit pragma may be used to limit the size of WAL files
> left in the file-system after transactions or checkpoints. Each time a WAL
> file resets, SQLite compares the size of the WAL file left in the
> file-system to the size limit.”
>
> But I think only when the first transaction commits AFTER a checkpoint will
> WAL file truncate to the limit. As the src code is,
> if( isCommit && pWal->truncateOnCommit && pWal->mxWalSize>=0 ).
>
> Which means WAL file may still consume a large amount of space after
> checkpoints, unless a new transaction commits. Is that right?

Correct.  The reset happens on the next transaction commit.

There is also "PRAGMA wal_checkpoint(TRUNCATE);"

--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users