Skip to content

Vector index: a location load that stops partway lets new vectors reuse ids held by other records #9892

Closed

Description

@lvca

Problem

After a restart, an LSM_VECTOR index builds its in-memory location map (vector id -> RID) on first use, in LSMVectorIndex.materializeLocations(). The id allocator (nextId) is then moved past the highest id the load read (syncNextIdWithResidentLocations(), the #6762 fix). The materialisation runs once per process.

If the load stops partway, the pages it never reached still hold higher ids, but the allocator only knows about the ids it read. Every later insert can then mint an id that a live record already owns. Two paths lead there:

  1. An Error during the load (realistically an OutOfMemoryError, since the first use after a restart happens under full load). The load only catches Exception, but the finally still runs the sync and latches locationsMaterialized = true with a half-filled map, for the life of the process.
  2. A page the lenient parser cuts short. LSMVectorIndexPageParser.parsePages catches the exception per page, logs WARNING "Error parsing page ..." and carries on, so the entries after the failure point are never read.

Effect

Two records end up on one vector id in the persisted pages. A later load gives the id to one of them (or deletes it), and the other record disappears from vector search. CHECK DATABASE (since #8946) reports it as:

N records have a vector id that a load gives to another record or deletes ... (first: #X:Y (mutable, id I lost to #X:Z) ...)

where an older record loses its id to a much newer one, with both on mutable pages. Rebuilding the index repairs it, but the next restart that hits the same condition creates new collisions in other indexes.

Reproduction

Open a database with a populated vector index, make the location map fail after N entries (with an OutOfMemoryError, or an exception on a page), then insert vectors: checkIntegrity() reports records whose id was handed to a newly inserted record.

Proposed fix

  • An Error during the load discards the partial map and does not latch it, so the next access loads again from scratch.
  • A load that could not read every entry (a page cut short, or an Exception partway) marks the index: it logs SEVERE once and refuses new vectors (IndexException) instead of minting ids that may collide, until the index is rebuilt.
  • checkIntegrity() reports such an index (and any page the parser cut short), so CHECK DATABASE lists it and CHECK DATABASE FIX rebuilds it.

Activity

  1. added
    engine
    vector
    severity:major
    on Oct 13, 2026
  2. added
    in progress
    on Oct 13, 2026
  3. added this to the 26.11.1 milestone on Oct 13, 2026
  4. added 2 commits that reference this issue on Oct 13, 2026
  5. lvca commented on Oct 13, 2026

    @lvca
    MemberAuthor

    Fixed in #9905, released in 26.11.1.

    On first use after a restart, a vector index reads its pages to learn which vector ids are already taken. If that read stopped partway (most often on an out-of-memory error), the index could hand a new vector an id another record already had, and one of the two records then disappeared from search results.

    Now:

    • A read stopped by an out-of-memory error, an interrupted thread or a database closing is simply done again on the next access.
    • A read that finds a page it cannot parse keeps serving searches, but refuses new vectors (inserts, and updates that change a vector) until the index is rebuilt. It logs a SEVERE message, and CHECK DATABASE lists the index as corrupted. Deletes still work.
    • Run CHECK DATABASE FIX or REBUILD INDEX <name> to rebuild the index and lift the refusal.

    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

  6. removed
    in progress
    on Oct 13, 2026
  7. added 2 commits that reference this issue on Oct 15, 2026
  8. added 3 commits that reference this issue on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugengineseverity:majorvector

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions