Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
allocator: Avoid assigning duplicate IPs during initialization #2237
When the allocator starts up, there is a pass that "allocates" the
The problem is that allocation of new IPs is interspersed with updating
This change makes the allocator do two passes on initialization. First
Jun 10, 2017
I 100% agree WRT the complexity.
In this case although the diff looks pretty large and confusing the bulk of it is just factoring out
So, LGTM. (I'm a little worried about the apparent non-determinism in the test case, implied by the looping 100 times, but I guess that is unavoidable for an issue like this).
I didn't observe any non-determinism, but wanted to make sure the test case is aggressive enough to catch regressions. The problem triggers much more quickly when creating tasks in reverse numerical order, which is why the test does this. If I remember correctly, it only takes 3 tasks to trigger the problem. But in forward numerical order, it took about 52 tasks (since the allocator iterates over tasks in lexical order, which I suppose is close to numerical order). To avoid encoding assumptions about the iteration order, I decided to do 100 iterations. The test case runs instantly so I don't think there's any downside.
We could consider randomizing the task IDs, but I generally prefer to avoid nondeterminism in tests.
Yes, if there are plans for another 17.03 release, I think it should be. There are also other high-priority fixes that would make sense to backport. Please let me know if I should work on these backports.