Skip to content

[8.4] Serialize and Restore Schema command - [MOD-11803]#7142

Merged
nafraf merged 1 commit into8.4from
backport-7032-to-8.4
Oct 24, 2025
Merged

[8.4] Serialize and Restore Schema command - [MOD-11803]#7142
nafraf merged 1 commit into8.4from
backport-7032-to-8.4

Conversation

@redisearch-backport-pull-request
Copy link
Copy Markdown
Contributor

@redisearch-backport-pull-request redisearch-backport-pull-request bot commented Oct 23, 2025

Description

Backport of #7032 to 8.4.


Note

Introduce schema serialization (FT.DEBUG DUMP_SCHEMA) and internal restore (FT._RESTOREIFNX SCHEMA), plus refactors for GC start and RDB (de)serialization utilities with tests.

  • Commands/APIs:
    • Add internal FT._RESTOREIFNX SCHEMA <encver> <blob> to restore an index schema via IndexSpec_Deserialize.
    • Add debug FT.DEBUG DUMP_SCHEMA <index> returning serialized schema and INDEX_CURRENT_VERSION.
    • Register new command macro RS_RESTORE_IF_NX and its subcommand.
  • Spec/RDB internals:
    • Introduce IndexSpec_Serialize/IndexSpec_Deserialize using module data type save/load to/from string.
    • Add IndexSpec_RdbLoad_Logic and save wrapper; update type registration to use them.
    • Refactor IndexSpec_StartGC to remove ctx param and use RSDummyContext; update callers.
    • Factor IndexSpec_StoreAfterRdbLoad; adjust RDB load paths accordingly.
  • Tests/Mocks:
    • Extend redismock with SaveDataTypeToString/LoadDataTypeFromStringEncver.
    • Add C++ tests for string-based schema (de)serialization.
    • Add Python tests for DUMP_SCHEMA and _RESTOREIFNX SCHEMA behavior and errors.

Written by Cursor Bugbot for commit 0222840. This will update automatically on new commits. Configure here.

* layout basic schema command generation

* implement IndexSpec_Serialize and IndexSpec_Deserialize

* added a unit-test

* fix warning

* implement mock API

* implement restore schema command

* add tests (and a dump debug command)

* improve test

* remove temporary logs

* fix tests

(cherry picked from commit 5feebc4)
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 23, 2025

Codecov Report

❌ Patch coverage is 98.24561% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.47%. Comparing base (48ee400) to head (0222840).
⚠️ Report is 5 commits behind head on 8.4.

Files with missing lines Patch % Lines
src/debug_commands.c 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              8.4    #7142      +/-   ##
==========================================
- Coverage   85.67%   85.47%   -0.20%     
==========================================
  Files         327      327              
  Lines       51945    50992     -953     
  Branches    10921    10921              
==========================================
- Hits        44503    43587     -916     
+ Misses       7276     7239      -37     
  Partials      166      166              
Flag Coverage Δ
flow 84.09% <98.24%> (-0.22%) ⬇️
unit 51.49% <45.61%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@redisearch-backport-pull-request redisearch-backport-pull-request bot added this pull request to the merge queue Oct 23, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 23, 2025
@GuyAv46 GuyAv46 added this pull request to the merge queue Oct 23, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 24, 2025
@nafraf nafraf added this pull request to the merge queue Oct 24, 2025
Merged via the queue into 8.4 with commit 2bfa9f3 Oct 24, 2025
22 checks passed
@nafraf nafraf deleted the backport-7032-to-8.4 branch October 24, 2025 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants