-
Notifications
You must be signed in to change notification settings - Fork 315
Add cursors parameter to scan_iter method #460
Comments
@EugeniuZ Have they updated the SCAN methods in redis-py that has caused the implementation in here to diverge away from redis-py? As the re-implementations here in this lib is based on what redis-py provides as feature so any new command, option or similar always must start there to be implemented to work with a single redis node and then (if it is needed) the re implementation can be done here in redis-py-cluster if there is further cluster optimizations or fixes that is needed. Also if i read the original post on redis, i don't really get what you are after as i am not that well versed in the SCAN method and how it is supposed to work, i know there is tons of issues in general with the scan method and how it works in a clustered environment when you have failovers and other things to think about and adding this kind of feature on top of it just makes it more complex to implement properly. You have to either make a PR to implement this as you think you need to implement this, because i do not really get what needs to be added here to provide you with what you need tbh |
If i think it is what you are after, it is either one of two things. One, it would mean to change the return value out from SCAN to perhaps be a tuple object like Two, add in some kind of argument just to support your need to have it print out, the problem here is that we take a much bigger stance on what should happen on the inside of the method in the case we want it printed. Not everyone wants it printed out to stdout as most code base might not even use this in a cli script so that would never really help them. They might want the option one instead so they can get it back via code and use the value in next request or in a retry scenario in a web server for example where a print would be useless as there are no interactive users working with the code. Either of these solutions is really something good that i want to implement here in some way so i dont really know how to move forward with what you asked for tbh |
Hi @Grokzen , I'll explain the use case (I think you already got it):
The solution here would be to supply the value of the cursor (in the cluster setup - cursors) to start from where I've left off. In the standard python client it is possible to do so as they return the cursor. I think scenario 1 is the way to go except don't change the current method, just provide another one:
Hope this clarifies the context. I'd also say this is very specific use case, which not that many users probably encounter. Regards, |
@EugeniuZ I dont see in your link where they return the cursor, what they do is |
Not sure if https://github.com/redis/redis-py/blob/master/redis/client.py#L378
|
Hi Eugeniu, |
Hi,
This is a feature request to be able to resume a previously started scan for the database with a large set of keys removed.
With the current implementation, the key scanning starts from the beginning resulting (internally) in the traversal of deleted keys as well.
The background for the request: redis/redis#9090
To take advantage of the extra parameter it is necessary to return somehow the cursor values together with the key (e.g. for the client to print the cursor values before interrupting the key scan.
Regards,
Eugeniu
The text was updated successfully, but these errors were encountered: