-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
Backup file system provider can not do buffered write #193151
Comments
One interesting behavior I found is sometimes backup happens right after I press cmd+s to save, maybe the delayed backup kicks in right before I save, but it feels weird to have both a backup and save operation at the same time. |
Good catch, but I think this is simply something that was forgotten when introducing the file user data provider. Since the underlying disk file system provider supports this, I see no reason why the file user data provider could not support this. @sandy081 can you check? |
Looks like this was an explicit decision in 87bf1d8#diff-28073e52c2a7e44ac456dfb32c4f0794985cb4a4bcc7c0d99a033e8224fff52cR25 and probably done to enforce atomic writes. I think we may be fine to bring back that capability. The file service is already optimising the calls to the provider in a way that vscode/src/vs/platform/files/common/fileService.ts Lines 372 to 390 in 2553649
On top of that: if any component comes with a buffer for writing, we never stream: vscode/src/vs/workbench/services/textfile/browser/textFileService.ts Lines 267 to 275 in 2553649
Which I would assume is the case for all our settings when written to programmatically. |
@bpasero Does it also need |
@sandy081 yes, that is what the |
I experimented adding the |
I wonder if a better approach for this would be to drop the Basically this method would call into vscode/src/vs/platform/userData/common/fileUserDataProvider.ts Lines 54 to 62 in fa99dac
|
I liked that. Does it mean we should not use |
@sandy081 I would not suggest to change anything with regards to |
I am wondering it is not straight forward to use disk FSP without changing the scheme. The main purpose of vscode-userdata fsp is to handle the scheme, for eg., watching on user data scheme and getting change events on the same scheme. We should also adopt the disk FSP not to call vscode/src/vs/platform/files/common/diskFileSystemProvider.ts Lines 217 to 219 in d8e6919
|
@sandy081 how about this then:
I think then we get the best of all worlds:
|
Sounds good 👍 |
@sandy081 I went with a slightly different approach: since the file user data provider is used in many contexts, it makes more sense to keep the decision about which resources should get atomic read/write inside the provider. As such, I added new methods to enforce atomic read, write or delete: #193228 |
This bug has been fixed in the latest release of VS Code Insiders! @rebornix, you can help us out by commenting If things still don't seem right, please ensure you're on version c72447e of Insiders (today's or later - you can use Happy Coding! |
Does this issue occur when all extensions are disabled?: Yes/No
I was verifying #192970 and found that large file piece tree buffers are still merged before write. Turns out that backup is always doing
doWriteUnbuffered
since it's usingFileUserDataProvider
, which doesn't haveFileOpenReadWriteClose
capability so it always runsvscode/src/vs/platform/files/common/fileService.ts
Lines 394 to 395 in 3b60c12
and unfortunately unbuffered write always concatenates all
buffers
firstvscode/src/vs/platform/files/common/fileService.ts
Line 1294 in 3b60c12
The text was updated successfully, but these errors were encountered: