valkey-io / valkey

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

Make KEYS can visit expired key in import-source state #1326

Open enjoy-binbin opened 2 days ago

enjoy-binbin commented 2 days ago

After #1185, a client in import-source state can visit expired key both in read commands and write commands, this commit handle keyIsExpired function to handle import-source state as well, so KEYS can visit the expired key.

This is not particularly important, but it ensures the definition, also doing some cleanup around the test, verified that the client can indeed visit the expired key.

codecov[bot] commented 2 days ago

Codecov Report

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

Project coverage is 70.57%. Comparing base (4986310) to head (3032a99).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## unstable #1326 +/- ## ============================================ - Coverage 70.68% 70.57% -0.11% ============================================ Files 115 115 Lines 63177 63179 +2 ============================================ - Hits 44657 44589 -68 - Misses 18520 18590 +70 ``` | [Files with missing lines](https://app.codecov.io/gh/valkey-io/valkey/pull/1326?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/db.c](https://app.codecov.io/gh/valkey-io/valkey/pull/1326?src=pr&el=tree&filepath=src%2Fdb.c&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=valkey-io#diff-c3JjL2RiLmM=) | `89.12% <100.00%> (+0.01%)` | :arrow_up: | | [src/networking.c](https://app.codecov.io/gh/valkey-io/valkey/pull/1326?src=pr&el=tree&filepath=src%2Fnetworking.c&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=valkey-io#diff-c3JjL25ldHdvcmtpbmcuYw==) | `88.56% <ø> (+0.16%)` | :arrow_up: | ... and [12 files with indirect coverage changes](https://app.codecov.io/gh/valkey-io/valkey/pull/1326/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=valkey-io)

🚨 Try these New Features:

zuiderkwast commented 2 days ago

I guess an importing client will not use KEYS and SCAN, but I agree, it's good to ensure the contract that this client can read expired keys.