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): generate image layers for sparse keyspace #7567

Merged
merged 7 commits into from
May 20, 2024

Conversation

skyzh
Copy link
Member

@skyzh skyzh commented Apr 30, 2024

Problem

Part of #7462

Sparse keyspace does not generate image layers for now. This pull request adds support for generating image layers for sparse keyspace.

Summary of changes

  • Use the scan interface to generate compaction data for sparse keyspace.
  • Track num of delta layers reads during scan.
  • Read-trigger compaction: when a scan on the keyspace touches too many delta files, generate an image layer. There are one hard-coded threshold for now: max delta layers we want to touch for a scan.
  • L0 compaction does not need to compute holes for metadata keyspace.

Know issue: the scan interface currently reads past the image layer, which causes delta_layer_accessed keeps increasing even if image layers are generated. The pull request to fix that will be separate, and orthogonal to this one.

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

Copy link

github-actions bot commented Apr 30, 2024

3102 tests run: 2975 passed, 0 failed, 127 skipped (full report)


Flaky tests (4)

Postgres 15

  • test_location_conf_churn[2]: debug
  • test_synthetic_size_while_deleting: debug
  • test_vm_bit_clear_on_heap_lock: debug

Postgres 14

  • test_compute_pageserver_connection_stress: debug

Code coverage* (full report)

  • functions: 31.3% (6396 of 20411 functions)
  • lines: 47.9% (48872 of 102126 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
58c801c at 2024-05-20T16:18:29.609Z :recycle:

@skyzh skyzh mentioned this pull request Apr 30, 2024
24 tasks
@skyzh skyzh force-pushed the skyzh/scan-interface branch from 4229426 to 5d9ba8b Compare May 2, 2024 17:23
Base automatically changed from skyzh/scan-interface to main May 3, 2024 14:43
@skyzh skyzh force-pushed the skyzh/sparse-image branch from ae24089 to 38c1420 Compare May 6, 2024 15:26
@skyzh skyzh force-pushed the skyzh/sparse-image branch 2 times, most recently from 007423d to 03c5484 Compare May 14, 2024 19:03
@skyzh skyzh changed the title [WIP/DNM] feat(pageserver): generate image layers for sparse keyspace feat(pageserver): generate image layers for sparse keyspace May 14, 2024
@skyzh
Copy link
Member Author

skyzh commented May 14, 2024

For reference, this is the log of test_metadata_scan, where image layer generation happens and L0 compaction works correctly.

test_metadata_scan.log

@skyzh skyzh marked this pull request as ready for review May 14, 2024 19:09
@skyzh skyzh requested a review from a team as a code owner May 14, 2024 19:09
@skyzh skyzh requested review from arssher, arpad-m and VladLazar and removed request for arssher May 14, 2024 19:09
pageserver/src/tenant.rs Show resolved Hide resolved
pageserver/src/tenant/timeline.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/timeline.rs Show resolved Hide resolved
pageserver/src/tenant/timeline.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/timeline.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/timeline.rs Outdated Show resolved Hide resolved
Signed-off-by: Alex Chi Z <chi@neon.tech>
@skyzh skyzh force-pushed the skyzh/sparse-image branch from 03c5484 to 7024e78 Compare May 15, 2024 18:59
Signed-off-by: Alex Chi Z <chi@neon.tech>
@skyzh skyzh requested a review from VladLazar May 15, 2024 19:48
pageserver/src/tenant/timeline.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/timeline.rs Outdated Show resolved Hide resolved
skyzh added 2 commits May 16, 2024 14:17
Signed-off-by: Alex Chi Z <chi@neon.tech>
Signed-off-by: Alex Chi Z <chi@neon.tech>
@skyzh
Copy link
Member Author

skyzh commented May 16, 2024

@arpad-m @VladLazar comments resolved and ready for review, thanks :)

Copy link
Contributor

@VladLazar VladLazar left a comment

Choose a reason for hiding this comment

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

I'd really like to avoid adding something to the request context that is only needed for compaction. I've got one suggestion here.

pageserver/src/tenant/storage_layer.rs Show resolved Hide resolved
pageserver/src/tenant/timeline.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/timeline.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/timeline.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/timeline.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/timeline.rs Show resolved Hide resolved
pageserver/src/tenant/timeline.rs Show resolved Hide resolved
pageserver/src/tenant/timeline.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/timeline.rs Outdated Show resolved Hide resolved
pageserver/src/tenant/timeline/compaction.rs Show resolved Hide resolved
skyzh added 2 commits May 17, 2024 12:44
Signed-off-by: Alex Chi Z <chi@neon.tech>
Signed-off-by: Alex Chi Z <chi@neon.tech>
@skyzh
Copy link
Member Author

skyzh commented May 17, 2024

should be ready for review and wait for CI runs...

Copy link
Contributor

@VladLazar VladLazar left a comment

Choose a reason for hiding this comment

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

Looks good to me.

pageserver/src/tenant/storage_layer.rs Show resolved Hide resolved
@skyzh skyzh enabled auto-merge (squash) May 20, 2024 15:07
@skyzh skyzh merged commit 7701ca4 into main May 20, 2024
55 checks passed
@skyzh skyzh deleted the skyzh/sparse-image branch May 20, 2024 16:08
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