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

refactor(layer): use detached init #7152

Merged
merged 11 commits into from Mar 20, 2024
Merged

Conversation

koivunej
Copy link
Contributor

@koivunej koivunej commented Mar 15, 2024

The second part of work towards fixing Layer::keep_resident so that it does not need to repair the internal state. #7135 added a nicer API for initialization. This PR uses it to remove a few indentation levels and the loop construction. The next PR #7175 will use the refactorings done in this PR, and always initialize the internal state after a download.

Split off from #7030.

Cc: #5331

Reviewing: commit by commit with whitespace hidden works.

@koivunej koivunej requested a review from a team as a code owner March 15, 2024 22:05
@koivunej koivunej requested a review from jcsp March 15, 2024 22:05
Copy link

github-actions bot commented Mar 15, 2024

2706 tests run: 2575 passed, 0 failed, 131 skipped (full report)


Code coverage* (full report)

  • functions: 28.3% (7132 of 25174 functions)
  • lines: 46.9% (43733 of 93330 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
178a2d6 at 2024-03-19T14:13:16.985Z :recycle:

@koivunej
Copy link
Contributor Author

Might be more ecological to just merge the #7030 because of e2e re-runs.

@jcsp
Copy link
Contributor

jcsp commented Mar 18, 2024

Can you update the PR description to explain how this PR fits into fixing hangs during eviction? It's not obvious if this PR is the fix or a precursor.

@jcsp jcsp requested a review from problame March 18, 2024 10:08
@koivunej
Copy link
Contributor Author

koivunej commented Mar 20, 2024

Can you update the PR description to explain how this PR fits into fixing hangs during eviction? It's not obvious if this PR is the fix or a precursor.

Unsure when I added this to the description in relation to your comment:

The next PR #7175 will use the refactorings done in this PR, and always initialize the internal state after a download.

That is how it fits. This is important because it will remove the case where the internal state is uninitialized:

  1. we start a download (spawned task)
  2. during download, the starter gets canceled
  3. no init ever happens -- thus, we need Layer::keep_resident to repair it

The remaining cases after the above are:

  • get_or_maybe_download canceled after deinitializing and so it cancels eviction

@koivunej koivunej merged commit 3d16cda into main Mar 20, 2024
53 checks passed
@koivunej koivunej deleted the joonas/layer-use-detached-init branch March 20, 2024 16:03
koivunej added a commit that referenced this pull request Mar 20, 2024
Before this PR, cancellation for `LayerInner::get_or_maybe_download`
could occur so that we have downloaded the layer file in the filesystem,
but because of the cancellation chance, we have not set the internal
`LayerInner::inner` or initialized the state. With the detached init
support introduced in #7135 and in place in #7152, we can now initialize
the internal state after successfully downloading in the spawned task.

The next PR will fix the remaining problems that this PR leaves:
- `Layer::keep_resident` is still used because
- `Layer::get_or_maybe_download` always cancels an eviction, even when
canceled

Split off from #7030. Stacked on top of #7152. Cc: #5331.
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.

None yet

3 participants