Skip to content

fix(watch): periodic Lance compact/prune to cap memory growth#16

Merged
scbrown merged 1 commit into
mainfrom
fix/watch-lance-compact
Apr 22, 2026
Merged

fix(watch): periodic Lance compact/prune to cap memory growth#16
scbrown merged 1 commit into
mainfrom
fix/watch-lance-compact

Conversation

@scbrown

@scbrown scbrown commented Apr 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds periodic VectorStore::compact() + prune() calls to the bobbin watch loop
  • Triggered when 100+ files have churned since last compaction OR 30 minutes have elapsed with any churn
  • Mirrors the post-bulk-index cleanup already present in src/cli/index.rs

Why

Per #15, the watch loop issued delete_by_file + insert for every change without ever reclaiming Lance fragments or version manifests. One long-running watcher accumulated 27,750 versions / 7,384 fragments and consumed 7.6 GB RSS + 4.2 GB swap over 8 days.

Test plan

  • cargo build --bin bobbin clean
  • cargo clippy --bin bobbin --no-deps — no new warnings from the changed region
  • Manual: start bobbin watch on a busy repo, touch >100 files, confirm Compacted lance dataset (N files since last) log line appears
  • Manual: verify .bobbin/vectors/chunks.lance/_versions/ count drops after compaction cycle

Fixes #15

🤖 Generated with Claude Code

The watch loop performed delete+insert per change event without ever
calling compact() or prune(). On long-running watchers, the Lance
dataset accumulated thousands of version manifests and data fragments,
driving RSS to multi-GB. Observed: 7.6 GB RSS + 4.2 GB swap on a
76K-file watcher after 8 days, with 27,750 versions / 7,384 fragments.

Track a file-churn counter and wall-clock since last compaction in the
watch loop. Trigger compact()+prune() when the counter reaches 100
files OR 30 minutes elapse with any churn, mirroring the post-index
cleanup in cli/index.rs.

Fixes #15 (bo-07l)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@scbrown scbrown merged commit ca87df6 into main Apr 22, 2026
1 check passed
@scbrown scbrown deleted the fix/watch-lance-compact branch April 22, 2026 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

watch: unbounded memory growth — no Lance compaction or pruning

1 participant