-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Conversation
@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. |
@eyison Thank you for signing the Contributor License Agreement! |
keys.add(bytes); | ||
} | ||
if (!keys.isEmpty()) { | ||
connection.del(keys.toArray(new byte[][]{})); |
There was a problem hiding this comment.
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[]>(); |
There was a problem hiding this comment.
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.
keys
command to scan
keys
command to scan
The change performs a |
clean
method usekeys
command to get all keys which is blocked , may cause other commands time out.https://jira.spring.io/browse/DATAREDIS-1151