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 key range for manual compaction trigger #9723

Merged
merged 6 commits into from
Nov 19, 2024

Conversation

skyzh
Copy link
Member

@skyzh skyzh commented Nov 11, 2024

Problem

part of #9114, we want to be able to run partial gc-compaction in tests. In the future, we can also expand this functionality to legacy compaction, so that we can trigger compaction for a specific key range.

Summary of changes

  • Support passing compaction key range through pageserver routes.
  • Refactor input parameters of compact related function to take the new CompactOptions.
  • Add tests for partial compaction. Note that the test may or may not trigger compaction based on GC horizon. We need to improve the test case to ensure things always get below the gc_horizon and the gc-compaction can be triggered.

@skyzh skyzh mentioned this pull request Nov 11, 2024
28 tasks
Copy link

github-actions bot commented Nov 11, 2024

5534 tests run: 5308 passed, 0 failed, 226 skipped (full report)


Flaky tests (1)

Postgres 17

Code coverage* (full report)

  • functions: 31.4% (7935 of 25246 functions)
  • lines: 49.6% (62994 of 127004 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
681fb1b at 2024-11-19T19:07:40.173Z :recycle:

@skyzh skyzh force-pushed the skyzh/partial-compaction-manual branch 3 times, most recently from 6aa7515 to 27e70aa Compare November 14, 2024 18:14
@skyzh skyzh requested a review from problame November 14, 2024 18:14
@skyzh skyzh marked this pull request as ready for review November 14, 2024 18:14
@skyzh skyzh requested a review from a team as a code owner November 14, 2024 18:14
@skyzh skyzh requested a review from arpad-m November 14, 2024 18:58
@skyzh skyzh force-pushed the skyzh/partial-compaction-manual branch from 27e70aa to 59c42fa Compare November 14, 2024 20:06
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.

Occupying the entire request body for just the CompactRange will make it harder to extend the endpoint down the line.

I think it shouldn't be particularly hard/time consuming to move all the query fields (force_l0_compaction, force_repartition etc) into a struct TimelineCompactRequest.

(The reason why it shouldn't be particularly time consuming is that the the only place where we're constructing the request is in the ps_http.timeline_compact() implementation.

Please do bit that bullet here, much appreciated!

Other than that, this looks good. Approving so you can merge this before your weekend starts

Copy link
Member

@arpad-m arpad-m left a comment

Choose a reason for hiding this comment

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

two minor points

libs/utils/src/http/json.rs Show resolved Hide resolved
test_runner/regress/test_compaction.py Outdated Show resolved Hide resolved
@skyzh
Copy link
Member Author

skyzh commented Nov 19, 2024

I think we should move all these compaction configs to the POST body. Given the compaction tests are now the only users for the API, we can change it as much as we want in the future (hopefully, in the next two week? as I'll probably add more options to the API and the current way of doing it is not manageable...)

Signed-off-by: Alex Chi Z <chi@neon.tech>
Signed-off-by: Alex Chi Z <chi@neon.tech>
Signed-off-by: Alex Chi Z <chi@neon.tech>
Signed-off-by: Alex Chi Z <chi@neon.tech>
Signed-off-by: Alex Chi Z <chi@neon.tech>
@skyzh skyzh force-pushed the skyzh/partial-compaction-manual branch from 71b20cf to 681fb1b Compare November 19, 2024 17:08
@skyzh skyzh enabled auto-merge (squash) November 19, 2024 17:08
@skyzh skyzh merged commit b22a84a into main Nov 19, 2024
79 of 83 checks passed
@skyzh skyzh deleted the skyzh/partial-compaction-manual branch November 19, 2024 19:38
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.

3 participants