diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e1612431..544a6ccf7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ or `dc_jsonrpc_instance_t` is unreferenced during handling the JSON-RPC request. #4153 - Delete expired messages using multiple SQL requests. #4158 +- Do not emit "Failed to run incremental vacuum" warnings on success. #4160 ## 1.111.0 diff --git a/src/sql.rs b/src/sql.rs index aec50171a..86f3bb4fa 100644 --- a/src/sql.rs +++ b/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 // only works if auto_vacuum is enabled. - if let Err(err) = context + match context .sql - .execute("PRAGMA incremental_vacuum", paramsv![]) + .query_row_optional("PRAGMA incremental_vacuum", (), |_row| Ok(())) .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