fix(storage): enforce Mooncake correctness contracts - #5
Open
overloadedHenry wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(storage): 强化 Mooncake 正确性契约
背景
本 PR 根据 redai-infra/Relax#278 中维护者的要求,将 Mooncake 正确性修复提交到 TransferQueue 上游,不再由 Relax 通过运行时 monkey patch 维护。
当前 MooncakeStore 路径存在三类可能被错误视为成功的失败场景:
batch_remove失败时只记录日志,不向调用方传播错误;这些情况可能使不完整的存储操作或被 controller 拒绝的 readiness 更新继续执行,形成静默数据丢失风险。
修改内容
校验每一次 Mooncake 批量调用的返回结果
新增统一的结果数量校验,并应用于:
batch_upsert_from的首次调用和每次重试;batch_get_into的首次调用和每次重试;batch_remove。每次调用都必须为每个请求 key 返回且仅返回一个结果码。返回值不可计算长度或结果数量不匹配时,立即抛出
RuntimeError。删除失败时显式报错
MooncakeStoreClient.clear()现在会:batch_remove返回数量异常时抛错;-704(对象不存在)视为幂等删除成功。production-status 必须收到正 ACK
Storage notification 现在采用 fail-closed 语义:
NOTIFY_DATA_UPDATE_ACK且success is True才视为成功;行为变化
batch_remove失败-704)测试覆盖
本次修改增加了以下测试场景:
batch_upsert_from重试返回结果过短;batch_get_into重试返回结果过短;batch_remove返回结果过短或删除失败;-704幂等删除;相关测试文件:
tests/test_mooncake_utils.pytests/test_storage_manager_notifications.py兼容性与风险
-704)的幂等删除语义。后续工作
本 PR 合入后,Relax 需要将 TransferQueue pin 更新到包含本修复的版本或 commit,并删除临时的 Mooncake runtime patch 及其调用点。
关联 PR