-
Notifications
You must be signed in to change notification settings - Fork 424
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 issues in distBag.addBulk
#26657
base: main
Are you sure you want to change the base?
Fix issues in distBag.addBulk
#26657
Conversation
Signed-off-by: Guillaume-Helbecque <helbecque.guillaume@gmail.com>
Signed-off-by: Guillaume-Helbecque <helbecque.guillaume@gmail.com>
b92e15f
to
5f622f2
Compare
Signed-off-by: Guillaume-Helbecque <helbecque.guillaume@gmail.com>
5aa21b8
to
37849be
Compare
While working on a test failure, I noticed that there was another tiny issue in the way we compute the number of elements to insert when the maximum capacity of a segment is reached. For some reasons, this was hidden in the previous tests. I thus provided more tests to capture this. |
distBag.addBulk
distBag.addBulk
I'm never gonna say no to more tests XD I'll try to take another look today, got a meeting coming up in five minutes |
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.
Looks good now, thanks! I'll merge this on Monday
In the
addBulk
procedure of thedistBag
data structure, things are as follows:This produces an issue when the input
elts
is not 0-based (e.g., array slices). For example,returns
[2, 3, 4, 5, 6, 7, 0, 0]
instead of[2, 3, 4, 5, 6, 7, 8, 9]
.A fix for this is to iterate over
elts
without specifying the domain, and use a counter to make sure that we do not insert more elements than we can. I also update the tests to make sure that this bug doesn't come back in the future.