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

chunked: fix reuse of the layers cache #2024

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Commits on Sep 13, 2024

  1. chunked: drop timeout mechanism for cache

    it is not clear if it is needed, so simplify it.
    
    Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
    giuseppe committed Sep 13, 2024
    Configuration menu
    Copy the full SHA
    5e479ab View commit details
    Browse the repository at this point in the history
  2. store: split ApplyDiffWithDiffer

    This is a requirement for the next commit.
    
    split ApplyDiffWithDiffer in two functions, so that it can run without
    holding any lock on the store.  This is necessary for the chunked
    cache as it calls directly into the store, causing ABBA deadlocks when
    another goroutine is already holding the store and tries to use the
    cache.
    
    It is also a nice performance improvement since now the heavy IO part
    of ApplyDiffWithDiffer can be done in parallel.
    
    Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
    giuseppe committed Sep 13, 2024
    Configuration menu
    Copy the full SHA
    05f0c4b View commit details
    Browse the repository at this point in the history
  3. chunked: fix reuse of the layers cache

    the global singleton was never updated, causing the cache to be always
    recreated for each layer.
    
    It is not possible to keep the layersCache mutex for the entire load()
    since it calls into some store APIs causing a deadlock since
    findDigestInternal() is already called while some store locks are
    held.
    
    Another benefit is that now only one goroutine can run load()
    preventing multiple calls to load() to happen in parallel doing the
    same work.
    
    Closes: containers#2023
    
    Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
    giuseppe committed Sep 13, 2024
    Configuration menu
    Copy the full SHA
    4fba6fa View commit details
    Browse the repository at this point in the history