Skip to content

[CI] CI fix sweep for 8.1 - #5441

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

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

Conversation

@valkeyrie-ops

@valkeyrie-ops valkeyrie-ops Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

CI fix sweep for 8.1

Automated fixes for CI failures on #5075.

Applied

Commit Failing job Title Detail
1b59f13 test-sanitizer-address (run) Keep failover2 replicas from starting elections in the same epoch

Fix details are posted as comments on this PR.


Generated by valkey-ci-agent using Claude Code.

@valkeyrie-ops

valkeyrie-ops Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

Pushed 7bd6b8b with a fix for test-sanitizer-address (run) on #5075.

The test let all three replicas wait for their election at once, and two of them started in the same epoch and split the votes. The patch lets the replicas of the lowest and highest failed primary rank fail over first and enables the middle one once they are primaries.

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

Diagnosis and checks

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

Root cause: After all nodes marked the three paused primaries as FAIL, the replicas scheduled their elections with delays of 949 ms (primary rank 0), 1483 ms (rank 1) and 1508 ms (rank 2). The rank 0 replica won epoch 11 at 09:54:47.263. The other two learned of it at 47.346 and 47.347, and both logged 'Failed primary rank updated, added -500 milliseconds of delay'. That put both of their delays in the past, so both started an election for epoch 12 within a millisecond of each other. The five voters split 3 to 2 with a quorum of 4, so neither won. On 8.1 a split vote with no winner is only resolved by the failover auth timeout, which is 30 s with cluster-node-timeout 15000, followed by a 60 s retry, so the 50 s wait for the three replicas to become primaries failed. The failure is flaky.

The fix: The earlier fix on this branch already makes every node see all three primaries as FAIL before the replicas may fail over, but it cannot stop the delays of two waiting replicas from being cut at the same moment when the first one wins. The patch keeps cluster-replica-no-failover on the replica of the middle rank until the other two are primaries. The lowest and highest ranked replicas have delays more than 500 ms apart, and when the first wins only one replica is left to have its delay shortened, so it starts alone in a new epoch. The middle replica then runs its election alone. The test still runs two failovers concurrently, with one replica waiting in its delay while the other wins, so the epoch 0 check and the failover timeout check still have something to check. No assertion or timeout was changed. The rank order is taken from CLUSTER MYSHARDID, which is what clusterGetFailedPrimaryRank compares. A product change is not appropriate here: the only upstream change that resolves split votes is the FAILOVER_AUTH_NACK feature, which adds a new cluster bus message and is not a backport candidate.

What the bot checked

  • Existing fixes found: 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 98465ea); 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 c426d53); 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 631c87b); be52d8b81a82 Fix trivial double-free issue in rdbLoadObject (Fix trivial double-free issue in rdbLoadObject #3453) (port candidate)

  • Code checks your change: the build must pass and the failing test must run and pass, once and then looped (up to 40 loops, fewer when one loop is slow):

    make -j4 all-with-unit-tests SANITIZER=address SERVER_CFLAGS='-Werror' BUILD_TLS=module && ./runtest --verbose --tags -slow --dump-logs --single unit/cluster/failover2 --only 'Primaries will not time out then they are elected in the same epoch' --fastfail --loops 40 --timeout 600 --clients 1

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

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

  • With the fix, this command passed 29 loops:

    make -j4 all-with-unit-tests SANITIZER=address SERVER_CFLAGS='-Werror' BUILD_TLS=module && ./runtest --verbose --tags -slow --dump-logs --single unit/cluster/failover2 --only 'Primaries will not time out then they are elected in the same epoch' --fastfail --loops 29 --timeout 600 --clients 1
  • One loop takes 90s, so 29 loops ran, not 40.

  • Review: The log confirms the diagnosis. The replicas scheduled delays of 949, 1483 and 1508 ms, the rank 0 replica won epoch 11 at 47.263, and the other two logged the -500 ms rank update at 47.346 and 47.347 and both started epoch 12. The five voters split 3 to 2 against a quorum of 4, and both attempts expired at 09:55:17, after the 30 s auth timeout. On this branch cluster_legacy.c only resets a losing election when another node claims an equal or higher config epoch, so a split with no winner waits for the auth timeout and retry; the server does not guarantee what the test assumed, which makes this a test bug. The patch holds the middle-rank replica back with the same cluster-replica-no-failover gate the test already uses, so only one replica is ever waiting when a rank update shortens delays, and no assertion, timeout or threshold changes. The ordering is sound: clusterGetFailedPrimaryRank compares shard ids with memcmp, which matches lsort on lowercase hex, and it still counts the held-back shard, so the two enabled replicas get ranks 0 and 2. The new wait reports the state it waited for, the comment explains why without history, and the change is test-only and confined to this test. The author states the trade-off openly: three-way competition is no longer exercised, and the split-vote timeout remains a server limitation on 8.1 that maintainers may want to track. One small inaccuracy: cron jitter can make the two delays slightly less than 500 ms apart, but that is still far too wide for a same-epoch start.

  • On unstable, which has the failing test, the agent made no fix: No change is made because unstable does not have the defect that failed on 8.1. A split vote here is ended in milliseconds by FAILOVER_AUTH_NACK, and the 8.1 fix would undo what this branch's version of the test deliberately checks. Nothing was run; this rests on reading the job log and this branch's source.

The agent's own notes

Not run here. The default branch does not have this change and does not need it: f2c1c5e (#3833) rewrote the test there with DEBUG CLUSTER-FAILOVER-DELAY and CLUSTER-FAILOVER-EPOCH and resolves split votes with FAILOVER_AUTH_NACK, none of which exists on 8.1. Of the other release branch commits, only baf141d on 9.1 touches this test. It is the same change this branch already has as fc5180e (wait for FAIL on all nodes, then enable failover on all three replicas), and this failure happened with it in place, so no commit there fits. 9.1 still has the same test body and looks exposed to the same collision, so it likely needs this change too. The 8.0 and 9.0 commits fix other tests in the file. Open PR #4296 only changes which jobs run the solo tests and does not fix this. The content of the reverted 793799d was not available, so I could not check whether it took a similar approach. The log does not show why the two replicas acted within the same millisecond; I assume their cluster cron ticks happened to line up, and the patch does not depend on that. The trade-off is that the third replica no longer competes with the other two, which is the price of removing a vote split that 8.1 cannot recover from without the timeout the test forbids.

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

@coderabbitai

coderabbitai Bot commented Nov 16, 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: fdedd9e3-4bc2-4ec6-b5ea-22be8365cf4b

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

After all nodes marked the three paused primaries as FAIL, the replicas
scheduled their elections with delays of 949 ms (primary rank 0), 1483
ms (rank 1) and 1508 ms (rank 2). The rank 0 replica won epoch 11 at
09:54:47.263. The other two learned of it at 47.346 and 47.347, and both
logged 'Failed primary rank updated, added -500 milliseconds of delay'.
That put both of their delays in the past, so both started an election
for epoch 12 within a millisecond of each other. The five voters split 3
to 2 with a quorum of 4, so neither won. On 8.1 a split vote with no
winner is only resolved by the failover auth timeout, which is 30 s with
cluster-node-timeout 15000, followed by a 60 s retry, so the 50 s wait
for the three replicas to become primaries failed.

The earlier fix on this branch already makes every node see all three
primaries as FAIL before the replicas may fail over, but it cannot stop
the delays of two waiting replicas from being cut at the same moment
when the first one wins. The patch keeps cluster-replica-no-failover on
the replica of the middle rank until the other two are primaries. The
lowest and highest ranked replicas have delays more than 500 ms apart,
and when the first wins only one replica is left to have its delay
shortened, so it starts alone in a new epoch. The middle replica then
runs its election alone. The test still runs two failovers concurrently,
with one replica waiting in its delay while the other wins, so the epoch
0 check and the failover timeout check still have something to check. No
assertion or timeout was changed. The rank order is taken from CLUSTER
MYSHARDID, which is what clusterGetFailedPrimaryRank compares. A product
change is not appropriate here: the only upstream change that resolves
split votes is the FAILOVER_AUTH_NACK feature, which adds a new cluster
bus message and is not a backport candidate.

CI-Fix-Job: test-sanitizer-address
CI-Fix-Run: https://github.com/valkey-io/valkey/actions/runs/43843157739
@valkeyrie-ops
valkeyrie-ops Bot force-pushed the agent/backport/ci-sweep/8.1 branch from 7bd6b8b to 1b59f13 Compare November 17, 2026 09:32
sarthakaggarwal97 pushed a commit to sarthakaggarwal97/valkey that referenced this pull request Nov 17, 2026
…lkey-io#5441)

After all nodes marked the three paused primaries as FAIL, the replicas
scheduled their elections with delays of 949 ms (primary rank 0), 1483
ms (rank 1) and 1508 ms (rank 2). The rank 0 replica won epoch 11 at
09:54:47.263. The other two learned of it at 47.346 and 47.347, and both
logged 'Failed primary rank updated, added -500 milliseconds of delay'.
That put both of their delays in the past, so both started an election
for epoch 12 within a millisecond of each other. The five voters split 3
to 2 with a quorum of 4, so neither won. On 8.1 a split vote with no
winner is only resolved by the failover auth timeout, which is 30 s with
cluster-node-timeout 15000, followed by a 60 s retry, so the 50 s wait
for the three replicas to become primaries failed.

The earlier fix on this branch already makes every node see all three
primaries as FAIL before the replicas may fail over, but it cannot stop
the delays of two waiting replicas from being cut at the same moment
when the first one wins. The patch keeps cluster-replica-no-failover on
the replica of the middle rank until the other two are primaries. The
lowest and highest ranked replicas have delays more than 500 ms apart,
and when the first wins only one replica is left to have its delay
shortened, so it starts alone in a new epoch. The middle replica then
runs its election alone. The test still runs two failovers concurrently,
with one replica waiting in its delay while the other wins, so the epoch
0 check and the failover timeout check still have something to check. No
assertion or timeout was changed. The rank order is taken from CLUSTER
MYSHARDID, which is what clusterGetFailedPrimaryRank compares. A product
change is not appropriate here: the only upstream change that resolves
split votes is the FAILOVER_AUTH_NACK feature, which adds a new cluster
bus message and is not a backport candidate.

CI-Fix-Job: test-sanitizer-address
CI-Fix-Run: https://github.com/valkey-io/valkey/actions/runs/43843157739
Backport-Source-PR: 5441
@valkeyrie-ops

valkeyrie-ops Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Dropped from this PR on the sweep's new head:

  • 1b59f13 Keep failover2 replicas from starting elections in the same epoch (test-sanitizer-address): the sweep has the same change.

Closing: no fix is left.

@valkeyrie-ops valkeyrie-ops Bot closed this Nov 17, 2026
sarthakaggarwal97 pushed a commit that referenced this pull request Nov 18, 2026
)

After all nodes marked the three paused primaries as FAIL, the replicas
scheduled their elections with delays of 949 ms (primary rank 0), 1483
ms (rank 1) and 1508 ms (rank 2). The rank 0 replica won epoch 11 at
09:54:47.263. The other two learned of it at 47.346 and 47.347, and both
logged 'Failed primary rank updated, added -500 milliseconds of delay'.
That put both of their delays in the past, so both started an election
for epoch 12 within a millisecond of each other. The five voters split 3
to 2 with a quorum of 4, so neither won. On 8.1 a split vote with no
winner is only resolved by the failover auth timeout, which is 30 s with
cluster-node-timeout 15000, followed by a 60 s retry, so the 50 s wait
for the three replicas to become primaries failed.

The earlier fix on this branch already makes every node see all three
primaries as FAIL before the replicas may fail over, but it cannot stop
the delays of two waiting replicas from being cut at the same moment
when the first one wins. The patch keeps cluster-replica-no-failover on
the replica of the middle rank until the other two are primaries. The
lowest and highest ranked replicas have delays more than 500 ms apart,
and when the first wins only one replica is left to have its delay
shortened, so it starts alone in a new epoch. The middle replica then
runs its election alone. The test still runs two failovers concurrently,
with one replica waiting in its delay while the other wins, so the epoch
0 check and the failover timeout check still have something to check. No
assertion or timeout was changed. The rank order is taken from CLUSTER
MYSHARDID, which is what clusterGetFailedPrimaryRank compares. A product
change is not appropriate here: the only upstream change that resolves
split votes is the FAILOVER_AUTH_NACK feature, which adds a new cluster
bus message and is not a backport candidate.

CI-Fix-Job: test-sanitizer-address
CI-Fix-Run: https://github.com/valkey-io/valkey/actions/runs/43843157739
Backport-Source-PR: 5441
sarthakaggarwal97 added a commit to sarthakaggarwal97/valkey-ci-agent that referenced this pull request Dec 1, 2026
The agent's commits were made as valkeyrie-bot[bot], a name with no
GitHub account behind it, and most had no DCO sign-off. Its own fixes
and repair commits had none, and a backport kept only what its upstream
commit carried: sometimes nothing, sometimes a sign-off under another
email than its author's. The DCO check therefore fails on the sweep pull
requests (valkey-io/valkey#5619, valkey-io/valkey#5499), on the CI-sweep
pull requests (valkey-io/valkey#5441) and on the fixes opened into
unstable (valkey-io/valkey#5437, valkey-io/valkey#5440,
valkey-io/valkey#5443), and a maintainer has to override it.

Every commit the agent makes is now committed and signed off by
valkeyrie-ops[bot], the App that opens its pull requests. The identity
and the sign-off line are in scripts/common/identity.py, and
proc.set_commit_identity gives them to a clone.

- A commit the agent writes (a CI fix, a sweep's repair commit, a
  revert, a release cut) has the App as its author.
- A commit it cherry-picks (a backport, an upstream fix ported to a
  backport branch) keeps its author and its own sign-off, and gets the
  App's as its committer. The DCO check takes a sign-off from a
  commit's author or its committer.
- An open sweep branch from before this is signed off once, the next
  time it is rebased. Other open pull requests keep their commits.

The pull requests the CI-fix bot opens now say that their commit
carries the bot's sign-off and that a maintainer adds their own before
merging. Nothing checks for the maintainer's.

The registry edit that onboards a release branch is unchanged: it is
github-actions[bot]'s commit and is already signed off.

Signed-off-by: Sarthak Aggarwal <[email protected]>
sarthakaggarwal97 added a commit to valkey-io/valkey-ci-agent that referenced this pull request Dec 1, 2026
* Sign off every commit the agent makes as valkeyrie-ops

The agent's commits were made as valkeyrie-bot[bot], a name with no
GitHub account behind it, and most had no DCO sign-off. Its own fixes
and repair commits had none, and a backport kept only what its upstream
commit carried: sometimes nothing, sometimes a sign-off under another
email than its author's. The DCO check therefore fails on the sweep pull
requests (valkey-io/valkey#5619, valkey-io/valkey#5499), on the CI-sweep
pull requests (valkey-io/valkey#5441) and on the fixes opened into
unstable (valkey-io/valkey#5437, valkey-io/valkey#5440,
valkey-io/valkey#5443), and a maintainer has to override it.

Every commit the agent makes is now committed and signed off by
valkeyrie-ops[bot], the App that opens its pull requests. The identity
and the sign-off line are in scripts/common/identity.py, and
proc.set_commit_identity gives them to a clone.

- A commit the agent writes (a CI fix, a sweep's repair commit, a
  revert, a release cut) has the App as its author.
- A commit it cherry-picks (a backport, an upstream fix ported to a
  backport branch) keeps its author and its own sign-off, and gets the
  App's as its committer. The DCO check takes a sign-off from a
  commit's author or its committer.
- An open sweep branch from before this is signed off once, the next
  time it is rebased. Other open pull requests keep their commits.

The pull requests the CI-fix bot opens now say that their commit
carries the bot's sign-off and that a maintainer adds their own before
merging. Nothing checks for the maintainer's.

The registry edit that onboards a release branch is unchanged: it is
github-actions[bot]'s commit and is already signed off.

Signed-off-by: Sarthak Aggarwal <[email protected]>

* Pass the App's identity with each commit command

A sweep commits in the clone its validation builds and tests in, and
git took the committer, and the name `commit -s` signs with, from that
clone's config, set once after cloning. A test that rewrote the config
changed whose commit and sign-off the next one was.

Every git command that commits now gets the identity in its environment
(proc.commit_env), which git reads before any config, and a clone is no
longer given one. A cherry-pick, a rebase and an amend still keep the
commit's author.

A CI fix written before the sign-offs keeps its unsigned commit when its
CI-sweep branch is rebuilt. The docs now say so.

Signed-off-by: Sarthak Aggarwal <[email protected]>

---------

Signed-off-by: Sarthak Aggarwal <[email protected]>
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