-
Notifications
You must be signed in to change notification settings - Fork 228
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
Removed freezing for RIBs #665
Conversation
*/ | ||
public void freeze() { | ||
_finalRoutes = Collections.unmodifiableSet(getRoutes()); | ||
return _allRoutes; |
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 is the expected semantics of the return value here?
Questions:
- Should clients be able to modify the return value?
- Should clients see updated values if this AbstractRib is modified later?
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.
- They should not.
- Good question. I believe the answer here is also no since we use getRoutes to iterate over a particular snapshot of the RIB.
Review status: 0 of 4 files reviewed at latest revision, 1 unresolved discussion. projects/batfish/src/main/java/org/batfish/bdp/AbstractRib.java, line 443 at r1 (raw file): Previously, progwriter (Victor Heorhiadi) wrote…
So it sounds like we either need to return a Or figure out the combination of memoizing + access pattern that makes this work out? Comments from Reviewable |
|
||
public AbstractRib(VirtualRouter owner) { | ||
_tree = new RibTree(); | ||
_owner = owner; | ||
_finalRoutes = null; | ||
_allRoutes = new TreeSet<>(); |
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.
why not ImmutableSet.of();
?
Reviewed 3 of 4 files at r1, 2 of 2 files at r2. projects/batfish/src/main/java/org/batfish/bdp/AbstractRib.java, line 213 at r2 (raw file):
I feel like this function adds questionable value over the 5 places it was used, but okay :) projects/batfish/src/test/java/org/batfish/bdp/AbstractRibTest.java, line 212 at r2 (raw file):
We should test the invariants we agreed upon in the PR discussion.
and probably also
(each in its own unit test). Comments from Reviewable |
Reviewed 1 of 1 files at r3. Comments from Reviewable |
I played with this last night and it seemed to shave something like a minute (out of 6.5 mins) off of building a real data plane. Nice. Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed. Comments from Reviewable |
79f58da
to
6627cf7
Compare
…f routes - Set obtained from getRoutes() is now an immutable set - Set obtained from getRoutes() does not reflect subsequent changed to the RIB (not a view) - Each call to getRoutes returns the same set, if the RIB has not been modified (performance improvement) - Added tests that enforce semantics described above
6627cf7
to
c929ff1
Compare
Reviewed 4 of 4 files at r4. Comments from Reviewable |
Now RIBs keep an up-to-date collection of all routes. Fixes #646
This change is