sapling/eden/fs/inodes/treeoverlay
Zeyi (Rice) Fan 1ad184455b inodes: implement FSCK for Windows Tree Overlay
Summary:
This diff implements FSCK for EdenFS Windows.

On Windows, users can still modify EdenFS mounts even when EdenFS is not
running, which may cause mismatch between EdenFS state and on-disk view. This
subsequently may cause issues when EdenFS is running again (such as permission
error, not seeing added entries in `hg status`, etc..).

This diff adds FSCK to EdenFS Windows. It is not exactly same as what fsck
traditionally do on *NIX systems. We are still dubbing it as FSCK since it
works at the same place as eden fsck.

At startup, FSCK will crawl the EdenFS mount to compare the overlay state with
disk state. It then synchronizes the overlay view with what the user has on
disk. Note Windows does not always permit user to modify the mount, it only
allows changes in certain situation. In particular, when the directory is in
Full state, this diff takes advantage of that so we can finish the scanning by
only scans such directories.

One limitation of Windows FSCK is that, it cannot reliably tell if the user
deleted a directory or file from dirty placeholder directories. This is because
ProjectedFS will hide untouched entries under dirty placeholder directory when
EdenFS is not running, and there is no way we can tell if the entry is gone
because of user deletion or hid by ProjectedFS.

This is not perfect but acceptable to some extent. One possible failure scenario is:

1. User creates a directory named `foo`.
2. User writes a file to that directory (`foo/bar`).
3. EdenFS then stops running.
4. User then deletes the entire `foo` directory on disk.
5. EdenFS starts again, `foo` will be recrated with an empty `bar` file. This
   will still correctly show in `hg status`, and the user is able to delete
   them again.

Reviewed By: xavierd

Differential Revision: D27872753

fbshipit-source-id: c553db568379062ff4504204c1a1785664f87c00
2021-05-17 23:38:02 -07:00
..
test use portable version of gtest 2021-05-12 15:58:27 -07:00
CMakeLists.txt inodes: implement FSCK for Windows Tree Overlay 2021-05-17 23:38:02 -07:00
TreeOverlay.cpp inodes: implement FSCK for Windows Tree Overlay 2021-05-17 23:38:02 -07:00
TreeOverlay.h inodes: implement FSCK for Windows Tree Overlay 2021-05-17 23:38:02 -07:00
TreeOverlayScanner.cpp inodes: implement FSCK for Windows Tree Overlay 2021-05-17 23:38:02 -07:00
TreeOverlayStore.cpp overlay: use PersistentSqliteStatement in TreeOverlayStore 2021-03-15 12:01:48 -07:00
TreeOverlayStore.h overlay: use PersistentSqliteStatement in TreeOverlayStore 2021-03-15 12:01:48 -07:00
TreeOverlayWindowsFsck.cpp inodes: implement FSCK for Windows Tree Overlay 2021-05-17 23:38:02 -07:00
TreeOverlayWindowsFsck.h inodes: implement FSCK for Windows Tree Overlay 2021-05-17 23:38:02 -07:00