valkey-io / valkey

A flexible distributed key-value datastore that is optimized for caching and other realtime workloads.
https://valkey.io
Other
17.42k stars 656 forks source link

Fix log printing always shows the role as child under daemonize #1301

Closed enjoy-binbin closed 1 week ago

enjoy-binbin commented 1 week ago

In #1282, we init server.pid earlier to keep log message role consistent, but we forgot to consider daemonize. In daemonize mode, we will always print the child role.

We need to reset server.pid after daemonize(), otherwise the log printing role will always be the child. It also causes a incorrect server.pid value, affecting the concatenation of some pid names.

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 70.69%. Comparing base (2df56d8) to head (0a98333). Report is 1 commits behind head on unstable.

Files with missing lines Patch % Lines
src/server.c 0.00% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## unstable #1301 +/- ## ========================================= Coverage 70.69% 70.69% ========================================= Files 114 114 Lines 63161 63163 +2 ========================================= + Hits 44650 44656 +6 + Misses 18511 18507 -4 ``` | [Files with missing lines](https://app.codecov.io/gh/valkey-io/valkey/pull/1301?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=valkey-io) | Coverage Δ | | |---|---|---| | [src/server.c](https://app.codecov.io/gh/valkey-io/valkey/pull/1301?src=pr&el=tree&filepath=src%2Fserver.c&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=valkey-io#diff-c3JjL3NlcnZlci5j) | `87.64% <0.00%> (-0.06%)` | :arrow_down: | ... and [11 files with indirect coverage changes](https://app.codecov.io/gh/valkey-io/valkey/pull/1301/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=valkey-io)