Skip to content

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

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

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

Conversation

@redisearch-backport-pull-request

@redisearch-backport-pull-request redisearch-backport-pull-request Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #11619 to 8.4.

Original PR

Cherry-pick result

  • Resolved 2 conflict(s) — see Conflict Log below.

Conflict Log

src/spec.c

  • Conflict: The source commit updates an existing legacy-spec refusal guard; this target has no guard at that location.
  • Why it conflicted: The supplied 8.4 base does not contain the earlier [MOD-15685] Fix crash when a legacy index spec is restored on a running server #10872 guard. Its legacy loader proceeds directly from the encoding-version check to reading the payload.
  • Resolution: Inserted the complete updated guard from this PR after the version check, requiring g_isLoading and both legacy globals before reading the payload. Preserved the target loader and any existing disk assertion.
  • Rationale: The complete guard is necessary to refuse legacy RESTORE after a failed load on this older baseline. The target already exposes g_isLoading via indexer.h. No persistence format or unrelated loader changes were imported; builds and tests are deferred to CI as requested.

tests/pytests/test_legacy_module_types.py

  • Conflict: The append conflict includes both an earlier ordinary-RESTORE test and this PR’s failed-load regression test.
  • Why it conflicted: The 8.4 test file predates testLegacyIndexSpecRestoreIsRefused, which is context from the source commit’s parent rather than an addition in this PR.
  • Resolution: Kept the target tests and appended only _fail_full_sync and testLegacyIndexSpecRestoreIsRefusedAfterFailedLoad, plus the two imports added by this PR. Dropped the earlier test pulled into the conflict.
  • Rationale: This retains exactly this PR’s regression scenario and avoids importing an unrelated test addition. The required payload helpers, ShardMock, and _grep_file_count exist on the target; execution remains for CI.

Release notes

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

🤖 Generated by the auto-backport workflow.

@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.
✅ Project coverage is 85.83%. Comparing base (9366ea3) to head (dddf158).

Additional details and impacted files
@@            Coverage Diff             @@
##              8.4   #11627      +/-   ##
==========================================
- Coverage   85.91%   85.83%   -0.08%     
==========================================
  Files         341      341              
  Lines       55103    55103              
  Branches    11117    11117              
==========================================
- Hits        47342    47300      -42     
- Misses       7618     7660      +42     
  Partials      143      143              
Flag Coverage Δ
flow 84.54% <100.00%> (-0.18%) ⬇️
unit 51.31% <0.00%> (-0.02%) ⬇️

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.

…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)
@kei-nan
kei-nan force-pushed the backport-agent/pr-11619-to-8.4 branch from d6c8c53 to dddf158 Compare September 30, 2026 07:46
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-30T07:50:35.257913Z dddf158 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kei-nan
kei-nan requested a review from dor-forer September 30, 2026 11:14
@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.4 with commit 23fec17 Sep 30, 2026
30 checks passed
@redisearch-backport-pull-request
redisearch-backport-pull-request Bot deleted the backport-agent/pr-11619-to-8.4 branch September 30, 2026 14:08
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 auto-backport-conflicts There were conflicts in this automatic backport size:S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants