feat: Index Migrator#583
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a pre-release RedisVL index migration system (sync + async) with planning, execution, validation, batch workflows, and extensive documentation/tests to enable crash-safe, document-preserving schema evolution.
Changes:
- Introduces migration core modules (planner/executor/validator/backup/quantize/reliability) plus batch migration support.
- Adds async equivalents and a new
rvl migrateCLI entry point + docs. - Adds comprehensive unit/integration tests and benchmark/e2e helper scripts.
Reviewed changes
Copilot reviewed 45 out of 53 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_async_migration_planner.py | Adds async planner unit coverage mirroring sync planner tests. |
| tests/unit/test_async_migration_executor.py | Adds async executor + disk space estimator unit tests and dtype-detection tests. |
| tests/integration/test_migration_v1.py | End-to-end integration test for sync plan/apply/validate flow. |
| tests/integration/test_migration_routes.py | Integration coverage for supported migration “routes” (algo/metric/dtype/params). |
| tests/integration/test_field_modifier_ordering_integration.py | Adds integration tests for new/related field modifiers (INDEXEMPTY/UNF/NOINDEX). |
| tests/integration/test_batch_migration_integration.py | Adds integration tests for batch plan/apply/resume/progress callback. |
| tests/integration/test_async_migration_v1.py | End-to-end integration test for async plan/apply/validate flow. |
| tests/benchmarks/visualize_results.py | Adds benchmark visualization script for retrieval/memory/latency charts. |
| scripts/verify_data_correctness.py | Adds manual script to verify float32→float16 migration correctness. |
| scripts/test_migration_e2e.py | Adds large-scale e2e migration benchmark script. |
| scripts/test_crash_resume_e2e.py | Adds crash/resume robustness test script for quantization checkpointing. |
| redisvl/redis/connection.py | Enhances vector attribute parsing to include HNSW params (m, ef_construction). |
| redisvl/migration/validation.py | Adds sync migration validation (schema/doc counts/key samples/functional checks). |
| redisvl/migration/utils.py | Adds YAML helpers, schema canonicalization, readiness polling, disk estimation utilities. |
| redisvl/migration/reliability.py | Adds crash-safety utilities: dtype detection, checkpointing, BGSAVE helpers, undo buffer. |
| redisvl/migration/quantize.py | Adds pipelined (and multi-worker) quantization for vector dtype conversions. |
| redisvl/migration/models.py | Adds migration/batch models and disk space estimate models/helpers. |
| redisvl/migration/batch_planner.py | Adds batch planner for applying a shared patch across many indexes. |
| redisvl/migration/batch_executor.py | Adds batch executor with checkpointing/resume and reporting. |
| redisvl/migration/backup.py | Adds crash-safe on-disk backup format for vector dumps and resume. |
| redisvl/migration/async_validation.py | Adds async validator parity with sync validation checks. |
| redisvl/migration/async_planner.py | Adds async planner wrapper over sync diff/classification logic. |
| redisvl/migration/init.py | Exposes new migration/batch APIs at package boundary. |
| redisvl/cli/utils.py | Fixes redis URL scheme building and refactors CLI option helpers. |
| redisvl/cli/main.py | Wires in new migrate CLI command group. |
| docs/user_guide/index.md | Adds migration to user guide landing page highlights. |
| docs/user_guide/how_to_guides/index.md | Adds “Migrate an Index” how-to link and toctree entry. |
| docs/user_guide/cli.ipynb | Updates CLI notebook with rvl migrate commands and reorganizes connection section. |
| docs/concepts/search-and-indexing.md | Updates concept docs to point to new migration workflow and docs. |
| docs/concepts/index.md | Adds “Index Migrations” concept card and toctree entry. |
| docs/concepts/index-migrations.md | New concept doc describing migration modes, supported changes, and sync/async behavior. |
| docs/concepts/field-attributes.md | Expands vector datatype docs + migration support notes for modifiers. |
| docs/api/cli.rst | Adds a full CLI reference including rvl migrate command group. |
| CLAUDE.md | Adds protected directory note (local_docs/). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3fe4972 to
3f03bb7
Compare
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5671e6fe69
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
01d3025 to
037c2d8
Compare
…, validator, and utilities Adds the core data structures and planning engine for the Index Migrator: - models.py: Pydantic models for MigrationPlan, DiffClassification, ValidationResult, MigrationReport - planner.py: MigrationPlanner with schema introspection, diffing, and change classification - validation.py: MigrationValidator for post-migration checks - utils.py: shared helpers for YAML I/O, disk estimation, index listing, timestamps - connection.py: HNSW parameter extraction for schema introspection - 15 unit tests for planner logic
- Fix import ordering in utils.py (isort compliance) - Simplify validation prefix key rewriting to mirror executor logic - Normalize single-element list prefixes in normalize_target_schema_to_patch
Adds the migration executor and CLI subcommands for plan/apply/validate: - executor.py: MigrationExecutor with sync apply, key enumeration, index drop/create, quantization, field/key rename - reliability.py: BatchUndoBuffer, QuantizationCheckpoint, BGSAVE helpers - cli/migrate.py: CLI with plan, apply, validate, list, helper, estimate subcommands - cli/main.py: register migrate command - cli/utils.py: add_redis_connection_options helper - Integration tests for comprehensive migration, v1, routes, and field modifier ordering
- Fix CLI step labels to match executor order - Fix GEO coordinates to lat,lon order in integration tests - Move JSON path to top-level field property in tests - Use sys.exit() instead of exit() in CLI - Use transaction=False for quantize pipeline
Adds guided migration builder for interactive plan creation: - wizard.py: MigrationWizard with index selection, field operations, vector tuning, quantization, and preview - cli/migrate.py: adds 'wizard' subcommand (rvl migrate wizard --index <name>) - Unit tests for wizard logic (41 tests)
- Improve field removal to clean up renames by both old_name and new_name - Resolve update names through rename map in working schema preview - Add multi-prefix guard to reject indexes with multiple prefixes - Fix dependent prompts (UNF, no_index) when field is already sortable - Pass existing field attrs to common attrs prompts for update mode
…CLI flag Adds non-blocking async migration support: - async_executor.py: AsyncMigrationExecutor with async apply, BGSAVE, quantization - async_planner.py: AsyncMigrationPlanner with async create_plan - async_validation.py: AsyncMigrationValidator with async validate - async_utils.py: async Redis helpers - cli/migrate.py: adds --async flag to 'apply' subcommand - Unit tests for async executor and planner
- Fix SVS client leak in async_planner check_svs_requirements - Remove dead async_utils.py (functions duplicated in async_executor)
…ands - batch_planner.py: multi-index plan generation with pattern/list support - batch_executor.py: checkpointed batch execution with resume capability - CLI: batch-plan, batch-apply, batch-resume, batch-status subcommands - 32 unit tests for batch migration logic
… CLI - Refactor _check_index_applicability to return Tuple[BatchIndexEntry, bool] where bool indicates quantization, avoiding redundant create_plan_from_patch - Replace exit(1) with sys.exit(1) in batch-apply and batch-resume CLI commands - Sanitize report filenames (colons to underscores) for Windows compat
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3865a72. Configure here.
| plan.merged_target_schema, field_rename.new_name | ||
| ) | ||
| if not old_path or not new_path or old_path == new_path: | ||
| continue |
There was a problem hiding this comment.
JSON field rename skipped silently
Medium Severity
For JSON storage, a field rename runs only when both old and new JSON paths resolve via get_schema_field_path. If either path is missing, the executor continues without error while the migration still drops and recreates the index, leaving documents under the old paths and breaking the new schema.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 3865a72. Configure here.
|
🚀 PR was released in |


feat: Index Migrator (Pre-release)
Zero-downtime, crash-safe index migration for RedisVL. Plan, apply, and rollback schema changes, including vector quantization, field renames, prefix changes, and algorithm swaps, through a single CLI or programmatic API.
Summary
This PR adds a complete index migration system to RedisVL, enabling users to evolve their index schemas without data loss. The migrator handles the full lifecycle: plan → review → apply → validate → rollback.
Key Capabilities
Architecture
Usage
CLI: Interactive Wizard
CLI: Batch Migration (Multiple Indexes)
Programmatic API
Async API
Crash Safety & Resume
Quantization migrations always write a vector backup to disk before mutating data. When
--backup-diris omitted, the executor auto-defaults to./migration_backups.rvl migrate rollbackrestores original vectors from the backup at any timeThe backup file tracks phase (dump → ready → active → completed) and batch progress, so resume skips already-completed work. Backups are retained on disk after success for audit/rollback; cleanup is a manual step.
Performance
--batch-size)--workers Nparallelizes vector re-encoding via ThreadPoolExecutor (sync) or asyncio.gather (async)rvl migrate estimatecalculates RDB + AOF impact before any mutationsWhat's Blocked
New Files
redisvl/migration/(core module)models.pyMigrationPlan,MigrationReport,MigrationTimings, etc.planner.pyexecutor.pyasync_executor.pyasync_planner.pyvalidation.py/async_validation.pybackup.pyVectorBackup: crash-safe binary backup formatquantize.pyreliability.pywizard.pybatch_planner.py/batch_executor.pyutils.pyredisvl/cli/migrate.pyCLI with 11 subcommands:
helper,wizard,plan,apply,estimate,rollback,validate,batch-plan,batch-apply,batch-resume,batch-statusTests
test_migration_planner.pytest_migration_wizard.pytest_vector_backup.pytest_pipeline_quantize.pytest_executor_backup_quantize.pytest_multi_worker_quantize.pytest_async_migration_executor.pytest_async_migration_planner.pytest_batch_migration.pyTotal: 219 unit tests collected, all pre-commit checks clean.
Review Notes
docs/user_guide/how_to_guides/migrate-indexes.mdanddocs/concepts/index-migrations.mdNote
High Risk
Introduces a large new migration subsystem that can drop/recreate indexes, rename keys/fields, and re-encode vector data; mistakes or edge cases can cause downtime or irreversible data changes despite backups/resume safeguards.
Overview
Adds a new experimental index migrator exposed via
rvl migrate(wizard/plan/apply/estimate/rollback/validate plus batch-plan/apply/resume/status) and a newredisvl.migrationpackage exporting sync/async planners, executors, validators, batch tooling, and models.Implements an async migration executor that supports drop/recreate migrations with key enumeration (FT.AGGREGATE w/ SCAN fallback), field renames (hash/JSON), prefix renames (standalone and cluster-safe), and vector datatype changes; quantization now enforces mandatory on-disk backups (auto-defaulting to
./migration_backups) to enable crash-safe resume and rollback.Expands documentation substantially: adds a CLI reference page, new migration concept/how-to guides, and updates existing docs/notebooks to include migrate commands; also updates
.gitignore,CLAUDE.md, and CLI connection option helpers.