Skip to content

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

Merged
enjoy-binbin merged 1 commit into
valkey-io:unstablefrom
enjoy-binbin:import-mode
Nov 27, 2024
Merged

Make KEYS can visit expired key in import-source state#1326
enjoy-binbin merged 1 commit into
valkey-io:unstablefrom
enjoy-binbin:import-mode

Conversation

@enjoy-binbin

Copy link
Copy Markdown
Member

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.

After valkey-io#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.

Signed-off-by: Binbin <binloveplay1314@qq.com>
@enjoy-binbin enjoy-binbin requested a review from lyq2333 November 20, 2024 05:44
@codecov

codecov Bot commented Nov 20, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.57%. Comparing base (4986310) to head (3032a99).
Report is 23 commits behind head on unstable.

Additional details and impacted files
@@             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 Coverage Δ
src/db.c 89.12% <100.00%> (+0.01%) ⬆️
src/networking.c 88.56% <ø> (+0.16%) ⬆️

... and 12 files with indirect coverage changes

@zuiderkwast

Copy link
Copy Markdown
Contributor

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.

@lyq2333 lyq2333 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @zuiderkwast. LGTM.

Comment thread src/db.c
@enjoy-binbin enjoy-binbin merged commit db7b739 into valkey-io:unstable Nov 27, 2024
@enjoy-binbin enjoy-binbin deleted the import-mode branch November 27, 2024 16:16
enjoy-binbin added a commit to enjoy-binbin/valkey that referenced this pull request Nov 27, 2024
In valkey-io#1326 we make KEYS can visit expired key in import-source state
by updating keyIsExpired to check for import mode. But after valkey-io#1205,
we now use keyIsExpiredWithDictIndex to optimize and remove the
redundant dict_index, and keyIsExpiredWithDictIndex does not handle
this logic.

In this commit, we handle keyIsExpiredWithDictIndex to make it check
for import mode as well so that KEYS can visit the expired key.

Signed-off-by: Binbin <binloveplay1314@qq.com>
enjoy-binbin added a commit that referenced this pull request Nov 28, 2024
)

In #1326 we make KEYS can visit expired key in import-source state
by updating keyIsExpired to check for import mode. But after #1205,
we now use keyIsExpiredWithDictIndex to optimize and remove the
redundant dict_index, and keyIsExpiredWithDictIndex does not handle
this logic.

In this commit, we handle keyIsExpiredWithDictIndex to make it check
for import mode as well so that KEYS can visit the expired key.

Signed-off-by: Binbin <binloveplay1314@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants