-
Notifications
You must be signed in to change notification settings - Fork 418
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
Reduce layer map locking on the read path #6833
Comments
Just realized while looking at some logs (slack thread), that compaction now needs to wait for on-demand downloads. This is a regression introduced with the Since no one has noticed this in quite some time, I don't think this is critical, but we should get it eventually fixed, so a slight boost to this issue. What needs to be done:
|
## Problem We currently hold the layer map read lock while doing IO on the read path. This is not required for correctness. ## Summary of changes Drop the layer map lock after figuring out which layer we wish to read from. Why is this correct: * `Layer` models the lifecycle of an on disk layer. In the event the layer is removed from local disk, it will be on demand downloaded * `InMemoryLayer` holds the `EphemeralFile` which wraps the on disk file. As long as the `InMemoryLayer` is in scope, it's safe to read from it. Related #6833
Update:
|
## Problem The vectored read path holds the layer map lock while visiting a timeline. ## Summary of changes * Rework the fringe order to hold `Layer` on `Arc<InMemoryLayer>` handles instead of descriptions that are resolved by the layer map at the time of read. Note that previously `get_values_reconstruct_data` was implemented for the layer description which already knew the lsn range for the read. Now it is implemented on the new `ReadableLayer` handle and needs to get the lsn range as an argument. * Drop the layer map lock after updating the fringe. Related #6833
Both PRs merged. Releasing on the week of 2024-04-08 |
Currently, the read path (
Timeline::get
andTimeline::get_vectored
when it merges) hold the layer manager read lock while accumulating the reconstruct data (includes on-demand downloads and disk IO). The non-vectored read path grabs the lock here.Locking for this long is not required. Instead, the read path could hold on to a
storage_layer::Layer
(introduced in #4938) and only hold the lock while querying the layer map. The fix for the vectored read path will be similar, but slightly more involved. The search fringe must be updated to holdstorage_layer::Layer
instead of layer descriptions and the in-memory handles will need some thought as well.The text was updated successfully, but these errors were encountered: