Skip to content

fix(pipeline): move FTS repair and cache invalidation before commit — post-commit failure leaves inconsistent state #815

Closed as not planned

Description

@Sinity

ingest_batch/_core.py: conn.commit() runs at line 642, then _commit_sync_ingest_side_effects() runs at line 722 AFTER commit. If side effects fail (FTS repair, trigger restoration, cache invalidation), data is committed but FTS is broken, triggers are suspended, and cache is stale. The code documents this risk at lines 711-722.

Also: if process receives SIGKILL mid-bulk-operation, FTS triggers remain dropped permanently (C6). Search returns stale results with no indication.

Activity

  1. Sinity commented on May 4, 2026

    @Sinity
    OwnerAuthor

    Also: rebuild.py line 82 sets _SESSION_INSIGHT_REBUILD_PAGE_SIZE = 1, causing one conversation per SQL round-trip (~17K queries for 4K conversations). Should be 50-200. Fix alongside post-commit ordering.

  2. Sinity commented on May 4, 2026

    @Sinity
    OwnerAuthor

    Folded into #817 (storage/DB fixes).

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

    area:pipelinetype:fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions