Skip to content

VACUUM is a no-op: vacuum and vacuum2 testfixture tests skipped #322

@timsehn

Description

@timsehn

Summary

The vacuum and vacuum2 SQLite testfixture tests are skipped in CI as of PR #316. VACUUM itself is implemented as a no-op for doltlite.

Why VACUUM is a no-op

Prolly trees use content-addressed chunk storage. There are no B-tree pages that fragment over time, so there's nothing for VACUUM to compact.

More critically, sqlite3BtreeCopyFile (which VACUUM uses to swap the compacted DB back into place) only copies root hash pointers between Btree structs — it doesn't transfer the underlying chunk data between chunk stores. This means VACUUM has always silently lost data on doltlite: after VACUUM, the main DB's root hashes point to chunks that only existed in the now-destroyed temp DB's chunk store.

CREATE TABLE t(id INTEGER PRIMARY KEY, val INT);
INSERT INTO t VALUES(1,10),(2,20),(3,30);
SELECT count(*) FROM t;  -- 3
VACUUM;
SELECT count(*) FROM t;  -- 0 (data lost!)

This was true on master before any PR #316 changes. Making VACUUM an explicit no-op (return SQLITE_OK in sqlite3RunVacuum) is safer than silent data loss.

What's skipped

In .github/workflows/test.yml:

  • vacuum removed from "SQLite core tests"
  • vacuum2 removed from "SQLite additional tests"

These tests validate B-tree page compaction behavior (page counts, free list, auto-vacuum) that doesn't apply to prolly tree storage.

To restore VACUUM

A proper VACUUM implementation would need sqlite3BtreeCopyFile to either:

  1. Swap the chunk stores between the source and destination BtShared structs, or
  2. Copy all referenced chunks from the source store to the destination store

This is non-trivial because ChunkStore contains heap-allocated arrays (branch refs, tag refs, index entries, pending writes) and file handles that can't be naively memcpy-swapped.

Alternatively, VACUUM could be reimplemented as a prolly-native GC/compaction operation using dolt_gc() instead of SQLite's ATTACH-copy-swap pattern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions