-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix incorrect resharding transfer fraction for points to transfer #6259
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
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
// - shards: 3 -> 4 | ||
// points: 33/33/33 -> 25/25/25/25 | ||
// transfer fraction of each shard: 1/4/3 = 0.083 | ||
Ordering::Less => (1.0 / to as f32) / (from as f32), |
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.
The final / from
here was wrong. It adjusted the factor from shard level to collection level, which was not correct.
4f2e008
to
8fc4417
Compare
Co-authored-by: Kumar Shivendu <kshivendu1@gmail.com>
5f56cc3
to
fe11d80
Compare
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.
thanks for the quick update!
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.
LGTM, but do we even need this method on HashRing
? Can't we just derive this from resharding state? It's literally just points_in_shard / new_shard_count
, no point in calculating f32
multiplier.
Yes. With the previous (wrong 🤡) implementation it was a bit more complex, and the plan was to use it in two places. But now that it's simpler I'll move it directly into the call site instead. 👍 |
lib/collection/src/shards/transfer/resharding_stream_records.rs
Outdated
Show resolved
Hide resolved
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.
Thanks!
) * Fix incorrect resharding transfer fraction for points to transfer * Explicitly handle case where from and to are the same * Update lib/collection/src/hash_ring.rs Co-authored-by: Kumar Shivendu <kshivendu1@gmail.com> * Move point fraction calculation right into the call site * Don't use intermediate f64 --------- Co-authored-by: Kumar Shivendu <kshivendu1@gmail.com>
Fixes incorrect implementation in #6084.
The function to calculate the fraction of points transferred during a resharding transfer was incorrect. For resharding up it gave us the wrong result.
For resharding up, the returned fraction was for the total number of points in the collection, not a fraction for the number of points in the current shard like the function describes.
Long story short, this fixed the fraction calculation. The documentation with examples has been updated as well.
In practice this fixes our point count estimate in shard transfers. It's not critical, but helpful to do proper transfer estimations.
All Submissions:
dev
branch. Did you create your branch fromdev
?New Feature Submissions:
cargo +nightly fmt --all
command prior to submission?cargo clippy --all --all-features
command?