Add a tool to VACUUM the k8s-dqlite database

dqlite supports VACUUM from v1.18.2, which microk8s 1.34 ships, but the dqlite shell wraps every statement in a transaction and SQLite refuses to VACUUM inside one. dqlite-vacuum sends it through the go-dqlite driver instead and otherwise just prints page statistics. dqlite-vacuum.sh makes the backups first.

Rehearsed on opti1 on a throwaway node in /dev/shm: 657 MB to 41 MB in 0.6s, with concurrent writes unaffected and the data intact after restarts.
This commit is contained in:
Ruben Hensen committed 2026-10-23 22:03:30 +02:00
1 parent c55b7ceab5
commit 175769d36c
5 files changed
+276 -4

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
module dqlite-vacuum
go 1.27.3
require (
github.com/canonical/go-dqlite/v3 v3.0.1
gopkg.in/yaml.v2 v2.4.0
)
require (
github.com/Rican7/retry v0.3.1 // indirect
github.com/google/renameio v1.0.1 // indirect
github.com/mattn/go-sqlite3 v1.14.7 // indirect
github.com/pkg/errors v0.9.1 // indirect
golang.org/x/sync v0.8.0 // indirect
)