Skip to content

[backport] Backport sweep for 9.2 - #4731

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

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

Conversation

@valkeyrie-ops

@valkeyrie-ops valkeyrie-ops Bot commented Sep 17, 2026

Copy link
Copy Markdown

Backport sweep for 9.2

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

Applied

Source PR Title Detail
#4654 [Bug Fix] Echo the rejected request epoch in FAILOVER_AUTH_NACK
#4702 Attribute LZ4 codec context memory to client memory usage
#4730 Deflake throttle-repl tests cherry-picked in a prior sweep

Generated by valkey-ci-agent using Claude Code.

xdk-amz and others added 2 commits September 17, 2026 23:06
A NACK for an old election could be counted against the current one,
since the receiver only checked the sender's header epoch. Carry the
rejected request's epoch in the NACK and only count exact matches. Fixes
#4627.

**Wire format change.** `clusterMsgDataFailoverNack` grows from 1 byte
(`reason`) to 16 bytes (`epoch`, `reason`, 7 reserved).
`CLUSTER_NODE_FAILOVER_AUTH_NACK_SUPPORTED` is unchanged, and
`clusterIsValidPacket` requires an exact length for this type, so a node
with this change and a node without it will drop each other's NACKs (one
`LL_WARNING` per dropped packet) and fall back to the timeout-based
election retry that predates #3833. Nothing released sets that
capability bit (#3833 is only on `unstable`), so this only affects mixed
`unstable` builds; it is not a rolling-upgrade concern for any released
version.

Signed-off-by: Dante Knowles <xdk@amazon.com>
Backport-Source-PR: 4654
Follow-up to #3853, addresses
#3853 (comment).

The LZ4 contexts go through the custom zmalloc allocator, so their
memory is inside `used_memory` but not attributed to anything and shows
up under `used_memory_dataset`. There are two of them: the per-replica
`LZ4F_cctx` on the primary, and the stream reader on the replica
(`LZ4F_dctx` plus a retained input buffer), which lives on the server
struct so per-client accounting never sees it.

`zmalloc_size(ctx)` doesn't work here. The context struct is ~200 bytes
and the staging buffers it allocates lazily are ~80 KiB. So the
allocator callbacks now count the bytes into a `ctx_memory` field on the
owning stream, via `LZ4F_CustomMem.opaqueState`.

`getClientMemoryUsage()` picks up the compressor context in the existing
replica block, and charges the replica-side reader to the primary
client, so it shows up in `mem_clients_normal` like other client memory.

Added a unit test that checks the counter grows when the streaming
buffers are allocated and drops back to zero on free.

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

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

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

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 8fbe46ae-1122-41b9-be61-b7bd479738c0

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

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

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.05882% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.71%. Comparing base (f01ed55) to head (095b37f).

Files with missing lines Patch % Lines
src/cluster_legacy.c 85.71% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              9.2    #4731      +/-   ##
==========================================
- Coverage   80.74%   80.71%   -0.03%     
==========================================
  Files         192      192              
  Lines      100803   100853      +50     
==========================================
+ Hits        81390    81403      +13     
- Misses      19413    19450      +37     
Files with missing lines Coverage Δ
src/compression_lz4.c 97.64% <100.00%> (+0.17%) ⬆️
src/networking.c 92.41% <100.00%> (-0.31%) ⬇️
src/unit/test_compression.cpp 97.51% <100.00%> (+0.08%) ⬆️
src/cluster_legacy.c 89.15% <85.71%> (+0.12%) ⬆️

... and 24 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.

@valkeyrie-ops

valkeyrie-ops Bot commented Sep 18, 2026

Copy link
Copy Markdown
Author

Automatic follow-up for the current backport head.

I did not push a fix: fix not applied (agent declined or made no edits)

Looked at the failure from this run.

Evidence
 debug_lua.c
    CC �[38:5:250m(LUA Module) engine_lua.c
    CC �[38:5:250m(LUA Module) function_lua.c
    CC �[38:5:250m(LUA Module) list.c
    CC �[38:5:250m(LUA Module) script_lua.c
cd ../../../deps && make lua
make[3]: Entering directory '/tmp/ci-fix-agqn6lpf/repo/deps'
MAKE lua
cd lua/src && make all CFLAGS="-Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DLUA_USE_MKSTEMP  -fPIC -O2" MYLDFLAGS="" AR="ar rc"
make[4]: Entering directory '/tmp/ci-fix-agqn6lpf/repo/deps/lua/src'
    CC �[38:5:250m(LUA Lib) lapi.c
    CC �[38:5:250m(LUA Lib) lcode.c
    CC �[38:5:250m(LUA Lib) ldebug.c
    CC �[38:5:250m(LUA Lib) ldo.c
    CC �[38:5:250m(LUA Lib) ldump.c
    CC �[38:5:250m(LUA Lib) lfunc.c
    CC �[38:5:250m(LUA Lib) lgc.c
    CC �[38:5:250m(LUA Lib) llex.c
    CC �[38:5:250m(LUA Lib) lmem.c
    CC �[38:5:250m(LUA Lib) lobject.c
    CC �[38:5:250m(LUA Lib) lopcodes.c
    CC �[38:5:250m(LUA Lib) lparser.c
    CC �[38:5:250m(LUA Lib) lstate.c
    CC �[38:5:250m(LUA Lib) lstring.c
    CC �[38:5:250m(LUA Lib) ltable.c
    CC �[38:5:250m(LUA Lib) ltm.c
    CC �[38:5:250m(LUA Lib) lundump.c
    CC �[38:5:250m(LUA Lib) lvm.c
    CC �[38:5:250m(LUA Lib) lzio.c
    CC �[38:5:250m(LUA Lib) strbuf.c
    CC �[38:5:250m(LUA Lib) fpconv.c
    CC �[38:5:250m(LUA Lib) lauxlib.c
    CC �[38:5:250m(LUA Lib) lbaselib.c
    CC �[38:5:250m(LUA Lib) ldblib.c
    CC �[38:5:250m(LUA Lib) liolib.c
    CC �[38:5:250m(LUA Lib) lmathlib.c
    CC �[38:5:250m(LUA Lib) loslib.c
    CC �[38:5:250m(LUA Lib) ltablib.c
    CC �[38:5:250m(LUA Lib) lstrlib.c
    CC �[38:5:250m(LUA Lib) loadlib.c
    CC �[38:5:250m(LUA Lib) linit.c
    CC �[38:5:250m(LUA Lib) lua_cjson.c
    CC �[38:5:250m(LUA Lib) lua_struct.c
    CC �[38:5:250m(LUA Lib) lua_cmsgpack.c
    CC �[38:5:250m(LUA Lib) lua_bit.c
    ARCHIVE liblua.a
    ARCHIVE liblua.a
    CC �[38:5:250m(LUA Lib) lua.c
    LINK lua
    CC �[38:5:250m(LUA Lib) luac.c
    CC �[38:5:250m(LUA Lib) print.c
    LINK luac
make[4]: Leaving directory '/tmp/ci-fix-agqn6lpf/repo/deps/lua/src'
make[3]: Leaving directory '/tmp/ci-fix-agqn6lpf/repo/deps'
    LINK libvalkeylua.a
make[2]: Leaving directory '/tmp/ci-fix-agqn6lpf/repo/src/modules/lua'
    LINK valkey-server
    INSTALL valkey-sentinel
    CC cli_commands.o
    CC cli_common.o
    CC serverassert.o
    CC valkey-cli.o
    LINK valkey-cli
    CC fuzzer_client.o
    CC fuzzer_command_generator.o
    CC valkey-benchmark.o
    CC valkey-benchmark-dataset.o
    LINK valkey-benchmark
    INSTALL valkey-check-rdb
    INSTALL valkey-check-aof

Hint: It's a good idea to run 'make test' ;)

    ARCHIVE libvalkey.a
make[2]: Entering directory '/tmp/ci-fix-agqn6lpf/repo/src/unit'
Makefile:113: *** googletest not found. Install gtest or set GTEST_CFLAGS/GTEST_LIBS explicitly.  Stop.
make[2]: Leaving directory '/tmp/ci-fix-agqn6lpf/repo/src/unit'
make[1]: *** [Makefile:817: valkey-unit-gtests] Error 2
make[1]: Leaving directory '/tmp/ci-fix-agqn6lpf/repo/src'
make: *** [Makefile:6: all-with-unit-tests] Error 2

@valkeyrie-ops

valkeyrie-ops Bot commented Sep 18, 2026

Copy link
Copy Markdown
Author

Automatic follow-up for the current backport head.

Fixed Throttling tears down when disabling config in tests/integration/throttle-repl.tcl and pushed 095b37f2fcf5 to this PR's branch.

Fixing the failure from this run.

Root cause: The throttle-repl integration test 'Throttling tears down when disabling config' timed out ('*** [TIMEOUT]: ... in tests/integration/throttle-repl.tcl', Test Summary: 5805 passed, 1 failed) because the release branch carries the pre-deflake version of throttle-repl.tcl, which upstream already fixed in the deflake commit.

Verified by: ported upstream fix; awaiting this PR's normal CI

Review: Ported upstream commit 1c847e8 with its original authorship; this PORT path relies on the PR's normal CI as the verification authority.

Other checks also failed in that run; re-invoke with the same command to address the next one:

  • test-valgrind-no-malloc-usable-size-test (integration-type)
  • test-valgrind-no-malloc-usable-size-test (unit)
  • test-valgrind-test (unit)
  • test-valgrind-misc

This is a port of an upstream fix; this PR's normal CI is the verification authority. I do not merge.

The fix was pushed as 095b37f2fcf5. At the post-push recheck, the PR API reported e245d53c224f as the current head, so CI follow-up will evaluate that head separately.

Fixes #4724, #4722, #4721, #4720, #4719

### valgrind
Tests defined in throttle-repl are time sensitive, running them under
valgrind makes them highly unstable.

valgrind:skip was added to the tests

### Throttling not protect a replica above the hard COB limit

setting `soft_time = 60`, as this test is related to hard limit, there
is no need to exercise any soft limit checks

### Throttling protects a replica above the soft COB limit

setting `soft_time = 1`, as using 0 results in a possible race condition
- Soft limit is hit first time at the last 100ms tick of Second X
- At the first tick of Second X+1, the soft limit is hit again
- `trendCal` is not able to install throttler in time (Doesn't have
enough samples)
- `throttleRepl_isClientExemptFromCobLimits` check fails as no throttler
is installed
- Connection is disconnected due to soft limit

Setting `soft_time = 1` solves this race as it give `trendCal` enough
time to install the throttler while exercising the
`throttleRepl_isClientExemptFromCobLimits` code path

### Throttling tears down when failover happened

After the replica is resumed, the 2 nodes will create a replica chain
- Node1 is replica of Node2
- Node2 is replica of Node1

`$replica replicaof no one` was added to create a clear primary between
the 2 nodes

---------

Signed-off-by: Bara' Hasheesh <bara.hasheesh@gmail.com>
(cherry picked from commit 1c847e8)
@valkeyrie-ops

valkeyrie-ops Bot commented Sep 18, 2026

Copy link
Copy Markdown
Author

Automatic follow-up for the current backport head.

I did not push a fix: fix not applied (agent declined or made no edits)

Looked at the failure from this run.

Evidence
 debug_lua.c
    CC �[38:5:250m(LUA Module) engine_lua.c
    CC �[38:5:250m(LUA Module) function_lua.c
    CC �[38:5:250m(LUA Module) list.c
    CC �[38:5:250m(LUA Module) script_lua.c
cd ../../../deps && make lua
make[3]: Entering directory '/tmp/ci-fix-7am6d93j/repo/deps'
MAKE lua
cd lua/src && make all CFLAGS="-Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DLUA_USE_MKSTEMP  -fPIC -O2" MYLDFLAGS="" AR="ar rc"
make[4]: Entering directory '/tmp/ci-fix-7am6d93j/repo/deps/lua/src'
    CC �[38:5:250m(LUA Lib) lapi.c
    CC �[38:5:250m(LUA Lib) lcode.c
    CC �[38:5:250m(LUA Lib) ldebug.c
    CC �[38:5:250m(LUA Lib) ldo.c
    CC �[38:5:250m(LUA Lib) ldump.c
    CC �[38:5:250m(LUA Lib) lfunc.c
    CC �[38:5:250m(LUA Lib) lgc.c
    CC �[38:5:250m(LUA Lib) llex.c
    CC �[38:5:250m(LUA Lib) lmem.c
    CC �[38:5:250m(LUA Lib) lobject.c
    CC �[38:5:250m(LUA Lib) lopcodes.c
    CC �[38:5:250m(LUA Lib) lparser.c
    CC �[38:5:250m(LUA Lib) lstate.c
    CC �[38:5:250m(LUA Lib) lstring.c
    CC �[38:5:250m(LUA Lib) ltable.c
    CC �[38:5:250m(LUA Lib) ltm.c
    CC �[38:5:250m(LUA Lib) lundump.c
    CC �[38:5:250m(LUA Lib) lvm.c
    CC �[38:5:250m(LUA Lib) lzio.c
    CC �[38:5:250m(LUA Lib) strbuf.c
    CC �[38:5:250m(LUA Lib) fpconv.c
    CC �[38:5:250m(LUA Lib) lauxlib.c
    CC �[38:5:250m(LUA Lib) lbaselib.c
    CC �[38:5:250m(LUA Lib) ldblib.c
    CC �[38:5:250m(LUA Lib) liolib.c
    CC �[38:5:250m(LUA Lib) lmathlib.c
    CC �[38:5:250m(LUA Lib) loslib.c
    CC �[38:5:250m(LUA Lib) ltablib.c
    CC �[38:5:250m(LUA Lib) lstrlib.c
    CC �[38:5:250m(LUA Lib) loadlib.c
    CC �[38:5:250m(LUA Lib) linit.c
    CC �[38:5:250m(LUA Lib) lua_cjson.c
    CC �[38:5:250m(LUA Lib) lua_struct.c
    CC �[38:5:250m(LUA Lib) lua_cmsgpack.c
    CC �[38:5:250m(LUA Lib) lua_bit.c
    ARCHIVE liblua.a
    ARCHIVE liblua.a
    CC �[38:5:250m(LUA Lib) lua.c
    LINK lua
    CC �[38:5:250m(LUA Lib) luac.c
    CC �[38:5:250m(LUA Lib) print.c
    LINK luac
make[4]: Leaving directory '/tmp/ci-fix-7am6d93j/repo/deps/lua/src'
make[3]: Leaving directory '/tmp/ci-fix-7am6d93j/repo/deps'
    LINK libvalkeylua.a
make[2]: Leaving directory '/tmp/ci-fix-7am6d93j/repo/src/modules/lua'
    LINK valkey-server
    INSTALL valkey-sentinel
    CC cli_commands.o
    CC cli_common.o
    CC serverassert.o
    CC valkey-cli.o
    LINK valkey-cli
    CC fuzzer_client.o
    CC fuzzer_command_generator.o
    CC valkey-benchmark.o
    CC valkey-benchmark-dataset.o
    LINK valkey-benchmark
    INSTALL valkey-check-rdb
    INSTALL valkey-check-aof

Hint: It's a good idea to run 'make test' ;)

    ARCHIVE libvalkey.a
make[2]: Entering directory '/tmp/ci-fix-7am6d93j/repo/src/unit'
Makefile:113: *** googletest not found. Install gtest or set GTEST_CFLAGS/GTEST_LIBS explicitly.  Stop.
make[2]: Leaving directory '/tmp/ci-fix-7am6d93j/repo/src/unit'
make[1]: *** [Makefile:817: valkey-unit-gtests] Error 2
make[1]: Leaving directory '/tmp/ci-fix-7am6d93j/repo/src'
make: *** [Makefile:6: all-with-unit-tests] Error 2

Other checks also failed in that run; re-invoke with the same command to address the next one:

  • test-valgrind-misc
  • test-valgrind-no-malloc-usable-size-misc
  • test-valgrind-test (integration-type)
  • test-valgrind-no-malloc-usable-size-test (integration-type)
  • test-valgrind-test (unit)
  • test-valgrind-no-malloc-usable-size-test (unit)

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.

3 participants