Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Commit 6edda0e

Browse files
authored
libsql: vacuum less often (#778)
For specific edge cases, a 32MiB threshold is a little small. Let's bump it to at least 256MiB of data and inform about vacuuming with info log level.
1 parent eb898ec commit 6edda0e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sqld/src/connection/libsql.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,9 +630,9 @@ impl<W: WalHook> Connection<W> {
630630
let freelist_count = self
631631
.conn
632632
.query_row("PRAGMA freelist_count", (), |row| row.get::<_, i64>(0))?;
633-
// NOTICE: don't bother vacuuming if we don't have at least 32MiB of data
634-
if page_count >= 8192 && freelist_count * 2 > page_count {
635-
tracing::debug!("Vacuuming: pages={page_count} freelist={freelist_count}");
633+
// NOTICE: don't bother vacuuming if we don't have at least 256MiB of data
634+
if page_count >= 65536 && freelist_count * 2 > page_count {
635+
tracing::info!("Vacuuming: pages={page_count} freelist={freelist_count}");
636636
self.conn.execute("VACUUM", ())?;
637637
} else {
638638
tracing::debug!("Not vacuuming: pages={page_count} freelist={freelist_count}");

0 commit comments

Comments
 (0)