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 #532

Closed
wants to merge 4 commits into from

Conversation

eyison
Copy link

@eyison eyison commented May 21, 2020

clean method use keys command to get all keys which is blocked , may cause other commands time out.

https://jira.spring.io/browse/DATAREDIS-1151

@pivotal-issuemaster
Copy link

@eyison Please sign the Contributor License Agreement!

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

See the FAQ for frequently asked questions.

@pivotal-issuemaster
Copy link

@eyison Thank you for signing the Contributor License Agreement!

keys.add(bytes);
}
if (!keys.isEmpty()) {
connection.del(keys.toArray(new byte[][]{}));

Choose a reason for hiding this comment

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

As the complexity of DEL is O(N), if the number of keys is huge, DEL command could time out as well, right?
Maybe we could do it batch by batch as well?

I was thinking of using UNLINK, but it's only supported in higher Redis version and it's a change of behavior (from sync to async)...


if (keys.length > 0) {
connection.del(keys);
List<byte[]> keys = new ArrayList<byte[]>();

Choose a reason for hiding this comment

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

Use LinkedList replace ArrayList because the list may be huge.

@mp911de mp911de changed the title change clean method keys command to scan DATAREDIS-1151 - change clean method keys command to scan Jul 1, 2020
@mp911de
Copy link
Member

mp911de commented Oct 5, 2020

The change performs a DEL call per cache key which isn't efficient. We have received a newer PR with #547 that supersedes this one.

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.

5 participants