-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix Child Process not working for BGREWRITEAOF on MacOS + Logging Improvements #704
Fix Child Process not working for BGREWRITEAOF on MacOS + Logging Improvements #704
Conversation
@lucifercr07 @vinitparekh17 could you review the changes here? |
Please rebase on the latest master |
f12a05c
to
9494d59
Compare
@JyotinderSingh , done |
@JyotinderSingh are there any blockers to merge this? Any effort required from my end? |
Reviewing this |
9494d59
to
ed5a0f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @KaviiSuri for fixing this, validated locally works fine in single threaded mode.
Can you please point to doc where you found this Macos M2 behaviour, wasn't able to find any concrete documentation around this behaviour.
@lucifercr07 i couldn't find the exact docs, but i did find a lot of people facing the same issue. Although, the solution implemented is quite generic, we just compare pid with previously recorded one, so it should be safe regadless if the fork return value behaviour also, apparently, both implementations of golang and python had to deal with such peculiarities on MacOS |
Thank you for these fixes. |
This PR fixes BGREWRITEAOF failing completely, Specifically for MacOS for now .
The root cause is that macos doesn't set
pid
to0
for child processThe solution is to record get original pid of main process and do
isChild := syscall.Getppid() == originalPID
. Thepid == 0
check is unreliable and breaks on maocs m2 in my testing.This PR also adds logging features and a bit of refactoring to reuse code and allow for
logger.With(...attrs)
to be logged correctly