Skip to content

[backport] Backport sweep for 9.2 - #5308

Open
valkeyrie-ops[bot] wants to merge 22 commits into
9.2from
agent/backport/sweep/9.2
Open

valkeyrie-ops[bot] wants to merge 22 commits into
9.2from
agent/backport/sweep/9.2

Conversation

@valkeyrie-ops

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

Copy link
Copy Markdown

Backport sweep for 9.2

Automated cherry-picks from PRs marked "To be backported".

Applied

Source PR Title Detail
#5283 bgiteration: remove RO list commands as format changing
#5276 Make path hash tests compatible with Tcl 8.5
#5275 Make Sentinel down-conditions quorum self-contained
#5274 Free valkey-cli test hint before exiting
#4711 Fix UAF in streams when XADD creates a new node
#5065 Cap the length of inbound cluster bus packets
#5199 Keep the 'n' keyspace event flag when 'A' is set
#4983 Fix for XINFO GROUPS reports too-high lag after XTRIM removes unread …
#5298 Size the bgiteration queue on items left over from the last feed
#5293 Isolate "GEOSEARCH BYPOLYGON standard operations" test
#4854 [TEST] Speed up "client evicted due to client tracking prefixes" test
#5251 Fix CLUSTER GETSLOTMIGRATIONS reply schema
#5289 Document missing key types and notification flags in module API
#5310 Correct the since version on SISMEMBER XX to 9.2.0
#5316 Close bgIteration MULTI when no replication work is pending
#5307 Stabilize forkless replication tests
#5235 Fix flaky "Failover is not possible without majority agreement" sentinel test
#4793 [Coverage] geo - adding coverage for error branches
#5315 CI: use supported macOS 15 runner

Skipped

These candidates were evaluated but contribute no change to this branch, e.g. the fix targets code that does not exist here. No backport commit was created for them.

Source PR Title Reason
#5287 Skip copy-avoidance test during reply schema validation The change does not apply to this branch: resolving the conflict matched the existing code, so the cherry-pick added nothing.

Generated by valkey-ci-agent using Claude Code.

JimB123 and others added 2 commits November 6, 2026 05:05
Read-only list commands were fixed in #4782 and no longer need a special case.

Signed-off-by: Jim Brunner <brunnerj@amazon.com>
Backport-Source-PR: 5283
Replace uses of `lsort -stride` in the path hash tests with a helper
compatible with Tcl 8.5. macOS ships Tcl 8.5, which does not support the
`lsort -stride` option.

[Failed
CI](https://github.com/valkey-io/valkey/actions/runs/41744961340/job/126295526487)

Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
Backport-Source-PR: 5276
@valkeyrie-ops valkeyrie-ops Bot added the backport Backport PR opened by valkey-ci-agent label Nov 6, 2026
@coderabbitai

coderabbitai Bot commented Nov 6, 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: 6cb9b586-cc13-4960-96f5-cccecd90a06e

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

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

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

@JimB123
JimB123 self-requested a review November 6, 2026 06:53
@JimB123 JimB123 self-assigned this Nov 6, 2026
@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.87234% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.44%. Comparing base (8a9f9d4) to head (5de5ae8).

Files with missing lines Patch % Lines
src/valkey-cli.c 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              9.2    #5308      +/-   ##
==========================================
+ Coverage   81.29%   81.44%   +0.14%     
==========================================
  Files         199      199              
  Lines      104066   104097      +31     
==========================================
+ Hits        84602    84778     +176     
+ Misses      19464    19319     -145     
Files with missing lines Coverage Δ
src/bgiteration.c 96.83% <100.00%> (+0.01%) ⬆️
src/cluster_legacy.c 89.46% <100.00%> (+0.17%) ⬆️
src/commands.def 100.00% <ø> (ø)
src/module.c 25.31% <ø> (ø)
src/notify.c 98.73% <100.00%> (+1.26%) ⬆️
src/server.c 90.18% <100.00%> (-0.03%) ⬇️
src/t_stream.c 94.96% <100.00%> (+0.18%) ⬆️
src/unit/test_bgiteration.cpp 99.79% <100.00%> (+<0.01%) ⬆️
src/valkey-cli.c 60.47% <0.00%> (-0.01%) ⬇️

... and 23 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

sarthakaggarwal97 and others added 3 commits November 6, 2026 09:05
The test references `$quorum` without defining it locally. It can
therefore fail deterministically when the test file is run independently
instead of after another test that happens to initialize the variable.

This change derive the majority quorum from the configured Sentinel
instance count:

    [llength $::sentinel_instances] / 2 + 1

This avoids a hard-coded quorum and keeps the test valid if the number
of Sentinel instances changes.

Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
Backport-Source-PR: 5275
This fixes the `SENTINEL SIMULATE-FAILURE valkey-cli hint` test by
freeing the generated hint before exit, eliminating the deterministic
186-byte LeakSanitizer report.

[Failed
CI](https://github.com/valkey-io/valkey/actions/runs/41744961340/job/126295525902)

Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
Backport-Source-PR: 5274
With io-threads enabled, the test's first 'r ping' is read by an I/O
thread in the same batch as the infinite eval_ro script.
processClientsCommandsBatch executes the script first, which enters busy
mode and loops in processEventsWhileBlocked; postponeClientRead stops
offloading reads while blocked, so nothing ever re-drains the batch, the
parsed PING is never executed, the Tcl client blocks forever waiting for
its reply, and SCRIPT KILL is never sent. The replica log in the failed
job shows busy mode entered and then total silence until the primary
drops the link at repl-timeout.

This is a timing assumption in a recently added test, not a server
regression: the test assumes a command sent concurrently with a busy
script always gets a -BUSY reply, which io-threads batching does not
guarantee. The repository's own stable busy-script test (functions.tcl)
waits for the 'Slow script detected' log message before contacting the
server; once busy mode is active, reads are processed inline on the main
thread and answered with -BUSY. Applying the same wait here removes the
race without weakening any assertion or changing product behavior, which
fits the backport-branch policy of a minimal mechanical fix.
@valkeyrie-ops

valkeyrie-ops Bot commented Nov 6, 2026

Copy link
Copy Markdown
Author

Automatic follow-up on this backport's CI.

Pushed 4d8766bb7f1b to this branch with a fix for test-ubuntu-tls-io-threads (run).

What failed: [TIMEOUT]: Busy script ending while the replica's postponed primary is paused in tests/unit/pause.tcl (job test-ubuntu-tls-io-threads)

Root cause: With io-threads enabled, the test's first 'r ping' is read by an I/O thread in the same batch as the infinite eval_ro script. processClientsCommandsBatch executes the script first, which enters busy mode and loops in processEventsWhileBlocked; postponeClientRead stops offloading reads while blocked, so nothing ever re-drains the batch, the parsed PING is never executed, the Tcl client blocks forever waiting for its reply, and SCRIPT KILL is never sent. The replica log in the failed job shows busy mode entered and then total silence until the primary drops the link at repl-timeout. The failure is flaky.

The fix: This is a timing assumption in a recently added test, not a server regression: the test assumes a command sent concurrently with a busy script always gets a -BUSY reply, which io-threads batching does not guarantee. The repository's own stable busy-script test (functions.tcl) waits for the 'Slow script detected' log message before contacting the server; once busy mode is active, reads are processed inline on the main thread and answered with -BUSY. Applying the same wait here removes the race without weakening any assertion or changing product behavior, which fits the backport-branch policy of a minimal mechanical fix.

What the bot checked

  • No merged change that looks like a fix was found.

  • Reproduced intermittently (passed once; failed within 20 loops):

    make -j"$(nproc)" BUILD_TLS=yes BUILD_ZSTD=yes SERVER_CFLAGS='-Werror' USE_LIBBACKTRACE=yes && ./runtest --io-threads --tls --accurate --verbose --tags network --dump-logs --single unit/pause --only 'Busy script ending while the replica'"'"'s postponed primary is paused' --fastfail --loops 20 --timeout 600
  • With the fix, the reproduction passed 40 loops:

    make -j"$(nproc)" BUILD_TLS=yes BUILD_ZSTD=yes SERVER_CFLAGS='-Werror' USE_LIBBACKTRACE=yes && ./runtest --io-threads --tls --accurate --verbose --tags network --dump-logs --single unit/pause --only 'Busy script ending while the replica'"'"'s postponed primary is paused' --fastfail --loops 40 --timeout 600
  • Review: The patch adds a polling wait on the replica's 'Slow script detected' log line so the test's ping cannot be read in the same io-thread batch as the infinite script, which is exactly the race the job log shows. It uses the repository's standard log-wait helpers, keeps every original assertion intact, and changes nothing beyond the failing test.

The agent's own notes

The wait uses helpers that exist on this branch (count_log_lines, wait_for_log_messages in tests/support/util.tcl) with the same 1000x10ms bounds as functions.tcl:1428. The subsequent wait_for_condition on 'r ping' failing is kept, so the test still asserts the -BUSY behavior before SCRIPT KILL.

This PR's own CI decides whether the fix holds, and the bot never merges.

Baraa-Hasheesh and others added 9 commits November 6, 2026 15:44
Fixes #4705.

### Summary

`XADD` can leave a stream's radix tree holding a **dangling pointer to a
freed
listpack**. When the entry is later read (`XRANGE`, `XREVRANGE`,
`XINFO STREAM ... FULL`), we hit UB.

### Root cause

In `streamAppendItem()`, when a `XADD` cannot append to the current tail
node, the tail node is shrunk to fit,
that in turn might relocate it to a different location in memory, while
`ri.data` is kept pointing to the old dangling pointer.

```
if (new_node) {
    lp = lpShrinkToFit(lp); <------ lp is moved to a new location in memory
    if (ri.data != lp) raxInsert(s->rax, ri.key, ri.key_len, lp, NULL);
    lp = NULL;
    <----- ri.data is still pointing to the old dangling pointer
}
```

After which a new node is created & is inserted.

```
    lp = lpNew(prealloc);
    ....
    raxInsert(s->rax, (unsigned char *)&rax_key, sizeof(rax_key), lp, NULL);
    <---- lp is now pointing to a new location different from ri.data (will later dangle)
```

Following that multiple appends happen on that node, that operation
might reallocate it & it's possible that the final
allocation might just happen to reallocate to the same location as the
original node `ri.data`, I.E. `ri.data == lp`

Due to this unfortunate allocation, the radix tree will never be updated
with the latest values leaving it with a dangling pointer

```
if (ri.data != lp) raxInsert(s->rax, (unsigned char *)&rax_key, sizeof(rax_key), lp, NULL);
<---- This check fails as ri.data == lp
```

### Fix

- A new `rax_lp` variable is now used track the need to update the radix
tree along side the origin `lp`
- remove `raxInsert` when a new node is created to avoid sending a
pointer to the radix tree that might later get invalidated

### Testing

Added an integration test in `tests/unit/type/stream.tcl` that reliably
fails with jemalloc without the fix

---------

Signed-off-by: Bara' Hasheesh <bara.hasheesh@gmail.com>
Co-authored-by: Ran Shidlansik <ranshid@amazon.com>
Backport-Source-PR: 4711
A cluster bus peer can send a header claiming a packet of up to 4GB, and
the node keeps the link open and grows its receive buffer until the
whole body arrives, because the header's length is only checked against
a minimum. This rejects packets over 16MB as soon as the header is read,
on both the main-thread and IO-thread read paths, for every type except
PUBLISH, PUBLISHSHARD and MODULE, whose client-supplied payloads can
legitimately be larger. Reported by Petr Khartskhaev.

Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
Backport-Source-PR: 5065
`n` (new key events) is not part of `A`, but
`keyspaceEventsFlagsToString()` only prints `n` when `A` is not set. So:

```
CONFIG SET notify-keyspace-events KEAn
CONFIG GET notify-keyspace-events   -> "AKE"
```

New key events still fire at runtime, but `CONFIG REWRITE` saves
`"AKE"`, so after a restart they silently stop.

The fix prints `n` outside the `A` branch, the same way `m` is handled.
`KEAn` now reads back as `AnKE`. Added the case to the existing CONFIG
GET/SET flags test.

Signed-off-by: Aman Kumar <amankumar020003@gmail.com>
Backport-Source-PR: 5199
#4983)

Fixes [#4979 ](#4979)

`XINFO GROUPS` / `XINFO STREAM ... FULL` reported a `lag` that was too
high after `XTRIM` (or `XADD` with a trimming option) removed entries
the group had not read yet.

`streamReplyWithCGLag` trusts the group's `entries-read` counter when no
tombstone sits after the group's last ID. `XTRIM` does not update
`max_deleted_entry_id`, so after a trim Valkey believed nothing was
deleted and computed `entries_added - entries_read`, which counts the
trimmed entries as still pending.

If the group's last ID is before the stream's first entry and no
tombstone follows it, everything left in the stream is unread, so the
lag is now the stream length.

Example (6 entries, group has read 0-1, then `XTRIM s MAXLEN 2`):

| | Before | After |
|---|---|---|
| `lag` | 5 | 2 |

Tests:
- Added "Consumer group lag after XTRIM removes unread entries" to
`tests/unit/type/stream-cgroups.tcl`.
- Corrected the expected lag in "Consumer group lag with XTRIM" (2 to 1)
and "Consumer group lag with XADD trimming" (3 to 2). Both trim an
unread entry and asserted the old, incorrect value.

---------

Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com>
Backport-Source-PR: 4983
Ensure bgiteration queue doesn't adjust downwards in the presence of replication.

Signed-off-by: Muhammad Taha <76549451+taham0@users.noreply.github.com>
Backport-Source-PR: 5298
### Problem
If the previous "GEOSEARCH repeated BYPOLYGON uses the last polygon"
test failed,
it would have left `points` with some data, which might cause a
cascading failure.

### Fix
Clear `points` before using it

Signed-off-by: Bara' Hasheesh <bara.hasheesh@gmail.com>
Backport-Source-PR: 5293
…#4854)

### Problem

Currently the "client evicted due to client tracking prefixes" test is
very slow, & can take +14 minutes under valgrind,
in some cases I've observed it taking +20 minutes (1230689ms) by itself.

This happens due the checking done in `checkPrefixCollisionsOrReply`
which checks every new prefix against every existing prefix, this in
practice costs us to hit a quadratic time complexity.

Reducing the `maxmemory-clients` isn't a viable option, as it has can't
go below 128KB (getClientEvictionLimit)

### Fix

The maximum memory is shrunk down by padding the client with various
pubsub channel names that are accounted for in the max memory checks

This lowers the number of needed prefixes to hit the eviction limit to a
couple of thousands rather than 100s of thousands

This in turn reduces the time it takes the test to complete to under 10s
under valgrind.

---------

Signed-off-by: Bara' Hasheesh <bara.hasheesh@gmail.com>
Backport-Source-PR: 4854
Correct the `CLUSTER GETSLOTMIGRATIONS` reply schema to match the fields
already returned by the server. This change fixes two inconsistencies in
`src/commands/cluster-getslotmigrations.json`:

- Renames `link_name` to `name`, matching the response generated by
`clusterCommandGetSlotMigrations()`.
- Adds the missing `remaining_repl_size` property, which was introduced
in #3135.

Signed-off-by: SHUVA JYOTI KAR <shuva.jyoti.kar.87@gmail.com>
Backport-Source-PR: 5251
The module API reference is generated from the doc comments in
`src/module.c` by `utils/generate-module-api-doc.rb`, so constants
defined only in `valkeymodule.h` never appear in it. When regenerating
from 9.2.0-rc2, `VALKEYMODULE_KEYTYPE_PATH_HASH` and
`VALKEYMODULE_NOTIFY_PATH_HASH` are missing.

This PR updates the doc comments only, with no code changes:

- `VM_KeyType`: list all possible return values, including
`VALKEYMODULE_KEYTYPE_PATH_HASH`.
- `VM_SubscribeToKeyspaceEvents`:
  - Add `VALKEYMODULE_NOTIFY_PATH_HASH`.
- Also add `VALKEYMODULE_NOTIFY_NEW`, which was missing from the same
list.
- Fix `VALKEYMODULE_NOTIFY_KEYMISS` to the actual macro name
`VALKEYMODULE_NOTIFY_KEY_MISS`.
- Note that `VALKEYMODULE_NOTIFY_ALL` also excludes
`VALKEYMODULE_NOTIFY_NEW`, matching `valkey.conf`.

Refs : valkey-io/valkey-doc#531

Signed-off-by: Su Ko <rhtn1128@gmail.com>
Backport-Source-PR: 5289
@valkeyrie-ops

valkeyrie-ops Bot commented Nov 6, 2026

Copy link
Copy Markdown
Author

Automatic follow-up on this backport's CI.

No fix for test-almalinux9-tls-module (run). The reported failure was not reproduced by code: every reproduction probe passed without reproducing the failure. No edit was attempted.

What the bot checked

PoisonGodv and others added 3 commits November 7, 2026 01:01
`XX` was added in #2972, which first shipped in 9.2.0-rc1.

---------

Signed-off-by: 李凝炜 <951448078@qq.com>
Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
Backport-Source-PR: 5310
Ensures that bgIteration isn't short-circuited by hasPostExecutionUnitPendingWork

Signed-off-by: harrylin98 <harrylin980107@gmail.com>
Backport-Source-PR: 5316
Stop background write generators before comparing replication offsets and database digests.

---------

Signed-off-by: Nitai Caro <caronita@amazon.com>
Co-authored-by: Nitai Caro <caronita@amazon.com>
Backport-Source-PR: 5307
@valkeyrie-ops

valkeyrie-ops Bot commented Nov 7, 2026

Copy link
Copy Markdown
Author

Automatic follow-up on this backport's CI.

No fix for test-ubuntu-tls-no-tls (run). Refusing. The two slot-migration failures share one root event: after the manual failback in the empty target shard, the source-shard replica R3 kept the stale migrating target (R7 instead of R6) past the 10s wait, and the second test failed as fallout when R3 was promoted. All identified upstream fixes, including the targeted deflake #4795 and #5141, are already ported to this branch, and the provided reproduction fails for an unrelated deterministic reason, so there is no evidence-backed fix….

What failed: tests/unit/cluster/slot-migration.tcl: 'Empty-shard migration target is auto-updated after failover in target shard' and 'Empty-shard migration source is auto-updated after failover in source shard' in job test-ubuntu-tls-no-tls

Root cause: A rare cluster-state propagation race: after failback of R6 in the empty target shard, observer replica R3 never updated migrating_slots_to from R7 back to R6 (clusterUpdateSlotsConfigWith / role-switch paths in src/cluster_legacy.c), and the stale entry then made the second failover test fail when R3 became primary. The exact interleaving is not recoverable from the CI log, which lacks the server logs. The briefing's reproduction instead fails deterministically because --only skips the prerequisite test that opens the migration, leaving R0 with an empty slot state, which is an artifact of isolated selection, not the CI race.

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) (already ported as b57b9a3); b55889b376a3 Deflake the slot-migration failover tests (Deflake the slot-migration failover tests #4795) (already ported as 5afb703); 9a029ba83635 Fix typos in comments and rename TimedOut/Sparkline functions and tests (Spelling 16 #2252) (already ported as 04dfb37)

  • Reproduced on every run (failed on both of two runs):

    make -j"$(nproc)" BUILD_TLS=yes SERVER_CFLAGS='-Werror' USE_LIBBACKTRACE=yes && ./runtest --verbose --dump-logs --single unit/cluster/slot-migration --only 'Empty-shard migration target is auto-updated after failover in target shard' --only 'Empty-shard migration source is auto-updated after failover in source shard' --fastfail --loops 1 --timeout 600

The test asserts the literal errno string 'Connection refused', but on
the macOS arm64 runner the libvalkey non-blocking connect race makes
valkey-cli report the refused connection as 'setsockopt(TCP_NODELAY):
Invalid argument' (deps/libvalkey/src/net.c blocking path sets
TCP_NODELAY after SO_ERROR reads 0), so the assert_match at
tests/unit/cluster/cli.tcl:649 fails. A secondary test bug: the final
cluster_known_nodes==1 checks depend on the previous del-node test
having run, so the test also fails when run alone with --only.

The server and CLI behaved correctly; the test encodes an OS- and
timing-specific error string the platform does not guarantee, so the fix
belongs in the test. Matching the stable 'Could not connect to Valkey
at' prefix keeps the intent (CLI warned it could not reach the dead
node) without depending on errno text, and checking the node ID is gone
from remaining members keeps the intent of the state check while making
the test order-independent per the repo's own test standards. Test-only,
minimal, and backport-friendly; no product behavior changes on this
release branch, and no merged upstream commit addressing this failure
was found to port.
@valkeyrie-ops

valkeyrie-ops Bot commented Nov 7, 2026

Copy link
Copy Markdown
Author

Automatic follow-up on this backport's CI.

Pushed b6fe328180aa to this branch with a fix for test-macos-latest (run).

What failed: del-node: Delete unreachable node without slots in tests/unit/cluster/cli.tcl (job test-macos-latest)

Root cause: The test asserts the literal errno string 'Connection refused', but on the macOS arm64 runner the libvalkey non-blocking connect race makes valkey-cli report the refused connection as 'setsockopt(TCP_NODELAY): Invalid argument' (deps/libvalkey/src/net.c blocking path sets TCP_NODELAY after SO_ERROR reads 0), so the assert_match at tests/unit/cluster/cli.tcl:649 fails. A secondary test bug: the final cluster_known_nodes==1 checks depend on the previous del-node test having run, so the test also fails when run alone with --only. The failure is flaky.

The fix: The server and CLI behaved correctly; the test encodes an OS- and timing-specific error string the platform does not guarantee, so the fix belongs in the test. Matching the stable 'Could not connect to Valkey at' prefix keeps the intent (CLI warned it could not reach the dead node) without depending on errno text, and checking the node ID is gone from remaining members keeps the intent of the state check while making the test order-independent per the repo's own test standards. Test-only, minimal, and backport-friendly; no product behavior changes on this release branch, and no merged upstream commit addressing this failure was found to port.

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) (already ported as b57b9a3)

  • Reproduced on every run (failed on both of two runs):

    make -j"$(nproc)" SERVER_CFLAGS='-Werror' USE_LIBBACKTRACE=yes && ./runtest --verbose --clients 1 --no-latency --dump-logs --single unit/cluster/cli --only 'del-node: Delete unreachable node without slots' --fastfail --loops 1 --timeout 600
  • With the fix, the reproduction passed 40 loops:

    make -j"$(nproc)" SERVER_CFLAGS='-Werror' USE_LIBBACKTRACE=yes && ./runtest --verbose --clients 1 --no-latency --dump-logs --single unit/cluster/cli --only 'del-node: Delete unreachable node without slots' --fastfail --loops 40 --timeout 600
  • Review: The failing assertion pinned an OS-specific errno string that macOS does not guarantee for a refused connection, and the patch keeps all meaningful checks (exit code, warning, the connection-failure stderr line, node removal) while replacing only the unstable suffix. The cluster_known_nodes change fixes the diagnosed secondary bug that breaks the test under --only, using the repo's polling helpers with no sleeps, skips, or weakened coverage.

The agent's own notes

Note for the reviewer: the bot's reproduction uses --only, which skips the two earlier del-node tests; the original exact known-nodes counts can never be satisfied in that mode, which is why reproduction failed with 'Nodes don't have expected cluster state' rather than the CI assertion. Both the CI failure (errno string) and the standalone failure (count assumption) are addressed.

This PR's own CI decides whether the fix holds, and the bot never merges.

Baraa-Hasheesh and others added 3 commits November 7, 2026 09:08
…nel test (#5235)

Fixes #4483

### Problem

The previous test, "ODOWN is not possible without N (quorum) Sentinels
reports", kills the primary and restarts it.

On a slow CI machine this can take a few seconds, so the Sentinels get
close to
`down-after-milliseconds` (2 s) before the primary is back.

As such when the "Failover is not possible without majority agreement"
test starts,
every Sentinel still shows the primary as `master,disconnected`.

The test lowers the quorum to 3 immediately. A Sentinel then crosses
`down-after`,
reaches ODOWN and starts a failover while all five Sentinels are still
alive to vote.
If the promotion finishes before the test's read, the surviving Sentinel
reports the new primary and the assertion fails.

### Out of Scope

A server bug makes the failover instant: since #2763, peer `master_down`
reports are never expired while a Sentinel sees the primary as up
(#4912,
fixed by #4913).

# Fix

Before lowering the quorum, wait until every Sentinel sees the primary
as plain
`master` (connected) with a PONG in the last second. This is the same
idea as
`ensure_master_up` in `07-down-conditions.tcl`.

The wait is on state, not time, so a slower runner just waits longer.

Signed-off-by: Bara' Hasheesh <bara.hasheesh@gmail.com>
Backport-Source-PR: 5235
Multiple error paths in the geo commands are not covered, adding
coverage for the following:
- longitudes & latitudes ranges
- Too many input arguments

---------

Signed-off-by: Bara' Hasheesh <bara.hasheesh@gmail.com>
Backport-Source-PR: 4793
A node only refreshes migrating/importing slot state when it sees a
slots-bitmap change or a replica-to-primary role edge (gate at
src/cluster_legacy.c:4708). An empty shard's bitmap never changes, and
failback issued the manual failover as soon as FAIL flags cleared, which
can happen via a stale pre-demotion PONG that still claims the primary
role. A node that missed the demotion sees no role edge on the
re-promotion and keeps its migrating destination pointed at the interim
primary forever, exactly the stuck [609->-R7] state in the job log.

This is a test synchronization bug, not a server regression: the
server's state converged everywhere except for the edge-triggered
open-slot update, and the already-ported deflake b55889b (#4795)
fixed the FAIL-flag half of this same race in the same helper. Extending
failback with a wait on the demoted primary's role view uses the
repository's polling-helper convention, changes no product behavior, and
removes the race deterministically. The --only guard makes the
reproduction command meaningful without affecting full-file runs.
@valkeyrie-ops

valkeyrie-ops Bot commented Nov 7, 2026

Copy link
Copy Markdown
Author

Automatic follow-up on this backport's CI.

Pushed be1b33bad963 to this branch with a fix for test-almalinux9-jemalloc (run).

What failed: tests/unit/cluster/slot-migration.tcl: 'Empty-shard migration target is auto-updated after failover in target shard' and 'Empty-shard migration source is auto-updated after failover in source shard' in job test-almalinux9-jemalloc

Root cause: A node only refreshes migrating/importing slot state when it sees a slots-bitmap change or a replica-to-primary role edge (gate at src/cluster_legacy.c:4708). An empty shard's bitmap never changes, and failback issued the manual failover as soon as FAIL flags cleared, which can happen via a stale pre-demotion PONG that still claims the primary role. A node that missed the demotion sees no role edge on the re-promotion and keeps its migrating destination pointed at the interim primary forever, exactly the stuck [609->-R7] state in the job log. The failure is flaky.

The fix: This is a test synchronization bug, not a server regression: the server's state converged everywhere except for the edge-triggered open-slot update, and the already-ported deflake b55889b (#4795) fixed the FAIL-flag half of this same race in the same helper. Extending failback with a wait on the demoted primary's role view uses the repository's polling-helper convention, changes no product behavior, and removes the race deterministically. The --only guard makes the reproduction command meaningful without affecting full-file runs.

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) (already ported as b57b9a3); b55889b376a3 Deflake the slot-migration failover tests (Deflake the slot-migration failover tests #4795) (already ported as 5afb703); 9a029ba83635 Fix typos in comments and rename TimedOut/Sparkline functions and tests (Spelling 16 #2252) (already ported as 04dfb37)

  • Reproduced on every run (failed on both of two runs):

    make -j SERVER_CFLAGS='-Werror' USE_LIBBACKTRACE=yes && ./runtest --verbose --dump-logs --single unit/cluster/slot-migration --only 'Empty-shard migration target is auto-updated after failover in target shard' --only 'Empty-shard migration source is auto-updated after failover in source shard' --fastfail --loops 1 --timeout 600
  • With the fix, the reproduction passed 40 loops:

    make -j SERVER_CFLAGS='-Werror' USE_LIBBACKTRACE=yes && ./runtest --verbose --dump-logs --single unit/cluster/slot-migration --only 'Empty-shard migration target is auto-updated after failover in target shard' --only 'Empty-shard migration source is auto-updated after failover in source shard' --fastfail --loops 40 --timeout 600
  • Review: The log shows the failback racing gossip convergence: a node that never observed the demotion cannot see the replica-to-primary edge that is the only refresh trigger for an empty shard's open slots, so the test assumed a state the server does not guarantee. The patch adds a polling convergence wait per repo conventions, keeps every assertion intact, and the extra setup hunks are no-ops in full runs, so nothing is weakened or skipped.

The agent's own notes

The bot's reproduction command uses --only for the two tests, which skips the preceding test that opens slot 609; without the added guard it fails trivially with an empty open-slots string (see reproduction.log line 43), which differs from the CI race. With the guard plus the failback wait, both the --only reproduction and the full-file ordering are covered. Note node_seen_as_replica_by_all uses the 'slave' flag as emitted by CLUSTER NODES.

This PR's own CI decides whether the fix holds, and the bot never merges.

@valkeyrie-ops

valkeyrie-ops Bot commented Nov 7, 2026

Copy link
Copy Markdown
Author

Automatic follow-up on this backport's CI.

No fix for test-ubuntu-tls (run). The reported failure was not reproduced by code: the reproduction stopped without reproducing the failure. No edit was attempted.

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) (already ported as b57b9a3)

  • Did not reproduce (passed once; passed 20 loops; no time left for 20 loops with every core busy):

    make -j"$(nproc)" BUILD_TLS=yes BUILD_ZSTD=yes SERVER_CFLAGS='-Werror' USE_LIBBACKTRACE=yes && ./runtest --verbose --dump-logs --tls --single unit/memefficiency --only 'Active Defrag main dictionary: cluster' --fastfail --loops 20 --timeout 600 --clients 1

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

@valkeyrie-ops

valkeyrie-ops Bot commented Nov 7, 2026

Copy link
Copy Markdown
Author

Automatic follow-up on this backport's CI.

No fix for test-valgrind-no-malloc-usable-size-test (integration-type) (run). The reported failure was not reproduced by code: the reproduction command could not run on this runner. No edit was attempted.

What the bot checked

  • Existing fixes found: f86d57e16241 Deflake diskless slow replicas drop during rdb pipe test (Deflake diskless slow replicas drop during rdb pipe test #4855) (already ported as 55fdaf0); c1ed73bfc03f Fix typos in comments and rename VALKEY_SANITAIZER_* CMake variables (Spelling 14 #2250) (already ported as 87a33d2)

  • Could not run the test on this runner:

    make -j"$(nproc)" valgrind CFLAGS="-DNO_MALLOC_USABLE_SIZE" SERVER_CFLAGS='-Werror' USE_LIBBACKTRACE=yes && ./runtest --valgrind --no-latency --verbose --clients 1 --timeout 2400 --dump-logs --single integration/replication --only 'Writes after bg iterator termination still reach the replica' --only 'FLUSHDB during forkless sync replays correctly (primary diskless=no, replica load=disabled)' --only 'FLUSHDB during forkless sync replays correctly (primary diskless=no, replica load=on-empty-db)' --fastfail --loops 1 --timeout 600

    The job's --timeout 2400 was lowered to 600s for the reproduction: a test that times out at 600s may be slow here, not hung.

@valkeyrie-ops

valkeyrie-ops Bot commented Nov 7, 2026

Copy link
Copy Markdown
Author

Automatic follow-up on this backport's CI.

No fix for test-valgrind-test (integration-type) (run). The reported failure was not reproduced by code: the reproduction command could not run on this runner. No edit was attempted.

What the bot checked

  • Existing fixes found: f86d57e16241 Deflake diskless slow replicas drop during rdb pipe test (Deflake diskless slow replicas drop during rdb pipe test #4855) (already ported as 55fdaf0); c1ed73bfc03f Fix typos in comments and rename VALKEY_SANITAIZER_* CMake variables (Spelling 14 #2250) (already ported as 87a33d2)

  • Could not run the test on this runner:

    make -j"$(nproc)" valgrind SERVER_CFLAGS='-Werror' BUILD_ZSTD=yes USE_LIBBACKTRACE=yes && ./runtest --valgrind --no-latency --verbose --clients 1 --timeout 2400 --dump-logs --single integration/replication --only 'Writes after bg iterator termination still reach the replica' --only 'FLUSHDB during forkless sync replays correctly (primary diskless=no, replica load=disabled)' --only 'FLUSHDB during forkless sync replays correctly (primary diskless=no, replica load=on-empty-db)' --fastfail --loops 1 --timeout 600

    The job's --timeout 2400 was lowered to 600s for the reproduction: a test that times out at 600s may be slow here, not hung.

GitHub retired the macOS 14 runner image, causing
`build-old-macos-versions` to be cancelled before a runner is allocated:

```text
The configuration 'macos-14-arm64-us-default' is not supported
```

Update the job to use `macos-15`, preserving older-version coverage
without duplicating the existing `macos-latest` jobs.

Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
Backport-Source-PR: 5315
@valkeyrie-ops

valkeyrie-ops Bot commented Nov 8, 2026

Copy link
Copy Markdown
Author

Automatic follow-up on this backport's CI.

No fix for test-freebsd (run). The reported failure was not reproduced by code: no code-owned reproduction command could be established. No edit was attempted.

@valkeyrie-ops

valkeyrie-ops Bot commented Nov 8, 2026

Copy link
Copy Markdown
Author

Automatic follow-up on this backport's CI.

No fix for test-valgrind-test (integration-type) (run). The reported failure was not reproduced by code: the reproduction command could not run on this runner. No edit was attempted.

What the bot checked

  • Existing fixes found: f86d57e16241 Deflake diskless slow replicas drop during rdb pipe test (Deflake diskless slow replicas drop during rdb pipe test #4855) (already ported as 55fdaf0); c1ed73bfc03f Fix typos in comments and rename VALKEY_SANITAIZER_* CMake variables (Spelling 14 #2250) (already ported as 87a33d2)

  • Could not run the test on this runner:

    make -j"$(nproc)" valgrind SERVER_CFLAGS='-Werror' BUILD_ZSTD=yes USE_LIBBACKTRACE=yes && ./runtest --valgrind --no-latency --verbose --clients 1 --timeout 2400 --dump-logs --single integration/replication --only 'Writes after bg iterator termination still reach the replica' --only 'FLUSHDB during forkless sync replays correctly (primary diskless=no, replica load=disabled)' --only 'FLUSHDB during forkless sync replays correctly (primary diskless=no, replica load=on-empty-db)' --fastfail --loops 1 --timeout 600

    The job's --timeout 2400 was lowered to 600s for the reproduction: a test that times out at 600s may be slow here, not hung.

@valkeyrie-ops

valkeyrie-ops Bot commented Nov 8, 2026

Copy link
Copy Markdown
Author

Automatic follow-up on this backport's CI.

No fix for test-valgrind-no-malloc-usable-size-test (integration-type) (run). The reported failure was not reproduced by code: the reproduction command could not run on this runner. No edit was attempted.

What the bot checked

  • Existing fixes found: f86d57e16241 Deflake diskless slow replicas drop during rdb pipe test (Deflake diskless slow replicas drop during rdb pipe test #4855) (already ported as 55fdaf0); c1ed73bfc03f Fix typos in comments and rename VALKEY_SANITAIZER_* CMake variables (Spelling 14 #2250) (already ported as 87a33d2)

  • Could not run the test on this runner:

    make -j"$(nproc)" valgrind CFLAGS="-DNO_MALLOC_USABLE_SIZE" SERVER_CFLAGS='-Werror' USE_LIBBACKTRACE=yes && ./runtest --valgrind --no-latency --verbose --clients 1 --timeout 2400 --dump-logs --single integration/replication --only 'Writes after bg iterator termination still reach the replica' --only 'FLUSHDB during forkless sync replays correctly (primary diskless=no, replica load=disabled)' --only 'FLUSHDB during forkless sync replays correctly (primary diskless=no, replica load=on-empty-db)' --fastfail --loops 1 --timeout 600

    The job's --timeout 2400 was lowered to 600s for the reproduction: a test that times out at 600s may be slow here, not hung.

@valkeyrie-ops

valkeyrie-ops Bot commented Nov 8, 2026

Copy link
Copy Markdown
Author

Automatic follow-up on this backport's CI.

No fix for test-sanitizer-address (gcc) (run). The reported failure was not reproduced by code: every reproduction probe passed without reproducing the failure. No edit was attempted.

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) (already ported as b57b9a3)

  • Did not reproduce (the build passed):

    export CC='gcc' && make -j"$(nproc)" all-with-unit-tests OPT=-O3 SANITIZER=address SERVER_CFLAGS='-Werror' USE_LIBBACKTRACE=yes

    No test failed: the reproduction is the job's own build, and its compiler output is the failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Backport PR opened by valkey-ci-agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.