-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-22097][CORE]Request an accurate memory after we unrolled the block #19316
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
| reserveAdditionalMemoryIfNecessary() | ||
| serializationStream.flush() | ||
| if (bbos.size > unrollMemoryUsedByThisBlock) { | ||
| val amountToRequest = bbos.size - unrollMemoryUsedByThisBlock |
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.
Here, we only need request the bbos.size - unrollMemoryUsedByThisBlock. I'm sorry for that. This mistake maybe introduced by my previous patch SPARK-21923.
|
@cloud-fan Pls take a look. Thanks a lot. |
|
Hi @cloud-fan @jiangxb1987 Do you have time to check this? Thanks a lot. |
|
ok to test |
| // Make sure that we have enough memory to store the block. By this point, it is possible that | ||
| // the block's actual memory usage has exceeded the unroll memory by a small amount, so we | ||
| // perform one final call to attempt to allocate additional memory if necessary. | ||
| if (keepUnrolling) { |
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.
shall we merge this if into the next if?
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.
We maybe need request the extra-memory (bbos.size - unrollMemoryUsedByThisBlock). So the keepUnrolling maybe change in line 393.
|
Test build #82616 has finished for PR 19316 at commit
|
| serializationStream.close() | ||
| reserveAdditionalMemoryIfNecessary() | ||
| if (bbos.size > unrollMemoryUsedByThisBlock) { | ||
| val amountToRequest = bbos.size - unrollMemoryUsedByThisBlock |
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 just fix that in reserveAdditionalMemoryIfNecessary ?
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.
Because we request val amountToRequest = (bbos.size * memoryGrowthFactor - unrollMemoryUsedByThisBlock).toLong in reserveAdditionalMemoryIfNecessary to avoid requesting for every records. But here we just need request the precise memory for the last request.
|
LGTM, merging to master! |
What changes were proposed in this pull request?
We only need request
bbos.size - unrollMemoryUsedByThisBlockafter unrolled the block.How was this patch tested?
Existing UT.