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 empty primary may have dirty slots data due to bad migration #1285

Closed enjoy-binbin closed 2 weeks ago

enjoy-binbin commented 2 weeks ago

If we become an empty primary for some reason, we still need to check if we need to delete dirty slots, because we may have dirty slots data left over from a bad migration. Like the target node forcibly executes CLUSTER SETSLOT NODE to take over the slot without performing key migration.

codecov[bot] commented 2 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 70.52%. Comparing base (e972d56) to head (93f7268). Report is 7 commits behind head on unstable.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## unstable #1285 +/- ## ============================================ - Coverage 70.70% 70.52% -0.19% ============================================ Files 114 114 Lines 63147 63149 +2 ============================================ - Hits 44648 44533 -115 - Misses 18499 18616 +117 ``` | [Files with missing lines](https://app.codecov.io/gh/valkey-io/valkey/pull/1285?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/cluster\_legacy.c](https://app.codecov.io/gh/valkey-io/valkey/pull/1285?src=pr&el=tree&filepath=src%2Fcluster_legacy.c&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=valkey-io#diff-c3JjL2NsdXN0ZXJfbGVnYWN5LmM=) | `86.29% <100.00%> (+0.07%)` | :arrow_up: | ... and [15 files with indirect coverage changes](https://app.codecov.io/gh/valkey-io/valkey/pull/1285/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=valkey-io)