Skip to content

Fix cache concurrency#1

Open
Xcelled wants to merge 2 commits into
hubspotfrom
fix-cache-concurrency
Open

Fix cache concurrency#1
Xcelled wants to merge 2 commits into
hubspotfrom
fix-cache-concurrency

Conversation

@Xcelled
Copy link
Copy Markdown

@Xcelled Xcelled commented May 17, 2024

The existing implementation used marker files and had some flaws that we found at scale, notably:

I changed the implementation to instead first copy into a temporary sibling folder and then atomically rename the temp folder to the expected cache key.

As part of this, the behavior changed to not update the cache once an entry is cached; this seems to me to be the safest and most desirable but it went against a test I removed, so I'm open to hearing otherwise.

@stevie400 @jaredstehler @suruuK

@stevie400
Copy link
Copy Markdown

LGTM

Are there any unit tests we could add to verify the fixed concurrency?


try {
// Atomically rename the completed cache entry into place
Files.move(tempDirectory, target.toPath(), StandardCopyOption.ATOMIC_MOVE);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

should we catch and have an alternative for fs's that dont support atomic move ?

@simschla
Copy link
Copy Markdown

would you consider submitting a PR upstream for these fixes?

@Xcelled
Copy link
Copy Markdown
Author

Xcelled commented May 23, 2024

would you consider submitting a PR upstream for these fixes?

Yes! I've been testing and fine-tuning these changes a little more internally first. Once they're ready I'll open a PR against the upstream. Might be ready tomorrow, might be Friday.

@Xcelled Xcelled force-pushed the fix-cache-concurrency branch from 3bad684 to e754307 Compare May 31, 2024 17:54
@Xcelled Xcelled force-pushed the fix-cache-concurrency branch from e754307 to 46ae8a2 Compare May 31, 2024 18:09
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.

4 participants