fix(migration): support RESP3 key enumeration - #730
Open
Kuang-xianxin wants to merge 1 commit 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.
Closes #713
Closes #714
On RESP3 connections, migration key enumeration reads byte-keyed FT.INFO maps as string-keyed dictionaries, treating failed or incomplete indexes as ready. Healthy indexes then hit a KeyError when the aggregate cursor's result map is sliced as a RESP2 row list.
Normalize FT.INFO before checking readiness and extracting SCAN prefixes. Preserve a real zero for percent_indexed instead of treating it as the missing-value default. Share aggregate key extraction between the sync and async executors, handling both RESP2 rows and RESP3 result maps while retaining cursor pagination and cleanup.
Validation:
pytest --confcutdir=tests/unitto exclude the root Docker startup fixture. The Redis-backed integration suite was not run because Docker is unavailable locally.Suggested release label: auto:patch.
AI assistance: implementation, tests and this description were prepared with Codex.
Note
Medium Risk
Changes core migration enumeration logic; incorrect parsing could skip or mis-count documents during migrations, though behavior is guarded by SCAN fallbacks and new regression tests.
Overview
Fixes migration document enumeration on RESP3 Redis connections where
FT.INFOandFT.AGGREGATEreturn structured maps instead of RESP2-style lists.FT.INFO responses are normalized with
convert_bytesbefore readiness checks and prefix extraction, so byte-keyed maps behave like string dicts.percent_indexednow treats an explicit0as incomplete indexing (SCAN fallback) instead of defaulting missing values to1.0.Adds shared
_extract_aggregate_keysfor sync and async executors to read__keyfrom both RESP2 cursor pages and RESP3 aggregate result maps, with cursor pagination and cleanup unchanged. New unit tests cover RESP2/RESP3, decoded vs byte wire formats, incomplete indexes, aggregate errors, and cursor release.Reviewed by Cursor Bugbot for commit d55117f. Bugbot is set up for automated code reviews on this repo. Configure here.