Skip to content

Introduce concept of enforced atomic operations (fix #193151) - #193228

Merged
Benjamin Pasero (bpasero) merged 7 commits into
mainfrom
rebornix/uncertain-tarsier
Sep 20, 2023
Merged

Benjamin Pasero (bpasero) merged 7 commits into
mainfrom
rebornix/uncertain-tarsier

Conversation

@rebornix

Copy link
Copy Markdown
Contributor

The only two file system providers being passed to FileUserDataProvider is either the disk one or the in memory one. The former already supports IFileSystemProviderWithOpenReadWriteCloseCapability thus in this PR we added the capability to the in memory file system provider

@bpasero Benjamin Pasero (bpasero) left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM except one code style issue.

I leave it up to Sandeep Somavarapu (@sandy081) to comment on the impact of this change. I think the idea of this provider was to explicitly enforce atomic writes on the level of the file system provider for all user data files (except backups). With your change, we now rely on the file service to use writeFile for this to happen. But writeFile is used only in specific conditions, for example when the file is small (3 * 64kb I believe) or when a file is changed not through an editor that has a ITextSnapshot but programmatically where the entire buffer is passed in (which I believe is most often the case with user data).

@sandy081

Copy link
Copy Markdown
Member

or when a file is changed not through an editor that has a ITextSnapshot but programmatically where the entire buffer is passed in (which I believe is most often the case with user data).

Benjamin Pasero (@bpasero) Is it also true if programmatic save goes through ITextFileService.save ?

save(resource: URI, options?: ITextFileSaveOptions): Promise<URI | undefined>;

@bpasero

Copy link
Copy Markdown
Contributor

Sandeep Somavarapu (@sandy081) no. But I think a better solution is to stop overriding the file system provider and do what I had suggested in #193151 (comment)

@sandy081

Copy link
Copy Markdown
Member

In this case, I would not suggest this change. It is important to have atomic write for user data like settings and extensions.

@bpasero

Copy link
Copy Markdown
Contributor

This is ready for review.

@bpasero Benjamin Pasero (bpasero) changed the title Fix #193151. Add IFileSystemProviderWithOpenReadWriteCloseCapability to FileUserDataProvider Introduce concept of enforced atomic operations (fi x#193151) Sep 20, 2023
@bpasero Benjamin Pasero (bpasero) changed the title Introduce concept of enforced atomic operations (fi x#193151) Introduce concept of enforced atomic operations (fix #193151) Sep 20, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good change. I liked it.

@bpasero
Benjamin Pasero (bpasero) deleted the rebornix/uncertain-tarsier branch September 20, 2023 08:31

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good change. I liked it.

@github-actions github-actions Bot locked and limited conversation to collaborators Nov 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants