Skip to content

Refactor PartitioningExchanger#9379

Merged
sopel39 merged 2 commits intotrinodb:masterfrom
pettyjamesm:refactor-partitioning-exchanger
Oct 5, 2021
Merged

Refactor PartitioningExchanger#9379
sopel39 merged 2 commits intotrinodb:masterfrom
pettyjamesm:refactor-partitioning-exchanger

Conversation

@pettyjamesm
Copy link
Member

Refactors to PartitioningExchanger to 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 PageReference to 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 the Page retained size field from 4 to 1.

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
@pettyjamesm pettyjamesm force-pushed the refactor-partitioning-exchanger branch from 6933f56 to ba2320b Compare October 1, 2021 14:04
@sopel39 sopel39 merged commit c9bc6b0 into trinodb:master Oct 5, 2021
@pettyjamesm pettyjamesm deleted the refactor-partitioning-exchanger branch October 5, 2021 12:41
@github-actions github-actions bot added this to the 363 milestone Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants