feat(ragfs): unify CacheRuntime and Redis-backed CacheFS/QueueFS - #4353
Conversation
|
主要问题 [P1] read_from_replica=true 会破坏 QueueFS 强一致语义 [P1] 已发布文档中的旧 CacheFS 配置升级后无法启动 [P1] CacheFS 在 Redis 启动时不可用的情况下不能 fail-open [P1] rediss:// 的 TLS 语义被丢弃 另有一个兼容性风险:旧 QueueFS 默认连接/命令超时均为 3000ms;迁移仅复制显式字段,省略时会采用新 Provider 的 1000ms/20ms 默认值,可能导致升级后大量超时。 |
|
建议 ov.example.conf 上面增加 cache 的示例配置 |
已增加 |
There was a problem hiding this comment.
感谢这次较完整的 CacheRuntime 重构,整体方向清晰,CacheFS 与 QueueFS 共用运行时也减少了重复实现。我重点检查了运行时生命周期、Redis 拓扑能力、QueueFS 消息恢复和新旧配置兼容,目前有 5 处希望合并前再确认并完善的问题:Redis 初始化失败后的任务清理、replica reads 的实现与描述一致性、config_path 对 canonical cache 配置的支持、QueueFS 关闭时的 heartbeat 清理,以及一组旧配置迁移兼容场景。具体触发路径和建议已分别标在对应代码处;辛苦修复并补充回归测试后再合并。
已修复 |
Description
This PR consolidates the RAGFS cache infrastructure into a shared
CacheRuntimeinside theragfscrate. It adds a built-in Fred-based RedisProvider, routes CacheFS and QueueFS cache operations through the same runtime, and makesragfs-pythonthe single Python binding and wheel build entry point.The default OpenViking behavior remains unchanged. CacheRuntime is initialized only when CacheFS or QueueFS selects
backend=cache. DynamicProvider and distributed PathLock support remain explicitly deferred.Human Involvement
Related Issue
4352
Type of Change
Changes Made
CacheRuntimeand synchronousSyncCacheRuntimeFacadeinside theragfscrate. The runtime exposes the Redis-style operations required by CacheFS and QueueFS, including String, batch String, counters, Set queries, non-blocking List commands, registered scripts, health checks, and lifecycle operations.SyncCacheRuntimeFacadeandRuntimeExecutorto call the same provider instead of maintaining a second synchronous connection pool.CacheQueueStorage -> CacheRuntime -> RedisProvider. QueueFS key layout, Lua scripts, heartbeat, stale-message recovery, and result parsing remain owned by QueueFS incache_protocol.rs.backend=redistobackend=cachewith the global RedisProvider. Redis failures in QueueFS return an error and do not switch to SQLite at runtime.cache.providerandcache.params. CacheFS and QueueFS select onlybackend=localorbackend=cache; no globalcache.enabledflag is required.storage.agfs.cacheconfiguration, legacy QueueFS Redis settings,singletonmode, and QueueFS Redis key prefixes. Conflicting legacy and canonical settings fail during configuration validation.ragfs-pythonand removed the separateragfs-python-nativecrate. CacheRuntime configuration is passed through the existing RAGFS binding and wheel path.Testing
Automated verification:
cargo test --locked -p ragfs --features cachecargo check --locked -p ragfs-pythonpassed.python3 -m pytest -q -o addopts='' tests/misc/test_config_validation.pygit diff --checkpassed.Docker and Redis validation:
read,ls,tree, andgrepoperations with CacheFS using RedisProvider.Checklist
Screenshots (if applicable)
Not applicable.
Additional Notes
backend=cache, Redis failures are returned to the caller instead of silently switching to SQLite..soloading, and capability negotiation are not implemented in this PR. They are planned as follow-up work.NamedQueue.enqueue()returns the binding write result instead of the generated message ID. This affects all QueueFS backends.