WeKnora icon indicating copy to clipboard operation
WeKnora copied to clipboard

[Bug]: Qdrant数据库Collection weknora_embeddings_1024 doesn't exist!

Open shaofengzeng opened this issue 2 months ago • 1 comments

Affected Component

Vector Database

Bug Description

相同的环境WSL2中运行正常,迁移到离线设备,在导入文档时报错Collection weknora_embeddings_1024 doesn't exist!。 离线环境为ubuntu 22.04, docker 27.0.3, WeKnora v0.8.0。 相关数据库包括Qdrant, Minio, postgres, Neo4j等。嵌入表示模型为bge-m3。通过UI配置嵌入表示模型,并通过测试。 上传文档后,报错collection不存在。手动创建后,服务正常。 在WSL2中,上述配置运行正常。

Steps to Reproduce

不详

Expected Behavior

可自动构建collection

Actual Behavior

无法自动创建亲qdrant collection

WeKnora Version

0.8.0

Deployment Method

Docker Compose

Operating System

ubuntu 22.04 server

Relevant Logs


Confirmation

  • [x] I have searched existing issues and confirmed this is a new one

shaofengzeng avatar Sep 17 '26 03:09 shaofengzeng

接一下这个 issue。

根因在「先删后写」这条链上:向量按维度存在 weknora_embeddings_<dim>,collection 由该维度的第一次写入惰性创建;而重新索引的路径(knowledgeService.updateChunkVector、chunkService.syncChunkIndex)以及按维度删除的路径都是先删旧向量、再写新的。当这次删除是该维度的第一次操作时,Qdrant 回 Collection ... doesn't exist!,删除报错,把后面本该创建 collection 的写入一起中断了——所以是「删除挡住建库」,不是 Qdrant 不会自动建。

修复是让三个删除路径对齐读路径已有的口径(VectorRetrieve 对不存在的 collection 按「没有结果」处理):不存在就跳过 DeletePoints 并返回 nil,探活本身失败仍然照常报错,collection 依旧由随后的写入自动创建(保持你期望的「可自动构建」)。已经手动建过 collection 的环境行为不变。

PR: https://github.com/Tencent/WeKnora/pull/3419

  • 单测覆盖三种删除 ×(collection 不存在 / 存在 / 探活失败 / 已初始化走缓存 / 空 ID 列表);去掉守卫会让三个子用例复现你报的那条原文
  • 另在本地真 Qdrant v1.16.2 上做了端到端验证:修复前「先删后写」报同样的 NotFound: Collection weknora_embeddings_1024 doesn't exist!,修复后删除无操作、随后的写入自动建出 collection、写入后再删能正常删掉

一点说明:我没有你那套离线环境的复现条件,上面是按代码链路推演 + 真 Qdrant 验证得到的,不是现场复现。如果之后还有残留,麻烦贴一下当时的完整日志,可以再收窄。

LeonPure avatar Sep 18 '26 17:09 LeonPure