Repository navigation
[Bugfix] Preserve transient Store GET errors during HA rebuild - #18
Open
ShuweiShen772 wants to merge 1 commit into
Open
ShuweiShen772 wants to merge 1 commit into
ShuweiShen772 wants to merge 1 commit into
Conversation
ShuweiShen772
force-pushed
the
bugfix/get-retry-during-ha-rebuild
branch
2 times, most recently
from
November 15, 2026 10:16
56d9712 to
d1350be
Compare
ShuweiShen772
force-pushed
the
bugfix/get-retry-during-ha-rebuild
branch
from
November 15, 2026 11:08
d1350be to
de56eea
Compare
This branch has not been deployed
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.
背景
启用
MC_ENABLE_HA_REBUILD=1后,Mooncake master 故障切换期间会经历选举和元数据重建阶段。此时 Store 查询可能暂时返回RPC_FAIL、UNAVAILABLE_IN_CURRENT_STATUS或REPLICA_IS_NOT_READY。此前,
RealClient::get_buffer_internal()会将对象不存在和其他读取错误都转换为nullptr;PythonMooncakeDistributedStore.get()又将nullptr转换为空 bytes。调用方因此无法区分“key 确实不存在”和“HA 重建期间 Store 暂时不可用”。对于可选 KV 缓存,暂时不可用可以由上层作为缓存未命中处理并继续计算;但通用 Store API 不应把暂时错误伪装成 key 不存在。
修改内容
get_buffer_with_status(),保留底层读取错误码,区分OBJECT_NOT_FOUND与其他错误。get()仅在确认OBJECT_NOT_FOUND时返回空 bytes;其他 Store 错误抛出RuntimeError。ha_get_retry_timeout_ms,用于需要等待数据恢复的调用方显式启用有界重试。默认值为 0,即默认不重试,避免缓存请求在 HA 重建期间长时间阻塞。测试结果
mooncake_store和 Pythonstore模块编译通过。RealClientTest.GetBufferWithStatusDistinguishesUnavailableFromMissing通过。serving。/v1/models正常。兼容性说明
真实不存在的 key 仍返回空 bytes。Store 暂时不可用等其他错误现在会显式抛出
RuntimeError。HA rebuild 客户端默认不等待重试;需要等待真实数据恢复的调用方可显式设置ha_get_retry_timeout_ms。可选 KV 缓存应由上层将暂时不可用按缓存未命中处理并继续计算。