You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is strange as I've used scan and it seems to work fine other than this case. The problem is that keys will return values but scan won't. The environment is redis cluster 3.0.2.
10.11.14.83:17000> keys DCC*
1) "DCC:sports::football"
2) "DCC:apparel::custom tees"
3) "DCC:internet::peer to peer"
4) "DCC:apparel::maternity"
5) "DCC:food and drink::gourmet"
...
103) "DCC:social networking::tools"
104) "DCC:news::environment"
105) "DCC:education::medical billing"
106) "DCC:real estate::general"
107) "DCC:shopping::coupons"
10.11.14.83:17000> scan 0 match DCC* count 20
1) "16384"
2) (empty list or set)
My expectation is that scan will return the same content as keys in chunks of 20 and not necessarily in the same order. Also that the new scan starting value would be 0 if it did not find any keys. I did try repeatedly using the returned value to see if more keys would come but it always returned a new scan number and an empty list.
Am I using scan incorrectly?
The text was updated successfully, but these errors were encountered:
Hello, yes you are using SCAN incorrectly ;-)
After the call, the cursor returned is non-zero, but 16384, so you have to call scan again with this cursor, and so on, until the cursor drops to 0, to signal the iteration ended.
This is what I tried repeatedly and new scan offsets kept coming, but no keys came. Why does the scan return nothing repeatedly. Or perhaps the question is if there are keys available, shouldn't scan return at least 1?
It checks a few keys per iteration, but none matched your pattern. The more you use a pattern with few keys compared to the total amount of keys, the less keys will be returned each iteration. Even zero at all. But you should keep iterating while all the keys are found for the pattern, and zero is returned as new cursor.
This is strange as I've used scan and it seems to work fine other than this case. The problem is that
keys
will return values butscan
won't. The environment is redis cluster 3.0.2.My expectation is that scan will return the same content as keys in chunks of 20 and not necessarily in the same order. Also that the new scan starting value would be 0 if it did not find any keys. I did try repeatedly using the returned value to see if more keys would come but it always returned a new scan number and an empty list.
Am I using scan incorrectly?
The text was updated successfully, but these errors were encountered: