Skip to content

[8.8-rse] [MOD-15685] Fix crash when a legacy index spec is restored after a failed replication sync - #11622

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

redisearch-backport-pull-request[bot] merged 1 commit into
8.8-rsefrom
backport-agent/pr-11619-to-8.8-rse

Conversation

@redisearch-backport-pull-request

Copy link
Copy Markdown
Contributor

Backport of #11619 to 8.8-rse.
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 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (8.8-rse@26baf39). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             8.8-rse   #11622   +/-   ##
==========================================
  Coverage           ?   81.22%           
==========================================
  Files              ?      562           
  Lines              ?    76570           
  Branches           ?    30619           
==========================================
  Hits               ?    62196           
  Misses             ?    14086           
  Partials           ?      288           
Flag Coverage Δ
flow 82.56% <100.00%> (?)
unit 52.45% <0.00%> (?)

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.8-rse with commit 6b2fb78 Sep 30, 2026
60 checks passed
@redisearch-backport-pull-request
redisearch-backport-pull-request Bot deleted the backport-agent/pr-11619-to-8.8-rse branch September 30, 2026 09:06
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