Skip to content
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

feat(pageserver): support partial gc-compaction for delta layers #9611

Merged
merged 3 commits into from
Nov 11, 2024

Conversation

skyzh
Copy link
Member

@skyzh skyzh commented Nov 1, 2024

Problem

The final patch for partial compaction, part of #9114, close #8921 (note that we didn't implement parallel compaction or compaction scheduler for partial compaction -- currently this needs to be scheduled by using a Python script to split the keyspace, and in the future, automatically split based on the key partitioning when the pageserver wants to trigger a gc-compaction)

Summary of changes

  • Update the layer selection algorithm to use the same selection as full compaction (everything intersect/below gc horizon)
  • Update the layer selection algorithm to also generate a list of delta layers that need to be rewritten
  • Add the logic to rewrite delta layers and add them back to the layer map
  • Update test case to do partial compaction on deltas

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.
  • Do we need to implement analytics? if so did you add the relevant metrics to the dashboard?
  • If this PR requires public announcement, mark it with /release-notes label and add several sentences in this section.

Checklist before merging

  • Do not forget to reformat commit message to not include the above checklist

@skyzh skyzh requested review from problame and arpad-m November 1, 2024 19:50
@skyzh skyzh requested a review from a team as a code owner November 1, 2024 19:50
Copy link

github-actions bot commented Nov 1, 2024

5372 tests run: 5152 passed, 0 failed, 220 skipped (full report)


Flaky tests (2)

Postgres 17

Code coverage* (full report)

  • functions: 31.8% (7882 of 24824 functions)
  • lines: 49.4% (62416 of 126226 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
6641f10 at 2024-11-11T20:39:49.439Z :recycle:

Copy link
Contributor

@problame problame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The final patch for partial compaction,

Hm, is this truly the final piece of work in partial bottommost compaction? We don't support partial bottommost compaction yet.


We should not have a not-partial-bottommost-compact going forward, to reduce the amount of potential code paths that need to be kept in mind / reviewed.

Hence, can we please switch the API to take the compaction_key_range a Range<Key> instead of Option<Range<Key>>.

Full bottommost compaction unit tests can pass Key::MIN..Key::MAX. Or should it be just .. ? Or Key::Min..=Key::MAX.

Anyway, hope you get the point.

pageserver/src/tenant/timeline/compaction.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/timeline/compaction.rs Show resolved Hide resolved
pageserver/src/tenant/timeline/compaction.rs Show resolved Hide resolved
pageserver/src/tenant/timeline/compaction.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/timeline/compaction.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/timeline/compaction.rs Outdated Show resolved Hide resolved
@skyzh skyzh force-pushed the skyzh/partial-compaction-delta branch 2 times, most recently from 16cc56f to 647fe84 Compare November 7, 2024 16:36
@skyzh skyzh requested a review from problame November 8, 2024 16:37
@skyzh
Copy link
Member Author

skyzh commented Nov 8, 2024

The full/partial code path is now consolidated, and ready for another round of review :) Next week I'll likely add compaction key range to the manual compaction API so that I can start some testing in staging.

@skyzh skyzh force-pushed the skyzh/partial-compaction-delta branch from e05af1e to d7392bb Compare November 8, 2024 16:41
skyzh added a commit that referenced this pull request Nov 11, 2024
Signed-off-by: Alex Chi Z <chi@neon.tech>

partial address comments

Signed-off-by: Alex Chi Z <chi@neon.tech>
skyzh added a commit that referenced this pull request Nov 11, 2024
… path (#9611)

Signed-off-by: Alex Chi Z <chi@neon.tech>
@skyzh skyzh force-pushed the skyzh/partial-compaction-delta branch from d7392bb to eaa253c Compare November 11, 2024 16:19
@skyzh skyzh enabled auto-merge (squash) November 11, 2024 17:39
skyzh and others added 3 commits November 11, 2024 13:38
Signed-off-by: Alex Chi Z <chi@neon.tech>

partial address comments

Signed-off-by: Alex Chi Z <chi@neon.tech>
…c-compaction (#9671)

Signed-off-by: Alex Chi Z <chi@neon.tech>
… path (#9611)

Signed-off-by: Alex Chi Z <chi@neon.tech>
@skyzh skyzh force-pushed the skyzh/partial-compaction-delta branch from eaa253c to 6641f10 Compare November 11, 2024 18:38
@skyzh skyzh merged commit 5a138d0 into main Nov 11, 2024
80 checks passed
@skyzh skyzh deleted the skyzh/partial-compaction-delta branch November 11, 2024 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gc-compaction: split compaction jobs across keyspace
2 participants