Skip to content

Fix/lancedb periodic compaction - #4833

Open
SahilArate wants to merge 2 commits into
topoteretes:mainfrom
SahilArate:fix/lancedb-periodic-compaction
Open

Fix/lancedb periodic compaction#4833
SahilArate wants to merge 2 commits into
topoteretes:mainfrom
SahilArate:fix/lancedb-periodic-compaction

Conversation

@SahilArate

Copy link
Copy Markdown
Contributor

Description

Acceptance Criteria

Type of Change

  • [ x] Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Code refactoring
  • Other (please specify):

Screenshots

1 2

Pre-submission Checklist

  • [ x] I have tested my changes thoroughly before submitting this PR (See CONTRIBUTING.md)
  • [ x ] This PR contains minimal changes necessary to address the issue/feature
  • [ x ] My code follows the project's coding standards and style guidelines
  • [ x] I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if applicable)
  • [ x] All new and existing tests pass
  • [ x ] I have searched existing PRs to ensure this change hasn't been submitted already
  • [ x ] I have linked any relevant issues in the description
  • [ x] My commits have clear and descriptive messages

DCO Affirmation

I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin.

Adds support for JSON documents where the target list is nested inside a dict (e.g. {"records": {"items": [...]}}) instead of only a flat top-level list. Auto-detects a single nested array, or accepts an explicit json_path when multiple arrays exist. Each chunk now carries json_path and, when present, json_context metadata. Flat top-level list behavior is unchanged. Fixes topoteretes#4236.
merge_insert mints a new table version and data fragment on every upsert, and nothing outside a one-off migration ever compacts them. On a long-lived deployment this grows without bound: one reported store hit 6,592 versions / 6,557 fragments across 20 tables, 937MB for a 2,461-node graph.

Add best-effort periodic compaction: every vector_db_compaction_write_interval writes to a table (default 25, 0 disables), call optimize(cleanup_older_than=timedelta(seconds=0)) so old fragment files are actually removed, not just merged. Mirrors the same fail-open compaction pattern already used after re-keying in _vector_rekey.py.

Tested: all 43 existing LanceDB unit tests still pass, plus 3 new tests confirming compaction triggers at the configured interval, the interval=0 opt-out preserves current behavior exactly, and row data survives compaction unchanged.

Fixes topoteretes#4684
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.

1 participant