Do not record a cancelled forkless save as failed - #4524
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forkless #4524 +/- ##
============================================
- Coverage 80.27% 79.41% -0.87%
============================================
Files 176 175 -1
Lines 97654 93238 -4416
============================================
- Hits 78396 74047 -4349
+ Misses 19258 19191 -67
🚀 New features to boost your workflow:
|
A cancelled forkless save (BGSAVE CANCEL, or a flush that aborts the iterator) was recorded as a failed save. With a save point configured and stop-writes-on-bgsave-error on, that denied every write with -MISCONF until the next successful save. Existing fork behavior: - FLUSHDB during a fork save: the save is unaffected. The fork child holds a copy-on-write snapshot, so wiping the live DB does not touch it and the save completes. - FLUSHALL during a fork save: the save is aborted (via SIGUSR1, which is whitelisted as not a failure) and a fresh save runs. For forkless we want to match that, but for FLUSHDB we can't: forkless has no copy-on-write protection and iterates the live data, so when the flushed data is deleted we have to abort the save there too. So forkless treats both FLUSHDB and FLUSHALL the way fork treats FLUSHALL: an intentional abort, not a failure. Treat an intentional cancel like the fork child's SIGUSR1 whitelist: skip recording end metrics and the persistence event, leaving lastbgsave_status untouched. When a key write fails only because the save is being terminated, clear the error so it is classified as a cancel rather than a failure. A genuine write error is still recorded as a failure. Signed-off-by: Nitai Caro <caronita@amazon.com>
50d9b1e to
6355e7c
Compare
A cancelled forkless save (
BGSAVE CANCEL, or a flush that aborts the iterator) was recorded as a failed save.Existing fork behavior:
FLUSHDBduring a fork save: the save is unaffected. The fork child holds a copy-on-write snapshot, so wiping the live DB does not touch it and the save completes.FLUSHALLduring a fork save: the save is aborted (viaSIGUSR1, which is whitelisted as not a failure) and a fresh save runs.For forkless we want to match that, but for
FLUSHDBwe can't: forkless has no copy-on-write protection, and expediting the write of the the entire db is too much. So we match it to the best of our abilities - forkless treats bothFLUSHDBandFLUSHALLthe way fork treatsFLUSHALL- as an intentional abort.Treat an intentional cancel like the fork child's SIGUSR1 whitelist: skip recording end metrics and the persistence event, leaving lastbgsave_status untouched. When a key write fails only because the save is being terminated, clear the error so it is classified as a cancel rather than a failure. A genuine write error is still recorded as a failure.