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

Enable on-demand download in WalIngest. #3233

Merged
merged 1 commit into from
Jan 3, 2023

Conversation

hlinnaka
Copy link
Contributor

Makes the top-level functions in WalIngest async, and replaces no_ondemand_download calls with with_ondemand_download.

This hopefully fixes the problem reported in issue #3230, although I don't have a self-contained test case for it.

Note: I created this PR over PR #3202, because this ran into problems with trying to hold the sync Tar reference over awaits.

@hlinnaka hlinnaka requested review from a team, bojanserafimov, LizardWizzard and SomeoneToIgnore and removed request for a team and bojanserafimov December 29, 2022 23:29
@hlinnaka hlinnaka force-pushed the ondemand-download-in-walingest branch from 34ba28d to 1ddf626 Compare December 30, 2022 11:27
Copy link
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

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

Somehow, recent PRs around this code feel better when pure anyhow got replaced with a few enum variant errors.
I see the approach now is to eagerly download all layers inplace.

2 thoughts on that:

Without deeply looking in the other PR, I can already say that inplace download approach + async conversion for pgdatadir_mapping.rs is a great standalone PR, that hopefully strips a few hundred lines off the big one. WDYT?

@hlinnaka hlinnaka force-pushed the ondemand-download-in-walingest branch from d12e62c to 2ce6692 Compare December 30, 2022 13:50
@hlinnaka
Copy link
Contributor Author

hlinnaka commented Dec 30, 2022

Somehow, recent PRs around this code feel better when pure anyhow got replaced with a few enum variant errors. I see the approach now is to eagerly download all layers inplace.

2 thoughts on that:

  • it would be great to measure timeline download process as a whole, from all such inplace downloads querying different (?) layers simultaneously.
    Otherwise, not sure how to assert the efficiency of the approach(es) taken.

Hmm, yeah, some kind of a metric or observability would be nice. Got any concrete ideas on how and where to do that?

Without deeply looking in the other PR, I can already say that inplace download approach + async conversion for pgdatadir_mapping.rs is a great standalone PR, that hopefully strips a few hundred lines off the big one. WDYT?

Yeah, this PR is really a subset of #3228 too. I agree it makes sense to do pgdatadir_mapping.rs next as a separate PR.

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.

Prior reviews are already sufficient. Quickly went through the diff to ensure that no new no_ondemand_download calls slipped in.

Also, I like that we get rid of lots of try_prr! wrinkles.

Base automatically changed from async-tar to main January 3, 2023 10:39
Makes the top-level functions in WalIngest async, and replaces
no_ondemand_download calls with with_ondemand_download.

This hopefully fixes the problem reported in issue #3230, although I
don't have a self-contained test case for it.
@hlinnaka hlinnaka force-pushed the ondemand-download-in-walingest branch from cfb167f to 4441d60 Compare January 3, 2023 10:47
@hlinnaka
Copy link
Contributor Author

hlinnaka commented Jan 3, 2023

Test failure because of existing flakiness. I'll re-run it.

@hlinnaka hlinnaka merged commit 8b692e1 into main Jan 3, 2023
@hlinnaka hlinnaka deleted the ondemand-download-in-walingest branch January 3, 2023 12:44
hlinnaka added a commit that referenced this pull request Jan 11, 2023
This makes Timeline::get() async, and all functions that call it
directly or indirectly with it. The with_ondemand_download() mechanism
is gone, Timeline::get() now always downloads files, whether you want
it or not. That is what all the current callers want, so even though
this loses the capability to get a page only if it's already in the
pageserver, without downloading, we were not using that capability.
There were some places that used 'no_ondemand_download' in the WAL
ingestion code that would error out if a layer file was not found
locally, but those were dubious. We do actually want to on-demand
download in all of those places.

Per discussion at
#3233 (comment)
hlinnaka added a commit that referenced this pull request Jan 12, 2023
This makes Timeline::get() async, and all functions that call it
directly or indirectly with it. The with_ondemand_download() mechanism
is gone, Timeline::get() now always downloads files, whether you want
it or not. That is what all the current callers want, so even though
this loses the capability to get a page only if it's already in the
pageserver, without downloading, we were not using that capability.
There were some places that used 'no_ondemand_download' in the WAL
ingestion code that would error out if a layer file was not found
locally, but those were dubious. We do actually want to on-demand
download in all of those places.

Per discussion at
#3233 (comment)
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