Repository navigation
[TransferEngine] Report Redis error replies as failures in the metadata plugin - #4107
Merged
Merged
Conversation
…ta plugin RedisStoragePlugin::set()/remove() treated any non-null reply as success and never inspected reply->type, so a REDIS_REPLY_ERROR — the server deliberately rejecting the write — was reported to registerSegmentDesc() as a completed publish. The likely trigger is a failover: a promoted or briefly routed-to replica answers -READONLY, which is a valid reply object, so the write was dropped with no signal anywhere. -OOM at maxmemory, -MISCONF and -NOAUTH take the same silent path. Check REDIS_REPLY_ERROR in set()/remove()/get() and log the server's error string so -READONLY is distinguishable from a connection failure, and map it to kUnavailable in getWithStatus() instead of letting the error text reach the JSON parser as a misleading parse error. The check mirrors the AUTH/SELECT handling already in the same class. Signed-off-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com>
he-yufeng
requested review from
alogfans,
chestnut-Q,
doujiang24 and
staryxchen
as code owners
September 14, 2026 10:13
10 of 31 tasks
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.
Description
Fixes #4099.
RedisStoragePlugin::set()/remove()treated any non-null reply as success and never inspectedreply->type, so aREDIS_REPLY_ERROR— the server deliberately rejecting the write — was reported toregisterSegmentDesc()as a completed publish. The likely trigger is a failover: a promoted replica, or a load balancer briefly routing to one, answers-READONLY, which is a valid reply object, so the write was dropped with no signal anywhere.-OOMat maxmemory,-MISCONFand-NOAUTHtake the same silent path.set()/remove()/get()now checkREDIS_REPLY_ERRORand log the server's error string, so-READONLYis distinguishable from a connection failure.getWithStatus()maps it tokUnavailabledirectly instead of letting the error text reach the JSON parser as a misleading parse error. The check mirrors the AUTH/SELECT handling already in the same class.No retry is added on purpose: the server answered, so the command was received and rejected; only the reporting was wrong.
Module
mooncake-transfer-engine)Type of Change
How Has This Been Tested?
There is no existing test harness for this plugin, so I built one off-tree for this PR: the current
RedisStoragePluginclass is extracted verbatim into a test driver at build time (so the binary runs the actual PR text, not a copy), linked against the real hiredis, and driven against a minimal fake Redis server speaking RESP2 that answers-READONLYto every write.Test commands:
Test results:
-READONLY:set()=true, remove()=true— the silent write loss, reproduced.-READONLY:set()=false, remove()=false, get()=false,getWithStatus()=kUnavailable, and the log carries the server's error string (READONLY You can't write against a read only replica.).set()/remove()/get()succeed,getWithStatus()=kFound— no behavior change on the healthy path.getWithStatus()=kNotFoundpreserved — authoritative absence still distinguishes from outage, assyncSegmentCacherelies on.Checklist
./scripts/code_format.sh(pre-commitFormat staged C/C++ changespassed on the touched file)tests/)AI Assistance Disclosure
Prepared with AI assistance (Kimi); the failing-then-passing harness results above are from my local runs, and the submitter has reviewed every changed line.