Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DATAREDIS-1151 - change clean method keys command to scan #2904

Closed

Conversation

bert82503
Copy link

@bert82503 bert82503 commented May 11, 2024

clean method use keys command to get all keys which is blocked, may cause other commands timeout or block.
As the complexity of DEL is O(N), if the number of keys is huge, DEL command could timeout as well.
Using DEL command is very risky in a production environment, right?

Use scan command as default BatchStrategy in RedisCacheWriter, for without locking behavior or with locking behavior.
We use this strategy in the production environment.
Use RedisCacheWriter#clean to asynchronously scan matches online batch scan to delete cached data for spring-data-redis

Here are my own thoughts:
Why do so many users raise issues and report that they encounter timeouts and blocks in use?
I'm wondering how we can improve the ease of use of good products?

@pivotal-cla
Copy link

@bert82503 Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 11, 2024
@pivotal-cla
Copy link

@bert82503 Thank you for signing the Contributor License Agreement!

@bert82503
Copy link
Author

Hi, bro.
Can you help to check this? thx! @mp911de

@mp911de mp911de self-assigned this May 13, 2024
@mp911de
Copy link
Member

mp911de commented May 13, 2024

We cannot do that. Jedis Cluster doesn't support cross-cluster SCAN by reusing a given cursor so we would break functionality for Redis Cluster users.

@mp911de mp911de closed this May 13, 2024
@mp911de mp911de added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels May 13, 2024
@bert82503
Copy link
Author

bert82503 commented May 14, 2024

We cannot do that. Jedis Cluster doesn't support cross-cluster SCAN by reusing a given cursor so we would break functionality for Redis Cluster users.

Okay, thanks for explaining the specific reasons.

@bert82503
Copy link
Author

We cannot do that. Jedis Cluster doesn't support cross-cluster SCAN by reusing a given cursor so we would break functionality for Redis Cluster users.

The KEYS batch strategy is fully supported using any driver and Redis operation mode (Standalone, Clustered). SCAN is fully supported when using the Lettuce driver. Jedis supports SCAN only in non-clustered modes.

Spring Data Redis /
Redis /
Redis Cache

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants