Skip to content

Use flush_fs_events more after performing synchronous fs mutations#59

Merged
as-cii merged 1 commit intomasterfrom
more-resilient-fs-events
May 13, 2021
Merged

Use flush_fs_events more after performing synchronous fs mutations#59
as-cii merged 1 commit intomasterfrom
more-resilient-fs-events

Conversation

@as-cii
Copy link
Member

@as-cii as-cii commented May 13, 2021

I am not sure I have caught all the examples of this, but in general I think we always want to perform a flush_fs_events as opposed to next_scan_complete when doing synchronous I/O. Indeed, the file system may inform us about the events caused by the just-performed I/O over multiple batches, and next_scan_complete may return before seeing all of them.

Note that this also removes a few assertions which were ensuring that, on start, a worktree's file handle wouldn't know its deleted status, even if the file didn't exist for sure on disk. However, now that file is an async API, it's possible that by the time the FileHandle is resolved, Worktree has already completed scanning. We test a similar behavior further along in the test where those assertions were removed, so it felt okay to proceed without them.

I am not sure I have caught all the examples of this, but in general
I think we always want to perform a `flush_fs_events` as opposed to
`next_scan_complete` when doing synchronous I/O. Indeed, the file
system may inform us about the events caused by the just-performed
I/O over multiple batches, and `next_scan_complete` may return
before seeing all of them.

Note that this also removes a few assertions which were ensuring
that, on start, a worktree's file handle wouldn't know its deleted
status, even if the file didn't exist for sure on disk. However,
now that `file` is an async API, it's possible that by the time the
`FileHandle` is resolved, `Worktree` has already completed scanning.
We test a similar behavior further along in the test where those
assertions were removed, so it felt okay to proceed without them.
@as-cii as-cii merged commit 2c43066 into master May 13, 2021
@as-cii as-cii deleted the more-resilient-fs-events branch May 13, 2021 08:42
@as-cii as-cii mentioned this pull request May 13, 2021
Anthony-Eid pushed a commit to Anthony-Eid/zed that referenced this pull request Nov 1, 2024
* Add current working directory to adapter

* Prio use resolve cwd
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.

1 participant