崩溃后目录级索引记录无法重新生成,导致 ov backup --include-vectors 永久被拦(附:skills 语义写锁、recursive=false 失效、僵尸 reindex 阻塞 session_commit)
环境
- OpenViking v0.4.21,docker 部署(ghcr.io/volcengine/openviking),linux/arm64 宿主机
vectordb.backend: local,sparse_weight: 0.5,embedding 走外部 provider,维度 2048index_meta.json:{"IndexType": "flat", "Dimension": 2048, "EnableSparse": true, ...}- 数据量约 4000 条,分布在
viking://user/<user>/(memories/skills/sessions)与viking://resources
背景
我方遭遇过索引视图损坏(重启后 get view out of bounds 家族错误; workaround 是删掉 index/default/versions 让引擎从数据层重建,每次都成功、零重嵌开销)。之后尝试走官方向量快照备份路径,遇到以下问题。
正常的部分(先说好消息)
ov export viking://user/<user>/memories ./m.ovpack --include-vectors成功:2419 条、16 秒,包内_ovpack/dense.f32字节数与「条数 × 维度 × 4」精确吻合。ov import ./m.ovpack viking://user/<user>/ --vector-mode require --on-conflict overwrite原位恢复成功(22 秒),向量直恢复、零 embedding 调用。- 小提示:import 的目标参数是父目录;传子树本身会报
ovpack source path is incompatible with target path;user 域的包导入viking://resources/会报source scope does not match target scope。建议文档里把父目录约定写显眼些。
问题一:崩溃后丢失的目录级索引记录,没有任何 API 能重新生成
ov system consistency viking:// 永久显示缺 5 条:
user/<user>#level=0
user/<user>#level=1
user/<user>/skills#level=0
user/<user>/skills#level=1
user/<user>/skills/<skill>/references/taxonomy.md#level=2
尝试过的再生途径全部失败:
ov reindex <目录> --mode vectors_only—— 能重建范围内的文件记录,但补不了这些目录级记录;ov reindex <目录> --mode semantic_and_vectors --recursive=false—— 见问题二/三;- 官方 skill 重装(
ov skills add <目录> -y -w)—— 执行成功(Embedding processed=1),目录级记录依然缺失; - 直接写文件到 skills 目录 —— 被 user 域写入白名单拒绝(符合预期)。
后果:ov backup --include-vectors(以及任何范围含这些路径的导出)被一致性预检永久拦截:INVALID_ARGUMENT: Cannot export incomplete OpenViking vector index snapshot。目前只能按干净子树分域导出绕开,可用但脆弱。
问题二:skills 命名空间的语义写入持续报 lock acquire timed out after 0ms,重启也不消失
ov reindex viking://user/<user>/skills --mode semantic_and_vectors --recursive=false → [INTERNAL] Internal server error,服务端日志:
[VikingFS] Failed to write viking://user/<user>/skills/<skill>: lock acquire timed out after 0ms
File ".../openviking/storage/viking_fs/_semantic.py", line 550, in write_context
File ".../openviking/pyagfs/async_client.py", line 372, in pathlock_acquire_exact
AGFS 磁盘层没有任何锁文件;该错误跨容器重启稳定复现。当时有多个带 skill 同步的客户端会话在线(不确定是否相关)。
问题三:user 命名空间根上 --recursive=false 不生效
ov reindex viking://user/<user> --mode semantic_and_vectors --recursive=false 仍然全子树下钻,给几百个深层旧文件排了语义摘要重算队列(日志可见 semantic_dag 风暴),最终卡死在 skills 路径(问题二),留下一个永远 running 的 admin_reindex 任务。
问题四(副作用,最紧急):僵死的 admin_reindex 任务会饿死 session_commit
该任务卡死期间,会话归档全线失败:LockAcquisitionError: lock acquire timed out after 30001ms(30 分钟 9 次,1 小时零成功提交)。重启容器清掉僵尸任务后会话归档立即恢复。建议:reindex 任务应支持取消 / 失败应快速释放锁,而不是无声阻塞无关写入。
请求
- 目录级索引记录(
#level=0/1)丢失后,官方支持的再生手段是什么? --include-vectors导出的一致性预检,能否容忍目录级记录缺失(它们不影响内容检索)?- 有没有不重启容器就能取消 running 状态 admin_reindex 任务的方法?
- 重启回放损坏(get view out of bounds)48 小时内命中 7 次;删 versions/ 总能修好,但若启动时能自愈会更好。
可以提供完整日志。感谢这个项目——分域向量导出/导入往返实测很有价值。
核对了当前 main 和你使用的 v0.4.21 标签源码,有两点具体跟进:
-
问题三(非递归请求意外下钻):当前实现的 namespace 分派确实忽略了
recursive=false。API 文档原本只支持具体 resource/memory/skill 目录的非递归语义刷新;user 根或 skills 容器并不支持。已提交 #5395,让semantic_and_vectors + recursive=false的 namespace 请求在建任务/加锁前明确报INVALID_ARGUMENT,避免静默启动整棵树的重建。10 个回归用例在原实现失败、修复后通过。这是拒绝不支持的组合,并没有实现 namespace 的单层刷新,也不解决其余索引/锁问题。 -
不重启取消 admin_reindex 的入口:v0.4.21 已有
ov task cancel <task_id>,对应POST /api/v1/tasks/{task_id}/cancel;该版本的可取消类型明确包含admin_reindex。需要使用创建任务的同一 account/user 身份,ROOT 身份会被拒绝。返回cancelling表示请求已接受,仍需通过ov task get <task_id>查看是否到达cancelled;源码支持这个入口不等于已验证它能解除你遇到的具体锁卡死。
目录根的 L0/L1 缺失另有 #4328 正在处理(目前仍是开放 PR,不能当作已发布修复)。我没有在真实存储上复现这里的锁竞争或损坏恢复;如果取消后一直停留在 cancelling,该任务的状态/事件和同时间段脱敏锁日志会有助于把取消未完成与索引记录缺失分开定位。
感谢这么快的跟进,信息量很大,逐条确认:
-
#5395(拒绝 namespace 的非递归语义请求):这正是我们需要的防护——当时的全库 semantic_dag 风暴就是
ov reindex viking://user/<user> --mode semantic_and_vectors --recursive=false触发的。等合并发版我们就升级。 -
ov task cancel:已在 v0.4.21 本地验证命令存在。当晚我们是用容器重启清掉僵尸任务的(当时不知道有这个入口),下次复现会先用同 account 身份 cancel,并把任务状态与同时间段锁日志带回来——特别是「停在 cancelling」的情况。 -
#4328(L0/L1 目录记录缺失):会持续关注。这 5 条缺失目前不影响内容检索,我们用分域导出绕开全库预检,所以不急,但在它合并前
ov backup --include-vectors对我们这类「崩溃过一次的库」是永久不可用的,希望预检对目录级记录缺失的容忍度也一并考虑。
补充一个对我们最重要的实测数据点,供 #4328 参考:分域 ov export --include-vectors + ov import --vector-mode require --on-conflict overwrite 原位往返(2419 条)验证向量快照可无损恢复、零重嵌——这条官方路径本身非常好用,只是被根域一致性预检挡在了全库场景之外。
再次感谢,issue 保持开放等 #4328/#5395 落地。
Root cause of my restart-time "get view out of bounds" family (reported here in Sep) has been identified and fixed by #4991 — concurrent hybrid queries were inserting terms into the sparse dictionary under a shared read lock, corrupting the persisted dictionary (term duplicate on next load). Confirmed the fix on v0.5.2.1 locally (official binary fails the PR's regression test, patched binary passes; 3 clean restarts since). Please merge #4991; it also fixes the dictionary bloat that made my versions wipe workaround necessary.