Skip to content

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

Merged
kei-nan merged 1 commit into
8.6-rsefrom
backport-agent/pr-11619-to-8.6-rse
Oct 1, 2026
Merged

kei-nan merged 1 commit into
8.6-rsefrom
backport-agent/pr-11619-to-8.6-rse

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.6-rse.

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.6-rse 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.6-rse 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f738a99f8f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/spec.c
if (encver < LEGACY_INDEX_MIN_VERSION || encver > LEGACY_INDEX_MAX_VERSION) {
return NULL;
}
// Upgrading a legacy spec only makes sense while an RDB load is in progress: the upgrade sweep that

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Wrap the overlength C comment

The new comment is 102 characters long, exceeding the repository's documented 100-character C line limit; wrap it to keep src/spec.c compliant.

AGENTS.md reference: AGENTS.md:L51-L51

Useful? React with 👍 / 👎.

…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.6-rse branch from f738a99 to 1c79e3e 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:54.278268Z 1c79e3e 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.6-rse with commit a0d1df8 Oct 1, 2026
26 checks passed
@kei-nan
kei-nan deleted the backport-agent/pr-11619-to-8.6-rse branch October 1, 2026 10:10
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