Fix Redis state store query index init on Redis 8.8+ - #4404
Open
wrysjy wants to merge 5 commits into
Open
Conversation
Redis 8.8 started prefixing the duplicate FT.CREATE reply with an error code, changing it from "Index already exists" to "SEARCH_INDEX_EXISTS Index already exists". registerSchemas compared the error string exactly, so on Redis 8.8+ any sidecar initializing a state.redis component with queryIndexes against an existing index failed with INIT_COMPONENT_FAILURE and exited. This breaks every app with more than one replica, and single-replica apps on restart. Match the error with strings.Contains so both reply formats take the existing drop-and-recreate path, and add unit tests covering both formats plus unrelated-error passthrough. Signed-off-by: Yu <wrysjy@gmail.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
mikeee
approved these changes
Jul 28, 2026
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
Redis 8.8 started prefixing module error replies with an error code: a duplicate
FT.CREATEnow returnsSEARCH_INDEX_EXISTS Index already existsinstead of the bareIndex already exists.registerSchemasin the Redis state store compared the error string exactly, so on Redis 8.8+ any daprd initializing astate.rediscomponent withqueryIndexesagainst an existing index failed withINIT_COMPONENT_FAILUREand exited — breaking every app with more than one replica, and single-replica apps on restart.This PR matches the error with
strings.Containsso both reply formats take the existing drop-and-recreate path, and adds unit tests forregisterSchemascovering both error formats plus unrelated-error passthrough (the function previously had no tests).Verified empirically: daprd built with this change initializes successfully against
redis:8.8.0with a pre-existing index (logsdrop stale query index), while v1.18.0 exits withINIT_COMPONENT_FAILURE. Behavior onredis:8.6.3and earlier is unchanged.Issue reference
Please reference the issue this PR will close: #4403
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: