Refactor PartitioningExchanger#9379
Merged
sopel39 merged 2 commits intotrinodb:masterfrom Oct 5, 2021
Merged
Conversation
sopel39
approved these changes
Oct 1, 2021
core/trino-main/src/main/java/io/trino/operator/exchange/PageReference.java
Outdated
Show resolved
Hide resolved
This is a cleanup refactor that stores page retained size in a field on PageReference and to updates local exchange usage sites to prefer calling PageReference#getRetainedSizeInBytes() instead of reading it from the Page itself. This serves a couple purposes: - In theory, this ensures that memory accounting always uses the same value when adding and removing pages from buffers even if somehow the pages retained size were to change while buffered - In practice, this reduces what is typically 4 volatile reads of the page retained size during local exchange hand-offs into a single volatile read to store the value in the field
6933f56 to
ba2320b
Compare
sopel39
approved these changes
Oct 5, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactors to
PartitioningExchangerto compact pages being sent to a single partition outside of the synchronized section to allow other threads to proceed while Page compaction completes. This is a follow up after a discussion as part of #9327.This PR also refactors
PageReferenceto store retainedSizeInBytes in a local field, and updates usage sites in local exchanges get the retained size from that field instead of from the Page itself. In the common case, this reduces the number of volatile reads on thePageretained size field from 4 to 1.