Add a limit to the SQLite WAL file size
When using SQLite as a database, Waarp Gateway uses it in WAL mode. This means that, when writing to the database, changes are first written to a separate WAL file, and then flushed to the database when the transaction ends.
By default, SQLite never truncates the WAL file, and instead simply overwrites the beginning of the file. While this has the advantage of being faster, it means that the file can never shrink in size, which can be a problem in certain circumstances if one or multiple large transactions cause the file to swell in size. This can end up causing disk space problems in the long run.
To fix this problem, the WAL file should be given a maximum size. This can be done with the journal_size_limit
pragma, which limits the size of the WAL file after a transaction. If the file goes over that limit, it will be truncated back to that limit when the transaction ends (assuming no conflicts with other concurrent transactions). Alternatively, if the limit can be set to zero, in which case, the file will be truncated to its minimum possible size instead.