Skip to content

[CI] CI fix sweep for 8.0 - #5699

Open
valkeyrie-ops[bot] wants to merge 1 commit into
agent/backport/sweep/8.0from
agent/backport/ci-sweep/8.0
Open

valkeyrie-ops[bot] wants to merge 1 commit into
agent/backport/sweep/8.0from
agent/backport/ci-sweep/8.0

Conversation

@valkeyrie-ops

@valkeyrie-ops valkeyrie-ops Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

CI fix sweep for 8.0

Automated fixes for CI failures on #5508.

Applied

Commit Failing job Title Detail
5d6ce9a test-ubuntu-latest (run) Allow a split vote to time out in the same epoch failover test

Fix details are posted as comments on this PR.


Generated by valkey-ci-agent using Claude Code.

@valkeyrie-ops

valkeyrie-ops Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Pushed 868cd01 with a fix for test-ubuntu-latest (run) on #5508.

The test now waits long enough for the server to retry after a split vote (150 s instead of 50 s) and allows "Failover attempt expired" only for a replica that took part in a split vote. All other replicas are still checked for no failover timeout, and the epoch 0 check is unchanged.

The failing test passed 30 loops with the fix, and the bot's review approved it.

Diagnosis and checks

What failed: Primaries will not time out then they are elected in the same epoch in tests/unit/cluster/failover2.tcl (No failover detected)

Root cause: The test rejects a split vote, which this branch's server can only resolve by letting the election expire. In the log replica 9 won epoch 8 at 09:10:11.797, then replicas 7 and 8 both started an election for epoch 9 at 09:10:12.143 and 09:10:12.145. Primaries 3 and 6 and the new primary 9 voted for replica 7, primaries 4 and 5 voted for replica 8, so the votes were 3 to 2 with a needed quorum of 4 and no one won the epoch. Because no node claimed an epoch equal to or higher than 9, neither election was reset, and both replicas logged "Failover attempt expired" from 09:10:42. On 8.0 the retry comes after four times the node timeout, 60 s with cluster-node-timeout 15000, while the test waits 50 s and failed at 09:10:46. The election delay on 8.0 is a fixed 500 + random() % 500 ms with no ranking across failed shards, so the larger node timeout ported earlier does not space the shards' elections here and only makes the retry slower. The failure is flaky.

The fix: A split vote in which no candidate reaches the majority, followed by a timeout and a retry, is correct server behaviour on 8.0, so the test should accept it rather than the server changing. The exception is narrow: a replica may time out only if it started an election in an epoch in which another replica also started one and which no replica won, as read from the "Starting a failover election for epoch" and "configEpoch set to N after successful failover" log lines. A replica that times out although another node won its epoch, which is what the test exists to catch, still fails. I kept the natural timing of the three elections instead of releasing the replicas one by one, because serialising them would stop the test from ever exercising same-epoch elections or the false epoch 0 case. No product change is made: upstream avoids or resolves split votes with features (failed primary ranking in #1018, the FAILOVER_AUTH_NACK message in #3833) that are not minimal backports for this branch.

What the bot checked

  • Existing fixes found: 1eaf118fdfe2 Fix RDB checker infinite loop on an RDB truncated inside a module value (Fix RDB checker infinite loop on an RDB truncated inside a module value #5476) (already ported as ffcc415); 9c4c8739da2e Apply the library load timeout to FUNCTION RESTORE (Apply the library load timeout to FUNCTION RESTORE #5181) (port candidate); eefa8927dc2b fix: Reject corrupt stream RDB with shared NACK across consumers (Reject corrupt stream RDB with shared NACK across consumers (CVE-2026-63639) #4073) (already ported as f8d2027); f7690377fba2 Increase the cluster-node-timeout to have longer delay between failover of each shard (Increase the cluster-node-timeout to have longer delay between failover of each shard #3946) (already ported as 0e0cac5); c403eecd5b7d Fix double free in stream consumer PEL loading with corrupt RDB data (Fix double free in stream consumer PEL loading with corrupt RDB data #3498) (already ported as a504c0f)

  • No change on the default branch was found to fix this failure, so this fix was written for this branch: the default branch does not have it.

  • A planned file uses run_solo, so its loops run one at a time.

  • The failed job could not host the fix, so plain make and runtest stand in for it.

  • With the fix, this command passed 30 loops:

    make -j"$(getconf _NPROCESSORS_ONLN)" && ./runtest --dump-logs --single unit/cluster/failover2 --only 'Primaries will not time out then they are elected in the same epoch' --fastfail --loops 30 --timeout 600 --clients 1
  • One loop takes 90s, so 30 loops ran, not 40.

  • Review: The log and the code confirm the diagnosis: replicas 7 and 8 both started an election for epoch 9 within 2 ms, the votes split 3 to 2 against a quorum of 4, no node claimed an epoch of 9 or higher so nothing reset either election, and on this branch the retry only comes after four times the node timeout (60 s) while the test waited 50 s. This branch's cluster_legacy.c has the fixed 500 + random() % 500 ms delay with no failed primary ranking and no NACK, so a split vote that expires and retries is designed behaviour and the test's blanket 'no timeout' assertion assumed something the server does not guarantee. The longer wait is justified by that 60 s retry, and the exception is narrow: a replica is excused only if it started an election in an epoch that another replica also started and that no replica won, so a replica that times out although another node won its epoch still fails, and runs without a split vote are checked exactly as before. No existing helper extracts epochs from a log, the comments explain behaviour without narrating the fix, the wait's failure message now prints the roles, and the change is test only. The author states the limits honestly: the exception path was not exercised by the 30 passing loops, and because events are not ordered in time a replica in a split vote that wrongly failed to reset on a later higher claim would be excused. I accept that limit because closing it needs timestamp ordering across three logs and it only applies in the rare runs where a split vote occurs. Whether to backport the ranking to make split votes rarer is rightly left to maintainers.

  • On unstable, which has the failing test, the agent made no fix: No change is needed on unstable. The 8.0 failure was a same-epoch split vote that 8.0 can only resolve by letting the election expire. Unstable resolves it with FAILOVER_AUTH_NACK, and its version of this test deliberately forces that split vote and requires that no election expires. Porting the 8.0 exception would make the test accept the defect it exists to catch. I made no edits.

The agent's own notes

Nothing was run here, and since a split vote is rare, the looped verification will mostly exercise the normal path, not the new exception. The default branch does not have this change and does not need it: since #3833 a split vote is retried through FAILOVER_AUTH_NACK without waiting for the timeout, and its version of this test controls the election epoch with debug commands that 8.0 lacks. None of the commits listed for the other release branches fits, they only change src/rdb.c. Open pull request #4296 only moves run_solo tests to a dedicated CI job and does not address this. The already ported #3946 (0e0cac5) left the node timeout at 15000, which was already the effective value, so it could not have fixed this. I could not inspect the other release branches; any branch without the NACK message can hit the same split vote and would take the same test change. One limit of the new check: it does not order events in time, so a replica that was in a split vote and wrongly failed to reset on a later, higher epoch claim would not be caught. With one split vote the test takes about 80 to 90 s instead of about 20 s. What the server did: it recovered on its own, but only 60 s after the split, which is by design on 8.0; whether to backport the failed primary ranking (#1018) to make split votes rarer is a maintainer decision.

#5508's CI decides whether the fix holds once this is merged, and the bot never merges.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 72cc9c1f-6ee2-497a-8095-3cdcb59c995e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@valkeyrie-ops
valkeyrie-ops Bot force-pushed the agent/backport/sweep/8.0 branch from ffcc415 to 979c514 Compare December 2, 2026 09:09
@valkeyrie-ops
valkeyrie-ops Bot force-pushed the agent/backport/ci-sweep/8.0 branch 5 times, most recently from 1a2c9d7 to d3a8253 Compare December 4, 2026 01:47
The test rejects a split vote, which this branch's server can only
resolve by letting the election expire. In the log replica 9 won epoch 8
at 09:10:11.797, then replicas 7 and 8 both started an election for
epoch 9 at 09:10:12.143 and 09:10:12.145. Primaries 3 and 6 and the new
primary 9 voted for replica 7, primaries 4 and 5 voted for replica 8, so
the votes were 3 to 2 with a needed quorum of 4 and no one won the
epoch. Because no node claimed an epoch equal to or higher than 9,
neither election was reset, and both replicas logged "Failover attempt
expired" from 09:10:42. On 8.0 the retry comes after four times the node
timeout, 60 s with cluster-node-timeout 15000, while the test waits 50 s
and failed at 09:10:46. The election delay on 8.0 is a fixed 500 +
random() % 500 ms with no ranking across failed shards, so the larger
node timeout ported earlier does not space the shards' elections here
and only makes the retry slower.

A split vote in which no candidate reaches the majority, followed by a
timeout and a retry, is correct server behaviour on 8.0, so the test
should accept it rather than the server changing. The exception is
narrow: a replica may time out only if it started an election in an
epoch in which another replica also started one and which no replica
won, as read from the "Starting a failover election for epoch" and
"configEpoch set to N after successful failover" log lines. A replica
that times out although another node won its epoch, which is what the
test exists to catch, still fails. I kept the natural timing of the
three elections instead of releasing the replicas one by one, because
serialising them would stop the test from ever exercising same-epoch
elections or the false epoch 0 case. No product change is made: upstream
avoids or resolves split votes with features (failed primary ranking in
#1018, the FAILOVER_AUTH_NACK message in #3833) that are not minimal
backports for this branch.

CI-Fix-Job: test-ubuntu-latest
CI-Fix-Run: https://github.com/valkey-io/valkey/actions/runs/46245707417
Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
@valkeyrie-ops
valkeyrie-ops Bot force-pushed the agent/backport/ci-sweep/8.0 branch from d3a8253 to 5d6ce9a Compare December 5, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants