Skip to content

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

Merged
kei-nan merged 1 commit into
8.10from
backport-agent/pr-11619-to-8.10
Oct 1, 2026
Merged

kei-nan merged 1 commit into
8.10from
backport-agent/pr-11619-to-8.10

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.10.

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.10 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.10 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.

…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.10 branch from 1cb7a70 to d5df28e Compare September 30, 2026 11:12
@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-30T11:16:31.574052Z d5df28e 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:15
@sonarqubecloud

Copy link
Copy Markdown

@redisearch-backport-pull-request
redisearch-backport-pull-request Bot added this pull request to the merge queue Sep 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 30, 2026
@kei-nan
kei-nan added this pull request to the merge queue Oct 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 1, 2026
@kei-nan
kei-nan added this pull request to the merge queue Oct 1, 2026
Merged via the queue into 8.10 with commit ab8842b Oct 1, 2026
26 checks passed
@kei-nan
kei-nan deleted the backport-agent/pr-11619-to-8.10 branch October 1, 2026 10:24
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