Skip to content

[8.2] [MOD-15685] Fix crash when a legacy index spec is restored after a failed replication sync - #11638

Merged
redisearch-backport-pull-request[bot] merged 1 commit into
8.2from
backport-agent/pr-11619-to-8.2
Sep 30, 2026
Merged

redisearch-backport-pull-request[bot] merged 1 commit into
8.2from
backport-agent/pr-11619-to-8.2

Conversation

@redisearch-backport-pull-request

Copy link
Copy Markdown
Contributor

Backport of #11619 to 8.2.
Merge commit: b1b6903a1cc5b314fc64329f1434ff8f09710fdd

Describe the changes in the pull request

  1. Current: [MOD-15685] Fix crash when a legacy index spec is restored on a running server #10872 refuses a legacy ft_index0 RESTORE outside an RDB load, but it infers "outside a load" from the legacy-spec registry and the UPGRADE_INDEX rules being NULL. A failed load (LOADING_FAILED) leaves both allocated. So on a server that hasn't completed a load since startup, for example a replica whose first full sync failed and was then promoted, a truncated legacy payload still gets past the guard and crashes the server.
  2. Change: also refuse when no load is in progress (g_isLoading).
  3. Outcome: RESTORE of a legacy index spec now returns an error after a failed load too, instead of crashing the server.

Which additional issues this PR fixes

  1. MOD-15685
  2. Follow-up to [MOD-15685] Fix crash when a legacy index spec is restored on a running server #10872. Addresses the Codex review findings on its backports [8.4] [MOD-15685] Fix crash when a legacy index spec is restored on a running server #11615 and [8.10] [MOD-15685] Fix crash when a legacy index spec is restored on a running server #11612.

Main objects this PR modified

  1. IndexSpec_LegacyRdbLoad: the refusal now also checks loading state.
  2. test_legacy_module_types.py: new test that fails a full sync against a fake master, promotes the replica and restores a truncated legacy spec. Without the fix it crashes the server.

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

Release Notes

  • This PR requires release notes
  • This PR does not require release notes

🤖 Generated with Claude Code

…iled replication sync (#11619)

[MOD-15685] Refuse a legacy index spec RESTORE after a failed load

The guard added in #10872 refused a legacy ft_index0 load when the legacy-spec
registry or the UPGRADE_INDEX rules were NULL, taking that as "no load in
progress". A failed load breaks that assumption: LOADING_FAILED clears the
loading flag but frees neither global, and the rules are only ever freed by a
successful load. On a server that has not completed a load since startup - for
example a replica whose first full sync failed and was then promoted - a
RESTORE of a truncated legacy payload got past the guard and crashed on the
NULL spec name.

Key the refusal on g_isLoading as well. The new test drives exactly that
sequence against a fake master; it crashes the server without the fix.

Co-authored-by: Claude Opus 5.5 <[email protected]>
(cherry picked from commit b1b6903)
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Sep 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.04%. Comparing base (5bcc635) to head (44b379a).

Additional details and impacted files
@@            Coverage Diff             @@
##              8.2   #11638      +/-   ##
==========================================
- Coverage   89.11%   89.04%   -0.08%     
==========================================
  Files         262      262              
  Lines       43228    43228              
  Branches     3851     3851              
==========================================
- Hits        38523    38491      -32     
- Misses       4656     4688      +32     
  Partials       49       49              
Flag Coverage Δ
flow 82.23% <100.00%> (-0.22%) ⬇️
unit 47.30% <0.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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 Sep 30, 2026
Merged via the queue into 8.2 with commit 88f481e Sep 30, 2026
42 checks passed
@redisearch-backport-pull-request
redisearch-backport-pull-request Bot deleted the backport-agent/pr-11619-to-8.2 branch September 30, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport This PR was automatically backported by an agent size:S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant