Skip to content

Set cur_bgsave_type on the diskless replication path - #4482

Open
nitaicaro wants to merge 1 commit into
valkey-io:forklessfrom
nitaicaro:forkless-fix-diskless-bgsave-type
Open

Set cur_bgsave_type on the diskless replication path#4482
nitaicaro wants to merge 1 commit into
valkey-io:forklessfrom
nitaicaro:forkless-fix-diskless-bgsave-type

Conversation

@nitaicaro

Copy link
Copy Markdown
Contributor

The diskless full sync path set rdb_write_target but never set cur_bgsave_type.

The diskless full sync path set rdb_write_target but never set
cur_bgsave_type, so while a socket-target RDB child was running INFO
reported rdb_bgsave_in_progress:1 together with rdb_current_bgsave_type:
none. A diskless full sync still forks a child, so report it as a fork
save. It is cleared on completion by rdbClearSaveState() as before.

Signed-off-by: Nitai Caro <caronita@amazon.com>
@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cb20aaa7-26ee-49a6-a49d-bd3b3cff7de8

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 Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.45%. Comparing base (50ec936) to head (7af928c).

Additional details and impacted files
@@             Coverage Diff              @@
##           forkless    #4482      +/-   ##
============================================
- Coverage     79.82%   79.45%   -0.38%     
============================================
  Files           175      175              
  Lines         94843    93223    -1620     
============================================
- Hits          75712    74070    -1642     
- Misses        19131    19153      +22     
Files with missing lines Coverage Δ
src/rdb.c 77.10% <100.00%> (-0.48%) ⬇️

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

@xhon-pelushi xhon-pelushi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I verified the diskless replication save state and this fixes the observable INFO inconsistency.

Using a local primary/replica pair with repl-diskless-sync yes, repl-diskless-sync-delay 0, and 500k debug-populated keys, the parent commit 50ec936 reported rdb_bgsave_in_progress:1 together with rdb_current_bgsave_type:none while the socket-target RDB child was active. At head 7af928c, the same diskless full-sync window reports rdb_current_bgsave_type:fork, and after the transfer completes it returns to none.

I traced the path from startBgsaveForReplication() into rdbSaveToReplicasSockets(), then through backgroundSaveDoneHandler() and rdbClearSaveState(). The added assignment matches the disk-target rdbRecordStartMetrics(RDB_BGSAVE_TYPE_FORK) state, and the shared cleanup still clears both rdb_write_target and cur_bgsave_type after socket transfer completion.

Local verification: make -j$(nproc) and ./runtest --single integration/replication --verbose --dump-logs (72 passed, 0 failed). I also checked the red test-ubuntu-latest-cmake-tls CI job log; it failed in tests/unit/cluster/replica-priority.tcl on a missing Start of election...rank #1...replica priority 10 log pattern, not in the RDB/diskless replication path touched here.

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.

2 participants