Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kill diskless fork child asap when the last replica drop #1227

Open
wants to merge 1 commit into
base: unstable
Choose a base branch
from

Conversation

enjoy-binbin
Copy link
Member

We originally checked the replica connection to whether to kill the
diskless child only when rdbPipeReadHandler is triggered. Actually
we can check it when the replica is disconnected, so that we don't
have to wait for rdbPipeReadHandler to be triggered and can kill
the forkless child as soon as possible.

In this way, when the child or rdbPipeReadHandler is stuck for some
reason, we can kill the child faster and release the fork resources.

We originally checked the replica connection to whether to kill the
diskless child only when rdbPipeReadHandler is triggered. Actually
we can check it when the replica is disconnected, so that we don't
have to wait for rdbPipeReadHandler to be triggered and can kill
the forkless child as soon as possible.

In this way, when the child or rdbPipeReadHandler is stuck for some
reason, we can kill the child faster and release the fork resources.

Signed-off-by: Binbin <[email protected]>
Copy link

codecov bot commented Oct 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.66%. Comparing base (55bbbe0) to head (bd6eb2e).
Report is 1 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1227      +/-   ##
============================================
- Coverage     70.66%   70.66%   -0.01%     
============================================
  Files           114      114              
  Lines         63143    63144       +1     
============================================
- Hits          44623    44620       -3     
- Misses        18520    18524       +4     
Files with missing lines Coverage Δ
src/networking.c 88.50% <100.00%> (+0.01%) ⬆️
src/replication.c 87.37% <100.00%> (-0.02%) ⬇️

... and 8 files with indirect coverage changes

Copy link
Member

@ranshid ranshid left a comment

Choose a reason for hiding this comment

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

@enjoy-binbin generally looks good to me. I think there are no tests checking the logs for 0 replicas left during bgsave. Maybe worth adding a test to read and validate the correct logs are issued in that case?

src/networking.c Show resolved Hide resolved
@enjoy-binbin
Copy link
Member Author

generally looks good to me. I think there are no tests checking the logs for 0 replicas left during bgsave. Maybe worth adding a test to read and validate the correct logs are issued in that case?

sorry i forgot to reply. Diskless rdb transfer, last replica dropped, killing fork child you are saying we don't have test to cover this case?

i see we do have a test diskless $all_drop replicas drop during rdb pipe that are checking this log

@ranshid
Copy link
Member

ranshid commented Nov 11, 2024

generally looks good to me. I think there are no tests checking the logs for 0 replicas left during bgsave. Maybe worth adding a test to read and validate the correct logs are issued in that case?

sorry i forgot to reply. Diskless rdb transfer, last replica dropped, killing fork child you are saying we don't have test to cover this case?

i see we do have a test diskless $all_drop replicas drop during rdb pipe that are checking this log

Don't know how I missed it :) good to go

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