Commit Graph

2917 Commits

Author SHA1 Message Date
Zeyi (Rice) Fan
a3d912f2cd utils: introduce CaseSensitivity
Summary: `CaseSensitivity::Sensitive` is better than a mere `true` out of nowhere.

Reviewed By: kmancini

Differential Revision: D27867180

fbshipit-source-id: 39d21d3cc3b70c78c6984c3ddbd65b53520770be
2021-04-20 13:08:27 -07:00
Zeyi (Rice) Fan
865504778a cli: enable tree overlay for Windows users
Summary: This diff makes treeoverlay the default overlay type for Windows users.

Reviewed By: kmancini

Differential Revision: D27247658

fbshipit-source-id: 866eafc794eff1c262eab3061f14eb597bea0a66
2021-04-19 20:14:22 -07:00
Zeyi (Rice) Fan
e481fe8413 inodes: make tree-overlay a checkout configuration
Summary: This diff allows EdenFS to create tree overlay based on checkout configuration.

Reviewed By: kmancini

Differential Revision: D27242580

fbshipit-source-id: d0ebe33017c16517c117c1886f62bc9c6fe9f466
2021-04-19 19:49:33 -07:00
Xavier Deguillard
e1f54eead9 inodes: make lastCheckoutTime an atomic
Summary:
Now that lastCheckoutTime is a single uint64_t, we no longer need a lock to
protect it, simple atomics are sufficient. Since reading an atomic usually
doesn't require any atomic operation, this will save a handful of atomics when
loading an inode where the last checkout time is read.

Reviewed By: chadaustin

Differential Revision: D27860653

fbshipit-source-id: 464e950c949ca243664d213da99d96ff5d0fcbb8
2021-04-19 14:38:14 -07:00
Xavier Deguillard
28cf1cda9f inodes: make lastCheckoutTime an EdenTimestamp
Summary:
The lastCheckoutTime is mostly used to initialize the timestamps of newly
loaded inodes and since these store an EdenTimestamp, we incur a conversion for
every inode loads. Instead of doing this conversion, we can simply make it an
EdenTimestamp directly.

Similarly, the getNow function was always converted to an EdenTimestamp
(sometimes more than once), we can also make it return the EdenTimestamp
directly.

Reviewed By: chadaustin

Differential Revision: D27860652

fbshipit-source-id: 9ea8fe9a312e6c3d8667b93130bb32a46ab92961
2021-04-19 14:38:14 -07:00
Skotch Vail
a3a02abd7a debug for merge picker
Summary:
I am debugging why some people get vim to pop up during a merge conflict and some do not.

also fixes a few lint issues

Reviewed By: DurhamG

Differential Revision: D27684419

fbshipit-source-id: f636d71c18353a3816d1e442c05790cf4fd7b90b
2021-04-19 12:22:27 -07:00
Pyre Bot Jr
b6af8df1a3 Add annotations to eden/fs/py/eden/thrift/windows_thrift.py
Reviewed By: xavierd

Differential Revision: D27846256

fbshipit-source-id: fed9073df58bd604ffeec2de93e0dd5e96930fb0
2021-04-19 09:19:20 -07:00
Xavier Deguillard
c1e940608f privhelper: do not make macOS NFS mount SOFT
Summary:
While soft mount are nice as they allow the server (edenfs) to die and the
client applications to not end up in D state, this also force a maximum
(non-configuerable) 60s timeout for all IOs, after which application receive a
ETIMEDOUT. Thus, we need to not make the mount hard, thankfully, since the
mount is INTR, applications should not stay in D state if EdenFS dies.

Reviewed By: genevievehelsel

Differential Revision: D27808311

fbshipit-source-id: 17c30e88e5b236418064d8c309d85fdc6f1ca3e9
2021-04-16 17:55:20 -07:00
Pyre Bot Jr
dc8edb9bd7 Add annotations to eden/fs/py/eden/thrift/test/client_test.py
Reviewed By: xavierd

Differential Revision: D27823522

fbshipit-source-id: 6bec6252e1c6f402528aed2ee784ba85373e6db3
2021-04-16 10:14:23 -07:00
Katie Mancini
fd78a70d7a fix prefetch-profile activate
Summary:
activate recently got broken when we added the prefetch-metadata flag,
this needs to be on activate as well as fetch

Reviewed By: xavierd

Differential Revision: D27778771

fbshipit-source-id: 052710c2f206e66d8042314773b6b408cff4915c
2021-04-15 09:30:16 -07:00
Durham Goode
f0f6a38fbe dynamicconfig: backout D26801059 that enabled no-repo configs
Summary: This seems to have broken the EdenFS HgPrefetch test.

Reviewed By: xavierd

Differential Revision: D27795192

fbshipit-source-id: 80a748036961aa6a5750182bf65637fb76825341
2021-04-15 09:00:19 -07:00
Durham Goode
4803877dde dynamicconfig: generate dynamicconfigs when there's no repo
Summary:
Previously we'd skip dynamicconfigs when there wasn't a repo available.
Now that dynamicconfig can represent the NoRepo state, let's load dynamicconfigs
in that situation.

This also supports the case where there is no user name.

Reviewed By: kulshrax

Differential Revision: D26801059

fbshipit-source-id: 377cfffb6695a7fbe31303868a88862259ebf8c4
2021-04-14 14:32:16 -07:00
Pyre Bot Jr
b127a5ab2d Add annotations to eden/fs/cli/doctor/test/disk_usage_test.py
Reviewed By: xavierd

Differential Revision: D27766016

fbshipit-source-id: 9862fc315794feaa5f1dd9f1723514e4a0ba0f25
2021-04-14 13:43:13 -07:00
Andrii Grynenko
e1dc359365 Move ReleasableDestructor into HeaderClientChannel
Summary: Since HeaderClientChannel now accepts a transport unique_ptr there's no need to have this deleter exposed outside of HeaderClientChannel.

Reviewed By: iahs

Differential Revision: D27729209

fbshipit-source-id: 064b03afdfe567b6df6437348596f0f6f97f6aaf
2021-04-13 23:35:41 -07:00
Xavier Deguillard
f462a76f80 nfs: implement the MKNOD procedure
Summary:
This allows unix sockets to be created in the mount. This will allow Buck to
run properly as it tries to create sockets in the repository.

Reviewed By: kmancini

Differential Revision: D27690406

fbshipit-source-id: 5725d68bdda12f3a5882ce48b6bdd02b14cdece4
2021-04-13 15:17:35 -07:00
Xavier Deguillard
dbc51feb5e nfs: add RPC types for MKNOD
Summary: This merely adds the types for the procedure

Reviewed By: kmancini

Differential Revision: D27690405

fbshipit-source-id: b94fb03658cabaece4166c29135c5fdf9a613d3c
2021-04-13 14:59:58 -07:00
Xavier Deguillard
6836229ab3 nfs: implement RMDIR procedure
Summary:
This is roughly the same logic as the UNLINK one with the only difference being
in the handling of "." and "..".

Reviewed By: kmancini

Differential Revision: D27684716

fbshipit-source-id: 86a95c38e6c783bc3a45c0a8b000d0210b6dd0b8
2021-04-13 14:59:57 -07:00
Xavier Deguillard
dbe993312d nfs: add RPC for RMDIR
Summary:
This merely adds the types needed for the RMDIR procedure. Implementation will
follow.

Reviewed By: genevievehelsel

Differential Revision: D27684736

fbshipit-source-id: 84f5a4f3dc805e7893853b0de1dc19cb01c1319f
2021-04-13 14:59:57 -07:00
Xavier Deguillard
62056fb8ea nfs: fix typo in fsstat
Summary:
To get the size in bytes, we need to multiply the quantity with the block size,
not with itself.

Reviewed By: genevievehelsel

Differential Revision: D27690857

fbshipit-source-id: 7d7ca767881b1118fc24befed230a63f342bc911
2021-04-13 14:59:57 -07:00
Zeyi (Rice) Fan
5407ab67bd make msvc happy
Summary: Apparently MSVC isn't able to accept `std::array<char, N>::end()` as `const char*`. This fixes that.

Reviewed By: xavierd

Differential Revision: D27744719

fbshipit-source-id: 61c30f987612db4274c210aea67163505a8878bf
2021-04-13 14:34:41 -07:00
Katie Mancini
bcf6aa465c teach edenfs to signal itself on MacOS nfs
Summary:
MacOS does not have the device field like linux that we can use to mark edenfs
nfs mounts. But there is the `f_mntfromname` field. This field more typically
might have the path which this nfs mount is mirrored from, but it should be fine
to hyjack as the edenfs indicator field.

Reviewed By: xavierd

Differential Revision: D27717945

fbshipit-source-id: 056fb39dc3273b68d79c26487fd045f4e7f93b7b
2021-04-13 09:09:02 -07:00
Katie Mancini
ccb76f1187 make device type for nfs similar to fuse
Summary:
With fuse we report "edenfs:" as the device, let's do the same thing with nfs
so watchman can recognize edenfs nfs mounts similarly.

I think its fine to use the standard "edenfs" as the server name in the mount
call rather than the address, from looking at:
https://www.systutorials.com/docs/linux/man/8-mount.nfs/

Reviewed By: xavierd

Differential Revision: D27630764

fbshipit-source-id: 9e476c90ece90e758b98d140c6bf4067dbca3661
2021-04-13 09:09:02 -07:00
Xavier Deguillard
db2c912111 store: re-enable store tests under tsan
Summary: Running these with tsan appears to run properly, let's try to re-enable them.

Reviewed By: genevievehelsel

Differential Revision: D27723525

fbshipit-source-id: 42e61d26cf478cbe808698a6a0615015832180fa
2021-04-12 18:46:26 -07:00
Genevieve Helsel
1776efce9c log file accesses to edenfs_file_stats_accesses
Reviewed By: chadaustin

Differential Revision: D27660120

fbshipit-source-id: 7e8e64e9a8db62d818db5177155db77195870e0a
2021-04-12 16:58:09 -07:00
Xavier Deguillard
1aee89eaee store: use NO_PRETTY_VALUES when discovering tests
Summary:
The CMake documentation states:

>By default, the value index of value-parameterized tests is replaced by the
>actual value in the CTest test name. If this behavior is undesirable (e.g.
>because the value strings are unwieldy), this option will suppress this
>behavior.

Which appears to be a decent default, but not when the parameter is a pointer,
in which case the test name will contain some hex values.

Reviewed By: genevievehelsel

Differential Revision: D27713222

fbshipit-source-id: 0f15b24d04817384ff975ad7b07e16b744e1eb2e
2021-04-12 13:43:09 -07:00
Xavier Deguillard
f641a24ecf doctor: add types to nfs_test
Summary:
It looks like nfs_test is tripping the nightly pyre infer job causing it to not
publish diff that increase our typing coverage. Let's manually type it to
unblock the nightly job.

Reviewed By: genevievehelsel

Differential Revision: D27682093

fbshipit-source-id: a32df9f5b8eeaef2006de7d64f5adadb763402e8
2021-04-12 11:06:28 -07:00
Yedidya Feldblum
d5de1b81dd migrate from uint64ToBufferUnsafe
Summary: Migrate the codebase away from the ad-hoc `folly::uint64ToBufferUnsafe` and to `folly::to_ascii_decimal` which is intended for these cases.

Reviewed By: WillerZ

Differential Revision: D27281875

fbshipit-source-id: 0c98749e4aed9c873853eed2221cf54a89279ff4
2021-04-09 21:34:38 -07:00
Katie Mancini
4fe39e0a3a make widgets for top
Summary:
We are moving our skelton for eden top a bit further, by creating the view
structure for eden top. This creates the widget for the banner of eden top,
the help page and the main page as well as a couple sections of the main
page.

The main page is displayed on default and they are toggled with `h` for help
page and `esc` to return to the mage page. Visable and hidden widgets are not
implemented in termwiz yet so we have to do a bit of hacking to hide and
display widgets for our selves.

Each of the sections is stubed with place holder text for testing.

Reviewed By: xavierd

Differential Revision: D26892620

fbshipit-source-id: a7bb4d0e11f3a8968ef071e7f585d07a9c286880
2021-04-09 12:27:04 -07:00
Stiopa Koltsov
5853fa3baf Use File::dupCloseOnExec() from folly
Summary: Code cleanup.

Reviewed By: kmancini

Differential Revision: D27556087

fbshipit-source-id: e19ae631b46a8461fb7fe02712846e4c4071dd6f
2021-04-09 10:37:04 -07:00
Xavier Deguillard
4f999f5daf store: reduce verbosity of tree fetching
Summary:
Our logs are filled with this message, making it almost impossible to read,
this doesn't need to be DBG1, let's reduce it to DBG5 similarly to what we do
for blobs.

Reviewed By: kmancini

Differential Revision: D27652526

fbshipit-source-id: c61d502a9f17d8180bad857ff6c1a9033763947d
2021-04-08 18:56:11 -07:00
Morgan Newman
7ed6627c6b add --prefetch-metadata flag to prefetch profiles CLI
Summary: Here we further add prefetch-metadata support to prefetching profiles

Reviewed By: genevievehelsel

Differential Revision: D27568542

fbshipit-source-id: 64507125f47cf093c0133c82fcab941ed6495f32
2021-04-07 09:17:11 -07:00
Xavier Deguillard
24e3919dea privhelper: allow mounting via NFS on macOS
Summary:
On macOS, the mount syscall for NFS expects the arguments to be XDR encoded.
This set of argument roughly match with its Linux counterpart and appears to
start the mount process. It fails early on when trying to access the .hg
directory but this is probably an issue with the NFS server code, not of the
mounting code.

Reviewed By: kmancini

Differential Revision: D27306769

fbshipit-source-id: 697fadfddc4048ef56c3a23f75dd5bdbcc92af1b
2021-04-06 14:17:00 -07:00
Stiopa Koltsov
a252bb1307 follow-up to sandcastle_instance_id
Summary:
* use `std::nullopt`
* TODO about sandcastle_instance_id in opensource version

Reviewed By: chadaustin

Differential Revision: D27575732

fbshipit-source-id: bf76970a15fee5a3dc1e4e411ea70f5af7248496
2021-04-06 13:14:12 -07:00
Stiopa Koltsov
babc84bed6 Add sandcastle_instance_id column to scuba
Summary: To be able to quickly find all activity related to given Sandcastle job as discussed in [this workplace post](https://fb.workplace.com/groups/2120196508269853/permalink/2899040243718805).

Reviewed By: kmancini

Differential Revision: D27541803

fbshipit-source-id: a55900064bbee92da902de785ebe0c0e8738c3a2
2021-04-03 00:11:47 -07:00
Morgan Newman
5debd246b9 add --prefetch-metadata flag to prefetch command
Summary: As titled.

Reviewed By: kmancini

Differential Revision: D27519428

fbshipit-source-id: 00da2c8dc6647d87c935ee2db0bb11fe2f7f8103
2021-04-02 14:33:59 -07:00
Stiopa Koltsov
ec1e6b5bea log session id on startup
Summary:
Currently eden on startup prints:

```
Starting edenfs (dev build), pid 190
Opening local RocksDB store...
Opened RocksDB store in 0.073 seconds.
Could not parse config.json file: couldn't read /var/twsvcscm/local/.eden/config.json: No such file or directory
Skipping remount step.
Started edenfs (pid 190)
Logs available at /var/twsvcscm/local/.eden/logs/edenfs.log
```

Would be convenient if it also printed session id, to be able to query scuba straight away.

Reviewed By: chadaustin

Differential Revision: D27522665

fbshipit-source-id: d7d4cf6c97bc551061761f2653375f208e393498
2021-04-02 11:36:13 -07:00
Stiopa Koltsov
afddf66676 Move getSessionId to a separate file
Summary: Refactoring to make the following diff smaller.

Reviewed By: chadaustin

Differential Revision: D27522581

fbshipit-source-id: 8f858714fcbfe4b8f8b1c3678bb2003623abbd94
2021-04-02 11:36:13 -07:00
Stiopa Koltsov
fe00ae209e Do not inherit stderr copy in scribe_cat
Summary:
Still trying to enable Scuba logging in ovrsource TD to figure out what caused Buck regression when we started working with multiple watchman instances.

Did not try previous fix of pgrp (deploying stuff on Sandcastle is not trivial), although now I'm not sure that pgrp was the issue. Hard to say.

But now I'm launching CI differently and observe different symptoms.

`eden start` command finishes in 30 seconds (according to logs), but Sandcastle waits for something for 10 minutes and then somebody kills `scribe_cat` and Sandcastle continues. I don't really know what that means, but there's another issue I discovered:

`scribe_cat` inherits a copy of stderr fs created during daemon startup.

This diff fixes the issue.

Reviewed By: kmancini

Differential Revision: D27494520

fbshipit-source-id: 069f4e9ea1efb553cf7a7f18e20ae92c27da808d
2021-04-02 09:57:16 -07:00
Stiopa Koltsov
c247025da9 Log how long it took for eden to start
Summary:
I see in Sandcastle logs it was 10 minutes between `eden start` command and the following command.

So I'm curious, is it eden took 10 minutes to start or Sandcastle did something else but did not log it?

This little message in log will help to understand that.

Reviewed By: kmancini

Differential Revision: D27491709

fbshipit-source-id: 796c8db5abe49b056bd81b03ea57585a761c3cb6
2021-04-01 10:32:18 -07:00
Stiopa Koltsov
18957b3401 Call setpgrp early in daemon init
Summary:
We call `setsid` too late, [on successful startup](https://fburl.com/diffusion/p88am07t), after `scribe_cat` binary launched.

As a result, `scribe_cat` does not belong to process group of eden, it belongs to the process group of launcher process, so it is killed by `timeout` command in ovrsource CI.

To deal with it, this diff proposes additionally calling `setpgrp` call early during initialization.

Reviewed By: chadaustin

Differential Revision: D27436474

fbshipit-source-id: acb168c1ab5b78b1598c34ebece88847a9a6480d
2021-03-31 18:34:55 -07:00
Xavier Deguillard
82720fa0b8 privhelper: make NFS mount soft
Summary:
In the case where EdenFS crashes, any client performing IO to EdenFS would be
stuck in the D state waiting for the server to be back up and running. Since on
restart EdenFS will chose different ports, this makes it hard/impossible to
actually recover and will keep some process unkillable, often time requiring
rebooting a host.

To avoid this, we can make the mount "soft" which aborts the IO after some time
has elapsed and the server isn't back up. This should enable us to kill these
processes and recover more gracefully.

Reviewed By: chadaustin

Differential Revision: D27402817

fbshipit-source-id: ff81a4360900c4c94665174e3c0cf63402f1533e
2021-03-31 13:34:20 -07:00
Xavier Deguillard
49b103584c nfs: call incFsRefcount when giving an InodeNumber
Summary:
During an `hg update`, all the loaded inodes are unloaded and forgotten, except
the ones that had a positive refcount, these are forgotten when FUSE calls the
`forget` API. For NFS, this `forget` API doesn't exist but the protocol relies
on file handle to stay valid for some time. The duration for which a file
handle need to stay alive depends on several factor. The root one needs to
always be valid, the rest relies on the lookup cache that the client keeps.
This lookup cache is invalidated when the mtime for the parent directory
changes, but mtime changes are often not immediately detected, as attributes
are cached client side with the `acdirmin` and `acregmin` for directories and
files.

For now, this diff doesn't attempt to deal with files being out of date right
after an `hg update`, it merely accounts for the NFS client being able to pass
old file handles to EdenFS. The astude reader will have noticed that
InodeNumber are never reclaimed for now, for that, a time-based mechanism will
need to be added to forget InodeNumbers that have expired.

Reviewed By: kmancini

Differential Revision: D27405295

fbshipit-source-id: af4a4ce9e31bfcc335608da91f0247b50ab87b3f
2021-03-30 19:10:58 -07:00
Xavier Deguillard
b900d402de privhelper: add XDR types for macOS mount arguments
Summary: On macOS, the mount argument are encoded with XDR, let's add them first before using them.

Reviewed By: genevievehelsel

Differential Revision: D27306770

fbshipit-source-id: 727824f05d3874119858af60c263267adfb3e61e
2021-03-30 10:16:14 -07:00
Xavier Deguillard
0e711bb181 inodes: make updateMtimeAndCtime return void
Summary:
The returned value was never used by any callers, let's simply not return any
value.

Reviewed By: kmancini

Differential Revision: D27418015

fbshipit-source-id: 2a6f15eee01052cdfa9ae334c34e69f2f0a74407
2021-03-30 10:07:52 -07:00
Xavier Deguillard
abc6a09aac inodes: update a directory mtime on update
Summary:
When EdenFS is mounted via FUSE, the changed directory and files are flushed so
the kernel is forced to re-read them to obtain new InodeNumber. When NFS is
used, EdenFS can't directly invalidate the client view of the FS, instead we
need to rely on when and how is this invalidated. On Linux, a file handle won't
be refreshed if its parent directory hasn't changed, which is done by looking
at the mtime of the directory by performing a GETATTR call. It is thus crucial
that the mtime is updated during an `hg update`.

Reviewed By: chadaustin

Differential Revision: D27403729

fbshipit-source-id: 1f7195c6c33e2a34c3bb73145f404d652302d828
2021-03-29 15:06:58 -07:00
Xavier Deguillard
a5d2a857f5 inodes: remove ifdef around update{Atime,MtimeAndCtime}
Summary:
We can move the ifdef in the function itself. This makes the functions calling
these easier to read, and it's less likely for someone to forgot to add the
proper ifdef. If we also ever want to make these do something on Windows, it
will be easier to do too.

Reviewed By: chadaustin

Differential Revision: D27403730

fbshipit-source-id: c5b78ea7c7eb70eaf8d4974e5bec14296f91576f
2021-03-29 15:06:58 -07:00
Xavier Deguillard
c0e3d78468 nfs: allow serializing std::optional
Summary:
Non-list optional data can be present in some XDR description, let's special
case it so the intent is clear when declaring XDR datastructures.

Reviewed By: fanzeyi

Differential Revision: D27306768

fbshipit-source-id: 9d4d18bf8deff16f859c6d28a2579341dac8ee6f
2021-03-29 09:20:33 -07:00
Xavier Deguillard
53700635c1 nfs: when receiving a packet iterate over all the fragments
Summary:
After receiving a network packet, it's possible that more than one fragment
were received as part of it. We thus need to service all of them before
returning.

This would typically be seen when running `rg` in the repository, which would
cause hangs due to some requests not being serviced as they would stay in the
iobuf queue until a new packet was received.

Reviewed By: kmancini

Differential Revision: D27194038

fbshipit-source-id: 3d81c797b5be7d0466d4acad7208f6a82593b4ca
2021-03-29 09:20:33 -07:00
Xavier Deguillard
2cb1a14b42 nfs: use a cached chain length when building the fragment
Summary:
Computing the length of an iobuf chain can be expensive due to having to walk
its entirety. Thanksfully, IOBufQueue can cache the total length when data is
appended to it, which makes computing the length a constant operation.

Reviewed By: kmancini

Differential Revision: D27194037

fbshipit-source-id: af659c162ada61f2796bf407f419f5f15e918c02
2021-03-29 09:20:33 -07:00
Xavier Deguillard
a598d6ceb4 nfs: move servicing of NFS callback to a threadpool
Summary:
By moving the work to a background threadpool, we can more quickly go back to
servicing incoming NFS requests and thus allow more work to be done
concurrently. This would allow tools like ripgrep to being able to use multiple
cores to search in the code base.

Reviewed By: genevievehelsel

Differential Revision: D27194040

fbshipit-source-id: 7f1775ddaaa7eaf8776a06d05951cb936cd3fbb5
2021-03-29 09:20:33 -07:00