[BugFix] Keep base_version in sync with base_metadata in publish_version#76313
Conversation
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@mergify rebase |
✅ Branch has been successfully rebased |
7c9d97e to
429a5dc
Compare
|
Deprecation notice: This pull request comes from a fork and was rebased using |
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@mergify rebase |
🛑 The pull request rule doesn't match anymoreDetailsThis action has been cancelled. |
When a single-mode publish already succeeded and its txnlog was deleted but FE never received the response, the txn gets re-sent as the first element of a batch publish. The recovery branch that handles this reassigns base_metadata to the newer version but left the base_version scalar stale, breaking the base_version == base_metadata->version() invariant relied on elsewhere in the function. Sync base_version alongside base_metadata and add a DCHECK to guard the invariant. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KFu5UZqgfiVXuyUSnttF8J
429a5dc to
2f5ebe1
Compare
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[FE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[BE Incremental Coverage Report]✅ pass : 2 / 2 (100.00%) file detail
|
|
@Mergifyio backport branch-4.1 |
✅ Backports have been createdDetails
|
Why I'm doing:
publish_version()has an implicit invariant: the local scalarbase_versionmust always equalbase_metadata->version(). The single→batch conversion recovery branch (handling a txn that already published successfully in single mode, whose txnlog was deleted, but whose FE response was lost) reassignsbase_metadatatometa@(base_version+1)andcontinues the loop — without advancingbase_versionto match. From that point on,base_version != base_metadata->version()for the rest of the call.This currently produces no observable data-plane bug in OSS (the only other reader of the scalar is an unreachable
DCHECKin the schema-change path), but it's a real invariant violation waiting to bite any future code that readsbase_versionto mean "the versionbase_metadatais at."What I'm doing:
base_version = base_metadata->version()right after the reassignment in the skip branch.DCHECK_EQ(base_version, base_metadata->version())wherelog_applieris initialized, as a regression guard for this invariant.NoOpPublishTest.single_to_batch_conversion_keeps_base_version_in_sync, which drives the skip branch with a 3-txn batch. Verified the added DCHECK actually fires (Check failed: base_version == base_metadata->version() (1 vs. 2)) when the fix line is reverted, and passes cleanly with it restored.What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
(Additive only: two new leader-side monitoring metrics appear in the FE
/metricsoutput. No existing metric, SQL surface, parameter, or persisted state changes.)Checklist:
Bugfix cherry-pick branch check: