Run the SQLite-only FTS deadlock step only on SQLite #227

Merged
weichen merged 2 commits from fix/search-deadlock-test-pg-dialect into main 2026-10-20 09:28:58 +00:00
@@ -84,21 +84,24 @@ func TestSearchDeadlockRegression(t *testing.T) {
}) })
// 2. Content FTS scan: pred callback queries the same Store // 2. Content FTS scan: pred callback queries the same Store
runBounded("searchKnowledgeFTSCandidates", func() { // knowledge_fts MATCH is SQLite FTS5 only; production never calls it on PostgreSQL.
hits, err := st.searchKnowledgeFTSCandidates(func(d core.KnowledgeDoc) bool { if st.Dialect() == "sqlite" {
_, qerr := st.GetAccountByOwner(d.Owner) runBounded("searchKnowledgeFTSCandidates", func() {
if qerr != nil { hits, err := st.searchKnowledgeFTSCandidates(func(d core.KnowledgeDoc) bool {
t.Errorf("GetAccountByOwner failed in callback: %v", qerr) _, qerr := st.GetAccountByOwner(d.Owner)
if qerr != nil {
t.Errorf("GetAccountByOwner failed in callback: %v", qerr)
}
return true
}, core.RetrievalQuery{Text: "database optimization", TopK: 5}, true)
if err != nil {
t.Errorf("searchKnowledgeFTSCandidates failed: %v", err)
} }
return true if len(hits) == 0 {
}, core.RetrievalQuery{Text: "database optimization", TopK: 5}, true) t.Errorf("expected at least 1 hit, got 0")
if err != nil { }
t.Errorf("searchKnowledgeFTSCandidates failed: %v", err) })
} }
if len(hits) == 0 {
t.Errorf("expected at least 1 hit, got 0")
}
})
// 3. Content LIKE scan: pred callback queries the same Store // 3. Content LIKE scan: pred callback queries the same Store
runBounded("searchKnowledgeLikeSharedCandidates", func() { runBounded("searchKnowledgeLikeSharedCandidates", func() {