Skip to content

Skip replication pings in hashexpire monitor tests - #5437

Merged
sarthakaggarwal97 merged 1 commit into
unstablefrom
agent/ci-fix/upstream/8717a0a998e77689
Dec 1, 2026
Merged

sarthakaggarwal97 merged 1 commit into
unstablefrom
agent/ci-fix/upstream/8717a0a998e77689

Conversation

@valkeyrie-ops

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

Copy link
Copy Markdown
Contributor

Multiple expired hash fields are replicated as single HDEL command to replica failed in test-sanitizer-undefined (clang) on 9.1 (run). No change on unstable fixes it. The fix made there applies here as it is: it is made here first, and backported to 9.1 once it merges.

Root cause: The failure message shows the three monitor lines the test collected were "ping" (db 0, from the primary at 127.0.0.1:21641), HSET and HPEXPIREAT, so the pattern HSETmyhashf1f2f3HDELmyhashf2* did not match. The ping is the one replicationCron() in src/replication.c feeds to replicas every repl-ping-replica-period, and a replica's MONITOR shows it. In this run it arrived at 09:22:14.885, right after the full sync finished and just before HSET. read_monitor_output filtered only INFO and SELECT lines, so the ping took a slot and the HDEL line was never read. The failure is flaky.

The fix: A ping in the replication stream is correct server behaviour, and its timing relative to the test is not something the test controls, so this is a test bug. Skipping ping lines in read_monitor_output removes the cause without loosening the check: the test still requires HSET followed by an HDEL of only the expired field. The harness already does the same in assert_replication_stream in tests/test_helper.tcl. The change is one condition in a helper used only by the two monitor tests in this block, so the sibling test 'HDEL replication includes only actually expired fields not non-existent ones' gets the same protection.

What the bot checked

  • The fix applies to unstable at 180283c3f217, and was run there too.

  • With the fix, this command passed 40 loops:

    export CC='clang' && make -j"$(getconf _NPROCESSORS_ONLN)" all-with-unit-tests OPT=-O3 SANITIZER=undefined SERVER_CFLAGS='-Werror' LUA_DEBUG=yes USE_LIBBACKTRACE=yes && ./runtest --accurate --verbose --dump-logs --single unit/hashexpire --only 'Multiple expired hash fields are replicated as single HDEL command to replica' --fastfail --loops 40 --timeout 600
The agent's own notes

Nothing was run here. The default branch does not have this fix: none of the upstream commits to tests/unit/hashexpire.tcl listed in upstream-changes.md touches read_monitor_output, so it most likely shares the flake and needs the same change. None of the port candidates addresses it (they concern listpack encoding, COPY TTLs, FUNCTION RESTORE and expired field tracking), and the 9.0 bot commits in other-release-branches.md (ports of #4785 and #5092) do not touch this helper either, so there was no commit to follow. The existing comment above the tests saying they are flaky and that monitor output should probably be filtered was left in place to keep the diff minimal; a maintainer may want to drop it.

What the bot checked on 9.1
  • Existing fixes found: c80da010b57e Listpack encoding for Hash field expiration (Listpack encoding for Hash field expiration #3212) (port candidate); caf5f2bfc20d Deflake COPY Preserves TTLs test under libc malloc (Deflake COPY Preserves TTLs test under libc malloc #4785) (port candidate); 9c4c8739da2e Apply the library load timeout to FUNCTION RESTORE (Apply the library load timeout to FUNCTION RESTORE #5181) (port candidate); 45ec67c30745 Fix HSETEX and HGETEX when the key is named "fields" (Fix HSETEX and HGETEX when the key is named "fields" #4945) (already ported as 4a3f130); 7f72724dc2c9 Fix untracked expired hash fields after listpack-to-hashtable conversion (Fix untracked expired hash fields after listpack-to-hashtable conversion #4894) (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):

    export CC='clang' && make -j"$(getconf _NPROCESSORS_ONLN)" all-with-unit-tests OPT=-O3 SANITIZER=undefined SERVER_CFLAGS='-Werror' LUA_DEBUG=yes USE_LIBBACKTRACE=yes && ./runtest --accurate --verbose --dump-logs --single unit/hashexpire --only 'Multiple expired hash fields are replicated as single HDEL command to replica' --fastfail --loops 40 --timeout 600
  • 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 40 loops:

    export CC='clang' && make -j"$(getconf _NPROCESSORS_ONLN)" all-with-unit-tests OPT=-O3 SANITIZER=undefined SERVER_CFLAGS='-Werror' LUA_DEBUG=yes USE_LIBBACKTRACE=yes && ./runtest --accurate --verbose --dump-logs --single unit/hashexpire --only 'Multiple expired hash fields are replicated as single HDEL command to replica' --fastfail --loops 40 --timeout 600
  • Review: The log supports the diagnosis: the replica's MONITOR output began with a db 0 "ping" from the primary at 14.885400, the same millisecond the monitor client was accepted and just after the full sync finished at 14.884, so the ping took one of the three slots and the HDEL line was never read. One detail is not established: the full resync started at offset 0, so this ping may be the one replicaStartCommandStream() sends when the replication stream is empty, not the periodic replicationCron() one the author names. That does not change the verdict, because both are legitimate pings in the replication stream and the filter handles either. Skipping ping lines does not loosen the check, since the test still requires HSET followed by an HDEL of only the expired field, and no line it cares about contains "ping". It mirrors what assert_replication_stream in tests/test_helper.tcl already does. The change is one condition in a helper used only by the two monitor tests, the comment describes the code without history, and the author's 40 loops passed. A maintainer may want the comment to mention the initial ping as well, and to drop the stale 'These tests are flaky' note.


Prepared by the CI-fix bot, which never merges. This PR's CI and a maintainer's review decide. Its commit has no DCO sign-off: whoever takes the change over signs it off.

@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: 593035f5-a09c-43d6-833f-b04409c22743

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

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.81%. Comparing base (12b3635) to head (c95e750).

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #5437      +/-   ##
============================================
+ Coverage     81.71%   81.81%   +0.09%     
============================================
  Files           203      203              
  Lines        105998   105998              
============================================
+ Hits          86614    86717     +103     
+ Misses        19384    19281     -103     

see 21 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 added a commit to valkey-io/valkey-ci-agent that referenced this pull request Nov 17, 2026
…ranch's (#168)

The first PRs into unstable (valkey-io/valkey#5437, valkey-io/valkey#5440,
valkey-io/valkey#5443) showed the release branch agent's notes as if they
were about unstable ("Nothing was built or run here", "I could not read
its copy of the test"), right under the line saying the fix passed there.
They now have their own section, named for the release branch.

Every published fix also carried the plan the agent is given, "Code
checks your change with `<command>`: ...", next to the line saying what
that command did. Only what ran is published now, with the plan's notes
(a stand-in for the job, a run_solo file). The agent and the reviewer
still get the plan, and a fix nothing can run still says so.

docs/backport.md said a fix for unstable passes at least 10 loops. Under
valgrind it is the 4 that are planned.

Signed-off-by: Sarthak Aggarwal <[email protected]>
sarthakaggarwal97 pushed a commit to sarthakaggarwal97/valkey that referenced this pull request Nov 17, 2026
The failure message shows the three monitor lines the test collected
were "ping" (db 0, from the primary at 127.0.0.1:21641), HSET and
HPEXPIREAT, so the pattern *HSET*myhash*f1*f2*f3*HDEL*myhash*f2* did not
match. The ping is the one replicationCron() in src/replication.c feeds
to replicas every repl-ping-replica-period, and a replica's MONITOR
shows it. In this run it arrived at 09:22:14.885, right after the full
sync finished and just before HSET. read_monitor_output filtered only
INFO and SELECT lines, so the ping took a slot and the HDEL line was
never read.

A ping in the replication stream is correct server behaviour, and its
timing relative to the test is not something the test controls, so this
is a test bug. Skipping ping lines in read_monitor_output removes the
cause without loosening the check: the test still requires HSET followed
by an HDEL of only the expired field. The harness already does the same
in assert_replication_stream in tests/test_helper.tcl. The change is one
condition in a helper used only by the two monitor tests in this block,
so the sibling test 'HDEL replication includes only actually expired
fields not non-existent ones' gets the same protection.

Backport-Source-PR: 5437
sarthakaggarwal97 pushed a commit that referenced this pull request Nov 18, 2026
The failure message shows the three monitor lines the test collected
were "ping" (db 0, from the primary at 127.0.0.1:21641), HSET and
HPEXPIREAT, so the pattern *HSET*myhash*f1*f2*f3*HDEL*myhash*f2* did not
match. The ping is the one replicationCron() in src/replication.c feeds
to replicas every repl-ping-replica-period, and a replica's MONITOR
shows it. In this run it arrived at 09:22:14.885, right after the full
sync finished and just before HSET. read_monitor_output filtered only
INFO and SELECT lines, so the ping took a slot and the HDEL line was
never read.

A ping in the replication stream is correct server behaviour, and its
timing relative to the test is not something the test controls, so this
is a test bug. Skipping ping lines in read_monitor_output removes the
cause without loosening the check: the test still requires HSET followed
by an HDEL of only the expired field. The harness already does the same
in assert_replication_stream in tests/test_helper.tcl. The change is one
condition in a helper used only by the two monitor tests in this block,
so the sibling test 'HDEL replication includes only actually expired
fields not non-existent ones' gets the same protection.

Backport-Source-PR: 5437

@xdk-amz xdk-amz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Skipping "ping" the same way assert_replication_stream does is the right fix, and it doesn't loosen the match: skipped lines don't take a slot, and none of the HSET/HDEL lines the tests check can contain "ping". Locally I forced a ping into the stream before the HSET: without this change both monitor tests fail with the same mismatch as CI, and with it both pass (plus 15 normal loops green).

Needs DCO

Comment thread tests/unit/hashexpire.tcl
# Skip lines with INFO commands
if {[regexp {\"info\"} $curr_read] || [regexp {\"SELECT\"} $curr_read]} {
# Skip lines with INFO and SELECT commands, and the pings the
# primary sends at regular intervals in the replication stream.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the ping in the CI failure is actually the one-off ping replicaStartCommandStream() sends right after the first full sync to move the offset off zero (it's in db 0), not the periodic one. The filter catches both, but the comment could say so, like assert_replication_stream does: "...and the pings the primary feeds into the replication stream, both the periodic ones and the one sent when a replica first comes online." Also, the # These tests are flaky, probably monitor output should be filtered comment at L4512 is now stale and could go in this PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. The comment should cover the initial replicaStartCommandStream() ping too, and the stale "These tests are flaky" note at L4512 should go.

sarthakaggarwal97 pushed a commit that referenced this pull request Nov 18, 2026
The failure message shows the three monitor lines the test collected
were "ping" (db 0, from the primary at 127.0.0.1:21641), HSET and
HPEXPIREAT, so the pattern *HSET*myhash*f1*f2*f3*HDEL*myhash*f2* did not
match. The ping is the one replicationCron() in src/replication.c feeds
to replicas every repl-ping-replica-period, and a replica's MONITOR
shows it. In this run it arrived at 09:22:14.885, right after the full
sync finished and just before HSET. read_monitor_output filtered only
INFO and SELECT lines, so the ping took a slot and the HDEL line was
never read.

A ping in the replication stream is correct server behaviour, and its
timing relative to the test is not something the test controls, so this
is a test bug. Skipping ping lines in read_monitor_output removes the
cause without loosening the check: the test still requires HSET followed
by an HDEL of only the expired field. The harness already does the same
in assert_replication_stream in tests/test_helper.tcl. The change is one
condition in a helper used only by the two monitor tests in this block,
so the sibling test 'HDEL replication includes only actually expired
fields not non-existent ones' gets the same protection.

Backport-Source-PR: 5437

@madolson madolson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Needs DCO sign-off.

@madolson

Copy link
Copy Markdown
Member

Suggested description, since it becomes the squash message:

A replica's MONITOR shows the pings the primary feeds into the replication stream, both the periodic ones and the one sent when a replica first comes online. read_monitor_output in tests/unit/hashexpire.tcl only skipped INFO and SELECT, so a ping could take one of the three slots the two HDEL replication tests read and make them fail. Skip ping lines too, as assert_replication_stream in tests/test_helper.tcl already does.

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
sarthakaggarwal97 force-pushed the agent/ci-fix/upstream/8717a0a998e77689 branch from 73a37e0 to e412b3a Compare December 1, 2026 17:18
The failure message shows the three monitor lines the test collected
were "ping" (db 0, from the primary at 127.0.0.1:21641), HSET and
HPEXPIREAT, so the pattern *HSET*myhash*f1*f2*f3*HDEL*myhash*f2* did not
match. The ping is the one replicationCron() in src/replication.c feeds
to replicas every repl-ping-replica-period, and a replica's MONITOR
shows it. In this run it arrived at 09:22:14.885, right after the full
sync finished and just before HSET. read_monitor_output filtered only
INFO and SELECT lines, so the ping took a slot and the HDEL line was
never read.

A ping in the replication stream is correct server behaviour, and its
timing relative to the test is not something the test controls, so this
is a test bug. Skipping ping lines in read_monitor_output removes the
cause without loosening the check: the test still requires HSET followed
by an HDEL of only the expired field. The harness already does the same
in assert_replication_stream in tests/test_helper.tcl. The change is one
condition in a helper used only by the two monitor tests in this block,
so the sibling test 'HDEL replication includes only actually expired
fields not non-existent ones' gets the same protection.

Signed off on behalf of valkeyrie-ops[bot].

Signed-off-by: Sarthak Aggarwal <[email protected]>
@sarthakaggarwal97
sarthakaggarwal97 force-pushed the agent/ci-fix/upstream/8717a0a998e77689 branch from e412b3a to c95e750 Compare December 1, 2026 17:24
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]>
@sarthakaggarwal97
sarthakaggarwal97 merged commit 6b8bf33 into unstable Dec 1, 2026
88 checks passed
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.

3 participants