mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
sql: expect zero-column results from PRAGMA incremental_vacuum
The fact that `PRAGMA incremental_vacuum` may return a zero-column SQLITE_ROW result is documented in `sqlite3_data_count()` documentation: <https://www.sqlite.org/c3ref/data_count.html> Previously successful auto_vacuum worked, but resulted in a "Failed to run incremental vacuum" log.
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
or `dc_jsonrpc_instance_t` is unreferenced
|
or `dc_jsonrpc_instance_t` is unreferenced
|
||||||
during handling the JSON-RPC request. #4153
|
during handling the JSON-RPC request. #4153
|
||||||
- Delete expired messages using multiple SQL requests. #4158
|
- Delete expired messages using multiple SQL requests. #4158
|
||||||
|
- Do not emit "Failed to run incremental vacuum" warnings on success. #4160
|
||||||
|
|
||||||
|
|
||||||
## 1.111.0
|
## 1.111.0
|
||||||
|
|||||||
16
src/sql.rs
16
src/sql.rs
@@ -713,12 +713,22 @@ pub async fn housekeeping(context: &Context) -> Result<()> {
|
|||||||
|
|
||||||
// Try to clear the freelist to free some space on the disk. This
|
// Try to clear the freelist to free some space on the disk. This
|
||||||
// only works if auto_vacuum is enabled.
|
// only works if auto_vacuum is enabled.
|
||||||
if let Err(err) = context
|
match context
|
||||||
.sql
|
.sql
|
||||||
.execute("PRAGMA incremental_vacuum", paramsv![])
|
.query_row_optional("PRAGMA incremental_vacuum", (), |_row| Ok(()))
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
warn!(context, "Failed to run incremental vacuum: {}", err);
|
Err(err) => {
|
||||||
|
warn!(context, "Failed to run incremental vacuum: {err:#}");
|
||||||
|
}
|
||||||
|
Ok(Some(())) => {
|
||||||
|
// Incremental vacuum returns a zero-column result if it did anything.
|
||||||
|
info!(context, "Successfully ran incremental vacuum.");
|
||||||
|
}
|
||||||
|
Ok(None) => {
|
||||||
|
// Incremental vacuum returned `SQLITE_DONE` immediately,
|
||||||
|
// there were no pages to remove.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(e) = context
|
if let Err(e) = context
|
||||||
|
|||||||
Reference in New Issue
Block a user