Commit Graph

5161 Commits

Author SHA1 Message Date
Kostia Balytskyi
1256d9cf45 commitcloud: add reversefillerqueue to the repo_client schemas
Summary: This is an sqlite equivalent of what exists in xdb now.

Reviewed By: krallin

Differential Revision: D21427621

fbshipit-source-id: 7024fbf7a8773c4465d2e6ee327aadeaf87cb213
2020-05-07 02:56:39 -07:00
Jun Wu
ead30c096c phrevset: rewrite pull -r Dxxx into pull -r HASH
Summary: This matches user expectation.

Reviewed By: sfilipco

Differential Revision: D21320629

fbshipit-source-id: 0464b813c01fe31a2ca9473d5b389e563c7a2827
2020-05-06 15:29:57 -07:00
Jun Wu
495bf73f13 phrevset: implement autopull in revset layer
Summary:
Implement autopull so non-automation `hg pull -r Dxxxx`, `hg up Dxxxx` will
pull `Dxxxx` automatically.

Since we now autopull the commits, error messages are removed. The old code
actually causes issues because it will raise at `"D1234" in repo`, which is
a surprise to many code paths, including the revset autopull logic, which
uses `x in repo` to decide whether `x` is unknown.

Note `hg pull -r Dxxxx` is not using the revset layer and needs to be handled
separately. It works for hg servers right now because the server can translate
`Dxxx` to a commit hash. It probably does not work for a Mononoke server.

Reviewed By: sfilipco

Differential Revision: D21320626

fbshipit-source-id: 939abe12e3a9a8ed5ca7ed29bb4f90fb39e7674a
2020-05-06 15:29:57 -07:00
Jun Wu
c08236ccc9 phrevset: make diffid -> node translation infalliable
Summary:
Change the interface to return infallible `Optional[node]` instead of fallible
`List[rev]`.  In the next diff, we're going to use the 'node' information to
implement autopull.

Reviewed By: sfilipco

Differential Revision: D21320628

fbshipit-source-id: 6f7c070faba667cc85313cc78d6149c787ca8593
2020-05-06 15:29:56 -07:00
Jun Wu
cb3b437fe5 phrevset: improve sucessor calculation
Summary:
Currently, phrevset picks the "successor" that has the maximum revision
number. That depends on the assumption that larger revision numbers
are modified last. Howevver, that's not always true with commit cloud sync. For example, in my repo I have D21179514 modified from 63768bf43
to 684612d5d. Phabricator has 63768bf43. Local successor is 684612d5d,
but the revision number of 684612d5d is smaller than 63768bf43:

    quark@devvm1939 ~/hg/edenscm/hgext % hg log -r 'D21179514'
    changeset:   63768bf436d01982a8d42ce97160ac6d9ae2cdad  D21179514
    user:        Jun Wu <quark@fb.com>
    date:        Wed, 22 Apr 2020 09:45:50 -0700
    summary:     [hg] commitcloud: log metalog root during update references

    quark@devvm1939 ~/hg/edenscm/hgext % lhg log -r 'D21179514'
    changeset:   684612d5d606b01c224889f2b3f87aff7b93db49  D21179514  (@)
    user:        Jun Wu <quark@fb.com>
    date:        Wed, 22 Apr 2020 10:10:37 -0700
    summary:     [hg] commitcloud: log metalog root during update references

    quark@devvm1939 ~/hg/edenscm/hgext % lhg log -r 'successors(63768bf436d0198
    2a8d42ce97160ac6d9ae2cdad)' -T '{node} {rev}\n'
    684612d5d606b01c224889f2b3f87aff7b93db49 76718
    63768bf436d01982a8d42ce97160ac6d9ae2cdad 95363

Improve it by actually prefer selecting a non-obsoleted successor.

Reviewed By: sfilipco

Differential Revision: D21267552

fbshipit-source-id: d43d72a7c273c55af70bb41ad967fff0c78a452a
2020-05-06 15:29:56 -07:00
Jun Wu
e1179f695e autopull: pull names in batch
Summary: This is more efficient (if pullattempts have high chance to succeed).

Reviewed By: sfilipco

Differential Revision: D21320627

fbshipit-source-id: a2166f5a59f98c7d705c806b9d152ceb9981f3be
2020-05-06 15:29:55 -07:00
Jun Wu
e89e16d35c autopull: make autopull function declarative
Summary:
Make it so that the autopull functions just describe what to do (using the
`pullattempt` struct) instead of having the side effect directly. This will be
useful in multiple cases:
- The actual autopull logic becomes easier to implement.
- The revset autopull layer can merge `pullattempt`s to fetch things in one go.
- The `pull -r` logic can reuse the `pullattempt`s to translate what to pull
  (ex. from `D1234` to a commit hash).

This has subtle changes that multiple "remote"s are no longer properly
supported.  That is probably fine in our production use-cases but we might
want to revisit if we want to support remotes "properly".  Currently, this
greatly simplifies things due to the fact that "infinitepush" or
"infinitepushbookmark" have to be used in certain cases.

Reviewed By: sfilipco

Differential Revision: D21320633

fbshipit-source-id: e38b68abf69a34a97431685aa7ab0d2fe022fda8
2020-05-06 15:29:55 -07:00
Jun Wu
1ee6f1f91a registrar: add autopullpredicate
Summary: Add a way for extensions to register how to auto pull unknown names.

Reviewed By: sfilipco

Differential Revision: D21320630

fbshipit-source-id: d20e11cff83b8a7e15a5085b0508a3e5bef305c3
2020-05-06 15:29:55 -07:00
Jun Wu
a5c1b003a3 autopull: move to a module
Summary:
We're going to make autopull more complicated. Move it to a separate module as
it is not directly related to revset.

Reviewed By: sfilipco

Differential Revision: D21320631

fbshipit-source-id: fe60bc53ebf1c75f8bf66156805cbe2801fe6532
2020-05-06 15:29:54 -07:00
Jun Wu
a71893676d autopull: analyze unknown names before revset optimization
Summary:
The revset optimization makes unknown names harder to extract.  For example,
`(or (list "a" "b" "c"))` will be optimized to `(_list "a\0b\0c")` and it
becomes harder to extract `"a"`, `"b"`, and `"c"`.

Move the unknown name extraction logic to before the optimization step to solve
it.

Reviewed By: sfilipco

Differential Revision: D21320632

fbshipit-source-id: 3a25f1cf4aab0449be6952113d622f29b1c0b631
2020-05-06 15:29:54 -07:00
Wez Furlong
b29f7a1020 eden: fix compilation on latest vs2017
Summary:
vs2017 is not able to compile the static assertion in KeySpace.cpp.
Previously we thought that this would be resolved in a later release of vs2017
but now that is here it is clear that it hasn't been fixed.

This commit pushes the version requirement to vs2019 (see
https://dev.to/yumetodo/list-of-mscver-and-mscfullver-8nd for a mapping between
product versions and compiler versions), but we cannot build with vs2019
because folly and rangev3 don't compile with vs2019, so this assertion (heh!)
has literally not been tested.

This commit also fixes up an oversight in the gating logic: the intent is that
we perform the assertion on all systems except known broken MSVC.  We were
accidentally restricting it to later versions of MSVC.

Reviewed By: simpkins

Differential Revision: D21432890

fbshipit-source-id: e11ffccc53bf8dffdf2db45ad4f3cf199b1cc70d
2020-05-06 15:05:37 -07:00
Jun Wu
44c8c7a9e3 transaction: write hgrc to metalog
Summary:
This allows us to understand what config is used during a transaction.
For example, is `selectivepull` enabled during a `pull`?

Reviewed By: DurhamG

Differential Revision: D21222146

fbshipit-source-id: a8c82f2b02e9657885947a706f728e28b1bfc1e2
2020-05-06 12:15:36 -07:00
Durham Goode
1fdc23ddf6 progress: invalidate engine on process fork
Summary:
We're seeing deadlocks where if the process forks (like in a update
worker) while a background python thread is holding the progress lock, it can
cause a deadlock in the forked process if the thread ever tries to access the
progress bar.

To fix it, let's invalidate the engine if the process forks.

Reviewed By: xavierd

Differential Revision: D21415152

fbshipit-source-id: 75607dd2c1ed122b3a9df68d359ba9dcdde78a77
2020-05-06 12:01:39 -07:00
Lukas Piatkowski
179a72ef4e mononoke: fixup licenses in mononoke
Reviewed By: krallin

Differential Revision: D21427558

fbshipit-source-id: dc46b4269836bbb70636efcea24c3ead090df84c
2020-05-06 10:00:19 -07:00
Stanislau Hlebik
5e095198eb mononoke: fix scrub_get race
Summary:
There was a bug in scrub blobstore that caused failures while traversing the
fsnodes.
If all blobstores returned None, then we need to return None and not fail as we
do now. So the situation we ran into was:
1) fsnodes is not derived, all blobstore return None
2) Previously it returned the error, which later checked in
https://fburl.com/diffusion/mhhhnkxv - this check makes sure there's no entry
with the same key on the queue. However by that time fsnodes might already be
derived and someone else might insert a new entry in the blobstore and in the
queue. This would return an error to the client.

The fix here is to not fail if all blobstores returned None

Reviewed By: ahornby

Differential Revision: D21405418

fbshipit-source-id: 21fe130ce65a0087c408a5014e5b108c7ce8fe6c
2020-05-06 09:20:42 -07:00
Durham Goode
aa99e36327 configs: convert (www|www-merge)_overrides.rc
Summary: Converts (www|www-merge)_overrides.rs to our dynamic config generator

Reviewed By: quark-zju

Differential Revision: D21412128

fbshipit-source-id: d248d3b756e4f59038cb33335ba4a023fe335b2c
2020-05-06 09:03:18 -07:00
Durham Goode
939ff6c956 configs: move repo names to a enum
Summary:
A number of repo names are used quite frequently. Let's use an enum to
prevent typos and make things cleaner.

Reviewed By: quark-zju

Differential Revision: D21365036

fbshipit-source-id: 1d3d681443df181e9076f5ee87029ae61124a486
2020-05-06 09:03:17 -07:00
Lukas Piatkowski
ff2eddaffb mononoke: reverse autocargo include list to excludes
Summary: Cover as much as remining code with `Cargo.toml`s, for the rest create an exlusion list in the autocargo config.

Reviewed By: krallin

Differential Revision: D21383620

fbshipit-source-id: 64cc78a38ce0ec482966f32a2963ab4939e20eba
2020-05-06 08:43:18 -07:00
Stanislau Hlebik
864a9bc991 mononoke: remove pending_heads
Summary: The alarm was already removed in D21425313

Reviewed By: krallin

Differential Revision: D21425971

fbshipit-source-id: d043e1393e497bdf29f28d224d7e710b6beaa8f8
2020-05-06 07:55:04 -07:00
Stanislau Hlebik
d3fd4f09a2 mononoke: renamed futures to futures-old
Reviewed By: krallin

Differential Revision: D21425900

fbshipit-source-id: 121bf1d9e5527bd6f035f1f7a506ad0f75de68fc
2020-05-06 07:55:04 -07:00
Stanislau Hlebik
1b9bf79c69 mononoke: asyncify is_derived
Reviewed By: krallin

Differential Revision: D21425882

fbshipit-source-id: 9c3969da679339e13818928a0c8de06f6ae78958
2020-05-06 07:55:04 -07:00
Stanislau Hlebik
043887c13e mononoke: asyncify find_underived
Reviewed By: krallin

Differential Revision: D21425800

fbshipit-source-id: e445bb8e10fd8c41b0322cbe4de5f6fd0a4e924c
2020-05-06 07:55:03 -07:00
Lukas Piatkowski
2a1863c35d mononoke/server: make the main mononoke binary OSS buildable
Summary: Covering repo_listener and microwave plus some final touch and we have a buildable Mononoke binary.

Reviewed By: krallin

Differential Revision: D21379008

fbshipit-source-id: cca3fbb53b90ce6d2c3f3ced7717404d6b04dd51
2020-05-06 06:11:02 -07:00
Lukas Piatkowski
7033889eac mononoke/repo_client: make repo_client buildable in OSS
Summary:
There are few related changes included in this diff:
- backsyncer is made public
- stubs for SessionContext::is_quicksand and scuba_ext::ScribeClientImplementation
- mononoke/hgproto is made buildable

Reviewed By: krallin

Differential Revision: D21330608

fbshipit-source-id: bf0a3c6f930cbbab28508e680a8ed7a0f10031e5
2020-05-06 06:11:02 -07:00
Mistral Orhan Jean-Pierre Contrastin
5fe820dd06 Expose ctime from Blobstore::get() in mononoke
Summary:
- Change get return value for `Blobstore` from `BlobstoreBytes` to `BlobstoreGetData` which include `ctime` metadata
- Update the call sites and tests broken due to this change
- Change `ScrubHandler::on_repair` to accept metadata and log ctime
- `Fileblob` and `Manifoldblob` attach the ctime metadata
- Tests for fileblob in `mononoke:blobstore-test` and integration test `test-walker-scrub-blobstore.t`
- Make cachelib based caching use `BlobstoreGetData`

Reviewed By: ahornby

Differential Revision: D21094023

fbshipit-source-id: dc597e888eac2098c0e50d06e80ee180b4f3e069
2020-05-06 00:55:07 -07:00
Zeyi (Rice) Fan
61f67c044a batch fetch blobs
Summary: Instead of having `HgBackingStore` fetch blobs separately, we now try to read from hgcache and fetch from `HgImporter` as batches.

Reviewed By: chadaustin

Differential Revision: D20903245

fbshipit-source-id: d8e404d6765f1bcbacbf2a39f83eab0a351a3fe0
2020-05-05 20:59:04 -07:00
Zeyi (Rice) Fan
5bf6b58928 clean up HgQueuedBackingStore
Summary: split functions up.

Reviewed By: chadaustin

Differential Revision: D20808045

fbshipit-source-id: 3160566deb763c888a0bf34557d934feccc5ae3b
2020-05-05 20:59:04 -07:00
Zeyi (Rice) Fan
cc880f9622 populate multiple requests at once from the queue
Summary: This diff makes `HgImportRequestQueue` to be able to return multiple requests in the queue at once.

Reviewed By: chadaustin

Differential Revision: D20197070

fbshipit-source-id: 8cff1780d6e56321a756d30ac0e9b9d5d319c049
2020-05-05 20:59:03 -07:00
Zeyi (Rice) Fan
beb58087c9 track request by attaching the tracker to the Future
Summary: The life of a request is only able to be finished with one of the method. So we can instead having the tracker destroyed when the future is resolved.

Reviewed By: chadaustin

Differential Revision: D20995819

fbshipit-source-id: 5dac2f762513b5d0bcacaab7d0669fc8fdb61e80
2020-05-05 20:59:03 -07:00
Zeyi (Rice) Fan
659d185b4f Split HgBackingStore::getBlob
Summary:
Readability improvements.

`HgQueuedBackingStore` will need to call these functions individually.

Reviewed By: chadaustin

Differential Revision: D20683321

fbshipit-source-id: 9a9bd766c34559048bd0971f17304090abbb2774
2020-05-05 20:59:03 -07:00
Zeyi (Rice) Fan
4b2a6b7f16 remove Mononoke usage in HgBackingStore
Reviewed By: genevievehelsel

Differential Revision: D20909616

fbshipit-source-id: 5bd8cc386dc1a5fdfaf2c4fd0cabbb18da1ed179
2020-05-05 20:59:02 -07:00
Mohan Zhang
2ef3e20e4d Run auto cargo locally
Summary: Since thirdpart depedency change on D21341319

Reviewed By: jsgf, wqfish

Differential Revision: D21417890

fbshipit-source-id: 3cc6bafa23512c7ae489513216bcafa46e7a744f
2020-05-05 20:59:02 -07:00
Chad Austin
0e86e57c2c disallow import helpers from spawning watchman instances
Summary:
During a graceful restart, while the fuse mount is not handling
requests, avoid a possible deadlock between the edenfs, hg
debugedenimporthelper, and watchman processes.

See the comment in HgImporter.cpp.

Reviewed By: fanzeyi

Differential Revision: D21342275

fbshipit-source-id: df8fb5df5d5cd1490e88b42054b34cbb2acdb692
2020-05-05 20:46:31 -07:00
Zeyi (Rice) Fan
952069397c fix get blob local
Summary: This bug got in while iterating the original Diff. It should only be returning empty when the blob does not exist locally.

Reviewed By: xavierd

Differential Revision: D21417659

fbshipit-source-id: 676e22313ab4a024af5341d8c99797fc062bd293
2020-05-05 20:21:21 -07:00
Durham Goode
022196d3b7 configs: convert instagram-server_overrides.rc
Summary: Converts instagram-server_overrides.rc to our dynamic config generator

Reviewed By: quark-zju

Differential Revision: D21339855

fbshipit-source-id: 1cd4709c1f239322de3ccf516c4ebef519ea41ac
2020-05-05 18:19:11 -07:00
Durham Goode
726e3f6a73 configs: convert configerator_overrides.rc
Summary: Converts configerator_overrides.rc to our dynamic config generator

Reviewed By: quark-zju

Differential Revision: D21339856

fbshipit-source-id: 84bd17d04db1a2e6070eb5e75bda668a596822d4
2020-05-05 18:19:11 -07:00
Durham Goode
97d84e3b5d configs: move hgrc.dynamic to always be in the shared repo
Summary:
Instead of trying to maintain two hgrc.dynamic's for shared repositories,
let's just always use the one in the shared repo. In the long term we may be
able to get rid of the working-copy-specific hgrc entirely.

This does remove the ability to dynamically configure individual working copies.
That could be useful in cases where we have both eden and non-eden pointed at
the same repository, but I don't think we rely on this at the moment.

Reviewed By: quark-zju

Differential Revision: D21333564

fbshipit-source-id: c1fb86af183ec6dc5d973cf45d71419bda5514fb
2020-05-05 18:19:10 -07:00
Durham Goode
c326c5fc6b configs: log dynamic config mismatches to scuba
Summary: Let's log the mismatches to scuba so we can track them down.

Reviewed By: quark-zju

Differential Revision: D21313255

fbshipit-source-id: ee79c9504a80ebe5b21849c0eae5993b65eaff28
2020-05-05 18:19:10 -07:00
Durham Goode
b9223b9db6 sampling: move ui.log sampling logic to core
Summary:
In a future diff we want to log information about configuration
mismatches. In order to do that, we need to be able to call ui.log before
extensions are setup. Let's move the ui.log sampling logic into core so it can
be called before extension setup.

Reviewed By: quark-zju

Differential Revision: D21313257

fbshipit-source-id: fe1c0f572720c17e7398f2a4fa7082ef8fb59536
2020-05-05 18:19:09 -07:00
Durham Goode
ece8408993 configs: migrate devserver_no_sandcastle_overrides.rc
Summary:
Moves the conditional configuration from
devserver_no_sandcastle_overrides.rc into our dynamic config fb rules.

Reviewed By: quark-zju

Differential Revision: D21310916

fbshipit-source-id: 116711afbfa9fb9f134bbe55b7b8b302b39dab36
2020-05-05 18:19:09 -07:00
Durham Goode
e67d609e1d configs: validate dynamic configs
Summary:
Adds python logic for validating the dynamic configs. Any dynamic
configs that don't match the given list of rc files will be reported and removed

Reviewed By: quark-zju

Differential Revision: D21310919

fbshipit-source-id: 07f584bba990f1b01347dfbc285e3ca814fe5c5a
2020-05-05 18:19:09 -07:00
Durham Goode
6e7f85b949 config: load .hg/hgrc.dynamic
Summary:
Adds .hg/hgrc.dynamic to the default load path, before .hg/hgrc though,
so it can be override.

Reviewed By: quark-zju

Differential Revision: D21310921

fbshipit-source-id: 288a2a2ba671943a9f8532489c29e819f9d891e1
2020-05-05 18:19:08 -07:00
Durham Goode
dc90e2ca04 configs: add domain, platform, and improve dynamicconfigs
Summary:
Adds dynamic config conditionals for domain, platform, and adds a few
useful helper functions.

Reviewed By: quark-zju

Differential Revision: D21310920

fbshipit-source-id: 58f35e52d6d7a4edae2b3aefff533ef2c021aa57
2020-05-05 18:19:08 -07:00
Xavier Deguillard
8f872412e6 config: restrict stat comparison on Windows
Summary:
On Windows, the following pseudo code:

  int fd = open("file");
  struct stat st;
  fstat(fd, &st);

Will have a different st_dev than the following code:

  struct stat st;
  stat("file", &st);

Since the FileChangeMonitor uses st_dev as a way to compare if a file
changed, the config is always reloaded.

For our use case, the filesize and its mtime should be enough to know if the
configuration changed, so let's only use these 2 on Windows.

Reviewed By: wez

Differential Revision: D21312679

fbshipit-source-id: f08b3eb7d6037f5d88ece82efe3a5437b1954ba2
2020-05-05 18:14:55 -07:00
Xavier Deguillard
5fc68d15f9 inodes: enable RenameTest on Windows
Summary:
Only the mtime test had to be disabled due to getMetadata not being tracked
on Windows.

Reviewed By: wez

Differential Revision: D21312680

fbshipit-source-id: 5678956ed2b8b45b38d44c459557161aa6fd222e
2020-05-05 18:14:55 -07:00
Xavier Deguillard
6d726d574a inodes: enable RemoveTest for Windows
Summary:
Fairly straightforward, one change to the test was necessary as reading an
unlinked file cannot be done on Windows.

Reviewed By: wez

Differential Revision: D21312681

fbshipit-source-id: c8cca5eeca7825983176ef618007c514b8e02140
2020-05-05 18:14:54 -07:00
Xavier Deguillard
6d4a55a3ea win: change the argument order for writeFile
Summary:
This brings it closer to folly::writeFile which should help in avoiding ifdef
whenever we want to use it.

Reviewed By: wez

Differential Revision: D21319020

fbshipit-source-id: 80fbf7fba671b18b5ef68375910e1a2a8869f590
2020-05-05 18:14:54 -07:00
Durham Goode
8744b81151 git: update git dependency to 0.13.5 to match internal version
Summary:
Our internal git dependency got upgraded, so we need to upgrade our
Cargo.toml version.  Unfortunately this doesn't seem to have any test coverage?

Reviewed By: singhsrb

Differential Revision: D21410241

fbshipit-source-id: 64fe7f39a9c93aa5d97ce095ee1641c1cc6ed365
2020-05-05 15:35:12 -07:00
Adam Simpkins
2e0f442a24 work around slightly broken AF_UNIX connect() behavior on Windows
Summary:
On Windows calling `connect()` on an AF_UNIX socket path that does not exist
creates a file at that location.  This is problematic as it now prevents
servers from binding to that path.  Even if the server attempts to remove the
file in order to bind, clients attempting to call `connect()` can race with it
and make binding fail.

This updates our client connection code check to see if the file exists before
attempting to call `connect()`.  This can still race with a server that is
trying to remove an old socket and re-bind, but it at least makes the race
less likely to happen.

Reviewed By: genevievehelsel

Differential Revision: D21410571

fbshipit-source-id: 3df63b19b40b25be98108246186a48a379cdab28
2020-05-05 15:03:57 -07:00
Durham Goode
1cd598279e backout D21348756 about printing progress of downloads
Summary:
The formatter is broken, it prints to stdout which breaks json output,
and it's questionable whether we want a new line printed to the user for every
200k files downloaded.

Reviewed By: quark-zju

Differential Revision: D21409529

fbshipit-source-id: 2a5d94f8fcc62dbe25f0aae5453e4664c49fdcb2
2020-05-05 14:33:22 -07:00
Thomas Orozco
3b14b52337 mononoke/scuba_ext: allow truncating overly long msg fields
Summary:
When we log to Scuba, we need to truncate the `msg` field if it's too long, or
we might be missing log entries in Scuba. I put this behind a tunable so we can, well,
tune it.

Reviewed By: farnz

Differential Revision: D21405959

fbshipit-source-id: 08f0d3491d1a9728b0ca9221436dee2e8f1a17eb
2020-05-05 12:28:51 -07:00
Chad Austin
b9ba1b40af fix help text for info subcommand
Summary:
The name of a checkout is not a public concept, so refer to the
checkout's path.

Reviewed By: genevievehelsel

Differential Revision: D21393208

fbshipit-source-id: 4c014a6f65515f4632f2dffe5d563d0ee859dda0
2020-05-05 12:09:12 -07:00
Chad Austin
e0cfe9e104 rename stats io to stats fuse and stats latency to stats fuse-latency
Summary:
When I want FUSE stats, I never run `eden stats io`. To unify the
command language, rename `io` to `fuse` and `latency` to
`fuse-latency`, to match `thrift` and `thrift-latency`.

Leave aliases in place in the off chance someone cares.

Reviewed By: genevievehelsel

Differential Revision: D21392931

fbshipit-source-id: 843c1c85ea0aa162ba167f251f0f2cde5a389e72
2020-05-05 12:09:12 -07:00
Chad Austin
8b5c1e66b7 remove stats memory command
Summary:
`eden stats memory` was never useful because it shows system
statistics which you can get better from `top`, `htop`, or `atop`.

Reviewed By: genevievehelsel

Differential Revision: D21392737

fbshipit-source-id: 010021b8a97bd8ba8ac289d906acc3c3ecd10768
2020-05-05 12:09:11 -07:00
Zeyi (Rice) Fan
1c4c0f4024 fix perfect forwarding problem
Summary: So the linter will stop nagging at my changes to this file.

Reviewed By: wez

Differential Revision: D21396011

fbshipit-source-id: dbc3479637cca83aa1a11ff94a9033dfa42fc2a6
2020-05-05 11:46:21 -07:00
Zeyi (Rice) Fan
3baa8cc9b4 check if the blob fetching is present locally
Summary:
Talked with xavierd last week and we can use LocalStore's `get_missing` to determine if a blob is present locally. In this way we can prevent the backingstore crate from accidentally asking EdenAPI for a blob, so better control at EdenFS level.

With this change, we can use this function at the time where a blob import request is created with confidence that this should be short cheap call.

This diff should not change any behavior or performance.

Reviewed By: xavierd

Differential Revision: D21391959

fbshipit-source-id: fd31687da1e048262cb4eae2974cab6d8915a76d
2020-05-05 11:14:40 -07:00
Thomas Orozco
cef5d8d956 mononoke: test-linknodes: add more testing
Summary:
This test is flaky right now, but it's not clear why. I'm also unable to repro.
Let's add more logging.

Reviewed By: StanislavGlebik

Differential Revision: D21405284

fbshipit-source-id: 3ce5768066091de61e62339286410a6223d251d5
2020-05-05 10:32:55 -07:00
Durham Goode
1da0256921 discovery: use the latest commits for discovery instead of random ones
Summary:
When doing discovery, for repos with long master lines and infrequent
branches, picking a random set of sample commits could result in not picking the
master, and therefore having to do very long commit graph traversals to check
ancestors against the other samples.

To prevent this, let's pick the N most recent commits instead of a random
sample. This should generally get the master commit into our sample.

Reviewed By: quark-zju

Differential Revision: D21394302

fbshipit-source-id: f4b8110cd126b90553ec624e48cab0b590e124fb
2020-05-05 09:56:26 -07:00
Lukas Piatkowski
621678a798 mononoke/time_window_counter: use trait objects to represent time_window_counter
Summary: Making a trait out of TimeWindowCounter will help with providing different implementations of load limiting for OSS and FB.

Reviewed By: krallin

Differential Revision: D21329265

fbshipit-source-id: 7f317f8e9118493f3dcbadb0519eaff565cbd882
2020-05-05 08:02:50 -07:00
Thomas Orozco
0dd85d1c15 mononoke/cache_warmup: add a bit more error context
Summary:
This is helpful. Also, while in there, I removed an error that wasn't used at
all.

Reviewed By: StanislavGlebik

Differential Revision: D21399489

fbshipit-source-id: 0e5ef20b842afa9ffc0bb8530c48eb48339c558e
2020-05-05 05:44:53 -07:00
Thomas Orozco
9ac8e0505b mononoke: update various error enums to use #[source]
Summary:
We have a number of error enums that wrap an existing errors, but fail to
register the underlying error as a `#[source]`. This results in truncated
context chains when we print the error. This fixes that. It also removes a
bunch of manual `From` implementation that can be provided by thiserror's
`#[from]`.

This also required updating the `Display` implementation for those errors. I've
opted for not printing the underlying error, since the context chain will
include it. This does mean that if we print one of those errors without the
context chain (i.e. `{}` as opposed to `{:#}` or `{:?}`), then we'll lose out a
bit of context. That said, this should be OK, as we really shouldn't ever being
do this, because we'd be missing the rest of the chain anyways.

Reviewed By: StanislavGlebik

Differential Revision: D21399490

fbshipit-source-id: a970a7ef0a9404e51ea3b59d783ceb7bf33f7328
2020-05-05 05:44:52 -07:00
Thomas Orozco
fd6b1d4ec6 common/rust/failure_ext: get rid of error chain
Summary:
This removes our own (Mononoke's) implementation of failure chains, and instead
replaces them with usage of Anyhow. This doesn't appear to be used anywhere
besides Mononoke.

The historical motivation for failure chains was to make context introspectable
back when we were using Failure. However, we're not using Failure anymore, and
Anyhow does that out of the box with its `context` method, which you can
downcast to the original error or any of the context instances:

https://docs.rs/anyhow/1.0.28/anyhow/trait.Context.html#effect-on-downcasting

Reviewed By: StanislavGlebik

Differential Revision: D21384015

fbshipit-source-id: 1dc08b4b38edf8f9a2c69a1e1572d385c7063dbe
2020-05-05 05:44:52 -07:00
Thomas Orozco
70007f049e mononoke/lfs_server: add a test for error formatting
Summary:
I'm going to send a diff to get rid of failure chains, and the LFS Server
actually uses that quite a bit. Let's make sure we don't affect the error
rendering there.

Reviewed By: StanislavGlebik

Differential Revision: D21383032

fbshipit-source-id: e0ec9c88760e7fd48d39fa1570efd1870a9ef532
2020-05-05 05:44:52 -07:00
Thomas Orozco
c63ac4a8eb mononoke: fix a broken test
Summary:
Looks like this broke yesterday. There was a Reindeer update yesterday IIRC, so
I'm guessing that's the cause. In any case, this is easy to fix forward.

Reviewed By: farnz

Differential Revision: D21399830

fbshipit-source-id: 5cf33411e089a8c675a8b3fdf7b6ae5ae267058d
2020-05-05 02:47:03 -07:00
Chad Austin
630ad5dbd6 default storage engine in config.toml
Summary:
If config.toml exists but does not contain a valid storage engine,
edenfs would fail to start. Now, it will set a default value and write
the updated config file.

Reviewed By: simpkins

Differential Revision: D19671453

fbshipit-source-id: 32f19dbed2be02bec2a96e1349dca6e7038b9301
2020-05-04 22:08:41 -07:00
Shannon Zhu
83dc7b9129 Custom pyre upgrade for eden
Summary:
Addressing issues simpkins brought up on D21207287 when we upgraded and introduced some pyre bugs.

Temporarily upgrading just this project, once we resolve some sandcastle capacity issues we'll release this via another global upgrade in fbcode.

Reviewed By: simpkins

Differential Revision: D21316793

fbshipit-source-id: f0c79f53d97f7182e7d8fe6e081c58ef53ce0c9a
2020-05-04 21:19:20 -07:00
Zeyi (Rice) Fan
da28f5a5b1 revisionstore: create directory with group share permission in correct places
Summary: When we create directory at certain places, we want these directories to be shared between different users on the same machine. This Diff uses the previously added `create_shared_dir` function to create these directories.

Reviewed By: xavierd

Differential Revision: D21322776

fbshipit-source-id: 5af01d0fc79c8d2bc5f946c105d74935ff92daf2
2020-05-04 19:21:33 -07:00
Jeremy Fitzhardinge
cde51faec8 third-party/rust: update cargo to 0.44 release
Summary:
All the changes we need are now in stable, so use the stable crates.io version.

I also had to do coordinated updates of git2 and rustsec to make sure they're
all using the same version of libgit2-sys. This had a couple of little API changes which affected our code:
- mononoke gitimport (krallin)
- linttool (zertosh) (BTW the old code had some very dubious lifetime stuff - a signature of the form `fn foo<'a>(&self) -> Thing<'a>` never makes any sense - output lifetimes should always be derived from the params)

Similarly, toml-rs needed to be updated because there's now a hard dependency on 0.5.6.

msdkland[rust_cargo]
msdkland[rust_reindeer]

Reviewed By: dtolnay

Differential Revision: D21311180

fbshipit-source-id: 82083c8f2bb8523e70cbe99dc0a630c4bc67a505
2020-05-04 18:59:57 -07:00
Jeremy Fitzhardinge
294b328e03 third-party/rust: update toml to 0.5.6
Summary: With updated local patch.

Reviewed By: zertosh, dtolnay

Differential Revision: D21360289

fbshipit-source-id: 92383b452f8ac6f8dc8a5af855ab3aad8bdb4ec7
2020-05-04 18:59:56 -07:00
Chad Austin
65d278cc55 move docs/ into eden/fs/
Summary: These docs are all EdenFS specific so move them into the fs/ directory.

Reviewed By: genevievehelsel

Differential Revision: D21329620

fbshipit-source-id: 4090ed4ca371d01ea98e06ad6ce8f434c0660962
2020-05-04 12:34:47 -07:00
Xavier Deguillard
84b25c7abb eden: fix Windows build
Summary:
The MSVC compiler complains that it doesn't have the full definition of
PrivHelper, causing the build to fail. Include the right header to fix this.

Reviewed By: genevievehelsel

Differential Revision: D21381946

fbshipit-source-id: 0d0389ee8db44a36786973404c38487a94e8c4df
2020-05-04 11:53:33 -07:00
Adam Simpkins
c0fb9cea2d enable all integration test sources in CMake builds
Summary:
Previously we only included `basic_test.py` and `hg/status_test.py` in the
integration tests during CMake-based builds.  This updates the code to now
include all of the test files, with just a few exclusions based on platform
type and what dependencies were available at build time.

Reviewed By: wez

Differential Revision: D21239912

fbshipit-source-id: b8826d249a6323ac3bcc555c9ceba54a4cbcfde9
2020-05-04 11:46:09 -07:00
Adam Simpkins
a755d9e979 blacklist some integration tests on non-RedHat Linux distributions
Summary:
10 of the integration tests fail on Ubuntu.  For now simply blacklist them
from running on non-RedHat-based distributions.

Reviewed By: wez

Differential Revision: D21332629

fbshipit-source-id: 3fadb74bb31e89092177afaa01ddc7f6bcd0f9de
2020-05-04 11:46:09 -07:00
Adam Simpkins
ea7460f2d3 apply the integration test case blacklist to some more tests
Summary:
Add a new IntegrationTestCase base class that checks the test blacklist during
`setUp()`, and update a few remaining test classes that did not derive from
`EdenTestCase` to derive from this.

Also drop the method name argument from the `skip_test_if_blacklisted()`
function, since we can get this from the existing test case argument.

Reviewed By: genevievehelsel

Differential Revision: D21340539

fbshipit-source-id: d4fc125f119d74ab923c2cc3c9070b86c582c87e
2020-05-04 11:46:09 -07:00
Adam Simpkins
f390948707 fix the UserInfoTest on Ubuntu
Summary:
Run `env` as `/usr/bin/env` instead of `/bin/env`
This command is typically installed in `/usr/bin`.  Recent RedHat releases
replaced `/bin/ with a symlink to `/usr/bin`, allowing this command to work
when invoked as `/bin/env`, but this isn't true on all distributions, such as
Ubuntu.

Reviewed By: chadaustin

Differential Revision: D21340540

fbshipit-source-id: d7588f8c90e9a86a0cb31fd3ab3a9067aa6e79ea
2020-05-04 11:46:08 -07:00
Chad Austin
63158b56f6 move third-party/ into eden/fs/
Summary: These third-party includes are edenfs-specific, so move them into eden/fs/

Reviewed By: simpkins

Differential Revision: D21314642

fbshipit-source-id: c52b0a00d5080934e1f07e4cd55373602f2f6b0a
2020-05-04 11:33:12 -07:00
Chad Austin
bb7005d60e move benchmarks/ into eden/fs/
Summary: These benchmarks are edenfs-specific, so move them into /eden/fs/

Reviewed By: genevievehelsel

Differential Revision: D21314464

fbshipit-source-id: 1dcf6adfbdea1394f222de4d462397ea531ced00
2020-05-04 11:33:12 -07:00
Thomas Orozco
6df567f7ca mononoke/repo_client: log when hooks finished (and how many were rejected)
Summary:
This updates repo_client to log when hooks finished, and how many were rejecte,
if any. This required a bit of refactoring to avoid iterating twice over
whether hooks are rejected or not (and instead just filter-maps outcomes to a
rejection), but it's probably for the better since it removes a bit of
un-necessary cloning (notably of the hook name).

Reviewed By: farnz

Differential Revision: D21379690

fbshipit-source-id: 53c8368d3871620ec61db76dc35b47dd17276ac4
2020-05-04 09:54:59 -07:00
Genevieve Helsel
367db1d20a shorten recovery wait timeout and increase restarter restart timeout
Reviewed By: wez

Differential Revision: D21333897

fbshipit-source-id: ba2b9aa375bfa91693c8985ff4cb57e944b04eff
2020-05-04 09:22:24 -07:00
Thomas Orozco
cfde4afe90 mononoke/gitimport: support read-only mode
Summary:
This adds support for running Gitimport with `--readonly-storage`. The way we
do this is by masking the various storages we use (blobstore, changesets,
bonsai).

Reviewed By: markbt

Differential Revision: D21347939

fbshipit-source-id: 68084ba0d812dc200776c761afdfe41bab9a6d82
2020-05-04 07:18:02 -07:00
Thomas Orozco
28eee11931 mononoke/gitimport: improve concurrency
Summary:
The original gitimport wasn't really designed for concurrency, since it did
commits one by one. With this update, we can now derive Bonsais from multiple
commits in parallel, and use multiple threads to communicate with the Git
repository (which is actually somewhat expensive when that's all we do).

We also store Bonsais iteratively. There is a bit of extra work that could be
done also here by saving Bonsais asynchronously to the Blobstore, and inserting
a single batch in Changesets once we're finished.

Reviewed By: farnz

Differential Revision: D21347941

fbshipit-source-id: e0ea86bf4d164599df1370844d3f0301d1031801
2020-05-04 07:18:02 -07:00
Thomas Orozco
bc7e31cdd1 mononoke/gitimport: allow deriving a range of commits
Summary:
This adds support for deriving commits within a range in gitimport, which gets
us one step closer to resumable gitimport. The primary goal of this is to
evaluate whether using Gitimport for Configerator might be suitable.

Differential Revision: D21347942

fbshipit-source-id: aa3177466e389ceb675328999ccf836f29912698
2020-05-04 07:18:01 -07:00
Thomas Orozco
57ccda8e9c mononoke/gitimport: add derive hg functionality
Summary:
This adds some basic functionality for deriving hg manifests in gitimport. I'd
like to add this to do some correctness testing on importing Git manifests from
Configerator.

Differential Revision: D21347940

fbshipit-source-id: 6f819fa8a62b3088fb163138fc23910b8f2ff3ce
2020-05-04 07:18:01 -07:00
Thomas Orozco
310781b4f5 mononoke/unbundle: make pushrebase logs more consistent + more complete
Summary:
- Use the same case consistently
- Log even when pushrebase fails

Reviewed By: farnz

Differential Revision: D21378033

fbshipit-source-id: 062e986151086476db9100e3d9c71aa702661032
2020-05-04 07:13:48 -07:00
Stanislau Hlebik
3c6179ac99 mononoke: update comment in warm bookmark cache
Reviewed By: mitrandir77

Differential Revision: D21378890

fbshipit-source-id: ecb58d35a0ef5ab54c45173fdbfba561c8dfc6fe
2020-05-04 05:05:05 -07:00
Stanislau Hlebik
6914d544d9 mononoke: read list of derived data to derive from the config
Summary:
Currently we need to specify which derived data we need to derive, however they
are already specified in the configerator configs. Let's just read it from
there.

That means that we no longer need to update tw spec to add new derived data types - we'll just need to add them to configerator and restart the backfiller.

Reviewed By: krallin

Differential Revision: D21378640

fbshipit-source-id: f97c3f0b8bb6dbd23d5a50f479ecfccbebd33897
2020-05-04 04:52:26 -07:00
Lukas Piatkowski
5aea06ca2a mononoke/load_limiter: use trait objects to represent load_limiter
Summary: Making a trait out of LoadLimiter will help with providing different implementations of load limiting for OSS and FB.

Reviewed By: farnz

Differential Revision: D21302819

fbshipit-source-id: 1b982a367aa7126ca5d7772e4a2406dabbe9e13b
2020-05-04 04:36:03 -07:00
Kostia Balytskyi
01310a4b70 config: sync from configerator
Summary: A result of `configerator-thrift-updater scm/mononoke/repos/repos.thrift`

Reviewed By: farnz

Differential Revision: D21350982

fbshipit-source-id: b3344c99c6f53c727ea16ebc0f81f90527de103d
2020-05-04 04:13:45 -07:00
Shannon Zhu
0b93429dc1 Convert type check targets in eden to use configuration
Summary:
D21316793 is blocked from landing because there are a few targets in eden that are running pyre via buck targets integration.

We can't do custom version overrides for projects that are using a mix of local configurations and buck integration, because buck doesn't provide an interface for setting the equivalent pyre version override.

We're moving away from buck targets integration for pyre across the board, and I've run a codemod over the project to clean up all of the buck typing integration (including some residual mypy) as well as updated type ignores / fixmes accordingly.

Let me know if you have any concerns; upon skimming it looks like most changes are either converting `type: ignore`s into fixmes, or removing `type: ignores`.

Reviewed By: dkgi

Differential Revision: D21343093

fbshipit-source-id: 5ee1436377eb526c0a679fb821c42e07cbca52a5
2020-05-02 21:16:55 -07:00
Puneet Kaushik
9e23152da8 Add CREATE_NO_WINDOW to CreateProcess to suppress console window.
Summary:
When running Eden as a service, CreateProcess will pop up a console window for every new console based process. Eden fs spawns hg import helper process which will create console windows.  It doesn't impact the functionality but is a bad user experience.

Passing the CREATE_NO_WINDOW flag to CreatePeocess will suppress the console Window.

Reviewed By: wez

Differential Revision: D21361412

fbshipit-source-id: 96ecfa2d9ca811287cdc60ba1c4632f16f38340e
2020-05-01 20:00:08 -07:00
Puneet Kaushik
f8c57fca03 Add the --foreground flag to run the edenfs as a console application.
Summary: This enables the Edenfs to run as a console application.

Reviewed By: wez

Differential Revision: D21241794

fbshipit-source-id: 704e8488b680ac90f11e9eabef704879a395d7e0
2020-05-01 20:00:07 -07:00
Puneet Kaushik
f1fb15677b Run Eden as a Windows service
Summary: By default the Eden on Windows will run as a service. It should be installed as a Windows service by the installer to work properly.

Reviewed By: wez

Differential Revision: D21241597

fbshipit-source-id: 2bcbd518d274d829bee5616d266c542f3fcc4b16
2020-05-01 20:00:07 -07:00
Jun Wu
6438f28e99 color: detect ConEmu and limit colors to 16
Summary:
ConEmu tries to normalize 256 colors to 16 colors but its normalization logic
is buggy. For example, color196 gets normalized to green instead of red. See
the attached picture of ConEmu and its debug real console.

{F235735030}

Reviewed By: markbt, ikostia

Differential Revision: D21311443

fbshipit-source-id: cb6db07d6b10a7365e33f4aa8f5f3f61f90c8e69
2020-05-01 14:51:51 -07:00
Jun Wu
5b881f086f pyzstore: further reduce cpython_ext::Bytes usage
Summary: This avoids data copies.

Reviewed By: DurhamG

Differential Revision: D21213075

fbshipit-source-id: 9575173f163d71543affabd9861931c11086f40a
2020-05-01 14:24:52 -07:00
Jun Wu
73ff6559e6 zstore: add simple caching
Summary: Add simple caching so zstore can avoid some zstd calculation.

Reviewed By: DurhamG

Differential Revision: D21213076

fbshipit-source-id: 5e3152949cf4e6d6193c3ef3401f24e2efac5620
2020-05-01 14:24:52 -07:00
Adam Simpkins
129d87fe23 use the normal PrivHelper.h header file on Windows
Summary:
While EdenFS does not use a separate privhelper process on Windows, it still
defines a stub PrivHelper class.  However, this class was previously defined
in a separate win/utils/Stub.h header file, which led to awkward `#ifdef`s to
include the correct platform-specific header file.

This diff moves the definition of the dummy PrivHelper class in Windows into
the same `PrivHelper.h` header file used on POSIX platforms.  This results in
a few more `ifdef`s in the PrivHelper files, but fewer `ifdef`s in the calling
code, and will make it easier to start unifying more of the `EdenMain` logic
on Windows and non-Windows platforms.

Reviewed By: xavierd

Differential Revision: D21332568

fbshipit-source-id: c63bf2b4a8b7e767d7db7dcda28675f735c23bf8
2020-05-01 14:01:40 -07:00
Chad Austin
9626ab1b64 enable FUSE_HANDLE_KILLPRIV
Summary:
The kernel has some legacy logic to attempt to clear the setuid and
setgid mode bits upon writes, but it is racy and disabled by default
in libfuse3. Now that we don't support setgid and setuid bits at all,
opt out of the legacy kernel behavior.

Reviewed By: wez

Differential Revision: D21334075

fbshipit-source-id: bdef12c1958a5e9bd2649c2bcb54975b0b4e78d6
2020-05-01 13:50:53 -07:00
Durham Goode
3ac2be361a configs: move fbrules to a Facebook only part of the crate
Summary:
We'll be adding a bunch of Facebook specific configuration and values
here. Let's move it to someplace not open source.

Reviewed By: quark-zju

Differential Revision: D21241038

fbshipit-source-id: 2ac9cdce40b1b46f15f171d9d1f6b6692dcd29bf
2020-05-01 13:17:21 -07:00
Durham Goode
b1a2785a19 configparser: add ensure_location_supersets function
Summary:
Implements an ensure_location_supersets function who's goal is to
verify that a given config location specifies the exact same configs as a given
set of other locations. Any inconsistencies are removed from the config and
reported to the caller.

This will be used to ensure our dynamic configs match our existing rc file
configs exactly, before we delete the file configs.

Reviewed By: quark-zju

Differential Revision: D21240837

fbshipit-source-id: e2c8ec054a3696d2cf02e65c212ad886c5117253
2020-05-01 13:17:21 -07:00
Mark Thomas
ed49d36d41 templatekw: parents template should not return null p2
Summary:
The `parents` template currently returns "meaningfulparents".  This sometimes
returns the null revision as the second parent, making templates think this is a
merge commit when it is not.  Make sure we filter this out.

Reviewed By: quark-zju

Differential Revision: D21347776

fbshipit-source-id: af83fd5cff381850ac39d97b5b2f4c77033fe2fb
2020-05-01 12:49:37 -07:00
Simon Farnsworth
fafe8802b4 Clean up Lua-only hook config requirements
Summary:
Make all the things that only Lua hooks needed (hook type etc) optional.

With this done, configs can be cleaned up to not contain redundant data.

Reviewed By: ikostia

Differential Revision: D21349614

fbshipit-source-id: 1c72c2082b8c002e3feb41d1d720a41d21afaae5
2020-05-01 12:13:07 -07:00
Wez Furlong
5537225a02 eden: enable rocksdb in the windows build
Summary:
In the initial stages of the windows port we had
problems building rocksdb on windows, so we disabled it.

These days we're able to build it and detect it--we even
require it in the cmake code, but hadn't gotten around
to telling the rest of the code that we can use it.

This commit re-enables it in the build but leaves sqlite
as the default engine until we're able to perform some
benchmarking.

Rocksdb itself has some build issues on Windows; it doesn't
use cmake to locate dependencies, so even though we built
snappy it doesn't know how to find it without modifying the
source:
https://github.com/facebook/rocksdb/blob/master/thirdparty.inc#L4

For that reason, we disable the use of Snappy in the Windows build.
However, in the version of rocksdb that we were using, it would
default to trying to use Snappy even though it wasn't compiled in
and throw an exception.

I've upgraded to a newer version of rocksdb that will simply not
use compression if no compression was enabled at build time.

Given that we mostly store relatively small objects, I'm assuming
that the lack of compression is fine for now.

Reviewed By: xavierd

Differential Revision: D21319896

fbshipit-source-id: 2a2d06d4bd5382706e9220f9b4a2de99dc18311d
2020-05-01 10:33:32 -07:00
Jason White
d5b2fb798e Fix outdated Cargo.toml files
Summary: `cargo autocargo` should normally produce no changes on `master`. The features of the `log` crate was updated in D21303891 without re-running autocargo. This fixes it.

Reviewed By: dtolnay

Differential Revision: D21349799

fbshipit-source-id: ce487bc5989e179673297350249593103b4d34dd
2020-05-01 10:29:33 -07:00
Stanislau Hlebik
bec619bc5e remotefilelog: print the progress when downloading files
Summary:
Now we download files in 200K chunks, and it might be confusing - it's unclear
whether hg is making any progress or not.
This diff makes it clearer.

Note I'm not printing progress before first fetch to avoid breaking the tests

Reviewed By: farnz

Differential Revision: D21348756

fbshipit-source-id: 05e5169114adf2b99a74b37d933755a644214a42
2020-05-01 07:56:26 -07:00
Kostia Balytskyi
b17df254d7 infinitepush: do not record crossbackendsync bundles
Summary: Mercurial Infinitepush normally records received bundles into the `forwardfillerqueue`, which is later tailed by the commit cloud `forwardfiller` in order be replayed onto Mononoke. Now I am adding a reverse filler, which means that we will have two such queues and sync in two directions. Therefore, in order to avoid infinite loops we need to distinguish cross-backend bundle replay from genuine pushes. I propose to use `crossbackendsync` bundle2 param to indicate that no recording is needed.

Reviewed By: krallin

Differential Revision: D21255446

fbshipit-source-id: 70f6efe1331bd3c7fd3aca61d486d350d93086dc
2020-05-01 06:46:50 -07:00
Stanislau Hlebik
03023aa095 commit cloud: fix hg cloud --help
Summary:
Previously we weren't showing help at all when running "hg cloud --help". This
diff should fix it

Reviewed By: ikostia

Differential Revision: D21347825

fbshipit-source-id: 1d9d11e2f9fe18a03b5d2cd8bd316fe9a218347c
2020-05-01 06:08:14 -07:00
Stanislau Hlebik
c71469dc1c mononoke: add tunable for warm bookmark config
Summary: Let's make it tunable, more context in D21300885

Reviewed By: ikostia, krallin

Differential Revision: D21347636

fbshipit-source-id: 4bc91effdd212a3f5c4a0c3d4952f52a1cf417d7
2020-05-01 04:04:51 -07:00
Thomas Orozco
5c254250be mononoke: make path elements longer than 255 bytes illegal
Summary:
Path elements longer than 255 bytes cannot be materialized on most filesystems,
so allowing them isn't very useful.

We can't normally receive a push for this (because the client would have to
have the file on their isk), but they could get created through a
specially-crafted bundle or accidentally through a Thrift API (e.g. create
commit in SCS).

Reviewed By: farnz

Differential Revision: D21328145

fbshipit-source-id: cb32d6df0aa60863665a651f1a33c69c75c6a880
2020-05-01 01:59:13 -07:00
Adam Kramer
05f7469a84 Make graph renderer link command-clickable
Summary:
In vs-code if you have a well-formed url you can command-click it
to open it, e.g., when you see it in your terminal. But this URL is not
well-formed because it's missing the protocol. So let's add it.

Reviewed By: quark-zju

Differential Revision: D21336742

fbshipit-source-id: dd2de2d5177d3a2542c4a22f0099f28b97c79d06
2020-04-30 23:59:36 -07:00
Adam Simpkins
268d64cf3f unify the StartupLogger code on Windows and POSIX
Summary:
Update the Windows code to use the normal StartupLogger.h and .cpp files.
Previously the Windows code defined its own separate StartupLogger.h file.
The class declaration looked largely like a copy of the POSIX
DaemonStartupLogger code, but most of the methods were not actually defined
anywhere.  The actual functionality appears identical to the POSIX
ForegroundStartupLogger, so this code just switches to using that in most
cases.

Reviewed By: xavierd

Differential Revision: D21332570

fbshipit-source-id: 0585a38d8f37dc93459d380aa277082c35cbadfc
2020-04-30 23:36:49 -07:00
Sergey Firsov
14ed2e817d Add new workloads to fiosynth
Summary:
add new 2 workloads
fixed unit tests

Reviewed By: darryleg

Differential Revision: D21333448

fbshipit-source-id: 2673dc3a62cdf227559f33e5301fab9293c3eb01
2020-04-30 21:50:17 -07:00
Harvey Hunt
3cd49f9d3c mononoke: Add tunables - a simple form of config hot reloading
Summary:
Currently, Mononoke's configs are loaded at startup and only refreshed
during restart. There are some exceptions to this, including throttling limits.
Other Mononoke services (such as the LFS server) have their own implementations
of hot reloadable configs, however there isn't a universally agreed upon method.

Static configs makes it hard to roll out features gradually and safely. If a
bad config option is enabled, it can't be rectified until the entire tier is
restarted. However, Mononoke's code is structured with static configs in mind
and doesn't support hot reloading. Changing this would require a lot of work
(imagine trying to swap out blobstore configs during run time) and wouldn't
necessarily provide much benefit.

Instead, add a subset of hot reloadable configs called tunables. Tunables are
accessible from anywhere in the code and are cheap to read as they only require
reading an atomic value. This means that they can be used even in hot code
paths.

Currently tunables support reloading boolean values and i64s. In the future,
I'd like to expand tunables to include more functionality, such as a rollout
percentage.

The `--tunables-config` flag points to a configerator spec that exports a
Tunables thrift struct. This allows differents tiers and Mononoke services to
have their own tunables. If this isn't provided, `MononokeTunables::default()`
will be used.

This diff adds a proc_macro that will generate the relevant `get` and `update`
methods for the fields added to a struct which derives `Tunables`. This struct is
then stored in a `once_cell` and can be accessed using `tunables::tunables()`.

To add a new tunable, add a field to the `MononokeTunables` struct that is of
type `AtomicBool` or `AtomicI64`. Update the relevant tunables configerator
config to include your new field, with the exact same name.

Removing a tunable from `MononokeTunables` is fine, as is removing a tunable
from configerator.

If the `--tunables-config` path isn't passed, then a default tunables config
located at `scm/mononoke/tunables/default` will be loaded. There is also the
`--disable-tunables` flag that won't load anything from configerator, it
will instead use the `Tunable` struct's `default()` method to initialise it.
This is useful in integration tests.

Reviewed By: StanislavGlebik

Differential Revision: D21177252

fbshipit-source-id: 02a93c1ceee99066019b23d81ea308e4c565d371
2020-04-30 16:08:30 -07:00
Chad Austin
ec00e91309 disallow setting suid, sgid, and sticky bits
Summary:
FUSE_HANDLE_KILLPRIV expects that any write() call is handled by
clearing the setuid and setgid bits in the userspace. To avoid
implementing that behavior, disallow setting setuid or setgid in the
first place.

Reviewed By: xavierd

Differential Revision: D21333703

fbshipit-source-id: eb084ee8b00afe74c0da26e41c32c2cb742723da
2020-04-30 15:18:35 -07:00
Simon Farnsworth
4c3993bdd6 Add the bookmark name to commit metadata going to Scribe
Summary: Wanted for post-commit hooks

Reviewed By: krallin

Differential Revision: D21288952

fbshipit-source-id: 9f50a590a1a9f6b5fb2984346385689a8982c03b
2020-04-30 14:31:25 -07:00
Simon Farnsworth
0a42c545a6 asyncify processing.rs and scribe_commit_queue
Summary: I'm about to add a new parameter to `scribe_commit_queue`; first asyncify it to modernise

Reviewed By: krallin

Differential Revision: D21288044

fbshipit-source-id: d1a4bb052b3c055383dd9d9df5fe36d61b14bdfe
2020-04-30 14:31:25 -07:00
Kostia Balytskyi
9b914911f6 infinitepush: do not read the whole file to check size
Summary: If the bundle file has 1G in size, we probably don't want to waste 1G of memory just to see that it is too big.

Reviewed By: markbt

Differential Revision: D21177359

fbshipit-source-id: 026b5ab40e6dbddba3d7142a8e34256d127bf82c
2020-04-30 13:00:22 -07:00
Kostia Balytskyi
e016ea16a2 commit cloud forwardfiller: add a test to exercise the flow
Summary:
Building on the previous two commits, this adds a test which performs the following steps:
- does an infintiepush push to a Mercurial server
- looks into the `forwardfillerqueue`
- runs commitcloud forwardfiller's `fill-one` to replay the bundle to Mononoke
- verifies that this action causes the commit to appear in Mononoke

As this test uses `getdb.sh` from Mercurial test suite, it needs to be whitelisted from network blackholing (Note: we whitelist mononoke tests, which run with `--mysql` automatically, but this one is different, so we need to add it manually. See bottom diff of the stack for why we don't use `--mysql` and ephemeral shards here).

Reviewed By: krallin

Differential Revision: D21325071

fbshipit-source-id: d4d6cbdb10a2bcf955ee371278bf2bbbd5f5122c
2020-04-30 13:00:22 -07:00
Kostia Balytskyi
5041433ad6 tests: make hgsql and infinitepush libraries usable from Mononoke
Reviewed By: krallin

Differential Revision: D21303956

fbshipit-source-id: 61c3eaf5235f55636fd5b5c8d9ac899f39691d9d
2020-04-30 13:00:22 -07:00
Thomas Orozco
48d3c33411 mononoke/microwave: warmup from last derived state
Summary:
Microwave doesn't normally allow writes, which can cause cache warmup to fail
if master has underived commits. So, let's go back in bookmarks history to
whatever is most recent and derived. We can do so using the existing logic we
use in the warm bookmarks cache.

Reviewed By: farnz

Differential Revision: D21325485

fbshipit-source-id: 11e758cd512a22e02704ac34458fead18c284c20
2020-04-30 12:47:35 -07:00
Thomas Orozco
a381722ad1 mononoke/cache_warmup: asyncify
Summary:
This updates cache_warmup to new futures, since I'd like to do a little bit of
work in there. This also changes a bit of functionality: until now we were
roundtripping through a hg changeset id un-necessarily so that updates it to
just use the bcs id instead.

Reviewed By: mitrandir77

Differential Revision: D21325484

fbshipit-source-id: 4d296c5fbe7c21dda681aed4ed9c572a38246893
2020-04-30 12:47:35 -07:00
Thomas Orozco
b6e5963a4f mononoke/microwave: clarify rationale for panics on expected calls
Summary: As it says in the title.

Reviewed By: farnz

Differential Revision: D21323300

fbshipit-source-id: 37c5f239087c4582219e3c22cefabf13b1dd01e4
2020-04-30 12:47:34 -07:00
Chad Austin
ddd6943359 use a single static table for the fuse access type lookup
Summary:
Instead of multiple linear array scans to determine the type of a FUSE
request, use a single lookup table. This is a small optimization, but
it makes the code a bit nicer too.

Reviewed By: wez

Differential Revision: D21314720

fbshipit-source-id: 5b6700ad5bb8e353da1e457de1533e6a626e8f68
2020-04-30 10:20:45 -07:00
Chad Austin
407c817d7a switch from folly benchmark to google benchmark
Summary:
Google Benchmark is easier to use, has more built-in functionality,
and more accurate default behavior than Folly Benchmark, so switch
EdenFS to use it.;

Reviewed By: simpkins

Differential Revision: D20273672

fbshipit-source-id: c90c49878592620a83d2821ed4bc75c20e599a75
2020-04-30 09:36:01 -07:00
Mark Thomas
ff08b99c08 remotenames: hide unwanted commits after clone with selectivepull
Summary:
Cloning a repository with selectivepull enabled temporarily disables
selectivepull for the duration of the initial pull so that we can get a
streaming clone.

Once this is done, hide all of the commits in the repository by clearing the
visible heads.  Selective pull will then populate the remote bookmarks with the
public heads that we do want.

Reviewed By: quark-zju

Differential Revision: D21301037

fbshipit-source-id: 565ae50439ed5405ce940a5675caeba912fe7083
2020-04-30 05:44:04 -07:00
Mark Thomas
ac62d5b52c commitcloud: allow omission of remote bookmarks
Summary: If a scratch remotebookmark points to a draft commit that is not available locally (i.e., has been hidden on a different machine), then don't pull it into the local repository.  Instead, just omit the remote bookmark.

Reviewed By: quark-zju

Differential Revision: D21287886

fbshipit-source-id: 84e7c6b52250709f7c88b07fccdbb61e044370c8
2020-04-30 05:44:03 -07:00
Mark Thomas
e025e68e33 commitcloud: allow sync to delete remote bookmarks
Summary:
Rewrite `_processremotebookmarks` to allow sync operations to delete
remote bookmarks.

Reviewed By: quark-zju

Differential Revision: D21283026

fbshipit-source-id: 7ded1d1cfb725f4b60ad2d55cf7d102c91113d6a
2020-04-30 05:44:03 -07:00
Mark Thomas
a4648a7805 remotenames: don't remove selectivepull subscriptions on push
Summary:
Selective pull subscripts are lost during a push.  This is because
`remotenames.expush` calls `selectivepullbookmarknames` with the
remote, not the remote name.

`remotenames.exclone` does the same, but in that case there is
no need for the remote name as the destination can't have any
subscriptions other than the default set.

Reviewed By: quark-zju

Differential Revision: D21283029

fbshipit-source-id: 52c2e7e301b8e95b4a252cbfe2ad9de168e81044
2020-04-30 05:44:02 -07:00
Mark Thomas
da9e7b2264 commitcloud: add test demonstrating bugs in remotebookmarkssync
Summary:
Commit cloud remote bookmarks sync has several edge cases that don't work correctly.

This test demonstrates some that we will fix.

Reviewed By: quark-zju

Differential Revision: D21283028

fbshipit-source-id: 4e746476a0f3bf0ca7d7088f510451632a2ee075
2020-04-30 05:44:02 -07:00
Lukas Piatkowski
6ea1603432 mononoke_api: fix for acl check in tests
Summary:
This is a fix after D21067809 broke the mononoke_api unittests and was not caught by sandcastle.

Prior to this change if `ctx.identities` were None then the permission was unconditionally denied, even when the permission checker is set to always_allow. After this change if the identities is None then the permission_checker is called with empty identity set thus making unit tests work properly.

Reviewed By: krallin

Differential Revision: D21324038

fbshipit-source-id: 1edd5fd2af6731d43cab06324b4d9fc02882c09e
2020-04-30 03:14:50 -07:00
Adam Simpkins
8392001e38 update the systemd-related integration tests to work on Ubuntu
Summary:
The systemd binary is installed in a different location on Debian-based
distributions (e.g., Ubuntu) from RedHat-based distributions.  Update the
integration tests to look in both places.

Reviewed By: wez

Differential Revision: D21297591

fbshipit-source-id: 67e5a698080205b8624c1f38aa49e75c20b6a28c
2020-04-29 23:12:37 -07:00
Adam Simpkins
0400e99d09 update the integration tests to guess at CMAKE_SOURCE_DIR
Summary:
Our CMakeLists.txt file requests `ctest` to pass in a `CMAKE_SOURCE_DIR`
environment variable when running our integration tests via `ctest`.  However
if a developer manually invokes the test binary this environment variable may
not be set.

For convenience, this updates the code to try looking at the default location
where getdeps will have put the source relative to the build directory (at
least for internal builds using shipit-converted fbsource sources).

Reviewed By: wez

Differential Revision: D21307807

fbshipit-source-id: d747c50d79d2d378721b68b18c256d5363e41f26
2020-04-29 18:50:34 -07:00
Adam Simpkins
ea59a68521 improve finding the system hgrc during CMake-based integration tests
Summary:
Update the integration tests to attempt to find the Mercurial config files
from the source directory even in CMake-based builds.  This directory will be
available when doing an internal build from fbsource via getdeps.py

If this directory isn't present (e.g., on a build from the github repository)
we will still fall back to using the Mercurial configuration files installed
on the system.  In that case I did update the code to use the correct system
configuration path on Windows.

Reviewed By: wez

Differential Revision: D21307808

fbshipit-source-id: 917ba5e8548fed999fb06a29324be125cec83cac
2020-04-29 18:50:34 -07:00
Adam Simpkins
1c3eb54e21 remove the requirement that edenfs must be invoked with --edenfs
Summary:
Remove the requirement that the `--edenfs` argument flag must be passed in
when invoking the `edenfs` daemon.

This flag was added in D12927803 to help provide a better error message if
users accidentally ran `edenfs` when they really mean to run `edenfsctl`.
However, this shouldn't really be a major problem any more: on Linux and Mac
we now install `edenfs` in a `libexec` subdirectory instead of `bin`, so it
should not be in most user's `$PATH` by default any more.  Additionally we
also verify that no other unexpected arguments have been supplied.  Prior to
D12927803 the `edenfs` binary would ignore unexpected arguments, making the
error messages more confusing when users tried to run it with `edenfsctl`
subcommand arguments.

One motivation for changing this now is that the Windows version of `edenfs`
does not require this flag, and it is desirable to remove this behavior
discrepancy.  Rather than making this flag required on Windows it seems fine
to just drop the requirement on Mac & Linux.

Reviewed By: wez

Differential Revision: D21297159

fbshipit-source-id: e24bd694dadc036cd31dead287ae2c1184747822
2020-04-29 17:55:34 -07:00
Adam Simpkins
f48674b1df update the service test cases to skip when appropriate
Summary:
Update the tests that derive from `ServiceTestCaseBase` to honor the test
blacklist, and to also skip if we cannot run the `fake_edenfs` utility.  This
latter check primarily fails when we cannot run `sudo` non-interactively
without a password prompt.

Most of the other tests were already honoring blacklist through the
`EdenTestCase` base class, but `ServiceTestCaseBase` does not derive from
`EdenTestCase`.

Reviewed By: wez

Differential Revision: D21297160

fbshipit-source-id: 5044e9939bbe487c09aa96021166c95f02fb376e
2020-04-29 17:55:34 -07:00
Chad Austin
836429c71b add TODO comments for optimizing getEntryInformation and getFileInformation
Reviewed By: genevievehelsel

Differential Revision: D21310220

fbshipit-source-id: 6614175881395c8ed921054a7ee5f81f011bb85c
2020-04-29 17:52:02 -07:00
Adam Simpkins
c55781c666 move UserInfo to eden/fs/utils/
Summary:
Move the `UserInfo` code from `fuse/privhelper` to `utils`, and also unify the
POSIX and Windows implementations of this class.

This code was originally put in the `fuse/privhelper` directory since it was
written at the same time as the privhelper.  However, it's really a
lower-level library that doesn't depend on FUSE or any of the other code in
the `fuse/` subdirectory.

Reviewed By: wez

Differential Revision: D21296594

fbshipit-source-id: f58682f6ce86bba0328472c491bb4c0dc3370319
2020-04-29 17:21:12 -07:00
Aida Getoeva
2009db293b mononoke: use deleted manifest for merged file history
Summary:
Merge react and userprofile_shell into master, rewrite profile to use react and revert changes to p page

```

Reviewed By: markbt

Differential Revision: D21285297

fbshipit-source-id: f60006738af068982a25fa368fd260ba5b7f3781
2020-04-29 15:21:59 -07:00
Lukas Piatkowski
764023bc99 mononoke: replace all remaining usages of aclchecker with permission_checker
Summary: The changes to server/context, gotham_ext and the code that depends on them are the only reminding places where aclchecker is used directly and it is not easy to split this diff to convert them separately.

Reviewed By: krallin

Differential Revision: D21067809

fbshipit-source-id: a041ab141caa6fe6871e1fda6013e33f1f09bc56
2020-04-29 11:57:34 -07:00
Adam Simpkins
f04f0388d9 enable the fs/utils tests in the Windows build
Summary:
Enable the unit tests under eden/fs/utils on Windows.

This does comment out a few tests related to `AbsolutePath` that are broken on
Windows.  The AbsolutePath constructor does not enforce that the input path is
actually absolute.  Additionally the `canonicalPath()` function ends up doing
weird things and returning paths that start with `/` followed by a drive
letter (e.g., `/C:/foo`).  These issues should ideally be addressed in
subsequent diffs.

Reviewed By: xavierd

Differential Revision: D21239886

fbshipit-source-id: ef08d62353ba83b96d9fd79bd4636f4a0f961373
2020-04-29 11:04:21 -07:00
Stanislau Hlebik
f1388043ea mononoke: add an artificial delay to warm bookmark cache
Reviewed By: krallin

Differential Revision: D21300885

fbshipit-source-id: 10a4e82de84e73e3b7b76d62999d430a12e98ef1
2020-04-29 05:34:26 -07:00
Harvey Hunt
83e6bf3536 mononoke: hgcli: Add a connection timeout
Summary:
When connecting to Mononoke, it's possible for the connection to hang
for a while before ultimately failing. This is a poor experience for users.

Add a timeout, such that hgcli will only wait for 15 seconds before reporting a
failure back to the user.

Reviewed By: krallin

Differential Revision: D21281472

fbshipit-source-id: 6329a108a1ae3ec337d74529a80e0fcd74e02231
2020-04-29 03:27:14 -07:00
Alex Hornby
359d1a1824 mononoke: walker: add README.md
Summary: Add a README to provide an overview of the walker for reviewers and maintainers

Reviewed By: ikostia

Differential Revision: D21250280

fbshipit-source-id: 9fd7cd3a076a276de904b8ae5372fc1c0c28458b
2020-04-29 03:16:03 -07:00
Wez Furlong
28706ca81b eden: implement getFileInformation on windows
Summary:
The operation originally wanted to operate on the fuse `Attr`
structure which we don't have on Windows, so I repurposed the
`InodeBase::getattr` into `InodeBase::stat` and moved the conversion
of `struct stat` to `Dispatcher::Attr` to the `EdenDispatcher::getattr`
method (and a couple of other adhoc places that were doing a similar
conversion).

Reviewed By: chadaustin

Differential Revision: D20562459

fbshipit-source-id: 6b538110038352e9b5590fcb5ff5c33fe84ac1d8
2020-04-28 22:10:15 -07:00
Xavier Deguillard
a624458b82 inodes: enable InodeTimestampsTest on Windows
Summary:
The only change I had to make was due to the fact that MSVC wasn't smart
enough to realize that the shift value couldn't be negative, so a manual
folly::to_unsigned was added to silence the warnings.

Reviewed By: simpkins

Differential Revision: D21268634

fbshipit-source-id: e65f15d58d5ea23bfa6796bab23cf1f5c2e7c12c
2020-04-28 21:37:50 -07:00
Xavier Deguillard
b4fe0765f9 inodes: add InodePtrTest to Windows
Summary:
On Windows, the expected refcount is one less than what it is on Linux, due
to the .eden directory not being present.

Reviewed By: simpkins

Differential Revision: D21268203

fbshipit-source-id: 91cfe742fa4d576917d552964d9541dc68ad2c75
2020-04-28 21:37:49 -07:00
Zeyi (Rice) Fan
8830ed55df util: not try to create the directory when it already exists
Summary: Fix permission issues we are seeing with the latest Mercurial release.

Reviewed By: xavierd

Differential Revision: D21294499

fbshipit-source-id: bcfb13dd005258b2e3b74fa281dbd8df36133ef6
2020-04-28 20:33:59 -07:00
Chad Austin
61e738cd84 use enumValue instead of static_cast<int>
Summary:
Where appropriate, replace uses of `static_cast<int>` with
`enumValue`.

Reviewed By: simpkins

Differential Revision: D20975196

fbshipit-source-id: 581643366ea7eda5d1961238b0693cf45c4eec94
2020-04-28 18:59:34 -07:00
Genevieve Helsel
bd00e12830 introduce eden uptime command
Summary: I thought it would be helpful to introduce and `eden uptime` command, especially with automated graceful restart on the way. This prints it in human readable format, later on if for some reason automation would like to use this, a flag could be added that allows for custom formatting. Also, this can be added to `eden rage` output later.

Reviewed By: chadaustin

Differential Revision: D21260800

fbshipit-source-id: 3f9a4f8d6264dfc38bd15c024a0209f7eeb912fa
2020-04-28 18:25:03 -07:00
Chad Austin
3d82713027 add enumValue utility function
Summary:
Previously, for logging the value of unexpected enum values, we wrote
`static_cast<int>`. Given enumerations can have any integral type
backing them, this was somewhat inaccurate. Instead, introduce an
explicit enumValue function which returns a value of the appropriate
underlying type.

Reviewed By: genevievehelsel

Differential Revision: D20975176

fbshipit-source-id: 0bb5b0d2f68f8fe9d68e4c6a847d59ae0997d0df
2020-04-28 17:41:24 -07:00
Katie Mancini
6dd392de92 update eden top display for pending FUSE imports
Summary:
D21074489 adds metrics for pending FUSE requests, this cleans up the display for
pending requests.

This removes the max duration of pending requests for FUSE requests since this
data is not available (it is not measured by the FUSE library).

Reviewed By: chadaustin

Differential Revision: D21074746

fbshipit-source-id: e5585ec091aa5fd5499deee2d8be89f47f769a6a
2020-04-28 13:28:01 -07:00