Repository navigation
Fix stale MY_PRIMARY_FAIL gossip flag - #4533
Conversation
Signed-off-by: DaeMyung Kang <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthrough
ChangesPrimary failure state
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change is localized to clearing stale failover state and adding tests; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (1 skipped: 1 unsupported.) Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
enjoy-binbin
left a comment
There was a problem hiding this comment.
The fix LGTM, thanks. We have a faster-failover.tcl, can you move the test to that file?
|
@enjoy-binbin Ok. I intentionally divide the test to stale-primary-fail.tcl. It can make faster-failover.tcl slower. |
Signed-off-by: DaeMyung Kang <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #4533 +/- ##
============================================
- Coverage 78.77% 78.70% -0.07%
============================================
Files 171 171
Lines 89857 89861 +4
============================================
- Hits 70785 70728 -57
- Misses 19072 19133 +61
🚀 New features to boost your workflow:
|
A replica could keep the `CLUSTER_NODE_MY_PRIMARY_FAIL` flag after it was moved from a failed primary to a healthy new primary. Because this flag is gossiped to other replicas, a later unrelated failover could incorrectly look like every replica had already observed the primary failure, allowing the best-ranked replica to skip the normal election delay even though replication offsets had not been re-exchanged. This change clears the local `CLUSTER_NODE_MY_PRIMARY_FAIL` flag when the old primary recovers, when the local node is promoted, and when a replica is reconfigured under a new primary. Introduced in #2227. Signed-off-by: DaeMyung Kang <[email protected]> Backport-Source-PR: 4533
A replica could keep the `CLUSTER_NODE_MY_PRIMARY_FAIL` flag after it was moved from a failed primary to a healthy new primary. Because this flag is gossiped to other replicas, a later unrelated failover could incorrectly look like every replica had already observed the primary failure, allowing the best-ranked replica to skip the normal election delay even though replication offsets had not been re-exchanged. This change clears the local `CLUSTER_NODE_MY_PRIMARY_FAIL` flag when the old primary recovers, when the local node is promoted, and when a replica is reconfigured under a new primary. Introduced in valkey-io#2227. Signed-off-by: DaeMyung Kang <[email protected]>
A replica could keep the `CLUSTER_NODE_MY_PRIMARY_FAIL` flag after it was moved from a failed primary to a healthy new primary. Because this flag is gossiped to other replicas, a later unrelated failover could incorrectly look like every replica had already observed the primary failure, allowing the best-ranked replica to skip the normal election delay even though replication offsets had not been re-exchanged. This change clears the local `CLUSTER_NODE_MY_PRIMARY_FAIL` flag when the old primary recovers, when the local node is promoted, and when a replica is reconfigured under a new primary. Introduced in #2227. Signed-off-by: DaeMyung Kang <[email protected]> Backport-Source-PR: 4533
> [!NOTE] > **Opened ready despite 3 flagged items** (`force_ready` was set): notes flagged low-confidence; release-safety guardrail overrode AI triage; AI triaged PRs without release-notes (confirm include/exclude). Review the sections below and confirm before merging. Cuts **9.1.3** onto release line `9.1`. - Promotes the release notes into a dated section, bumps `src/version.h`, and refreshes the running contributor list. - Release notes computed over the range below (`9.1.2..c6dc0fc`): ``` mode: ga source_ref: 9.1 target_branch: 9.1 base: 9.1.2 @ 7f1dffe head: c6dc0fc @ c6dc0fc ``` ###⚠️ Notes to double-check The generator flagged these notes low-confidence; confirm category and wording before merging: | PR | Category | Why flagged | |----|----------|-------------| | #4571 | Build and Tooling | dev-utility-only change; flagged per build/tooling policy, may not be user-facing; non-fix category on a patch release needs explicit maintainer confirmation | | #4815 | Bug Fixes | could be Observability and Logging | | #4823 | Bug Fixes | explicit impact scope omitted: 32-bit | ### Release-impact review Code detected release-impact terms (availability, memory safety, data integrity, access control, protocol, compatibility) in these PRs; this forces review, it is not a severity classification. The requested urgency is **SECURITY**. Confirm it and decide whether any change needs a hand-authored **Security Fixes** entry:⚠️ [#4571](#4571) names **CVE-2026-6321**. A named CVE normally ships with `SECURITY` urgency and a hand-authored **Security Fixes** entry; this holds the cut at any other urgency. <details> <summary>10 PR(s) with impact signals</summary> | PR | Title | Signal | |----|-------|--------| | [#4571](#4571) | Bump fast-uri to 3.1.6 in reply-schema-linter to clear CVEs | data or persisted-state corruption risk | | [#4676](#4676) | Fix return types of three module API declarations to match definitions | security, access-control, or injection hardening | | [#3645](#3645) | fix: Reject module writes during client pause to prevent crash | server crash, assertion, or availability failure | | [#4880](#4880) | Reject relative expires that overflow when the base time is added | server crash, assertion, or availability failure | | [#4214](#4214) | fix(acl): prevent NULL pointer dereference on malformed selector in ACL file | server crash, assertion, or availability failure | | [#4504](#4504) | Fix crash and wrong return values in the hash stringRef module API | server crash, assertion, or availability failure | | [#4270](#4270) | make getMonotonicUs static in libvalkeylua | server crash, assertion, or availability failure | | [#4733](#4733) | Fix sds overflow assert on RESTORE payload with an overflowing string length | server crash, assertion, or availability failure | | [#4489](#4489) | Hold no descriptor on nodes.conf when rename() publishes it | server crash, assertion, or availability failure | | [#5030](#5030) | Fix cluster Pub/Sub length truncation | memory-safety risk | </details> ### Excluded from generated notes (listed under Security Fixes) #5030 was supplied as a `--security-fix`, so the generated bullet(s) in the normal categories were dropped to avoid double-listing. To keep the notes consistent, it appears only under **Security Fixes**, where each is reviewed as a factual security entry. ###⚠️ Release-safety guardrail overrode AI triage AI excluded these PRs (or gave no verdict) but their text names a release-impact signal, so code forced them into the notes; confirm each bullet, category, urgency, and security treatment: | PR | Title | Guardrail reason | |----|-------|------------------| | [#4571](#4571) | Bump fast-uri to 3.1.6 in reply-schema-linter to clear CVEs |⚠️ release-safety guardrail (data or persisted-state corruption risk; AI exclusion) | ### Triage summary - 20 PR(s) triaged into the notes - 9 PR(s) triaged out - 2 PR(s) hard-excluded by `no-release-notes` Per-PR verdicts (with reasons) are in the run's `triage-verdicts` artifact. To include a wrongly-dropped PR, label it `release-notes` and re-cut. ### Wording carried from other release lines A backported change is cut once per release line, and each cut words its notes independently. To keep one commit from being described differently per branch, a note whose source PR another line already published takes that published wording verbatim (joined on the trailing `(#N)`, which always names the original source PR). Only the text is reused; the category, the `by @handle` credit, and the `(#N)` are this cut's own. - Release lines consulted: `9.2`, `9.0`, `8.1`, `8.0`, `7.2`, `7.0`, `6.2`, `6.0`, `5.0`, `4.0`, `3.2`, `3.0`, `2.8`, `2.6`, `2.4`, `2.2` - 1 generated note(s) already matches the published wording: #4567 - Reused published wording for 8 note(s) <details> <summary>8 note(s) reusing published wording</summary> | PR | Wording from | Carried wording | This cut generated | |----|--------------|-----------------|--------------------| | #3459 | `9.2` (Valkey 9.2.0-rc1) | Fix stream commands that mutate consumer-group or PEL state (`XGROUP`, `XSETID`, `XREADGROUP`, `XACK`, `XCLAIM`, `XAUTOCLAIM`) not triggering `WATCH` and client-side tracking invalidation | Stream commands that modify consumer-group state (`XGROUP`, `XSETID`, `XREADGROUP`, `XACK`, `XCLAIM`, `XAUTOCLAIM`) now correctly trigger `WATCH` and client tracking invalidation | | #4733 | `7.2` (Valkey 7.2.15) | Fix a server abort on a RESTORE payload declaring a string length that overflows the allocation size; such payloads are now rejected as bad data | Fix a server abort when a `RESTORE` payload declares a string length that overflows the allocation size; such payloads are now rejected as bad data | | #4997 | `7.2` (Valkey 7.2.15) | Fix ZINTER/ZINTERSTORE returning input-order-dependent scores when a weighted term is 0*inf; a NaN weighted score now counts as 0, matching ZUNION | Fix `ZINTER`/`ZINTERSTORE` returning input-order-dependent scores when a weighted term is 0 times infinity; such NaN terms now count as 0, matching `ZUNION` | | #4533 | `9.2` (Valkey 9.2.0-rc1) | Clear a stale primary-failure gossip flag on replicas so later failovers don't incorrectly skip the election delay | Fix a stale primary-failure gossip flag on cluster replicas that could let a later unrelated failover skip the normal election delay | | #4676 | `9.2` (Valkey 9.2.0-rc1) | Correct `ValkeyModule_FreeModuleUser`, `ValkeyModule_ACLAddLogEntry` and `ValkeyModule_ACLAddLogEntryByUserName` declarations to return int as implemented, fixing undefined behavior on targets with strict call signature checks | Fix module API declarations of `ValkeyModule_FreeModuleUser` and the ACL log entry functions to return int, avoiding traps on platforms with strict call-signature checks such as WebAssembly | | #4214 | `7.2` (Valkey 7.2.15) | Fix a server crash when loading an ACL file containing a selector with an unmatched parenthesis | Fix a server crash when loading an ACL file containing a selector definition with an unmatched parenthesis | | #4489 | `7.2` (Valkey 7.2.15) | Fix cluster config saving to avoid publishing truncated `nodes.conf` files, losing the startup lock after the first save, and failing every save on SMB filesystems such as Azure Files; the lock now lives on a separate `nodes.conf.lock` file | Fix cluster config saving by locking a separate `nodes.conf.lock` file, fixing crash loops on SMB filesystems such as Azure Files and restoring protection against two nodes sharing one config | | #4823 | `7.2` (Valkey 7.2.15) | Fix `LSET` on 64-bit builds silently modifying the wrong element for out-of-range indexes instead of returning an index out of range error | Fix `LSET` on 64-bit builds modifying the wrong element instead of returning an error for very large out-of-range indexes | </details> *Generated by valkey-ci-agent. Review before merging into the release line.* --------- Signed-off-by: valkeyrie-bot[bot] <3692572+valkeyrie-bot[bot]@users.noreply.github.com> Signed-off-by: Sarthak Aggarwal <[email protected]> Co-authored-by: valkeyrie-bot[bot] <3692572+valkeyrie-bot[bot]@users.noreply.github.com> Co-authored-by: Sarthak Aggarwal <[email protected]> Co-authored-by: Roshan Khatri <[email protected]>
… ) (#3729) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [ghcr.io/valkey-io/valkey](https://github.com/valkey-io/valkey) | patch | `9.1.2` → `9.1.3` | --- >⚠️ **Warning** > > Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/3566) for more information. --- ### Release Notes <details> <summary>valkey-io/valkey (ghcr.io/valkey-io/valkey)</summary> ### [`v9.1.3`](https://github.com/valkey-io/valkey/releases/tag/9.1.3) [Compare Source](valkey-io/valkey@9.1.2...9.1.3) ## Valkey 9.1.3 - Released Mon 26 October 2026 Upgrade urgency SECURITY: This release includes security fixes we recommend you apply as soon as possible. ##### Security Fixes - GHSA-f4q9-j22m-xqq9: Fix a heap buffer overflow in cluster Pub/Sub message construction that could allow an authenticated client to potentially execute arbitrary code by publishing an oversized message by [@​roshkhatri](https://github.com/roshkhatri) ([#​5030](valkey-io/valkey#5030)) ##### Bug Fixes - Fix stream commands that mutate consumer-group or PEL state (`XGROUP`, `XSETID`, `XREADGROUP`, `XACK`, `XCLAIM`, `XAUTOCLAIM`) not triggering `WATCH` and client-side tracking invalidation by [@​Tarte12](https://github.com/Tarte12) ([#​3459](valkey-io/valkey#3459)) - Reject module write commands while the server is paused for writes, preventing a crash from module timer callbacks during `CLIENT PAUSE WRITE` or `CLUSTER FAILOVER` by [@​smkher](https://github.com/smkher) ([#​3645](valkey-io/valkey#3645)) - Fix event loop busy-spinning on virtual machines by not using raw TSC for the monotonic clock when the kernel clocksource is not tsc by [@​quanyeyang](https://github.com/quanyeyang) ([#​4707](valkey-io/valkey#4707)) - Fix a crash in `ValkeyModule_HashHasStringRef` on a missing or expired field and correct wrong return values in the hash stringRef module APIs by [@​ShubhamTaple](https://github.com/ShubhamTaple) ([#​4504](valkey-io/valkey#4504)) - Fix a server abort on a RESTORE payload declaring a string length that overflows the allocation size; such payloads are now rejected as bad data by [@​enjoy-binbin](https://github.com/enjoy-binbin) ([#​4733](valkey-io/valkey#4733)) - Fix ZINTER/ZINTERSTORE returning input-order-dependent scores when a weighted term is 0\*inf; a NaN weighted score now counts as 0, matching ZUNION by [@​leomurillo](https://github.com/leomurillo) ([#​4997](valkey-io/valkey#4997)) - Clear a stale primary-failure gossip flag on replicas so later failovers don't incorrectly skip the election delay by [@​charsyam](https://github.com/charsyam) ([#​4533](valkey-io/valkey#4533)) - Correct `ValkeyModule_FreeModuleUser`, `ValkeyModule_ACLAddLogEntry` and `ValkeyModule_ACLAddLogEntryByUserName` declarations to return int as implemented, fixing undefined behavior on targets with strict call signature checks by [@​rainsupreme](https://github.com/rainsupreme) ([#​4676](valkey-io/valkey#4676)) - valkey-check-aof now recognizes RDB base files with the `VALKEY` signature instead of misreporting a valid multipart AOF as invalid by [@​sarthakaggarwal97](https://github.com/sarthakaggarwal97) ([#​4739](valkey-io/valkey#4739)) - Fix module commands that access undeclared keys in other slots reading or writing the wrong slot in cluster mode, and aborting in debug builds by [@​patrickswedish](https://github.com/patrickswedish) ([#​4424](valkey-io/valkey#4424)) - Reject relative expire times in `SET`/`GETEX`, `RESTORE`, and `ValkeyModule_SetExpire` that overflow when added to the current time, preventing server aborts from negative expires by [@​madolson](https://github.com/madolson) ([#​4880](valkey-io/valkey#4880)) - `HDEL`, `HGETDEL`, `HPERSIST`, and `HEXPIRE` no longer propagate fields they treat as expired, preventing replica and AOF-reload divergence by [@​xdk-amz](https://github.com/xdk-amz) ([#​4772](valkey-io/valkey#4772)) - Fix a server crash when loading an ACL file containing a selector with an unmatched parenthesis by [@​magic-peach](https://github.com/magic-peach) ([#​4214](valkey-io/valkey#4214)) - Fix a segfault on Alpine/musl when Lua is built as a module, caused by a symbol clash on an internal clock function by [@​mohammedgqudah](https://github.com/mohammedgqudah) ([#​4270](valkey-io/valkey#4270)) - `COPY` of a hash now includes expired-but-unreaped fields so their deletion is propagated and replicas stay in sync by [@​pirate329](https://github.com/pirate329) ([#​4939](valkey-io/valkey#4939)) - Restore acceptance of hexadecimal float sorted set scores (such as `0x10`), keeping replication and AOF replay compatible with Valkey 9.0 by [@​quanyeyang](https://github.com/quanyeyang) ([#​4875](valkey-io/valkey#4875)) - Sorted set range commands with a negative `LIMIT` offset now return an empty result instead of a spurious element on btree-encoded keys by [@​xiaocj](https://github.com/xiaocj) ([#​4637](valkey-io/valkey#4637)) - Fix listpack encoding incompatibility that caused RDB load and replication failures for entries of certain lengths between 9.0 and 9.1.x by [@​jjuleslasarte](https://github.com/jjuleslasarte) ([#​4819](valkey-io/valkey#4819)) - Fix atomic slot migration not replicating evictions on the import target, which let replicas grow far past `maxmemory` by [@​shanezx-sc](https://github.com/shanezx-sc) ([#​4920](valkey-io/valkey#4920)) - Redact error text in server logs when `hide-user-data-from-log` is enabled, so command arguments no longer leak into logs by [@​zackcam](https://github.com/zackcam) ([#​4815](valkey-io/valkey#4815)) - Fix `HSETEX` and `HGETEX` failing to parse their arguments when the key is named `fields` by [@​sebxt](https://github.com/sebxt) ([#​4945](valkey-io/valkey#4945)) - Fix cluster config saving to avoid publishing truncated `nodes.conf` files, losing the startup lock after the first save, and failing every save on SMB filesystems such as Azure Files; the lock now lives on a separate `nodes.conf.lock` file by [@​KewangZhili](https://github.com/KewangZhili) ([#​4489](valkey-io/valkey#4489)) - Fix `LSET` on 64-bit builds silently modifying the wrong element for out-of-range indexes instead of returning an index out of range error by [@​charsyam](https://github.com/charsyam) ([#​4823](valkey-io/valkey#4823)) - Fix atomic slot migration with `cluster-databases` > 1 applying writes made during the snapshot to the wrong database on the target by [@​pirate329](https://github.com/pirate329) ([#​4952](valkey-io/valkey#4952)) **Full Changelog**: <valkey-io/valkey@9.1.2...9.1.3> </details> --- ### Configuration 📅 **Schedule**: (in timezone America/Chicago) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xNTEuMiIsInVwZGF0ZWRJblZlciI6IjQ0LjE1MS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19--> Reviewed-on: https://git.rsr.net/roger/k8s-gitops/pulls/3729
A replica could keep the
CLUSTER_NODE_MY_PRIMARY_FAILflag after it wasmoved from a failed primary to a healthy new primary. Because this flag is
gossiped to other replicas, a later unrelated failover could incorrectly look
like every replica had already observed the primary failure, allowing the
best-ranked replica to skip the normal election delay even though replication
offsets had not been re-exchanged.
This change clears the local
CLUSTER_NODE_MY_PRIMARY_FAILflag when the oldprimary recovers, when the local node is promoted, and when a replica is
reconfigured under a new primary.
Introduced in #2227.