Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@

- Added `blocks: Vec<String>` to `ffi::MozAdsRequestOptions`, `AdsClient::request*_ads`, `MARSClient::fetch_ads`, `mars::AdRequest`, and `mars::AdRequest::try_new`. This is serialized and passed to MARS so that it can remove blocks server-side.

### sql_support

- All databases are initialized with `PRAGMA auto_vacuum=incremental`.
This avoids having to do a full vacuum on the first `sql_support::run_maintenance` call.
(https://bugzilla.mozilla.org/show_bug.cgi?id=2064759)

# v156.0 (_2026-08-27_)

## ✨ What's Changed ✨
Expand Down
20 changes: 20 additions & 0 deletions components/support/sql/src/open_database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ fn do_open_database_with_flags<CI: ConnectionInitializer, P: AsRef<Path>>(

if open_flags.contains(OpenFlags::SQLITE_OPEN_READ_WRITE) {
let mut write_schema_version = true;
if db_empty {
// Need to run this before starting a transaction, since it executes VACUUM.
init_new_database(&conn)?;
}
let tx = conn.transaction_with_behavior(TransactionBehavior::Immediate)?;
if db_empty {
debug!("{}: initializing new database", CI::NAME);
Expand Down Expand Up @@ -204,6 +208,22 @@ pub fn open_memory_database_with_flags<CI: ConnectionInitializer>(
open_database_with_flags(":memory:", flags, conn_initializer)
}

fn init_new_database(conn: &Connection) -> Result<()> {
// Enable incremental auto-vacuum. This stores some additional data to enable auto-vacuum,
// but requires an explicit `PRAGMA incremental_vacuum` to be run rather than auto-vacuuming
// after each transaction. The `run_maintenance()` function performs an auto-vacuum.
//
// This is generally the best setting for components. Even if you're not calling
// `run_maintenance()` now, it's worth it to collect the data to avoid needing a full vacuum
// when you do.
conn.execute_one("PRAGMA auto_vacuum=incremental")?;
// Also call `VACUUM` to ensure the previous PRAGMA takes effect.
// This is not needed for a fresh database with 0 tables, which is probably what we have now.
// However, VACUUM will be a no-op in that case anyways.
conn.execute_one("VACUUM")?;
Ok(())
}

// Attempt to handle failure when opening the database.
//
// Returns:
Expand Down