Skip to content

fix(search): stop cancelled migrations before creating temporary indexes - #13529

Merged
tiensonqin merged 1 commit into
masterfrom
devin/1790765333-fix-fts-migration-cancel
Sep 30, 2026
Merged

tiensonqin merged 1 commit into
masterfrom
devin/1790765333-fix-fts-migration-cancel

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Validate the active build ID and source index version after the initial timer, before creating blocks_fts_next. Truncating during that timer gap previously recreated the temporary table and its triggers after truncation had removed them; a superseded migration could also erase a newer build's temporary index. Existing truncation cleanup remains responsible for removing tables, avoiding delayed cleanup that could delete a successor's work.

Integration: follow-up to #13475, which has landed on master. Rebased onto master at 792f86328b; this PR now targets master directly and contains only the fix and regression tests. git range-diff confirms the fix is unchanged by the rebase.

Verification

  • Two new race regressions: 2 tests, 10 assertions passed. Both fail with the production guard removed: truncation leaves duplicate triggers, and an obsolete migration empties its successor's temporary FTS table.
  • Existing rowid and migration regressions: 3 tests, 26 assertions passed.
  • Scoped clj-kondo: 0 errors, 0 warnings; CLJS test compilation: 0 warnings.
  • Compiled production worker API probe: build a v4 index → immediately truncate → wait for migration exit → write a block. Before: six triggers and writes into both FTS tables. After: three triggers, no temporary table, valid searchable content; persisted state also verified after closing and reopening SQLite.
  • These local checks were run before the rebase. Verification used the Node worker API and real SQLite through the compiled test bundle; Desktop UI and browser-worker end-to-end testing were not run.

Commands:

bb dev:test \
  -v frontend.worker.db-core-test/search-rowid-migration-truncated-before-start-test \
  -v frontend.worker.db-core-test/search-rowid-migration-superseded-before-start-test \
  -v frontend.worker.db-core-test/search-build-blocks-indice-in-worker-moves-version-four-index-to-rowid-keys-test \
  -v frontend.worker.search-test/fts-rows-keep-blocks-rowids-test \
  -v frontend.worker.search-test/fts-rowid-migration-keeps-search-right-test
clojure -M:clj-kondo --lint src/main/frontend/worker/handler/search.cljs src/test/frontend/worker/db_core_test.cljs

Link to Devin session: https://app.devin.ai/sessions/26337e080f2d4682b150ea67cc37b380
Open in Devin Desktop: https://app.devin.ai/desktop/session/26337e080f2d4682b150ea67cc37b380?variant=devin
Requested by: @tiensonqin


Devin Review

@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@tiensonqin
tiensonqin changed the base branch from devin/1790765699-pr13475-base to master September 30, 2026 11:01
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1790765333-fix-fts-migration-cancel branch from 80c219b to 3c58582 Compare September 30, 2026 11:02
@tiensonqin
tiensonqin merged commit e8f0448 into master Sep 30, 2026
12 of 14 checks passed
@tiensonqin
tiensonqin deleted the devin/1790765333-fix-fts-migration-cancel branch September 30, 2026 11:05
devin-ai-integration Bot pushed a commit that referenced this pull request Sep 30, 2026
…mporary index (#13475 #13529)

Co-authored-by: Tienson Qin <[email protected]>
Signed-off-by: Tienson Qin <[email protected]>
devin-ai-integration Bot pushed a commit that referenced this pull request Oct 1, 2026
…mporary index (#13475 #13529)

Co-authored-by: Tienson Qin <[email protected]>
Signed-off-by: Tienson Qin <[email protected]>
devin-ai-integration Bot pushed a commit that referenced this pull request Oct 8, 2026
…mporary index (#13475 #13529)

Co-authored-by: Tienson Qin <[email protected]>
Signed-off-by: Tienson Qin <[email protected]>
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