[Draft] Atomic locking of createExecDir
#1353
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary: today we reference an
Entry
after it has been "downloaded". Today we expire during execution andInputFetch
stage whenEntries
for keys either existed on the file system or were loaded from the distributed store in theInputFetch
operation. Will also mutate existing entries due todeleting
the reference to the last inode of a file. The latter manfiests in several ways e.g. like failing the report stage of a concurrent action.Prior to
CASFileCache.putDirectory
we incrementkeyReferences
to prevent eviction during execution. This provides atomicity guarantees around the keys within directories while minimizing mutexes.Fixes my contention with
createExecDir
/ and my write-to-CAS failures which manifested as a result.TLDR:
Logical and atomic locking of an
execDir
by gaining references to keys via the new methodlockDirectoryKeys
. Because there are many references to a singleEntry
this needs to be reference counted for each concurrentexecDir
and must upheld through the entire lifetime of the directory.Testing:
I have a number of manual integration tests that need reworking so I can add them here and will add these as part of the PR to get it out of the
Draft
state