Skip to content

fix(lancedb): disable FTS with_position to avoid optimize crash#336

Merged
cyfyifanchen merged 1 commit into
mainfrom
fix/fts-with-position
Jul 10, 2026
Merged

fix(lancedb): disable FTS with_position to avoid optimize crash#336
cyfyifanchen merged 1 commit into
mainfrom
fix/fts-with-position

Conversation

@gloryfromca

@gloryfromca gloryfromca commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

What

Fix the FTS with_position optimize crash, plus the disk-bloat and silent-failure amplifiers it caused.

Fixes #335.

Root cause

On lancedb ≥ 0.32, FTS indexes built with with_position=True crash lance's optimize() / compaction when merging an unindexed tail — Max offset exceeds length of values in the RepDef offset restoration (upstream regression, lance-encoding v4.0.0 → v6.0.0, reported at lance-format/lance#7653). The crash aborts optimize() including version cleanup, so the index directory grows unbounded until the disk fills.

EverOS recall is OR-mode BM25 (MatchQuery) and never does phrase queries, so the positions with_position=True stores are never read.

Changes (3)

  1. core/persistence/lancedb/base.py — default with_position=False for FTS indexes (lossless; no phrase queries anywhere in recall).
  2. infra/persistence/lancedb/__init__.pymigrate_fts_indexes(): a one-time, marker-guarded startup migration that rebuilds pre-fix (with_position=True) indexes and reclaims the orphaned fragments left behind, so existing deployments self-heal on upgrade.
  3. memory/cascade/worker.py — count consecutive optimize() failures and escalate warning → error past a threshold, instead of swallowing them silently (the amplifier that let a single index bug grow the disk unbounded before anyone noticed).

Test

  • unit: 1483 passed (incl. new tests for migration idempotence + failure escalation)
  • TDD on lancedb 0.33.0: pre-fix crashes, post-fix OK
  • real production-data clone: rebuild recovers with zero row loss

FTS indexes built with with_position=True crash lance's optimize/compaction
on lancedb >= 0.32 when merging an unindexed tail (Max offset exceeds length
of values; upstream lance-format/lance#7653). The crash aborts optimize()
including version cleanup, so the index dir grows unbounded until the disk
fills. everos recall is OR-mode BM25 and never does phrase queries, so
positions are never read -- disabling is lossless.

- base: default with_position=False
- infra: migrate_fts_indexes() rebuilds pre-fix indexes once at startup + reclaims orphans
- cascade worker: count consecutive optimize failures, escalate warning->error

Fixes #335.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gloryfromca gloryfromca force-pushed the fix/fts-with-position branch from 02a170a to e8ff5ef Compare July 10, 2026 08:08
@cyfyifanchen cyfyifanchen merged commit 45656d3 into main Jul 10, 2026
8 checks passed
@cyfyifanchen cyfyifanchen deleted the fix/fts-with-position branch July 10, 2026 08:55
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.

FTS optimize crashes with 'Max offset exceeds length of values' on lancedb >= 0.32

2 participants