-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fix aggregate metrics issue #487
Conversation
final scanResult = conn.hscan(key, "0", new ScanParams().match(pattern).count(10000)) | ||
final scanResult = conn.hscan(key, "0", new ScanParams().match(pattern).count(hscanCount)) |
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.
what's the rationale?
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.
so that it can be changed, if we want to scan more records than the default amount
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.
official docs of count
https://redis.io/docs/latest/commands/scan/
The COUNT option
While SCAN does not provide guarantees about the number of elements returned at every iteration,
it is possible to empirically adjust the behavior of SCAN using the COUNT option.
Basically with COUNT the user specifies the amount of work that should be done at every call in order to retrieve elements from the collection.
This is just a hint for the implementation, however generally speaking this is what you could expect most of the times from the implementation.
- The default COUNT value is 10.
- When iterating the key space, or a Set, Hash or Sorted Set that is big enough to be represented by a hash table, assuming no MATCH option is used, the server will usually return count or a few more than count elements per call. Please check the why SCAN may return all the elements at once section later in this document.
- When iterating Sets encoded as intsets (small sets composed of just integers), or Hashes and Sorted Sets encoded as ziplists (small hashes and sets composed of small individual values), usually all the elements are returned in the first SCAN call regardless of the COUNT value.
This PR will add count to force redis to scan certain number of records