-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Use NavigableSet for representing version sets, rather than List #121266
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
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
ldematte
left a comment
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.
I skimmed though this and I thing it's a good idea; the only drawbacks I can think of are related to performance (e.g. if you need to traverse all versions), but it seems to me that most of the operations are equivalent (e.g. first, last). Wdyt?
|
Yes, the main change is use of We could use lists in some places in test code if you think this will matter, or define some kind of immutable sorted set with a backing list? |
That's a cool idea, but I don't think it's necessary; like you said, the iteration is limited and performed only by test code |
rjernst
left a comment
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.
I think we only need it to be navigable in tests, right? Could we maintain the sorted List in production code, and have the version util for tests build a TreeSet from that?
Introduce logarithmic random algorithm
|
I've kept a |
ldematte
left a comment
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, I like the new random utility!
💚 Backport successful
|
This failing test was already fixed by elastic#121266 Fixes elastic#121495
We can use
NavigableSetto represent version sets to show that they are sorted and unique, rather than lists that don't enforce this.