Skip to content

Unprotect rdb channel when bgsave child fails in dual channel replication#1297

Merged
enjoy-binbin merged 2 commits into
valkey-io:unstablefrom
enjoy-binbin:unprotect_rdb_channel
Nov 15, 2024
Merged

Unprotect rdb channel when bgsave child fails in dual channel replication#1297
enjoy-binbin merged 2 commits into
valkey-io:unstablefrom
enjoy-binbin:unprotect_rdb_channel

Conversation

@enjoy-binbin

@enjoy-binbin enjoy-binbin commented Nov 13, 2024

Copy link
Copy Markdown
Member

If bgsaveerr is error, there is no need to protect the rdb channel.
The impact of this may be that when bgsave fails, we will protect
the rdb channel for 60s. It may occupy the reference of the repl
buf block, making it impossible to recycle it until we free the
client due to COB or free the client after 60s.

We kept the RDB channel open as long as the replica hadn't established
a main connection, even if the snapshot process failed. There is no
value in keeping the RDB client in this case.

…tion

If bgsaveerr is error, there is no need to protect the rdb channel.
The impact of this may be that when bgsave fails, we will protect
the rdb channel for 60s. It may occupy the reference of the repl
buf block, making it impossible to recycle it until we free the
client due to COB or free the client after 60s.

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

Copy link
Copy Markdown
Member Author

The issue was found in #1288 (comment)

@enjoy-binbin enjoy-binbin requested a review from naglera November 13, 2024 07:59
@codecov

codecov Bot commented Nov 13, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.71%. Comparing base (2df56d8) to head (6abd6dd).
Report is 9 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1297      +/-   ##
============================================
+ Coverage     70.69%   70.71%   +0.01%     
============================================
  Files           114      114              
  Lines         63161    63162       +1     
============================================
+ Hits          44650    44663      +13     
+ Misses        18511    18499      -12     
Files with missing lines Coverage Δ
src/replication.c 87.36% <100.00%> (+<0.01%) ⬆️

... and 9 files with indirect coverage changes

@naglera naglera 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.

Thank you, @enjoy-binbin, for spotting that. We kept the RDB channel open as long as the replica hadn't established a main connection, even if the snapshot process failed.
There is no value in keeping the RDB client in this case.

Comment thread src/replication.c Outdated
Co-authored-by: Amit Nagler <58042354+naglera@users.noreply.github.com>
Signed-off-by: Binbin <binloveplay1314@qq.com>
Comment thread src/replication.c
@enjoy-binbin enjoy-binbin merged commit 86f33ea into valkey-io:unstable Nov 15, 2024
@enjoy-binbin enjoy-binbin deleted the unprotect_rdb_channel branch November 15, 2024 08:48
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.

4 participants