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

Ensure filestate stack.json file are atomically replaced #9122

Merged
merged 5 commits into from
Mar 8, 2022

Conversation

Frassle
Copy link
Member

@Frassle Frassle commented Mar 5, 2022

Description

When saving a new version of the stack checkpoint we don't delete the current file, instead we let WriteAll atomically replace it. This ensures that if any concurrent attempts are made to list or read the stack while the write is happening they can still pick up the existing about to be replaced version.

Also inlined the renaming logic to backupObject and so can now log a warning if the backup copy fails.

Fixes #9033

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • Yes, there are changes in this PR that warrants bumping the Pulumi Service API version

Copy link
Member

@mikhailshilkov mikhailshilkov left a comment

Choose a reason for hiding this comment

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

This makes sense to me. Probably a larger topic than this change - but should we start adding some test harness around file backends that could cover changes like this one?

@Frassle
Copy link
Member Author

Frassle commented Mar 8, 2022

but should we start adding some test harness around file backends that could cover changes like this one?

Yes we should! I did look at if it made sense to write a test for this specific case but it's very very racy so pretty much always passed even without the fix, so I didn't deem it useful enough to keep.

@Frassle Frassle merged commit ca3b9a5 into master Mar 8, 2022
@pulumi-bot pulumi-bot deleted the fraser/fix9033 branch March 8, 2022 11:21
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.

pulumi stack disappears during a pulumi up when using the GCP bucket backend
2 participants