Repository navigation
[Store] Port safe client metadata rebuild to v0.3.14. - #8
ShuweiShen772 wants to merge 8 commits into
Conversation
全面评审:43/43 文件 + 主路径调用链取证评审版本 head 总判定设计站得住,不建议按现状合入。硬风险集中在一处,正好打在本特性的核心目标上:一个永久离线的 owner 值得肯定的是:特性双侧默认关闭(master flag 默认 false / client 需 P2(3 条,建议合入前修)
P3(5 条)
判干净(含排除的怀疑)
测试覆盖19 个 TEST/TEST_F( 缺口(正好对应上面的 P2):
未验证边界没有构建、没有跑测试; 建议
需要作者回答
|
Semantically adapt 7932b32 onto the merged ff39d88 patch baseline. Preserve reviewed initialization contracts and use v0.3.14 route, liveness, allocator, and snapshot interfaces. Validated fresh GCC 13 / CANN 9.0 Ascend Direct binaries: 13 focused test targets, real NPU master kill/restart, and two repeated two-master NPU failovers with byte-exact read/write recovery and unchanged memory registrations. Original-commit: 7932b32 Signed-off-by: ShuweiShen772 <shenshuwei.3@jd.com>
0b3dc81 to
bc8bb57
Compare
Preserve legacy persisted descriptor schemas, use logical notify identities, fence standalone restarts with durable allocation incarnations, and retain checksum/session/residency during replay. Stage replacement resources before retiring old routes, respect managed weight import guards, retire unmounted ownership, close completed replay windows, and rekey dynamic replica tracking. Validation: PR-scoped pre-commit/static diff checks only. No build or test execution for this revision, per the requested review-and-simplify phase; prior bc8bb57 results do not validate this commit. Signed-off-by: ShuweiShen772 <shenshuwei.3@jd.com>
Centralize write-token derivation and resolve the segment identity together with allocator lookup, avoiding the second segment/owner traversal. Reject pre-connect heartbeat observations by connection generation while allowing fresh Ping recovery after a transient handshake failure. Fence completion against concurrent connection/epoch changes. Validation: static call-path review and PR-scoped pre-commit only. Builds and tests remain deferred by request; no new CPU, NPU or joint Qwen acceptance is claimed. Signed-off-by: ShuweiShen772 <shenshuwei.3@jd.com>
Retire the completed retry attempt in the same short critical section as the replay window so a late failure cannot be overwritten by a later success cleanup. Match existing group-before-state lock order, retain managed-weight ownership classification, and quarantine replay that lacks authoritative weight state or attempts to mutate a closed import. Validation: static review and file-scoped pre-commit only. Current revision is unbuilt and untested by request and is not merge-ready. Signed-off-by: ShuweiShen772 <shenshuwei.3@jd.com>
Remove unused scale benchmark and single-entry/completion RPC wrappers. Share typed batch gating, progress metrics, metadata publication, test fixtures, buffers and polling. Parameterize self/remote/lazy-delete recovery and single/batch Upsert; consolidate redelivery coverage with stalled-owner batch recovery while retaining byte checks, registrations, ordering and concurrency barriers. Avoid redundant metadata-vector copies and preserve the shared write-token high-water mark. PR diff against ff39d88 is 4,884 additions and 116 deletions (5,000 total), including production, tests, scripts and documentation. Validation: file-scoped pre-commit, changed-block CMake formatting, shell/Python syntax and static review only. No new build or test execution; current revision is not merge-ready. Signed-off-by: ShuweiShen772 <shenshuwei.3@jd.com>
|
本文覆盖 yt-zeng、THU-syh 和 DragonFive 的评审意见,逐条回复和最后的完整回复均可用于中文回复评审。 分支已更新到 当前提交尚未重新构建、尚未执行测试。 按当前要求,这个阶段只进行修改、简化和静态评审,测试暂缓。下文提到的历史测试结果属于 一、回复 yt-zeng 的逐条评审意见1. signal_complete 等待整张 outgoing pending 表清空(4490670685)这个问题成立,已修改。恢复完成不再等待历史 outgoing ACK 队列清空,而是等待当前恢复窗口内已接收、归本 client 所有的元数据重放任务。因此,永久离线的远端 owner 不会再阻止这个发送方完成自己符合恢复条件的元数据重放。 这里没有承诺恢复离线 owner 已丢失的内存,也没有绕过 master 的预期 owner 名单及降级超时机制。完成栅栏之后收到的迟到通知,如果只被旧 master 确认过,仍需先向当前 master 重放成功,再发送 ACK。 2. pending 队列无上限、无退避、固定频率全表重发(4490670835)这个问题成立,已修改。完全相同的重试会合并,队列设置了 1,024 条消息、65,536 条 entry 和 64 MiB 序列化载荷的上限。每轮最多取出 64 条到期任务,不再复制全部排队载荷后全量发送。 每条任务采用指数退避,间隔从 100 ms 增长到最高 10 s,并受 12 次尝试或五分钟存活时间限制;容量不足时优先淘汰最老任务。丢弃时记录 WARNING 并增加 3. owner 表锁跨整个批量重放 RPC 持有(4490671004)这个问题成立,已修改。快照采集和本地记账只使用短临界区,批量重放及迟到通知的 RPC 都在表锁之外执行;使用本地 owner 重放任务的 ticket 实现完成栅栏。 已有 8,193 条记录的回归用例用于检查锁作用范围,但它不是百万 key 恢复时延的测量,不能据此宣称百万级恢复性能已经验证。 4. OBJECT_ALREADY_EXISTS 从幂等成功变成可能失败(4490671145)这个问题成立,已修改。单条 Put 和 BatchPut 遇到 新 Put/Upsert 仍保留显式开启该特性后的 ownership 确认约定:数据可能已经提交,但 ACK 确认超时仍可能返回错误;这个错误不表示数据事务已经回滚。未开启该特性的 client 不进入 ownership 跟踪路径。 5. GrantReadLease(0) 没有效果,容易误导(4490671329)这个意见成立,已删除重建路径中的这行调用,没有改成强制撤销已有 lease。已有读者仍保留其 lease,被替换的 allocation 按既有读租约和写入宽限期延迟释放。 6. 一条非法 entry 导致整批有效记录无法恢复(4490671509)这个问题成立,已修改,同时保留原 RPC 返回类型,避免为此增加不必要的线协议/API 改动。 批量重放遇到永久性的 完成信号不包含已拒绝或不符合恢复条件的记录,不能将其解释为这些对象也已恢复成功。 7. offload/cachelib 不参与恢复,需要写清运维结论(4490671722)同意补充运维结论,但需要限定范围。client ownership 重放支持 OFFSET allocator 管理的内存副本,不导入 SSD/3FS/offloaded 副本或 cachelib allocation。 如果没有另外配置且适用的 snapshot/OpLog 恢复路径,只存在于这些不支持存储层的对象不会被本功能恢复,需要业务回源、重填或重新计算。但如果部署本身配置了独立的快照恢复,就不能笼统声称所有 offloaded 对象在每次 failover 后都一定不可见。 8. 无关 CMake 格式化改动(4490671868)这个意见成立,已回退。相对 与功能无关的 nof、TENT 和 source-check 等格式化改动已经移除。 补充:PR 描述中的限制及写主路径测试 hookPR 描述草稿已补充:client rebuild 模式下 Copy/Move 不可用、不支持的存储层不参与导入,以及 client/master 必须使用匹配的 schema。
二、回复 yt-zeng 提出的四个设计问题
三、回复 THU-syh 的评审意见1. 嵌套 descriptor 新增普通字段,破坏旧 snapshot/OpLog 的持久化兼容性这个问题成立,确实是持久化格式兼容问题,而不只是滚动升级时混用新旧二进制的问题。 已将 epoch、allocation extent 和 segment UUID 放在 当前暂停测试阶段,尚未生成或运行由真实 2. HTTP/etcd 等模式下 ACK 回发地址和匹配身份不一致这个问题成立,已修改。UPSERT 的回发地址和 ACK 中的 owner 身份统一采用 segment 注册使用的 仍需补充真实非 P2P 模式的回归验收,目前不宣称当前提交已完成非 P2P 或设备验证。 3. 成功卸载 segment 后残留 ownership 记录,阻断其它存活 segment 的恢复这个补充成立, 已在
因此,本轮不需要为同一个问题重复增加代码,也不会扩大 四、回复 DragonFive 的逐条评审意见1. P0:非 HA 重启复用 (0,id),旧高 token 可能覆盖重放前的新写这个问题成立,已修改。Standalone master 在接受任何写入之前分配一个持久化、严格递增的进程代次(incarnation),即使 gate 关闭也一样。计数器使用文件锁,并在每次启动时通过文件 fsync、原子 rename 和目录 fsync 持久化;HA 模式仍使用 leadership view。旧格式 allocation 的 epoch 0 早于第一个 standalone incarnation。 Ping 会传递确认记录的 master incarnation,它与对象自身的 allocation/write token 分开处理。运维必须跨重启保留 不能在已有 ownership/持久化 token 仍存活时,把 HA/standalone 模式切换当作自动 token 转换;需要协调冷启动 store 并回源重填。重放前新写的对抗性竞争窗口仍需针对当前提交重新执行回归测试。 2. P1:client 重放清空 checksum、session 和 residency这个问题成立,已修改。共享 entry 已携带这些属性, 逐字段恢复和后续 standby/OpLog 恢复仍需在当前提交上重新执行验证。 3. P1:先 Erase 再 reserve,新副本准备失败会破坏旧 route这个问题成立,已修改。在同一 key guard 内,所有可能失败的 reserve/bind 都先完成准备,期间保留旧 publication。完全相同的 in-place allocation 直接复用;只有准备成功后才替换旧 route。失败时通过 RAII 释放新准备的资源,被淘汰的旧 allocation 使用既有宽限期和记账清理方式处理。 如果 overlapping resize 无法与旧 allocation 同时 reserve,会安全失败并保留重试能力,不会仅为了推进恢复而先删除旧 route。当前提交尚未执行未 remount、allocator 不支持、reserve 冲突和 bind 失败的完整故障注入矩阵。 4. P1:managed-weight 重放绕过 group/import 控制约束这个问题成立,已修改。重放采用 group → master-state → key 的锁序,并使用既有 import activity guard 覆盖元数据重放及 OpLog 可见化过程。 entry 还保留该对象是否属于 managed weight,避免空 master 在缺少权威 weight 状态时,将旧成员重新解释为普通 group。缺少权威状态,或者向已关闭/非 IMPORTING 的组新增或替换成员,都不符合 owner 重放条件,返回 这个功能不是独立的 weight manifest 恢复机制。commit、abort、delete 和 residency 操作的竞争回归尚未在当前提交上执行。 5. P1:complete 后 replay view 未清除,后续写持续重复重建 RPC这个问题成立,已修改。成功发送完成信号后,在短表临界区内清理活动 replay 窗口,同时检查 view、连接代次和 master incarnation。已经由当前 master 确认的普通写入不再额外调用 只被旧 master 确认过的迟到记录仍需先重放再 ACK;不能简单清空全部状态,否则会丢失这部分恢复任务。失败或过期的完成过程仍保留重试能力。 retry 状态也与完成窗口在同一个临界区内退出,删除了后面另一个成功清理块,避免覆盖刚发生的失败所请求的新重试。恢复完成后连续 100 次写入的 RPC/事件计数回归仍需执行。 6. P1:UnmountLocalDiskSegment 漏掉 REBUILDING 门控这个问题成立,已修改。已补上与相邻 mount/unmount API 一致的 当前提交尚未执行该对称性检查及 offload 故障回归。 7. P2:in-place Upsert 重发 ReplicaID,却没有同步 dynamic 侧表这个问题成立,已修改。对已完成副本重新发号时,将已有 关闭特性后循环执行 dynamic-copy、Upsert 和 removal 的回归仍需在当前提交上重新执行,目前不宣称已经完成长期循环测试。 五、完整回复感谢几位评审对主路径逐项取证,并提供可复核的对照证据。可用性、持久化格式、ACK 身份、重启 token 和元数据生命周期方面的问题成立,相关修改已经推送到现有 PR,基线保持为 这轮修改保留并补齐了以下约束:通知队列有界重试、只等待本地 owner 恢复任务的完成栅栏、短表锁、已存在对象的 Put 幂等成功语义、嵌套 descriptor 的旧持久化格式兼容、统一的逻辑 ACK 身份、standalone 重启代次、完整的已提交对象属性、先准备资源再替换 route、weight 控制面约束、完成后 replay 窗口退出、卸载门控,以及 dynamic-replica 侧表一致性。 简化方面,已删除重复的本地元数据结构,统一 token 推导,使用栈上的 metadata accessor,并让 allocator 查找同时返回 segment 身份,避免再次遍历 segment/owner 表。后续静态复核还修复了连接/Ping 短暂失败后的恢复问题,以及迟到重试与完成状态清理的竞争。本轮没有通过删除安全栅栏、回归覆盖,或者隐藏不支持的存储层行为来缩小 diff。 验证结果与边界
联合 failover 的方向是 master 0 → 1,挂载 segment 的 provider 是预期 owner,完成数为 1/1。Qwen writer 的 另外保存了一次真实 supervisor 定时线程的实验:预期 owner 为 1、完成数为 0,约 125 秒后进入降级服务,没有手动调用 force-serving;这是独立的控制面定时实验,不是 Qwen 定时故障实验。 以上均为历史结果,不是当前提交的验收结果。 联合功能回归的成对输出与基线一致,但基线在部分提示词上的回答本身存在错误,因此不能宣称模型精度验收通过;也不宣称 PD、跨主机故障、百万 key 恢复时延或全存储层持久化已经验证。 按最新要求,当前提交只完成了静态调用链评审、PR 范围的 pre-commit 和 diff 检查,尚未重新构建、尚未执行测试,目前不能合入。 恢复验收前仍需要补齐并执行:真实基线版本产生的 snapshot/OpLog fixture、非 P2P 通知、重放前写入窗口、替换资源故障注入、weight 控制竞争、完成后的热路径 RPC 计数、磁盘卸载和 dynamic 侧表回归;同时必须从当前提交重新构建 CPU/NPU 二进制,并重新完成要求的全部联合实验,不能沿用旧二进制结果请求合入。 六、压缩迭代补充压缩版已推送到 已删除未用于功能验收的独立 scale benchmark、未使用的单条 committed-metadata RPC 和重复 completion RPC 包装;批量元数据读取同时服务单条与批量写,完成 RPC 直接使用同一实现。移除了生产 Client 中新增的公开测试访问接口,测试改用 friend peer;保留私有的提交/ACK 竞争 hook。 测试不是简单删场景:自身 owner、远端 owner、lazy-delete 和不同长度/字节内容的恢复合并为参数化读恢复用例;单条/批量 Upsert 共享创建、in-place、resize 用例;通知重试后 owner 记录及真实空 master 重启恢复合并到 Put/Upsert 的 stalled-owner batch 用例。并发栅栏、永久失联、超时/淘汰不等于 ACK、乱序地址复用、租户隔离和多副本合并继续保留。新增了 local-disk unmount 门控断言。 生产重放改用 const vector 引用,去掉不必要的整批复制;统一 batch 拒绝结果、进度 gauge 更新和 metadata 发布逻辑。同时恢复 shared write-token 的高水位推进,保留其专项回归,未通过删测试掩盖这项遗漏。 当前版本仅完成文件级 pre-commit、新增 CMake 块格式检查、shell/Python 语法和静态审查,尚未构建或执行测试;所有历史测试仍只对应 |
Fresh GCC13 CPU validation reproduced ClientRebuildRestoresQuotaIdempotently: a same-version additional replica raised the inferred current token, so a newer 128-byte replacement was skipped and 512 bytes remained charged. Trust explicit metadata write tokens; derive from descriptors only when absent. Keep committed-entry reporting consistent and assert the shared token survives replica merging. The reproducing CPU run was 11/12 focused targets passing. This fix has PR-scoped pre-commit checks; fresh rebuild/regression and NPU/joint validation follow. No merge-ready or new NPU pass claim. Signed-off-by: ShuweiShen772 <shenshuwei.3@jd.com>
Signed-off-by: ShuweiShen772 <shenshuwei.3@jd.com>
Signed-off-by: ShuweiShen772 <shenshuwei.3@jd.com>
Description
Port safe client metadata rebuild from v0.3.12 to the merged v0.3.14 xLLM patch
baseline (
ff39d883, PR #7). This updates the existing Mooncake HA PR; it does notcreate or replace the xLLM draft PR.
The client retains ownership of committed OFFSET-memory replicas and replays
metadata after master replacement without recreating the TransferEngine or
re-registering surviving buffers. Recovery has bounded retries, owner-local
completion barriers, version/address/segment fences, bounded remote notifications
and idempotent replay. The master gates business operations during HA rebuilding
and has an explicit degraded-serving timeout.
Review fixes preserve old persisted descriptor schemas, logical metadata-mode
ACK identities, checksum/session/residency, resource-safe route replacement,
managed-weight control contracts, completed replay-window retirement, disk-unmount
admission and dynamic-replica side-table keys. Standalone restarts use a durable
incarnation to prevent pre-replay new writes from sharing legacy
(0,id)ordering.Deployment and limitations
MC_ENABLE_HA_REBUILD=1; the HA master gate remains opt-in(
--enable_ha_rebuild_gate=true). Use matching client/master binaries; rollingmixed descriptor/schema operation is unsupported.
MC_REBUILD_EPOCH_FILE, default$HOME/.mooncake-rebuild-epoch. Do not reset orroll it back while ownership survives. This requirement also applies with
tracking disabled. Changing HA/standalone token domains requires cold-store/refill.
UNAVAILABLE_IN_CURRENT_MODE.separate applicable snapshot/OpLog recovery, refill/recompute unsupported-tier-only
objects. Managed-weight manifests/control state require authoritative weight
recovery; ineligible owner entries are not an alternate manifest source.
resize reservation fails safely rather than erasing old metadata to force progress.
this is not transactional rollback. OBJECT_ALREADY_EXISTS Put/BatchPut remain
idempotently successful and do not wait for ownership ACKs.
lazy-delete resurrection restrictions remain documented.
Suggested Merge Priority
Type of change
Module
Mooncake Store: client/master metadata recovery, allocator reconstruction,
rebuild RPC gates and focused validation drivers. The merged build/dependency/
transport initialization/force/manual-device/custom-topology/TENT baseline is retained.
Testing
Current head:
acc5a054b6ad79215fbdeaae06df7a666c6bee70— unbuilt and untested. The submitter requested a fix/simplify-onlyphase before resuming validation. Only PR-scoped pre-commit, static call-path review
and
git diff --checkhave been performed. Do not approve this revision on thebasis of historical binary results.
Historical evidence for bc8bb57, not the current head:
The Qwen writer owns no mounted global segment and is not a second expected owner.
The joint failover is not bidirectional or cross-host. Rollback is coordinated
cold deployment of matching ff39d88 binaries, not hot mixed-version rollback or
old-cache persistence. Paired functional outputs match the baseline, but baseline
answers on a few prompts were incorrect; model accuracy is not accepted.
No PD, million-key latency, all-tier persistence or leak-free shutdown claim is made.
Pending before merge: rebuild the new revision; add/run actual ff39d88-produced
snapshot/OpLog compatibility fixtures, non-P2P owner ACKs, pre-replay standalone
writes, replacement fault injection, weight control races, post-completion RPC/event
counts, unmount and feature-off dynamic-replica regressions; rerun the native/NPU
and all four required joint stages from the new source.
Checklist
v0.3.14_xllm_patch, not the original upstream tag.AI assistance disclosure
AI-assisted porting, review fixes, static simplification and validation harness
preparation. The human-review requirement remains outstanding; historical test
artifacts are not acceptance evidence for this untested revision.
Compaction follow-up
Current head:
acc5a054b6ad79215fbdeaae06df7a666c6bee70. The complete PR diff against ff39d88 is4,884 additions and 116 deletions (5,000 total), including production, tests,
scripts and documentation. Production adds 2,400 lines; tests/scripts add 2,378;
documentation adds 106. Unused scale benchmarking and redundant RPC/test wrappers
were removed. Shared fixtures and parameter cases retain self/remote/lazy-delete
byte recovery, registrations, Upsert variants, notify redelivery, concurrency,
version/address fences, tenant isolation and replica merging. Const-vector replay
avoids redundant metadata copies; the shared-token high-water mark is retained.
This head is unbuilt and untested, not merge-ready; old bc8bb57 binaries/results
are not acceptance evidence. These descriptions/replies have not been posted.