Commit Graph

8429 Commits

Author SHA1 Message Date
Alex Hornby
f077f69408 mononoke: move expected_item_size_byte into CachelibSettings
Summary:
Move expected_item_size_byte into CachelibSettings, seems like it should be there.

To enable its use also exposes a parse_and_init_cachelib method for callers that have different defaults to default cachelibe settings.

Reviewed By: krallin

Differential Revision: D24761024

fbshipit-source-id: 440082ab77b5b9f879c99b8f764e71bec68d270e
2020-12-02 00:47:22 -08:00
Wez Furlong
687fddca2f eden: remove some dead DMG redirection code
Summary:
We moved to APFS subvolumes a while back, so it's time
to kill this bit.

Reviewed By: chadaustin

Differential Revision: D25260825

fbshipit-source-id: 7487fb6d477f2650e2aedb0c4dfc4f45a10c9807
2020-12-01 23:58:32 -08:00
Meyer Jacobs
f16ef7dafd bindings: introduce C / C++ bindings to EdenAPI for use by EdenFS
Summary:
Introduce `edenapithin` crate, which offers C bindings to EdenAPI Client.

There are two top-level `owned` types, `EdenApiClient` and `TreeEntryFetch`, which represent `Box`ed results from calls to EdenAPI's blocking client. The C / C++ code is responsible for calling the associated `free` functions for these types, as well as `OwnedString`, which is used to represent error variants of a `Result` as a string.

Most functionality is provided through functions which operate on and return references into these top-level owned types, providing access into Rust `Result`s and `Vec`s (manually-monomorphized), and EdenApi's `TreeEntry` and `TreeChildEntry`.

Additional non-pointer types are defined in the `types` module, which do not require manual memory management.

C++ bindings are not included currently, but will be introduced soon.

Reviewed By: fanzeyi

Differential Revision: D24866065

fbshipit-source-id: bb15127b84cdbc6487b2d0e1798f37ef62e5b32d
2020-12-01 19:07:25 -08:00
Meyer Jacobs
293053b774 edenapi: expose "attributes" parameter in tree request API
Summary:
Introduce a new API type, `TreeAttributes`, corresponding to the existing type `WireTreeAttributesRequest`, which exposes which optional attributes are available for fetching. An `Option<TreeAttributes>` parameter is added to the `trees` API, and if set to `None`, the client will make a request with TreeAttributes::default().

The Python bindings accept a dictionary for the attributes parameter, and any fields present will overwrite the default settings from TreeAttributes::default(). Unrecognized attributes will be silently ignored.

Reviewed By: kulshrax

Differential Revision: D25041255

fbshipit-source-id: 5c581c20aac06eeb0428fff42bfd93f6aecbb629
2020-12-01 19:07:25 -08:00
Stefan Filip
4b9dc9074f segmented_changelog: measure runs/failures/duration for updates
Summary: Basic observability for how the segmeted changelog update process is performing.

Reviewed By: krallin

Differential Revision: D25108739

fbshipit-source-id: b1f406eb0c862464b186f933d126e0f3a08144e4
2020-12-01 17:29:23 -08:00
Stefan Filip
b2aac949cf cmds: update segmented-changelog-tailer to run on a list of repos
Summary:
The update of the segmented changelog is light weight enough that we can
consider all repositories sharing a common tailer process. With all
repositories sharing a single tailer the the maintenance burden will be lower.

Things that I am particularly unsure about are: tailer configuration setup and
tailer structure. With regards to setup, I am not sure if this is more or less
than what production servers do to instantiate. With regards to structure, I
think that it makes a lot of sense to have a function that takes a single repo
name as parameter but the configuration setup has an influence on the details.
I am also unsure how important it is to paralelize the instantiation of the
blobrepos.

Finally, it is worth mentioning that the SegmentedChangelogTailer waits for
`delay` after an update finishes rather than on a period. The benefit is that
we don't have large updates taking down a process because we schedule the same
large repo update too many timer. The drawback is that scheduling gets messed
up over time and multiple repo updates can end up starting at the same time.

Reviewed By: farnz

Differential Revision: D25100839

fbshipit-source-id: 5fff9f87ba4dc44a17c4a7aaa715d0698b04f5c3
2020-12-01 17:29:23 -08:00
Chad Austin
27b83d1d44 remove the unused glob() implementation
Summary:
Stop implementing the legacy glob() Thrift function, since it's
deprecated, and just noise at this point.

Reviewed By: xavierd

Differential Revision: D25247641

fbshipit-source-id: a022fee169ad54c886d8f300b57bef233453fe8b
2020-12-01 13:39:14 -08:00
Alex Hornby
dac5f36baa mononoke: add option to include all the derived types that are enabled for a repo
Summary: This makes it easier to enable all derived data for scrubbing

Reviewed By: ikostia

Differential Revision: D25188963

fbshipit-source-id: e9c981e33273d6b2eeadcce0d0a341b33e91e42d
2020-12-01 11:45:00 -08:00
Alex Hornby
14aa6d37f2 mononoke: Show possible Node and Edge type args in the scrub help
Summary:
Show the options for specifying node and edge types in the --help output

These changes removed the last use of lazy_static in the walker, so updated TARGETS as well.

Reviewed By: krallin

Differential Revision: D25188964

fbshipit-source-id: c5ccb4f5a0f3be1b8cb7d51cd5f99236d60d3029
2020-12-01 11:45:00 -08:00
Alex Hornby
a2247dc41c mononoke: rename MononokeApp to MononokeAppBuilder
Summary:
It has a build() method and later in stack it will build a mononoke
specific type rather than the clap::App

Differential Revision: D25216827

fbshipit-source-id: 24a531856405a702e7fecf54d60be1ea3d2aa6e7
2020-12-01 11:45:00 -08:00
Chad Austin
a8b380f589 skip edenfs tests when tsan is enabled
Summary:
Mercurial is incompatible with TSAN at the moment, due to Rust/C++
compilation issues, Python multiprocess, and Tokio false positives. So
disable our HG tests when running under TSAN.

Reviewed By: fanzeyi

Differential Revision: D25109413

fbshipit-source-id: 86e51ebd287e10f92d6e3b8e7bf191e7946c709a
2020-12-01 10:18:53 -08:00
Stefan Filip
03c55e82d0 edenapi: add full_idmap_clone functionality
Summary: Adding `full_idmap_clone` to edenapi and usign that in `debugsegmentclone`.

Reviewed By: quark-zju

Differential Revision: D25139730

fbshipit-source-id: 682055f7c30a94a941acd16e2b8e61b9ea1d0aef
2020-12-01 09:59:27 -08:00
Stefan Filip
b991370c3f commands: add debugsegmentclone
Summary: Prototype for cloning a repository using segmented changelog.

Reviewed By: quark-zju

Differential Revision: D24954821

fbshipit-source-id: 5ff42a5d60b6ba3e85dd4eab151e902bd4b96243
2020-12-01 09:59:27 -08:00
Stefan Filip
8327c54db1 dag: add DagImportCloneData::import_clone_data
Summary:
This method reconstructs a dag from clone data.

At the moment we only have a clone data construction method in Mononoke. It's
the Dags job to construct and import the clone_data. We'll consolidate that at
a later time.

Reviewed By: quark-zju

Differential Revision: D24954823

fbshipit-source-id: fe92179ec80f71234fc8f1cf7709f5104aabb4fb
2020-12-01 09:59:27 -08:00
Stefan Filip
042dcbb3a8 edenapi: update clone data request to POST
Summary:
The server expects post requests. At this time we don't want to cache this data
so POST.

Reviewed By: singhsrb

Differential Revision: D24954824

fbshipit-source-id: 433672189ad97100eee7679894a894ab1d8cff7b
2020-12-01 09:59:27 -08:00
Stefan Filip
559e152b2f clidispatch: update NoRepo commands to receive the config parameter
Summary:
The config is something that makes sense for all commands to have access to.
Commands that don't use a repo don't have access to the config that is prepared
by the dispatches. This change is a stop-gap to allow new commands that don't
require a repository to receive the config as an argument.

The construction of the config is something that we should iterate on. I see
the current implementaiton as a workaround.

Reviewed By: quark-zju

Differential Revision: D24954822

fbshipit-source-id: 42254bb201ba8838e7cc107394e8fab53a1a95c7
2020-12-01 09:59:26 -08:00
Lukas Piatkowski
25a93e6a09 arc/bucklint/non-fbcode-build: cover Mononoke and its dependencies with oss build
Summary: This is step #5 of T78216315

Reviewed By: farnz

Differential Revision: D24506457

fbshipit-source-id: 1417693d3bbc2c7316d63149b945d522a5a8efb2
2020-12-01 09:43:12 -08:00
Stanislau Hlebik
561ff43310 mononoke: add --use-hg-server-bookmark-value-if-mismatch option to hg sync job
Summary:
At the moment if we try to sync a bookmark entry but from_cs_id of bookmark
entry doesn't match the value of the bookmark on hg servers then the sync will
fail.
Let's add an option that in the case of this mismatch sets from_cs_id to the
current value on hg servers.

Reviewed By: krallin

Differential Revision: D25242172

fbshipit-source-id: 91180fb86f25d10c9ba2b78d7aa18ed0a52d13a5
2020-12-01 05:58:23 -08:00
Pavel Aslanov
6e93ed73f9 convert to new type futures
Summary: convert mercurial_derived_data to new type futures

Reviewed By: ahornby

Differential Revision: D25220329

fbshipit-source-id: c2532a12e915b315fe6eb72f122dbc37822bbb2a
2020-12-01 03:03:45 -08:00
Kostia Balytskyi
e4dab84619 scuba: turn ScubaSampleBuilderExt into a wrapper struct
Summary:
This diff prepares the Mononoke codebase for composition-based extendability of
`ScubaSampleBuilder`. Specifically, in the near future I will add:
- new methods for verbose scuba logging
- new data field (`ObservabilityContext`) to check if verbose logging should
  be enabled or disabled

The higher-level goal here is to be able to enable/disable verbose Scuba
logging (either overall or for certain slices of logs, like for a certain
session id) in real time, without restarting Mononoke. To do so, I plan to
expose the aforementioned verbose logging methods, which will run a check
against the stored `ObservabilityContext` and make a decision of whether the
logging is enabled or not. `ObservabilityContext` will of course hide
implementation details from the renamed `ScubaSampleBuilderExt`, and just provide a yes/no
answer based on the current config and sample fields.

At the moment this should be a completely harmless change.

Reviewed By: krallin

Differential Revision: D25211089

fbshipit-source-id: ea03dda82fadb7fc91a2433e12e220582ede5fb8
2020-11-30 21:26:24 -08:00
Andres Suarez
469bcf9191 Update CLI tests to current "reporter"
Summary:
`arc`'s `--conduit-uri` is being removed in D25223434. `eden rage` actually
uses `pastry --title "eden rage from $(hostname)"` ([source][1]).

[1]: https://www.internalfb.com/intern/diffusion/FBS/browse/master/fbcode/eden/facebook/packaging/config.d/00-defaults.toml?commit=5ea7c6669a5640bd5285cd93e16dfc1d4c3db42e&lines=8

Reviewed By: chadaustin

Differential Revision: D25227408

fbshipit-source-id: 808f99f0bb34a750e7cab8753a763725bcc4f363
2020-11-30 16:13:00 -08:00
Katie Mancini
eb12120a0e fix hex(None) bug
Reviewed By: singhsrb

Differential Revision: D25136486

fbshipit-source-id: 61041c4f8582f99aca868374ef6a94d9e9ca167c
2020-11-30 16:03:01 -08:00
Stanislau Hlebik
0d27cac271 mononoke: fix cross-repo bookmark validation alarm
Summary:
cross repo bookmark validation alarm fired a few times, and looks like it fired
because of the following:

1) find_bookmark_diff compared boomarks and found an inconsistency for bookmark
BM which points to commit A in large repo. Next step is  to check bookmark history
2) While find_bookmark_diff was running a new commit B was landed in a large repo
and was backsynced to the small repo, so BM now points to commit B.
3) check_large_bookmark_history is called and it fetches latest bookmark log entries, and
it gets entries for commit A and commit B. check_large_bookmark_history checks
if any of the fetched entries points to a commit in the small repo and if yes then
it also checks if this bookmark update happened not so long ago. And the
problem is in the way it checks the "not so long ago" part. It does so by
finding the time difference between latest bookmark update log entry and any
other bookmark update log entry.

Now, if time difference between these two log entries (for commit B and for
commit A)  is more than max_delay_secs (which happens only
if commit rate is low e.g. during the weekends), then the alarm would fire
because the delay between latest bookmark update log entry (the one that moved
BM to commit B) and previous log entry (the one that moved BM to commit A) is too large.

This diff fixes this race by skipping newest entries until we found a bookmark
update log entry which points to the large commit that find_bookmark_diff
returned.

Reviewed By: ikostia

Differential Revision: D25196760

fbshipit-source-id: dfa0dca0001b1c38759ec9f4f790cfa3197ae2cf
2020-11-30 14:06:31 -08:00
Pavel Aslanov
a1d0ce7ef7 remove dependency on old futures
Summary: remove dependency on old futures from derived data filenodes

Reviewed By: ahornby

Differential Revision: D25218521

fbshipit-source-id: 4d7eaf42c3ba15ea09276a7f3567128d5216e814
2020-11-30 12:00:22 -08:00
Pavel Aslanov
4f72c1eadf use new type futures in tests
Summary: Old futures removed from unodes tests

Reviewed By: ahornby

Differential Revision: D25197780

fbshipit-source-id: f5b3acaf6556515994495ccf443e9cb204b4573e
2020-11-30 12:00:22 -08:00
Pavel Aslanov
13cc72bd97 remove dependency on futures-old and futures_ext
Summary: `derived_data:derived_data` had already been almost converted, I've cleaned up some test so it would be possible to completely remove old futures dependency

Reviewed By: StanislavGlebik

Differential Revision: D25197406

fbshipit-source-id: 064439f42a15f715befc019e5350dda0a2975f2b
2020-11-30 12:00:22 -08:00
Pavel Aslanov
48b6813a06 convert save_bonsai_changesets to new type futures
Summary:
- convert save_bonsai_changesets to new type futures
- `blobrepo:blobrepo` is free from old futures deps

Reviewed By: StanislavGlebik

Differential Revision: D25197060

fbshipit-source-id: 910bd3f9674094b56e1133d7799cefea56c84123
2020-11-30 12:00:22 -08:00
Alex Hornby
5a091f1b6a mononoke: add FastlogBatch to walker
Summary: Add it so we can scrub and inspect it

Differential Revision: D25187550

fbshipit-source-id: a241c1e492dc3ad04358db4c7023f90c601d1b1e
2020-11-30 10:36:49 -08:00
Alex Hornby
6eb072fca7 mononoke: add FastlogDir to walker
Summary: Add support for walking fast entries for directories so we can scrub and inspect them

Differential Revision: D25187551

fbshipit-source-id: 812f9fd82459ef49dcd781c318fbe5c398daad21
2020-11-30 10:36:49 -08:00
Alex Hornby
68ba8fd566 mononoke: add fastlog for files to walker
Summary: Add FastlogFile to walker so it can be inspected and scrubbed.  Directory and batch components of fastlog covered in following diffs.

Differential Revision: D25187549

fbshipit-source-id: c046cbf2561cdbbc9563497119e34d1b09d0ebef
2020-11-30 10:36:49 -08:00
Durham Goode
bdaa63386d fsmonitor: filter out non-utf8 files
Summary:
On Python 3 we only support utf8 files. Python 3 has a way of
representing non-utf8 strings in utf8 format by utilizing surrogateescape, but
these strings cause issues in other parts of the codebase that don't expect
suorrageescaped strings (like the Rust code). Since we simply do not support
these paths, let's filter them out as soon as we get them from Watchman.

Reviewed By: quark-zju

Differential Revision: D25134079

fbshipit-source-id: 8be6893a6114b816097422f4469ac317fa3795d1
2020-11-30 10:22:13 -08:00
Lukas Piatkowski
21f701f0e8 mononoke/unbundle: migrate modules rate_limit, response and push_redirectors to futures 0.3
Reviewed By: ahornby

Differential Revision: D25196441

fbshipit-source-id: 7236df68d6f38d37eaf5f789a9521b63b6876937
2020-11-30 08:30:55 -08:00
Johan Schuijt-Li
ec5fc72848 proxygen compatibility
Summary: As HG<->Mononoke will go through proxygen, testing showed that Proxygen forces us to use 'Upgrade: websocket' and confirm with the Websocket handshake. Adjust accordingly to do so.

Reviewed By: ahornby

Differential Revision: D25197395

fbshipit-source-id: ca00ac31be92817c6f1a99d7d492469b17b46286
2020-11-30 08:10:42 -08:00
Stanislau Hlebik
550d331981 mononoke: remove unused code
Reviewed By: mitrandir77

Differential Revision: D25187055

fbshipit-source-id: 8faf2398e0407f56cf133feeb0da2812e27acaad
2020-11-30 07:51:08 -08:00
Stanislau Hlebik
80967e0c6a mononoke: fix clippy in hg sync job
Reviewed By: mitrandir77

Differential Revision: D25186814

fbshipit-source-id: 6258289cbf6ba349f1c1ba542e6bc81e94007fb9
2020-11-30 07:51:08 -08:00
Stanislau Hlebik
59c5f80b75 mononoke: add bundle combining to hg sync job
Summary:
This diff adds bundle combining to hg sync job. See motivation for doing that in D25168877 (cebde43d3f).

Main struct here is BookmarkLogEntryBatch. This struct helds a vector of BookmarkUpdateLogEntry that were combined (they are used mostly for logging) and also it contains parameters necessary for producing the bundle, notably from/to changeset ids and bookmarks. This struct has try_append method that decides whether it's possible to combine bundles or not.

Reviewed By: mitrandir77

Differential Revision: D25186110

fbshipit-source-id: 77ce91915f460db73d8a996efe415954eeea2476
2020-11-30 07:51:08 -08:00
Mark Juggurnauth-Thomas
783d6604da bookmarks_movement: don't call batch_derive for skeleton manifests
Summary:
Use of `RootSkeletonManifest::batch_derive` is wrong, as it doesn't take into
account manifests that are already derived.  Just use the normal derivation
method.

Reviewed By: StanislavGlebik

Differential Revision: D25218197

fbshipit-source-id: 60f2faad610d507a9659dc37ba72516431a9c036
2020-11-30 06:23:46 -08:00
Mark Juggurnauth-Thomas
9531f1d3ed admin: add more logging to verify-manifests
Summary: The verify-manifests command can take a while.  Add logging to show progress is being made.

Reviewed By: StanislavGlebik

Differential Revision: D25099918

fbshipit-source-id: 2b659f1a6921ed111441b2808ce29998bd2285dd
2020-11-30 06:23:46 -08:00
Mark Juggurnauth-Thomas
9614148f59 skeleton_manifests: don't store duplicate skeleton manifest blobs
Summary:
If files are only modified, and not added or deleted, the skeleton manifest
doesn't change.  Avoid duplicate writes by skipping the write if the skeleton
manifest we derive has the same ID as one of its parents.

Reviewed By: ahornby

Differential Revision: D25099917

fbshipit-source-id: 62900406711becea88491e706a09c6032109c964
2020-11-30 06:23:46 -08:00
Mark Juggurnauth-Thomas
b0a5c1ef8e backfill_derived_data: improve logging
Summary:
Improve backfill_derived_data logging to make it clear when a chunk is started
and when already-derived changesets have been skipped.

Fix the counters to take into account skiped changesets, and make the time
remaining human-readable.

Reviewed By: StanislavGlebik

Differential Revision: D25099919

fbshipit-source-id: b39d4b99ef0e79d253de2aa0c91f93276b561680
2020-11-30 06:23:46 -08:00
Mark Juggurnauth-Thomas
1b8b8cc099 admin: add skeleton manifests to admin command
Summary:
Add skeleton manifests to `derived-data verify-manifests` and add a
`skeleton-manifests` subcommand that allows listing and traversing of skeleton
manifests.

Since skeleton manfiests don't contain the content id or file type, they are
valid simply if they contain the same set of files as the manifest we are
comparing against.

To allow testing of these items while backfilling is still in progress, add an
`--if-derived` option to these commands that work even if derivation is
disabled, provided the manifest has already been derived.

Reviewed By: ikostia

Differential Revision: D25064785

fbshipit-source-id: a6f923bfc53262a5b2118917f8fdd3e99407e036
2020-11-30 06:23:46 -08:00
Mark Juggurnauth-Thomas
bf830f228a scs_server: add commit titles and messages to blame results
Summary:
Avoid clients needing to make a secondary look-up for the commit title or message, which
we already have, by returning it in the blame response if the clients request it.

To do this, we add `format_options` to the blame request parameters, which allows customization
of the returned response.  The default value if not specified corresponds to the old
behaviour for backwards compatibility.

Reviewed By: mitrandir77

Differential Revision: D25057231

fbshipit-source-id: 84faad7b2db1f684beb94d9fa799c8cef1a89ce8
2020-11-30 05:16:09 -08:00
Alex Hornby
7c4d5a0ddc mononoke: expose a couple of fastlog functions for use in walker
Summary: Use these in next diff from walker so we can start to scrub fastlog

Reviewed By: aslpavel

Differential Revision: D25187548

fbshipit-source-id: 4188a0c9bdb51a898817b6f5801fe473b6712385
2020-11-30 03:23:55 -08:00
Alex Hornby
012f666f21 mononoke: noticed blobstore_key_prefix() could be &'static str
Summary: noticed this in passing

Reviewed By: krallin

Differential Revision: D25187552

fbshipit-source-id: 63eaf66c435d9a867f7be6eb864d570de5c774b8
2020-11-30 03:23:55 -08:00
Alex Hornby
b046b8940b mononoke: UnodeManifest does not need path in walker key
Summary: The path isn't needed to load the UnodeManifest, it's only needed as route information for compression etc

Reviewed By: aslpavel

Differential Revision: D25187547

fbshipit-source-id: b8199a81c5dae4caceed5d455fa6a9bbc3f037ac
2020-11-30 03:23:55 -08:00
Alex Hornby
b7a7c27a94 mononoke: UnodeFile does not need path in walker key
Summary: The path is not needed to load the unode, only for route tracking

Reviewed By: aslpavel

Differential Revision: D25187553

fbshipit-source-id: baf6df3b7f56f5ca5a0ba086097acba4ecd82e75
2020-11-30 03:23:55 -08:00
Alex Hornby
980c9e8de6 mononoke: add UnodeFlags in preparation for walking Fastlog
Summary: Change from the walk_blame boolean to a bitflags struct so can also represent fastlog.  Using bitflags crate so as not to grow the node size.

Reviewed By: aslpavel

Differential Revision: D25185267

fbshipit-source-id: b45574cd6c4d048aec321357ae54e2ec404f84fc
2020-11-30 03:23:55 -08:00
Alex Hornby
642e42f870 mononoke: clean up ordering in walker parse_node test
Summary: Few things were not on lexical order, clean them up. Makes it easier to read next diff without this mixed in

Reviewed By: aslpavel

Differential Revision: D25188965

fbshipit-source-id: 38b7ea6f0e2c0583e6701550d6db16d85ba1a455
2020-11-30 03:23:55 -08:00
Mateusz Kwapich
dd1ec3c6b8 make commit-cloud reversefiller support multiple bundle prefix per repo
Summary:
Previously, the commitcloud reverse filler would only run for a single
repo. This is fine for some of the high throughput repos (e.g. fbsource).
However, for small repos it doesn't make sense to use a server per repo.

Most of support was already completed with forward filler moving to multirepo
jobs but the bundle prefix could be set once per job which prevents
reversefiller from using it. For each mononoke repo the bundles have different
prefix (repo id is in the prefix) that's why we now take a list of bundle ids
together with a list of repos.

NOTE: If I were implementing this functionality from scratch I'd probably teach
the filler to just read the right bundle prefixed from Mononoke configs but
this way of doing it is just faster to pull and it's backwards compatible with
current tw jobs so the rollout will be easy.

Reviewed By: ikostia

Differential Revision: D25188994

fbshipit-source-id: 1c25e52404d5ec45d721f047c8d71b002cdf0994
2020-11-30 02:16:56 -08:00
Kostia Balytskyi
329adafbdb blobstore_healer: avoid unnecessary blob clones
Summary:
Currently, the healer would clone a blob at least once if it needs to be healed. This is done because `blobstore.put` needs to take ownership of the `blob`. It is pretty wasteful in several different ways:
- if there's just one `put` needed, we can just use the existing `blob` instance and avoid cloning it
- we clone `blob` for every `stores_to_heal` at the same time, therefore consuming `stores_to_heal.len() * blob.len()` bytes of RAM. On the plus side, this allows us to run those `put`s in parallel, but on the flip side - it uses a lot of RAM. In cases when we need to heal a 4Gb blob to two different blobstores, this would immediately jump memory usage from 4Gb to 12Gb. Taking into account that we use 15Gb containers and heal 100 blobs in parallel, this is pretty bad. One way of dealing with this is doing `put`s one-by-one, cloning for each (except the last one). As each `put` succeeds, we drop the original cloned `blob`, therefore freeing some memory. Formulaically this means that our peak usage per blob is `blob.len() * 2` if there's >1 heal needed and just `blob.len()` if there's 1 heal needed.

So let's support two different strategies of healing: `Sequential` and `Concurrent`. We can choose `Concurrent` when we know that there's plenty of RAM to clone our blob enough times. To know what "plenty of RAM" is, let monitor our RSS and allow passing a "ceiling" on the command line (newly added `--max-rss-bytes` arg).

Note 1: Of course, this all is just best effort: there are obvious TOCTTOU problems with RSS checks, so false positives are possible.

Note 2: A much better approach here would be to have `.put` not take ownership of the blob in the first place, and to only clone from a passed reference when needed (I think it's actually not always needed, like `sqlblob` takes ownership, and then creates chunks by cloning it one more time, IIUC). Unfortunately, this is a much larger change with a lot of complexities, so I'd rather not do it here.

Reviewed By: krallin

Differential Revision: D25196372

fbshipit-source-id: 1128c13f68f2dc877cebcf45d8d96954543daf3c
2020-11-28 06:31:01 -08:00
Pavel Aslanov
ca4b5cf073 convert bookmark methods to new type futures
Summary: convert bookmark methods to new type futures

Reviewed By: ahornby

Differential Revision: D25196555

fbshipit-source-id: b41014937e1dd10ad839aca5011f199ee6007827
2020-11-27 11:11:19 -08:00
Pavel Aslanov
ac33b17233 convert globalrev related methods to new futures
Summary: convert globalrev related methods to new futures

Reviewed By: ahornby

Differential Revision: D25196171

fbshipit-source-id: 10c31f5869b9dd803955a7755d74b31ba1d8f7c5
2020-11-27 11:11:18 -08:00
Pavel Aslanov
4a0cb69c4e convert BlobRepo::{changeset_exists_by_bonsai, get_changeset_parents_by_bonsai} to new futures
Summary: convert `BlobRepo::{changeset_exists_by_bonsai, get_changeset_parents_by_bonsai}` to new futures

Reviewed By: ahornby

Differential Revision: D25195811

fbshipit-source-id: 0238440aa0757af6362effe09f1771c939bda030
2020-11-27 11:11:18 -08:00
Pavel Aslanov
6f08815dc3 convert BlobRepo::get_bonsai_bookmark to new type futures
Summary: convert `BlobRepo::get_bonsai_bookmark` to new type futures

Reviewed By: StanislavGlebik

Differential Revision: D25188577

fbshipit-source-id: fb6f2b592b9e9f76736bc1af5fa5a08d12744b5f
2020-11-27 11:11:18 -08:00
Stanislau Hlebik
43e7e847bb mononoke: modernize bookmarks_validator tests
Summary: Let's use fbinit::compat_test, it makes the tests a bit shorter

Reviewed By: ikostia

Differential Revision: D25196759

fbshipit-source-id: bd8aca4b676a71158269195fd35153a0934b0cbc
2020-11-27 09:45:13 -08:00
Pavel Aslanov
938af42e9c convert BlobRepo::get_bonsai.*bookmarks to new futures
Summary: convert `BlobRepo::get_bonsai.*bookmarks` to new futures

Reviewed By: StanislavGlebik

Differential Revision: D25188208

fbshipit-source-id: f071d38cbc74002e7a631d4590137418b1b07a22
2020-11-27 06:49:06 -08:00
Pavel Aslanov
beaca55a40 convert BlobRepo::get_bonsai_heads_maybe_stale to new futures
Summary: convert BlobRepo::get_bonsai_heads_maybe_stale to new futures

Reviewed By: StanislavGlebik

Differential Revision: D25187883

fbshipit-source-id: 78b8202a1e8d101ec69740fee2a8665ccc8334c8
2020-11-27 06:49:06 -08:00
Pavel Aslanov
13ee62332d prefix old future with Old
Summary: Prefix old futures with `Old` so it would be possible to start conversion of BlobRepo to new type futures

Reviewed By: StanislavGlebik

Differential Revision: D25187882

fbshipit-source-id: d66debd2981564b289d50292888f3f6bd3343e94
2020-11-27 06:49:06 -08:00
Alex Hornby
2b703be885 mononoke: fix flaky walker test case
Summary:
The expected walker validation failures can appear in any order.  Sort
them so the comparison is deterministic

Reviewed By: StanislavGlebik

Differential Revision: D25195052

fbshipit-source-id: aeded6675c85186e12d27023fb862d7c52dd764f
2020-11-27 05:34:12 -08:00
James Donald
c7fe8b849e Fix merge on Windows when path contains spaces
Summary: editmergeps.bat was separating a filename with spaces into args[0] and args[1] when calling editmergeps.ps1. Use proper quoting to send files with spaces as a single argument.

Reviewed By: ikostia

Differential Revision: D25194324

fbshipit-source-id: 065f677c9015681b310e1cfc46f52ff563a35f99
2020-11-27 03:57:03 -08:00
Lukas Piatkowski
a1e8abc88c mononoke/unbundle: mark non-public all objects that are not used outside unbundle
Summary: This will make it easier to choose how to migrate this code to futures 0.3

Reviewed By: ahornby

Differential Revision: D25185646

fbshipit-source-id: b39f7540275115fff4e8b6f2e740d544c2c876ef
2020-11-27 03:31:08 -08:00
Lukas Piatkowski
fa1a195fd0 mononoke/blobstore: pass CoreContext via borrowed instead of owned value
Summary: Follow up after removing 'static from blobstore.

Reviewed By: StanislavGlebik

Differential Revision: D25182106

fbshipit-source-id: e13a7a31d71b4674425123268e655ae66127f1b7
2020-11-27 03:31:07 -08:00
Thomas Orozco
8840f92d07 edenapi server: properly deserialize history requests
Summary:
While trying to repro a user report (https://fburl.com/jqvm320o), I ran into a
new hg error: P151186623, i.e.:

```
KeyError: 'Key not found HgId(Key { path: RepoPathBuf("fbcode/thrift/facebook/test/py/TARGETS"), hgid: HgId("55713728544d5955703d604299d77bb1ed50c62d") })'
```

After some investigation (and adding a lot of prints), I noticed that this
was trying to query the EdenAPI server for this filenode. That request should
succeed, given Mononoke knows about this filenode:

```
[torozco@devbig051]~/fbcode % mononoke_exec mononoke_admin fbsource --use-mysql-client filenodes by-id fbcode/thrift/facebook/test/py/TARGETS 55713728544d5955703d604299d77bb1ed50c62d
mononoke_exec: Using config stage prod (set MONONOKE_EXEC_STAGE= to override)
I1126 08:10:02.089614 3697890 [main] eden/mononoke/cmdlib/src/args/mod.rs:1097] using repo "fbsource" repoid RepositoryId(2100)
I1126 08:10:02.995172 3697890 [main] eden/mononoke/cmds/admin/filenodes.rs:137] Filenode: HgFileNodeId(HgNodeHash(Sha1(55713728544d5955703d604299d77bb1ed50c62d)))
I1126 08:10:02.995282 3697890 [main] eden/mononoke/cmds/admin/filenodes.rs:138] -- path: FilePath(MPath("fbcode/thrift/facebook/test/py/TARGETS"))
I1126 08:10:02.995341 3697890 [main] eden/mononoke/cmds/admin/filenodes.rs:139] -- p1: Some(HgFileNodeId(HgNodeHash(Sha1(ccb76adc7db0fc4a395be066fe5464873cdf57e7))))
I1126 08:10:02.995405 3697890 [main] eden/mononoke/cmds/admin/filenodes.rs:140] -- p2: None
I1126 08:10:02.995449 3697890 [main] eden/mononoke/cmds/admin/filenodes.rs:141] -- copyfrom: None
I1126 08:10:02.995486 3697890 [main] eden/mononoke/cmds/admin/filenodes.rs:142] -- linknode: HgChangesetId(HgNodeHash(Sha1(dfe46f7d6cd8bc9b03af8870aca521b1801126f0)))
```

Turns out, the success rate for this method is actually 0% — out of thousands of requests,
not a single one succeeded :(

https://fburl.com/scuba/edenapi_server/cma3c3j0

The root cause here is that the server side is not properly deserializing
requests (actually finding that was a problem of its own, I filed T80406893 for this).

If you manage to get it to print the errors, it says:

```
{"message":"Deserialization failed: missing field `path`","request_id":"f97e2c7c-a432-4696-9a4e-538ed0db0418"}
```

The reason for this is that the server side tries to deserialize the request
as if it was a `WireHistoryRequest`, but actually it's a `HistoryRequest`, so
all the fields have different names (we use numbers in `WireHistoryRequest`).

This diff fixes that. I also introduced a helper method to make this a little
less footgun-y and double-checked the other callsites. There is one callsite
right now that looks like it might be broken (the commit one), but I couldn't
find the client side interface for this (I'm guessing it's not implemented
yet), so for now I left it as-is.

Reviewed By: StanislavGlebik

Differential Revision: D25187639

fbshipit-source-id: fa993579666dda762c0d71ccb56a646c20aee606
2020-11-27 02:48:58 -08:00
Stanislau Hlebik
cebde43d3f mononoke: refactoring to allow combining bundles in the sync job
Summary:
In the next diff I'd like to allow hg sync job to combine a few bookmark update log entries and send a single bundle for all of them. The goal is to reduce the lag between mononoke and hg servers.

We've already made an attempt to implement bundle combining some time ago, hence why we have things like CombinedBookmarkUpdateLogEntry. However it was never really used in prod - back then the only way to sync a bundle from mononoke to hg servers was to replay a bundle that client has pushed to us, and combining bundles like that was tricky.

Now it's different, because hg sync job has the logic to generates the bundles itself rather than re-use the bundle that client has pushed to us. This makes implementing bundle combinging easier.

This diff doesn't add the actual bundle combining, but it does the refactoring that makes it easier. In particular:
1) Old logic for combining bundles was removed - it was never really used anyway.
1) prepare_bundles() function was added - this function takes a vector of BookmarkUpdateLogEntry and returns a vector of CombinedBookmarkUpdateLogEntry. The idea is to move bundle combining logic from main function to BundlePreparer class, since it has better knowledge of how to do bundle combining (in particular, it knows whether sync job re-uses existing bundle or generates it)
1) prepare_single_bundle() was changed - instead of taking bookmark name, from/to changeset id from BookmarkUpdateLogEntry, it now requires passing them explicitly. This makes adding bundle combining easier in the next diff.

Reviewed By: mitrandir77

Differential Revision: D25168877

fbshipit-source-id: 2935d1795925b4bf0456b9221e2f76ce3987cbd0
2020-11-27 02:21:50 -08:00
Stanislau Hlebik
966d33a84f mononoke: asyncify prepare_single_bundle
Reviewed By: aslpavel

Differential Revision: D25185096

fbshipit-source-id: 4a61420cdf01ceb7e64592c515271459c27114b3
2020-11-27 02:21:50 -08:00
Stanislau Hlebik
d856af393a mononoke: asyncify BundlePreparer constructor
Reviewed By: aslpavel

Differential Revision: D25185048

fbshipit-source-id: 251bca9e6693151e889520e0a40a8051e824d4f7
2020-11-27 02:21:49 -08:00
Stanislau Hlebik
f10d77ce5d mononoke: continue asyncifying main hg sync job loop
Reviewed By: aslpavel

Differential Revision: D25184859

fbshipit-source-id: 7cdc4a2676ee04d8832dc5fd60072cadf5474a18
2020-11-27 02:21:49 -08:00
Alex Hornby
0b873a594f mononoke: DeletedManifest does not need path in walker key
Summary: Only the id is used when loading the manifest, not the path. Path is only needed for route information

Reviewed By: mitrandir77

Differential Revision: D25185264

fbshipit-source-id: 1af453fa2716d53ea4fb18a81d59867e98ea07f6
2020-11-27 00:06:48 -08:00
Alex Hornby
867c6785c4 mononoke: Fsnode does not need path in walker key
Summary: The path is not needed to load the fsnode, only as route info for things like compression

Reviewed By: mitrandir77

Differential Revision: D25184485

fbshipit-source-id: afd84dcd9dbd82c2c9018e86fb676bc57a5d009b
2020-11-27 00:06:48 -08:00
Thomas Orozco
acf1453e12 mononoke: rename BlobManifest to HgBlobManifest
Summary:
We have `HgBlobChangeset`, `HgFileEnvelope`, `HgManifestEnvelope` ... but we
also have `BlobManifest`. Let's be a little consistent.

Reviewed By: markbt

Differential Revision: D25122288

fbshipit-source-id: 9ae0be49986dbcc31cee9a46bd30093b07795c62
2020-11-26 11:26:50 -08:00
Alex Hornby
49ead437dd mononoke: add SkeletonManifest to walker
Summary: Add them to the walker so we can scrub and inspect them

Reviewed By: StanislavGlebik

Differential Revision: D25124144

fbshipit-source-id: 5df1ca6e48d18d3d55f68905e93fd75fbae92adb
2020-11-26 10:11:25 -08:00
Lukas Piatkowski
077b90de0d mononoke:hgcli: fix broken OSS build
Summary: OSS build fails due to unused `res` variable, I don't know why it passes buck builds.

Reviewed By: ikostia

Differential Revision: D25187773

fbshipit-source-id: ee15132f5ccd279104a07bc8dc91de096566d9cf
2020-11-26 09:57:18 -08:00
Thomas Orozco
65c6869384 mononoke/blobrepo/test: use fbinit::compat_test consistently
Summary:
We have 4 different ways of awaiting futures in there: sometimes we create a
runtime, sometimes we use async-unit, sometimes we use `fbinit::test` and
sometimes we use `fbinit::compat_test`. Let's be consistent.

While in there, let's also get rid of `should_panic`, since that's not a very
good way of running tests.

Reviewed By: HarveyHunt

Differential Revision: D25186195

fbshipit-source-id: b64bb61935fb2132d2e5d8dff66fd4efdae1bf64
2020-11-26 08:22:05 -08:00
Thomas Orozco
015331583d mononoke: remove HgBlobEntry
Summary:
HgBlobEntry is kind of a problematic type right now:

- It has no typing to indicate if it's a file or a manifest
- It always has a file type, but we only sometimes care about it

This results in us using `HgBlobEntry` to sometimes represent
`Entry<HgManifestId, (FileType, HgFileNodeId)>`, and some other times to
represent `Entry<HgManifestId, HgFileNodeId>`.

This makes code a) confusing, b) harder to refactor because you might be having
to change unrelated code that cares for the use case you don't care about (i.e.
with or without the FileType), and c) results in us sometimes just throwing in
a `FileType::Normal` because we don't care about the type, which is prone to
breaking stuff.

So, this diff just removes it, and replaces it with the appropriate types.

Reviewed By: farnz

Differential Revision: D25122291

fbshipit-source-id: e9c060c509357321a8059d95daf22399177140f1
2020-11-26 08:22:05 -08:00
Thomas Orozco
1916f9c60b mononoke/derived_data/mercurial: prepare to remove HgEntry
Summary:
I'd like to get rid of HgEntry altogether, as it's not a very useful
abstraction (`Entry` is better). This is one step towards this, by moving the
HgEntry -> Leaf conversion close to where the `HgEntry` is created (which is
where we upload filenodes).

Reviewed By: markbt

Differential Revision: D25122290

fbshipit-source-id: 0e3049392791153b9547091516e702fb04ad7094
2020-11-26 08:22:05 -08:00
Thomas Orozco
c43aa44aca mononoke/mercurial_types: use manifest::Entry instead of HgEntryId
Summary:
I'd like to remove the number of places that use HgEntryId, and make its usage
a little more consistent. Indeed, right now, HgEntryId is used in some places
to upload things where we just give it a fake entry type, and sometimes to
represent an actual entry in a manifest; This isn't great.

Let's remove it from here.

Reviewed By: markbt

Differential Revision: D25122289

fbshipit-source-id: 5075383e037e4e890af203d133f0a25118c19823
2020-11-26 08:22:05 -08:00
Thomas Orozco
34fbac34e1 mononoke/mercurial_types: remove unused ContentBlobInfo
Summary:
This contains a path, which it turns out is actually never used throughout the
codebase. Remove it.

Reviewed By: markbt

Differential Revision: D25122292

fbshipit-source-id: eab528bfb1e3893bca4d92d62c30499cf9eead6c
2020-11-26 08:22:05 -08:00
Alex Hornby
636536bebb mononoke: add SkeletonManifestMapping to walker
Summary: So we can scrub and inspect them

Reviewed By: StanislavGlebik

Differential Revision: D25120995

fbshipit-source-id: d150e55f0d72f584c15dbaf2bd017d19130312b2
2020-11-26 08:07:52 -08:00
Stanislau Hlebik
3d03808d05 mononoke: asyncifying loop_over_log_entries
Reviewed By: aslpavel

Differential Revision: D25184814

fbshipit-source-id: 74e702e059856371fc8737bea3e755321ebe07ba
2020-11-26 07:42:49 -08:00
Stanislau Hlebik
3492e5531b mononoke: asyncify build_outcome_handler
Reviewed By: aslpavel

Differential Revision: D25184784

fbshipit-source-id: 66ca7fb874c7172c39ddfafd0ebde36e9c71f350
2020-11-26 07:42:49 -08:00
Stanislau Hlebik
629cfc750d mononoke: asyncify build_reporting_handler
Summary: This diff asyncifies build_reporting_handler, and while there also simplifies this function a bit by ignoring cases where log_entries is empty or not specified

Reviewed By: farnz

Differential Revision: D25184396

fbshipit-source-id: 46b5d2f9fb5571e502bcdf5a0fe964fb62426313
2020-11-26 07:42:49 -08:00
Stanislau Hlebik
c8400473c9 mononoke: asyncify locking/unlocking functions in hg_sync
Reviewed By: aslpavel

Differential Revision: D25184377

fbshipit-source-id: 72457cb669d00c68eee0fb2c19a866458a369bdb
2020-11-26 07:42:49 -08:00
Stanislau Hlebik
9f6fb707d9 mononoke: asyncify combine_entries in hg_sync job
Reviewed By: ahornby

Differential Revision: D25184363

fbshipit-source-id: fcc289e72b99fe524e6f92ab672bbcfba7101e9a
2020-11-26 07:42:49 -08:00
Stanislau Hlebik
196dec1904 mononoke: asyncify sync_single_combined_entry in hg_sync job
Reviewed By: ahornby

Differential Revision: D25184245

fbshipit-source-id: 59985cdc3cadc7ff945db60fabbcd6c241ff3ba1
2020-11-26 07:42:49 -08:00
Stanislau Hlebik
569733215c mononoke: make SYNC_LOOP async
Summary:
This diff asyncifies SYNC_LOOP similar to how SYNC_ONCE was asyncified.
The biggest part of SYNC_LOOP is a stream that starts with loop_over_log_entries. Previously it was a very long chain of combinators. This diff makes this chain ~2 times smaller, but unfortunately it can't make it even smaller  because of the use of "buffered(...)" method.

Reviewed By: ahornby

Differential Revision: D25123487

fbshipit-source-id: e913bbd1369e4375b5b1d0e6ba462e463a5a44fc
2020-11-26 07:42:48 -08:00
Thomas Orozco
e209225921 commitcloud: read backed up heads via backedup() revset
Summary:
The write & read path use different back up state files, which means they can
go out of sync. If that happens, it's a bit annoying because:

- The output of `hg cloud check` is out of sync with that of `hg sl`
- `hg cloud backup -r` says the commit is backedup, and `hg cloud check -r`
  says it isn't.

This diff fixes this by just using the `backedup()` revset, which under the
hood reads all state files.

Reviewed By: liubov-dmitrieva

Differential Revision: D25186071

fbshipit-source-id: 0ae2d43227d65a3564b2f796218b55982d5cc467
2020-11-26 06:35:57 -08:00
Stanislau Hlebik
2ca8bd5900 mononoke: make hg sync job SYNC_ONCE async
Reviewed By: farnz

Differential Revision: D25123103

fbshipit-source-id: 634287909a6be9e1b34160d63e27f14eabcdce95
2020-11-26 04:41:44 -08:00
Stanislau Hlebik
ed51aac36c mononoke: make retry asynchronous
Reviewed By: ikostia

Differential Revision: D25122781

fbshipit-source-id: a7d69c2cdeff0c9c6abd92e486af191e8baed8d5
2020-11-26 04:41:44 -08:00
Stanislau Hlebik
657d226360 mononoke: make try_prepare_single_bundle async
Reviewed By: farnz

Differential Revision: D25121835

fbshipit-source-id: 2564c404a01ad1f1772da4fef47c4a8940f80f0d
2020-11-26 04:41:44 -08:00
Lukas Piatkowski
15f0f924e6 mononoke/blobstore: use async_trait instead of BoxFuture
Reviewed By: farnz

Differential Revision: D25124793

fbshipit-source-id: 1ebe72d1db8043fabf9f20538f3e95c755e049e0
2020-11-23 07:58:34 -08:00
Thomas Orozco
95cc0e5a30 revisionstore: log more info when we time out
Summary:
Right now we just get a "deadline exceeded" error, which isn't very amenable to
helping us understand why we timed out. Let's add more logging. Notably,
I'd like to understnad what we've actually received at this point, if anything,
and how long we waited, as I'm starting to suspect this issue doesn't have much
to do with HTTP.

See https://fb.workplace.com/groups/scm/permalink/3361972140519049/ for
more context.

Reviewed By: quark-zju

Differential Revision: D25128159

fbshipit-source-id: b45d3415526fdf21aa80b7eeed98ee9206fbfd12
2020-11-23 01:45:54 -08:00
Katie Mancini
a46707cc19 Fix eden du --clean on MacOS
Summary:
`eden du --clean` currently fails with

```
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
```
Full error: P149352812

It looks like this is because Buck expects to run with a different python, so
here I clear out the PYTHONHOME variable before we start buck.

This reuses out logic used elsewhere to clean up the environment before
calling buck.

Reviewed By: wez

Differential Revision: D24904105

fbshipit-source-id: 73587c52aff3ea00f68339eb44e7042329de2e44
2020-11-20 17:25:55 -08:00
Jonathan Keljo
8cb2b9b710 Work around lru-disk-cache UB in Rust 1.48
Summary: `lru-disk-cache` depends on an old version of `linked-hash-map` which contains UB in 1.48 (see https://github.com/mozilla/sccache/issues/813). They updated the deps in their repo months ago, but haven't pushed a new version. This diff makes us get `lru-disk-cache` directly from their GitHub instead.

Reviewed By: dtolnay

Differential Revision: D25134582

fbshipit-source-id: 05fd63a76b7095ebeea458645b92a83bbd8c4614
2020-11-20 17:01:01 -08:00
Alex Hornby
5a6ccc9188 mononoke: fix DeletedManifest to child step in walker
Summary:
It was mistakenly mapping deleted manifest id to a unode id.

I'm surprised the walk.rs code that constructs the DeletedManifestToDeletedManifestChild edge built with this bug. The DeletedManifestId and ManifestUnodeId types presumably coerce to each other.

Reviewed By: markbt

Differential Revision: D25120994

fbshipit-source-id: 1b53037808779c345c163ef32324961938078fc7
2020-11-20 10:30:09 -08:00
Stanislau Hlebik
444289c5d0 mononoke: allow Push bookmark moves in hg sync job
Summary:
Soon we are going to use hg sync job for configerator repos, and they might use
Push bookmark move. Let's allow it in sync job

Reviewed By: ikostia

Differential Revision: D25121176

fbshipit-source-id: f6000617b42be8392730ffc56be1947fbdbfff76
2020-11-20 08:20:38 -08:00
Thomas Orozco
e65b22d9c4 mononoke/repo_client: do not re-upload commits we already have for infinitepush
Summary:
This adds support for optionally not uploading commits we already have when
they arrive via infinitepush. This can happen if we're replaying bundles.

This works by filtering the commits we have. We still get some futures created
for the underlying uploads, but we never poll them because when we visit
what futures are needed for what commits, we don't select uploads that are
only reachable from commits we filtered out.

Obviously, this isn't super efficient, since the client still has to send us
all this data, but it's better than having them send us all that data then
having us take hours overwriting it all.

Reviewed By: mitrandir77

Differential Revision: D25120844

fbshipit-source-id: f96881d0d98ec622259bedb624fd94b600a2bf1d
2020-11-20 06:30:12 -08:00
Lukas Piatkowski
0f54cc3d63 mononoke/blobstore: make Blobstore generic over lifetime
Summary: Remove 'static requirement for async methods of Blobstore, propagate this change and fixup low hanging fruits where the code can become 'static free easily.

Reviewed By: ahornby, farnz

Differential Revision: D24839054

fbshipit-source-id: 5d5daa04c23c4c9ae902b669b0a71fe41ee6dee6
2020-11-20 05:51:52 -08:00
Xavier Deguillard
8260e17f39 inodes: re-order some cache invalidation
Summary:
It feels like invalidating the entry before the directory makes slightly more
sense, so do it in that order.

Reviewed By: chadaustin

Differential Revision: D24800817

fbshipit-source-id: ed053d07bbae6954c276d1ad7a1ff247e5c055d9
2020-11-19 21:59:44 -08:00
Durham Goode
132f37fa14 py3: fix hggit tests
Summary:
It turns out the hggit tests weren't passing in Python 3, despite us
having removed them from our py3-broken list. Woops. This fixes them and enables
the tests.

Reviewed By: sfilipco

Differential Revision: D25095189

fbshipit-source-id: acffca34b0d5defa7575ede60621ca2ce0a2afe4
2020-11-19 18:47:02 -08:00
Durham Goode
a0af56bbd4 extras: allow surrogateescaped byte extras
Summary:
Back in March we forced all extras to be strings. It turns out hggit
needs to write binary extras since it stores some binary patches in extras.
To support that, let's encode commit extras using surrogateescaped. That will
allow hggit to put binary data in extras in a later diff.

Reviewed By: sfilipco

Differential Revision: D25095190

fbshipit-source-id: 330bf06b15fc435f70119490557b8c22341b6ed9
2020-11-19 18:47:02 -08:00
Aida Getoeva
49a5eff46f mononoke/sql: fix connection to the sharded db
Summary:
Apparently shards for some DBs start from 1 (production_filenodes) and for some - from 0 (production_blobstore).
This diff fixed the issue for mysql connections.

Long term we might want to query SMC for the list of shards instead of hardcoding different values in the different places.

Reviewed By: farnz

Differential Revision: D25057136

fbshipit-source-id: 9201a2ec8afe0b66a246a2ee91cc9389630f5ddf
2020-11-19 13:16:01 -08:00
Chad Austin
3f59c5f443 add eden trace hg command
Summary:
Add a TraceBus to HgQueuedBackingStore and allow tracing import events over Thrift.

This powers a new `eden trace hg` command that allows a live view of
tree and blob imports.

Reviewed By: genevievehelsel

Differential Revision: D24732059

fbshipit-source-id: 525152fe39047160a68c1706217a06a00a6dbef1
2020-11-19 13:02:42 -08:00
Stanislau Hlebik
dec791e015 mononoke: do not report bookmark validation error if we get an infra error
Summary:
We got a few ubns because one bookmark validator in a single region wasn't able
to connect to mysql and was reporting errors.

This diff fixes by separating logical and infra errors

Reviewed By: ikostia

Differential Revision: D25092364

fbshipit-source-id: 93f4be1a7e0467051b7b8d927eef9b4f5cd6a983
2020-11-19 12:57:50 -08:00
Thomas Orozco
d3235ff615 mononoke: remove name from HgBlobEntry
Summary:
This isn't actually being consulted anywhere save for a single test, so let's
just remove it (it's not like the test checks anything important — that field
might not as well exist given we never read it).

Reviewed By: farnz

Differential Revision: D25093494

fbshipit-source-id: 5f4a53f8666fc0e8a89ceade44baa96e71fb813f
2020-11-19 12:55:28 -08:00
Thomas Orozco
dae48357ac mononoke/mercurial_types: remove redundant passing of path in upload
Summary:
This is a bit unnecessary as it stands — we roundtrip the path through
execute() just to return it back. This path was used for trace logging, but
given we literally never look at this log, let's just simplify this logging a
little bit.

Reviewed By: StanislavGlebik

Differential Revision: D25089344

fbshipit-source-id: 15b0f1cce8c9b2938429de19ff063e5677794912
2020-11-19 12:55:28 -08:00
Jun Wu
e91552fefe template: add rev f64 compatibility
Summary:
With segmented changelog, rev can exceed f64 safe range
(Number.MAX_SAFE_INTEGER in Javascript, 9007199254740991, 0x1fffffffffffff).
If rev is used in JSON, then the JSON cannot be parsed with precise rev
information.

This diff adds a compatibility mode so template will map the out-of-range revs
to safe range, and the mapped revs can be detected, and mapped back to be
resolved correctly.

Reviewed By: sfilipco

Differential Revision: D25079001

fbshipit-source-id: 52a5a2c8345a76355b8bf81435034d90c7c31610
2020-11-19 12:15:36 -08:00
Mateusz Kwapich
51b21dd9a7 unit test for dechunker raw bundle2 saving
Summary: Tests the behaviour of collecting the raw bundles.

Reviewed By: krallin

Differential Revision: D25025255

fbshipit-source-id: 114da273a28d131f5dd24047ed28ea23d076f235
2020-11-19 06:41:06 -08:00
David Tolnay
448edf7461 Format fbsource with rustfmt-2.0.0-rc.2
Reviewed By: zertosh

Differential Revision: D25075717

fbshipit-source-id: 244182839311f96b69f381c07983276a04ecc5d3
2020-11-18 19:46:38 -08:00
Arun Kulshreshtha
45dd635486 treemanifest: prevent complete tree fetch after HTTP on-demand fetch
Summary:
The `getdesignatednodes` function returns a boolean indicating whether the requested nodes were actually fetched.

In the case of SSH, this is needed because the server may not support the `designatednodes` capability (only supported by Mononoke). If the fetch fails, Mercurial will fall back to an expensive complete tree fetch.

The HTTP version of this function accidentally omitted `return True`, which meant it implicitly returned `None`, which triggered the fallback path.

Reviewed By: sfilipco

Differential Revision: D25074067

fbshipit-source-id: 089d5382dd566db89ee732cdcb82762c8d43e21a
2020-11-18 17:44:12 -08:00
Xavier Deguillard
78fc38e27b store test: do not compile LocalStoreTest on Windows
Summary: The test doesn't compile on Windows, let's just ifdef it.

Reviewed By: genevievehelsel

Differential Revision: D25033804

fbshipit-source-id: 4f312f010f9d0db42cc9ae19df3f668e8e1c4665
2020-11-18 14:39:17 -08:00
Xavier Deguillard
9eca0f83a7 config test: use AbsolutePath instead of folly::fs::path
Summary:
Converting back and forth between folly::fs::path and AbsolutePath appears to
be problematic on Windows as NUL bytes appears in the paths, causing the tests
to fail. Instead of doing this conversion, let's simply use AbsolutePath everywhere.

Reviewed By: chadaustin

Differential Revision: D25033803

fbshipit-source-id: 6c45c2a20fc4bf18cecc838b219faacfeb8386d8
2020-11-18 14:39:17 -08:00
Thomas Orozco
31b9c58a0f mononoke_api: don't hit all bookmarks in all repos at the same time
Summary:
Querying bookmarks in all repos at the exact same time results in us making a
bunch of concurrent queries to MySQL, which in turn results in MyRouter
allocating a bunch of connections.

This is for reporting the age of bookmarks: that stuff can wait... It doesn't
need to be super fast. Let's make it run on repos one at a time to avoid
allocating dozens of connections every 10 seconds (which is more often than
MyRouter seems to close them).

Reviewed By: ikostia

Differential Revision: D25057432

fbshipit-source-id: 8b65ef65752fc9762a26d835ac80f61573003dd7
2020-11-18 09:48:51 -08:00
Johan Schuijt-Li
0cc4d4f100 introduce ability to talk to mononoke directly
Summary:
Skip the need to go through SSH/Mercurial servers. Directly connect to Mononoke
via TLS with X509 certificates.

Reviewed By: markbt

Differential Revision: D24756947

fbshipit-source-id: a782c894956d6a6be055eaa78287c040ceb57da7
2020-11-18 07:34:38 -08:00
Alex Hornby
7e6a398aa7 mononoke: add test for non-public hg changeset walk
Summary: Add a test case for walking hg data from non-public changeset

Reviewed By: ikostia

Differential Revision: D25023130

fbshipit-source-id: 34295f77926b32c77095f7c10d6daa8ef59d9550
2020-11-18 06:08:45 -08:00
Alex Hornby
3bcfce5803 mononoke: allow excluding filenodes from blobimport
Summary: Add command line option to exclude derived data types from blobimport so we can use it to create non-public commits without filenode data for tests

Differential Revision: D25023116

fbshipit-source-id: d8e5d6955f11cebec0de2075c22981bf6c6f4af3
2020-11-18 06:08:45 -08:00
Alex Hornby
88377d204f mononoke: add DeletedManifest to walker types
Summary: Add DeletedManifest to walker types with edges to linked changeset and its sub-manifests so that they can be scrubbed.

Differential Revision: D25000319

fbshipit-source-id: f146e6132fde0fb13e630d315484cc2c0a964bdc
2020-11-18 06:08:45 -08:00
Mark Juggurnauth-Thomas
99bab44a1a scs_server: reset scuba seq for each request
Reviewed By: farnz

Differential Revision: D25022577

fbshipit-source-id: 040dd3a76e4213f03145fe6d3ce73267da1f4d5f
2020-11-18 05:04:44 -08:00
Alex Hornby
bdcc5c2250 mononoke: add DeletedManifestMapping to walker
Summary: Add the mapping from bonsai to deleted manifest to the walker

Reviewed By: ikostia

Differential Revision: D24989424

fbshipit-source-id: 53d622f661629b9b3de91910f4560b641a95a7bf
2020-11-18 04:47:47 -08:00
Alex Hornby
5f5e222c3d mononoke: walker add selectable output format
Summary: Sometimes pretty debug format is too verbose and one per line regular debug format is preferrable.

Reviewed By: ikostia

Differential Revision: D24996432

fbshipit-source-id: 1acda3985658e4c17b57e36734c77b7579e7e28a
2020-11-18 04:47:47 -08:00
Alex Hornby
04c26ffd11 mononoke: add an output option to walker scrub
Summary: add an output option to walker scrub so we can dump out debug representation of any type the walker can walk

Reviewed By: farnz

Differential Revision: D24996433

fbshipit-source-id: a332d89d65e4d928159155a34bd39b0e2e1131de
2020-11-18 04:47:47 -08:00
generatedunixname89002005325676
c22e5de544 Daily arc lint --take CLANGFORMAT
Reviewed By: zertosh

Differential Revision: D25049451

fbshipit-source-id: 6b9d1b95dca0f2454e94918bb78e545e084e5d14
2020-11-18 04:32:26 -08:00
Mark Juggurnauth-Thomas
99c9c39128 mononoke_api: add stats to create changeset parts
Summary: Add gathering of statistics to the three main futures in create_changeset.

Reviewed By: StanislavGlebik

Differential Revision: D25022231

fbshipit-source-id: 26c7cd4a05483e694bdff24229e61a63249f98b5
2020-11-18 02:24:54 -08:00
Mark Juggurnauth-Thomas
dd85945e95 scs_server: add trait for logging thrift response information
Summary:
Add a trait that lets us log data from the response of a thrift request.

Use this to log the commit that was created by `repo_create_commit`.

Reviewed By: StanislavGlebik

Differential Revision: D25022232

fbshipit-source-id: c6526b29b1d2072bf7d4c46d80cb1a5bf522d227
2020-11-18 02:24:54 -08:00
Mark Juggurnauth-Thomas
e0857ba36f scs_server: add parameter logging for RepoCreateCommitParams
Summary:
We don't currently log any information about RepoCreateCommit parameters.

Start logging the parents, date, author and number of changes and deletes.

Reviewed By: farnz

Differential Revision: D25021423

fbshipit-source-id: 2723c208643e074861732a21e149c06ad47879f2
2020-11-18 02:24:54 -08:00
Mark Juggurnauth-Thomas
845167c91e bookmarks_movement: check for case conflicts when landing commits
Summary:
Move the check for commits not having case conflicts from upload time to when
the commit is being landed to a public bookmark.

This allows draft commits in commit cloud to contain erroneously-introduced
case conflicts, whilst still protecting public commits from these case conflicts.

Note that the checks we are moving are the checks for whether this commit
contains case conflicts internally (two files added by this commit conflict in
case), or against the content of ancestor commits (the commit adds a file which
conflicts with an existing file). The check for whether this commit and the
commits it is being pushrebased over conflict still happens during pushrebase.

This behaviour is controlled by a pair of tunable flags:
  * `check_case_conflicts_on_bookmark_movement` enables the new check at land time
  * `skip_case_conflict_check_on_changeset_upload` disables the old check at upload-time

The `check_case_conflicts_on_bookmark_movement` should always be set if the
`skip_case_conflict_check_on_changeset_upload` is set, otherwise users will
be able to land case conflicts.  Setting `check_case_conflicts_on_bookmark_movement`
without setting `skip_case_conflict_check_on_changeset_upload` allows both
checks to be enabled if that is necessary.

To handle bookmark-only moves, the `run_hooks_on_additional_changesets` tunable
flag must also be enabled.

Reviewed By: ahornby

Differential Revision: D24990174

fbshipit-source-id: 34e40e389f2c2139ba24ecee75473c362f365864
2020-11-18 02:10:55 -08:00
Mark Juggurnauth-Thomas
ccfb13ae0c tests: enable skeleton manifests
Summary: Enable skeleton manifest derivation in tests.

Reviewed By: farnz

Differential Revision: D25019342

fbshipit-source-id: a558abafa5a1f0b210c43638d94364b8603ebf4c
2020-11-18 02:10:55 -08:00
Mark Juggurnauth-Thomas
eddc285862 skeleton_manifest: add first_case_conflict method
Summary:
Add a method to `SkeletonManifest` which finds the paths to the first case
conflict, if there is one.

First means lexicographically first within directories, and with the shortest path.

Reviewed By: ahornby, StanislavGlebik

Differential Revision: D24990175

fbshipit-source-id: ec10f66582b81c40740823e32362ca489a6ebb4d
2020-11-18 02:10:55 -08:00
Mark Juggurnauth-Thomas
aea605a82d bookmarks_movement: cache loaded additional changesets
Summary:
Refactor loading of additional changesets so that it is cached.  This will
allow us to access them multiple times but only load them once.

Differential Revision: D24990176

fbshipit-source-id: c21cd1a811ede8fe2c2b03444de0f071ecf5a38c
2020-11-18 02:10:55 -08:00
Chad Austin
4299003775 return a better error message if something includes . or .. in their glob
Summary:
We used to produce a confusing error message during glob evaluation
when . or .. was specified as a glob component. Instead, fail early,
with an error message that more directly explains the problem.

Reviewed By: genevievehelsel

Differential Revision: D24969096

fbshipit-source-id: fe70a8f4db1fdce8eec13890d20913b63a516518
2020-11-17 12:53:39 -08:00
Chad Austin
20d032231c improve PathComponent parse failure error messaging
Summary:
Be more specific about which PathComponent string failed to validate
in order to help diagnose downstream issues like glob syntax errors.

Reviewed By: genevievehelsel

Differential Revision: D24966004

fbshipit-source-id: cd3bc0aeaeb389caa13c86b91149d48c5afdb306
2020-11-17 12:53:39 -08:00
Alex Hornby
4e6045eb4f mononoke: propagate error when parsing node and edge type in walker cmdline
Summary:
Previous code used flat_map on the result which discarded the errors.
Fix it and add a test

Reviewed By: StanislavGlebik

Differential Revision: D24989246

fbshipit-source-id: 075c8e40dceebc480ad722fb467a8a9e9bef5905
2020-11-17 12:24:52 -08:00
Kostia Balytskyi
c85fe51f5f hooks: allow two types of bypasses for the same hook
Summary:
There seem to be legitimate cases when we want to have both bypass mechanisms available: via the commit message and via the pushvar. The need to be able to use a commit message arises from the fact that engineers rarely have access to push CLI, so they cannot use pushvars. Still, pushvars are useful if we want to push an existing commit without any changes to its message.

NB. Since I wanted to make `HookBypass` a multi-option, I had to change it from `enum` to `struct`. If I left fields `pub` in that struct (the way it's commonly done in `metaconfig`, I would've allowed `HookBypass` instances with both options `None`. This is not a big deal, but is a bit ugly as we already store `Option<HookBypass>` instead, so it's better if `Some(hook_bypass)` symbolizes that there indeed is some way to bypass the hook. So I opted in for constructors, getters and private fields.

Reviewed By: StanislavGlebik

Differential Revision: D25000578

fbshipit-source-id: ad13076c9690ee8d45fc4a93e32a6026ff5bdd09
2020-11-17 06:02:30 -08:00
Mateusz Kwapich
1cb9ad2aaf fix the construction of full_bundle2_content in dechunker
Summary:
Dechunker has a feature of saving entire dechunked bundle contents in memory
 this is used to save the raw bundles to manifold. Unitl now this feature worked
 properly when accesed via `Read` trait methods. When accessed via `BufRead`
 trait the logic that was collecting the read contents was skipped.

 This manifested in the saved infinitepush bundles being always trimmed to 4kb.

Reviewed By: markbt

Differential Revision: D25020371

fbshipit-source-id: c606c9fb116a1cd00ae7f4558a7249364faa9c13
2020-11-17 04:56:39 -08:00
Alex Hornby
802a217229 mononoke: add Blame to walker
Summary:
Add Blame to walker so that we can scrub it.

For public commits, if blame is requested we wait for blame to be derived before traversing unodes. This saves traversing the unode tree twice.

For non-public commits they are not expected to have blame, so for those we don't wait for blame to be derived before traversing unodes.

Reviewed By: farnz

Differential Revision: D24896243

fbshipit-source-id: 66226a8e47f115bcda62269ade63874e0fff4ba0
2020-11-17 03:53:33 -08:00
Alex Hornby
b6f2ef5c94 mononoke: consolidate public phase checks in the walker
Summary:
This change allows the walk steps to check the underlying WalkState's phase information to see if a changeset is public. Its exposed to the steps via Checker::is_public().

This saves repeat checks from the changeset phase from the bonsai_to_hg_mapping_step if the walk state already knows its public, and makes sure we are passing the get_phase ephemeral_derive flag from just one place (it should always be the opposite of enable_derive).

Reviewed By: farnz

Differential Revision: D24954837

fbshipit-source-id: b911d69837db8ef34fbe2c27f642d6819ea46908
2020-11-17 03:53:33 -08:00
Alex Hornby
094f51dadb mononoke: use auto_impl for Arc<trait> in walker
Summary: Removes some boiler plate

Reviewed By: farnz

Differential Revision: D24954836

fbshipit-source-id: dcd13affbfeae5027c74e29829c4838c86573f83
2020-11-17 03:53:33 -08:00
generatedunixname89002005325677
e0776a86ed Daily arc lint --take RUSTFMT
Reviewed By: ahornby

Differential Revision: D25018239

fbshipit-source-id: b07b444fc3076b1754a98b5dd1cc9b6026e0a0be
2020-11-17 03:49:35 -08:00
Saurabh Singh
44be130a9d phabricator: ensure retrieved landed commits are in the repository
Reviewed By: mitrandir77

Differential Revision: D24968246

fbshipit-source-id: 6b68f93986a1d91abc676ca94f59d4ee7d3d34de
2020-11-17 03:46:44 -08:00
Alex Hornby
5e24a70160 mononoke: delegate FromStr, AsRef and sampling_fingerprint from BlameId
Summary:
delegate FromStr, AsRef and sampling_fingerprint from BlameId to the
inner FileUnodeId

Reviewed By: markbt

Differential Revision: D24917140

fbshipit-source-id: 1f39b15c91c1f90f371baf03d97f03d00d8798ea
2020-11-17 01:28:34 -08:00
Alex Hornby
50bfe98ec2 mononoke: no need to pass storage-id in walker tests if its the repo default storage
Summary: Remove some boiler plate from tests

Reviewed By: markbt

Differential Revision: D24864067

fbshipit-source-id: b4729f1004fdd0164ca5394b1c9f850ef0c9f25f
2020-11-17 01:28:34 -08:00
Alex Hornby
8cbafc574b mononoke: shorten NodeType variant names in the walker
Summary:
The NodeTypes variants and the EdgeType variants generated from them were getting rather long which makes them hard to work with.

This change shortens them by
   - changing BonsaiChangeset* to Changeset (this also has better consistency with changeset its blobstore keys)
   - updating Bonsai*Mapping to *Mapping )except for BonsaiHgMapping where it disambiguates with HgBonsaiMapping)

Due to the way walker output is sorted it made more sense to do these in one diff rather than two.

Reviewed By: markbt

Differential Revision: D24864061

fbshipit-source-id: dbd395a89be828ac97cf056f03787097d8f1491d
2020-11-17 01:28:34 -08:00
Xavier Deguillard
02ee056b71 inodes: make TraverseTest compile on Windows
Summary: The test wasn't compiling due to these 3 missing headers, add them.

Reviewed By: genevievehelsel

Differential Revision: D24997597

fbshipit-source-id: 6e3be0763362e41be138c670dc88a63bd9e88024
2020-11-16 16:25:22 -08:00
Durham Goode
dacb852353 edenapi: make http version configurable
Summary:
We've seen some hangs with http 2 in lfs. Switching to http 1.1 seems
to fix it. Let's make this configurable so we can tweak this if we see it in
edenapi. For now we continue to default to http 2.

Reviewed By: krallin

Differential Revision: D24901201

fbshipit-source-id: 9806e2c37fa299e4bd381ebdcb17d00800408de3
2020-11-16 10:05:19 -08:00
Johan Schuijt-Li
ec414a7f86 add support for HTTP preamble
Summary:
To support the ability for Mercurial to talk to Mononoke directly while going
through an HTTP proxy, we need to be able to accept HTTP prefixed requests.
This adds the support for Mononoke side. Mercurial client will be added in
subsequent diff.

Reviewed By: krallin

Differential Revision: D24989335

fbshipit-source-id: 597eaa974cea661332967e34abc80b2b609b94ff
2020-11-16 09:12:05 -08:00
Xavier Deguillard
2b1d0a9483 inodes: rename the fuseRefcount in InodeMap
Summary:
This is a preparatory phase to make the refcount usuable on Windows. For more
details, see D24716801 (e50725d2cb)

Reviewed By: chadaustin

Differential Revision: D24764568

fbshipit-source-id: 1e8c6ab00d4c1ec79c347fd5ae7167b2ce1dff68
2020-11-16 09:03:18 -08:00
Xavier Deguillard
4038c01e9f utils: remove //eden/fs/utils/test:linux_test
Summary:
The skip_on_mode_mac argument to cpp_unittest doesn't exist on Windows, and to
be consistent with the rest of the code, we can simply ifdef the code that
either doesn't compile, or doesn't run.

Note: For some reason the accessIncrementsAccessCount test fails when running
on Windows, but only if running after accessAddsProcessToProcessNameCache...

Reviewed By: chadaustin

Differential Revision: D24496450

fbshipit-source-id: fe18fe1d791a27fbe4bd03bd3e8c811feeb23f5f
2020-11-16 08:29:04 -08:00
Xavier Deguillard
b733f70ec2 cli: fix eden debug modified alias
Summary:
This is what `eden debug` shows:
  modified (m, a, t, e, r, i, a, l, i, z, e, d)
                      Enumerate all potentially-modified inode paths

Reviewed By: chadaustin

Differential Revision: D24908570

fbshipit-source-id: 62e91b6f0212c70de4bb1705539d3674e6e000d9
2020-11-16 08:25:03 -08:00
Xavier Deguillard
932e7152fb service: fill the file size for debug file_stats on Windows
Summary:
On Windows, `eden debug file_stats` would crash due to the fileSize not being
filled. Since computing the file size is just a matter of calling stat(2) on
the file, let's simply do that.

Reviewed By: chadaustin

Differential Revision: D24908430

fbshipit-source-id: 07ffb97ada15a07565bea397b436fd21d09b5565
2020-11-16 08:25:03 -08:00
Thomas Orozco
fad04d1b02 mononoke/lfs_import_lib: update to futures 0.3 / tokio 0.2
Summary: Like it says in the title.

Reviewed By: ahornby

Differential Revision: D24918676

fbshipit-source-id: 041823d72fe0ba36262fd71b7ff5be5c42dae283
2020-11-16 04:27:17 -08:00
Stanislau Hlebik
7b3990c080 mononoke: add an option to check service identity in hgcli
Reviewed By: krallin

Differential Revision: D24786082

fbshipit-source-id: 7cd709d19490defb39fcebad08f95c00af54216c
2020-11-16 03:27:29 -08:00