Skip to content

fix(knowledge): create HNSW index with IF NOT EXISTS - #7692

Closed
ump45nose wants to merge 1 commit into
1Panel-dev:v2from
ump45nose:fix/7596-hnsw-index-race
Closed

ump45nose wants to merge 1 commit into
1Panel-dev:v2from
ump45nose:fix/7596-hnsw-index-race

Conversation

@ump45nose

Copy link
Copy Markdown
Contributor

Summary

Fixes #7596.

create_knowledge_index() checks pg_indexes then runs CREATE INDEX. When a knowledge-base embedding fans out per-document workers, several tasks can pass the check at once; the first create wins and the rest raise DuplicateTable, failing those document jobs.

Change: CREATE INDEX IF NOT EXISTS ... so a concurrent creator is a no-op.

Test plan

AI disclosure

AI-assisted (authored and verified by ump45nose).

Parallel document embedding for one knowledge base can all pass the
pg_indexes existence check and then race on CREATE INDEX, raising
DuplicateTable. Use CREATE INDEX IF NOT EXISTS so losers of the race
do not fail the embedding task (Fixes 1Panel-dev#7596).

Signed-off-by: Vincent <1729065730@qq.com>
@liuruibin liuruibin closed this Nov 6, 2026
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.

[Bug] 同库多文档并行向量化时并发创建 HNSW 索引报 DuplicateTable,导致整库向量化任务失败

2 participants