Skip to content

Fix shard_id format specifier in UPDATE message log#3942

Merged
hpatro merged 1 commit into
valkey-io:unstablefrom
enjoy-binbin:fix_log
Jun 9, 2026
Merged

Fix shard_id format specifier in UPDATE message log#3942
hpatro merged 1 commit into
valkey-io:unstablefrom
enjoy-binbin:fix_log

Conversation

@enjoy-binbin

Copy link
Copy Markdown
Member

clusterNode.shard_id is a fixed-size char[CLUSTER_NAMELEN] buffer
that is not guaranteed to be NUL-terminated, so it must be printed
with %.40s.

This was introduced in #2510.

clusterNode.shard_id is a fixed-size char[CLUSTER_NAMELEN] buffer
that is not guaranteed to be NUL-terminated, so it must be printed
with %.40s.

This was introduced in valkey-io#2510.

Signed-off-by: Binbin <binloveplay1314@qq.com>
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 66bc0f51-3545-4d7f-b188-5d70b6bd7f99

📥 Commits

Reviewing files that changed from the base of the PR and between d9a80af and a529249.

📒 Files selected for processing (1)
  • src/cluster_legacy.c

📝 Walkthrough

Walkthrough

This PR updates the log message formatting in the cluster legacy code. A notice-level log message in the CLUSTERMSG_TYPE_UPDATE handling path is reformatted from a single-line string to a multi-line format, keeping all logged fields unchanged.

Changes

Cluster UPDATE message logging

Layer / File(s) Summary
UPDATE message log formatting
src/cluster_legacy.c
The LL_NOTICE log message during CLUSTERMSG_TYPE_UPDATE processing is reformatted to use a multi-line string literal, preserving sender identity, shard IDs, about-node identity, and configEpoch values.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing a format specifier issue in the UPDATE message log for shard_id.
Description check ✅ Passed The description is directly related to the changeset, explaining the technical issue with shard_id buffer handling and referencing the PR where the issue was introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@enjoy-binbin enjoy-binbin moved this to To be backported in Valkey 9.0 Jun 9, 2026
@enjoy-binbin enjoy-binbin moved this to To be backported in Valkey 9.1 Jun 9, 2026
@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.68%. Comparing base (d9a80af) to head (a529249).

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #3942      +/-   ##
============================================
+ Coverage     76.64%   76.68%   +0.03%     
============================================
  Files           162      162              
  Lines         80733    80733              
============================================
+ Hits          61880    61908      +28     
+ Misses        18853    18825      -28     
Files with missing lines Coverage Δ
src/cluster_legacy.c 88.47% <100.00%> (+0.07%) ⬆️

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

@hpatro hpatro merged commit 69004ca into valkey-io:unstable Jun 9, 2026
64 checks passed
@enjoy-binbin enjoy-binbin deleted the fix_log branch June 9, 2026 11:42
sarthakaggarwal97 added a commit to sarthakaggarwal97/valkey that referenced this pull request Jun 10, 2026
…-io#3942, valkey-io#3897)

These came in via the unstable merge in valkey-io#3853 but are unrelated to
replication compression. Restore cluster_legacy.c, db.c, and
failover.tcl to the rio-pr base so this review branch shows only the
replication-compression delta.

Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
valkeyrie-ops Bot pushed a commit that referenced this pull request Jun 10, 2026
clusterNode.shard_id is a fixed-size char[CLUSTER_NAMELEN] buffer
that is not guaranteed to be NUL-terminated, so it must be printed
with %.40s.

This was introduced in #2510.

Signed-off-by: Binbin <binloveplay1314@qq.com>
ranshid added a commit that referenced this pull request Jun 11, 2026
# Backport sweep for 9.1

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

## Applied

| Source PR | Title | Detail |
|---|---|---|
| #3743 | Fix buffered_reply assert in HFE commands with module keyspace
notifications | cherry-picked in a prior sweep |
| #3766 | Fix flaky block_keyspace_notification test for HGETDEL notify
race | cherry-picked in a prior sweep |
| #3800 | Fix heap-use-after-free in ACL LOAD when client free is
deferred | cherry-picked in a prior sweep |
| #3723 | Fix double-finish and RESP reply violation in cluster slot
migration | cherry-picked in a prior sweep |
| #3872 | Redacting customer information when hide_user_data_from_log is
true in rdb.c, networking.c, debug.c and t_hash | cherry-picked in a
prior sweep |
| #3846 | Fix use-after-free in VM_RegisterClusterMessageReceiver |
cherry-picked in a prior sweep |
| #3806 | Add ALL_DBS flag to CLUSTER FLUSHSLOT for database-level ACL |
cherry-picked in a prior sweep |
| #3847 | Harden SENTINEL commands and config rewrite against
control-character injection | |
| #3801 | Validate every DB clause in COPY against ACL db= permissions |
|
| #3851 | Replace AUTOMATION_PAT with Valkeyrie Bot GitHub App token | |
| #3848 | Fix cluster AUX-field control-character and delimiter
injection | |
| #3544 | Revert "IO-Threads redesign cleanup work (#3544)" |
cherry-picked in a prior sweep |
| #3888 | Report exact dbid for COPY in ACL LOG when db= access is
denied | conflicts resolved by Claude Code |
| #3942 | Fix shard_id format specifier in UPDATE message log |  |
| #3941 | Avoid random() % 0 undefined behaviour when
cluster-node-timeout < 30 | |

---
*Generated by valkey-ci-agent using Claude Code.*

---------

Signed-off-by: Binbin <binloveplay1314@qq.com>
Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
Signed-off-by: chx9 <lovelypiska@outlook.com>
Signed-off-by: zackcam <zackcam@amazon.com>
Signed-off-by: Eran Ifrah <eifrah@amazon.com>
Signed-off-by: Jules Lasarte <lasartej@amazon.com>
Signed-off-by: jjuleslasarte <jules.lasarte@gmail.com>
Signed-off-by: akash kumar <akumdev@amazon.com>
Co-authored-by: Binbin <binloveplay1314@qq.com>
Co-authored-by: Ran Shidlansik <ranshid@amazon.com>
Co-authored-by: lovelypiska <lovelypiska@outlook.com>
Co-authored-by: zackcam <zackcam@amazon.com>
Co-authored-by: eifrah-aws <eifrah@amazon.com>
Co-authored-by: jjuleslasarte <jules.lasarte@gmail.com>
Co-authored-by: Jules Lasarte <lasartej@amazon.com>
Co-authored-by: Akash Kumar <45854686+akashkgit@users.noreply.github.com>
@sarthakaggarwal97 sarthakaggarwal97 moved this from To be backported to Done in Valkey 9.1 Jun 15, 2026
valkeyrie-ops Bot pushed a commit that referenced this pull request Jun 22, 2026
clusterNode.shard_id is a fixed-size char[CLUSTER_NAMELEN] buffer
that is not guaranteed to be NUL-terminated, so it must be printed
with %.40s.

This was introduced in #2510.

Signed-off-by: Binbin <binloveplay1314@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To be backported
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants