-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[Managed Iceberg] Fix partition value race condition #33549
[Managed Iceberg] Fix partition value race condition #33549
Conversation
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.
It may be worth doing more to signpost what is mutable and what is not. I'm not sure what that would look like. But this change is really subtle even though it is small. It is easy to imagine we have other issues and/or will have issues in the future.
|
||
if (!writers.asMap().containsKey(partitionKey) && openWriters >= maxNumWriters) { | ||
if (!writers.asMap().containsKey(routingPartitionKey) && openWriters >= maxNumWriters) { |
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.
nit: You aren't guaranteed that asMap
is cheap. It could be linear time to convert from some other underlying data structure. It is better to call get
and check if the result was null
. (since this is not a LoadingCache
you don't have to worry about accidentally creating too many entries)
(maybe think about it for future changes)
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 tip, will do
Assigning reviewers. If you would like to opt out of this review, comment R: @damondouglas for label java. Available commands:
The PR bot will only process comments in the main thread (not review comments). |
* fix and update tests * dont mention df yet * add PR link * whitespace
* fix and update tests * dont mention df yet * add PR link * whitespace
Fixes #33497 (see comment and comment for details)
Also updates tests