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

db: offload downloads to objprovider to reduce cache and db.mu churn #3740

Open
itsbilal opened this issue Jul 9, 2024 · 0 comments
Open

Comments

@itsbilal
Copy link
Member

itsbilal commented Jul 9, 2024

Currently, the Download call after an external ingestion (eg. online restore) schedules multiple copy compactions if viaBackingFileDownload is true, and rewrite compactions if not. It makes sense for the latter to still flow through the compaction flow as we're materializing any prefix/suffix rewrite rules as we're going. But for the former, we can and should offload the job of doing byte-by-byte copies of sstable blocks to the object provider, for two main reasons:

  1. If we're doing block-by-block copies anyway, and data blocks are going to be identical between the remote and local sstable, we can avoid cache churn by keeping the file num and block handles identical between the remote and local file. This should reduce cache misses right after a download finishes.
  2. The compaction picking process involves holding db.mu, a mutex that is also held by ingestions and rotations of the memtable. If we're doing high-throughput downloads, holding this mutex every time we pick one file to download is wasteful and can be avoided if we just do the download "below" the pebble Version.

Sub-issues filed under this meta issue will be listed below.

Jira issue: PEBBLE-31

Epic CRDB-40359

@itsbilal itsbilal self-assigned this Jul 9, 2024
@itsbilal itsbilal changed the title db: offload downloads to objprovider to reduce cache and mutex churn db: offload downloads to objprovider to reduce cache and db.mu churn Jul 9, 2024
@itsbilal itsbilal removed their assignment Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Disagg - Online restore
Development

No branches or pull requests

1 participant