Commit Graph

3985 Commits

Author SHA1 Message Date
Jun Wu
7a12c33163 dev-logger: a simple library to enable env_logger for testing
Summary:
The tracing / env_logger integration works for hg as a binary. However I'd also
like to use it in library tests. This crate makes it easier to do so.

Reviewed By: xavierd

Differential Revision: D20286507

fbshipit-source-id: f5bf3288ce950591ddfe64b524ad51ce21ee4099
2020-03-10 14:16:38 -07:00
Jun Wu
cf72dc45f5 indexedlog: add some tracing information
Summary: Those has helped me debugging some issues.

Reviewed By: xavierd

Differential Revision: D20286513

fbshipit-source-id: 012ddb16c2d0efd8f8697a5ecd4564ea31d65630
2020-03-10 14:16:38 -07:00
Jun Wu
e7ed737a64 hgcommands: make env_logger show exit code
Summary: Move the scope of spans so the exit code is shown.

Reviewed By: xavierd

Differential Revision: D20286516

fbshipit-source-id: f39cbf60c86ea19a1bb0a09958748f04ff6a42e8
2020-03-10 14:16:37 -07:00
Jun Wu
bb9023c2cb hgcommands: move env_logger initialization to hgcommands
Summary:
Previously env_logger is only initialized if Python is initialized.
This diff makes env_logger initialized for Rust native commands.

Reviewed By: xavierd

Differential Revision: D20286517

fbshipit-source-id: 18fee96c2b41db1da9648d615d1e18809de90a63
2020-03-10 14:16:37 -07:00
Jun Wu
97d0a976fd tracing: make it write to the log eco-system
Summary:
This means crates like env_logger (which reads $RUST_LOG, and writes to stderr)
can be used for convenient debugging.

Reviewed By: xavierd

Differential Revision: D20286514

fbshipit-source-id: e3b80cc4830ba5cc6dbf7aa1cbb92a4f4f046a54
2020-03-10 14:16:37 -07:00
Jun Wu
796f199130 tracing: save static metadata from tracing to Spans
Summary:
Those metadata include module_path, target, line number, etc, in Rust native
format.  They will be used for the upcoming `log` integration.

Reviewed By: xavierd

Differential Revision: D20286510

fbshipit-source-id: 27019b941bef08c0bb3e505bbdae642282dcb141
2020-03-10 14:16:36 -07:00
Puneet Kaushik
9fad6af978 Cleaning up second definitions of dtype_t
Summary: Missed cleaning up the other definition in D19956272.

Reviewed By: chadaustin

Differential Revision: D20199689

fbshipit-source-id: 9a00cb7b640f71edc034632e354fb61112a74bc1
2020-03-10 12:27:51 -07:00
Puneet Kaushik
ef671b4e4e Add BlobCache to Windows EdenMount
Reviewed By: simpkins

Differential Revision: D19956271

fbshipit-source-id: d5a88ea8570421a1c61900fbad8a0f9d3e311458
2020-03-10 12:27:50 -07:00
Puneet Kaushik
db5d20b303 Move Windows EdenMount and RepoConfig to fs/inodes/win
Summary: Moving these two files to integrate them better with rest of the Inodes code.

Reviewed By: simpkins

Differential Revision: D19956267

fbshipit-source-id: 5bf8165a6dc70a0c03f71f3f73b383991f21eb56
2020-03-10 12:27:50 -07:00
Puneet Kaushik
aed430d676 Add mode_t size in DirEntry
Summary: Windows sdk doesn't define mode_t. On Windows we use mode to store the file type info which should fix in 16 bits - S_FMT is defined as 0xf000.

Reviewed By: simpkins

Differential Revision: D19956270

fbshipit-source-id: 81acd2cd708f1c82674b8b75cd607d4f5b41a156
2020-03-10 12:27:50 -07:00
Stanislau Hlebik
0f6a8e259f mononoke: log reponame to derived data scuba table
Reviewed By: HarveyHunt

Differential Revision: D20363458

fbshipit-source-id: b52f0051b8b00fc601d00686bc732585317403bc
2020-03-10 11:42:31 -07:00
Lee Howes
f15fdeec84 collectX to collectUnsafe
Summary:
Migration from Future-returning executor-erasing collectX forms to
SemiFuture-returning forms, that are less risky in particular with coroutines.

Earlier diffs added SemiFuture and Unsafe versions. This codemod migrates
collect versions to the Unsafe versions to allow the basic collect versions to
be made safe.

Reviewed By: simpkins

Differential Revision: D20331206

fbshipit-source-id: efc8dff487d45f7d53ee55e8c4696bd3eed0e6da
2020-03-10 11:36:09 -07:00
Victor Zverovich
639073cdd0 Make errnoStr return std::string instead of fbstring
Summary:
The result of `errnoStr` is often converted to `std::string` so returning `fbstring` adds an extra copy. Make it return `std::string` instead. This will also allow removing dependency between `String.h` and `FBString.h`.

(Note: this ignores all push blocking failures!)

Reviewed By: yfeldblum

Differential Revision: D20195395

fbshipit-source-id: 0dc65f1566911156be3fcb715dd105c58f2a8822
2020-03-10 10:50:44 -07:00
Aida Getoeva
3e510491cc scs/history: don't buffer stream if there is no need
Summary:
Time filters for file history require fetching changeset or changeset info to decide whether to include the commit into response. To speed up the process instead of sequential mapping, I buffer the map stream in batches of 100.
However it is unfortunate to fetch additional 100 history changesets if there is no time filters and only several commits were requested. Keeping also in mind that the most of the requests don't care about time.
Avoiding that would speed up the history generation,

I changed the changeset_path API so now it just returns the stream of changeset contexts. And commit_path API for history if there is no time filters collects everything to vector, otherwise applies them and also collects to vector. Then this vector is converted into response using FuturesOrdered.

Reviewed By: StanislavGlebik

Differential Revision: D20287497

fbshipit-source-id: 0c6b1315eccddb48f67bf5fa732bdf7c9a54a489
2020-03-10 10:03:05 -07:00
Genevieve Helsel
bbd450be88 cli logging set -> list for JsonTelemetryLogger
Summary: "tags" are stored as sets, but must be serialized as lists in python. This only affects the `ExternalTelemetryLogger`, which is used on mac builds.

Reviewed By: simpkins

Differential Revision: D20351645

fbshipit-source-id: b097bd6aeb6d109323186f4ae4ef959f831ead2b
2020-03-10 09:57:03 -07:00
Stanislau Hlebik
4241ca0272 mononoke: add repo name in BlobRepo
Summary:
A lot of callsites want to know repo name. Currently they need to pass it from
the place where repo was initialized, and that's quite awkward, and in some
places even impossible (i.e. in derived data, where I want to log reponame).

This diff adds reponame in BlobRepo

Reviewed By: krallin

Differential Revision: D20363065

fbshipit-source-id: 5e2eb611fb9d58f8f78638574fdcb32234e5ca0d
2020-03-10 08:32:33 -07:00
Stanislau Hlebik
a7f67cb698 mononoke: remove in_memory_writes* method
Summary: DangerousOverride trait is better

Reviewed By: krallin

Differential Revision: D20362886

fbshipit-source-id: f083936bce60faa0c60ccd4672704fc642b68234
2020-03-10 07:51:28 -07:00
Thomas Orozco
6f5c623899 mononoke/repo_listener: track request success / failure in ODS
Summary:
We track this in Scuba right now (and alarm on it), but tracking it in ODS will
make it easier to incorporate in our canary and post-release health check
workflow.

Reviewed By: StanislavGlebik

Differential Revision: D20361803

fbshipit-source-id: 99fb514d41f9cda42c3c9a82f3b8d6681285430a
2020-03-10 06:25:11 -07:00
Mateusz Kwapich
9fd7f0d2b4 improve the check for conflicts during insert
Summary:
Before we assumed that if the rows_affected length doesn't match the number of
entries we were trying to insert we have a conflict. Let's verify if we really
have conflict or we're trying to insert the same entry twice.

Reviewed By: krallin

Differential Revision: D20343219

fbshipit-source-id: 19e032439fdd65f5fe1afe1a10b401bc2fe33462
2020-03-10 05:47:05 -07:00
Mateusz Kwapich
e1bf77097f test showing the blobimport problem.
Summary: Running blobimport twice on the same commit seems to cause problems.

Reviewed By: krallin

Differential Revision: D20343218

fbshipit-source-id: 4d572630e7c15c219bee8db15cc879b2cb8602fe
2020-03-10 05:47:05 -07:00
Mark Thomas
9fc8716e85 debugnetwork: show how long it took to query server master bookmark
Summary:
It might be useful to know how long the end-to-end wireproto command to find
the master bookmark took, so log that.

Reviewed By: quark-zju

Differential Revision: D20344686

fbshipit-source-id: 8459a378a0c828a929eee5f9ffd34875a5b8d3cc
2020-03-10 05:36:23 -07:00
Mark Thomas
ed4d2ae9aa debugnetwork: allow multiple tests within a connection to aid warmup
Summary:
For high latency connections we will need to warm up the connection before
starting the download or upload test.  Facilitate this by making it possible to
run multiple tests within the same connection.

This changes the protocol for the speed-test command to be line-oriented commands.

Reviewed By: farnz

Differential Revision: D20344687

fbshipit-source-id: 1d2a815736caf974ed1aaaaf365b86343d41fe02
2020-03-10 05:36:23 -07:00
Alex Hornby
b8ca854c0b mononoke: walker: add ability to walk all published bookmarks
Summary: Add ability to walk all published bookmarks as there may be multiple important bookmarks

Reviewed By: krallin

Differential Revision: D20249806

fbshipit-source-id: aff2ee1ec7d51a9e4fb6e1e803612abd207fd6cb
2020-03-10 05:26:35 -07:00
Lukas Piatkowski
6365fa6509 rust-shed: add no-op memcache_stub implementation to the shed
Reviewed By: mitrandir77

Differential Revision: D20304739

fbshipit-source-id: bd2956619f6a5cf1551bccb921780e7a542e9859
2020-03-10 01:07:46 -07:00
Adam Simpkins
e1490e631c add a counter to report the number of mount failures during startup
Summary:
Add a counter to report the number of mounts that we failed to remount during
startup.  Mount failures do not prevent EdenFS startup from proceeding.  It is
useful to have a metric to report if these errors did occur even though the
start-up as a whole still proceeded otherwise.

Reviewed By: chadaustin

Differential Revision: D20319512

fbshipit-source-id: fd503a1ccc91b476cc9dc2bc6323501bbbeaf2c5
2020-03-09 17:41:34 -07:00
Aida Getoeva
84c0aa9e8c mononoke: allow to derive changeset info
Summary: This also replaces RepoBlobstore with generic Blobstore.

Reviewed By: krallin

Differential Revision: D20336107

fbshipit-source-id: 4e09430d462053d5ccb0b2f0eca7a9d0417b4b5e
2020-03-09 16:41:53 -07:00
Jun Wu
fc911f4c3f sampling: make sure output JSON strings are valid utf-8
Summary:
On Python 2 the Mercurial JSON can be binary, which can break the telemetry
logger. Ensure the JSON string is valid utf-8 (although it might still be
invalid JSON).

Reviewed By: xavierd

Differential Revision: D20343845

fbshipit-source-id: 61e99e742bddf23c7fd5354a5754d79a0a452c28
2020-03-09 14:24:29 -07:00
Stanislau Hlebik
b0cb300af8 mononoke: introduce BlobrepoBuilder
Summary:
The goal of the whole stack is quite simple (add reponame field to BlobRepo), but
this stack also tries to make it easier to initialize BlobRepo.

To do that BlobrepoBuilder was added. It now accepts RepoConfig instead of 6
different fields from RepoConfig - that makes it easier to pass a field from
config into BlobRepo. It also allows to customize BlobRepo. Currently it's used
just to add redaction override, but later we can extend it for other use cases
as well, with the hope that we'll be able to remove a bunch of repo-creation
functions from cmdlib.

Because of BlobrepoBuilder we no longer need open_blobrepo function. Later we
might consider removing open_blobrepo_given_datasources as well.

Note that this diff *adds* a few new clones. I don't consider it being a big
problem, though I'm curious to hear your thoughts folks.

Note that another option for the implementation would be to take a reference to objects
instead of taking them by value. I briefly looked into how they used, and lot of them are passed to the
objects that actually take ownership of what's inside these config fields. I.e. Blobstore essentially takes ownership
of BlobstoreOptions, because it needs to store manifold bucket name.
Same for scuba_censored_table, filestore_params, bookmarks_cache_ttl etc. So unless I'm missing anything, we can
either pass them as reference and then we'll have to copy them, or we can
just pass a value from BlobrepoBuilder directly.

Reviewed By: krallin

Differential Revision: D20312567

fbshipit-source-id: 14634f5e14f103b110482557254f084da1c725e1
2020-03-09 12:05:57 -07:00
Stanislau Hlebik
44effbe62e mononoke: log derived data type and changeset as separate fields
Summary:
We've recently added new scuba table for derived data
(https://fburl.com/scuba/mononoke_derived_data/e4sekisf), and looks like our
previous format of logging is not very useful. It's better to have separate
fields for changeset id and derived data type, since it makes aggregation
easier.

Reviewed By: krallin

Differential Revision: D20309093

fbshipit-source-id: 48f5f04e0412002ef04028e34b12bf267a9b6834
2020-03-09 10:56:59 -07:00
Stefan Filip
d8b4ddcecf dag: split lock file acquisition to own function
Summary:
Spliting lock file acquisition from `IdDag::prepare_filesystem_sync` to its own
function.
Useful when looking ahead to split IdDag from IndexedLog.

Reviewed By: quark-zju

Differential Revision: D20316443

fbshipit-source-id: a0fd43439730376920706bb4349ce497f6624335
2020-03-09 10:18:07 -07:00
Stefan Filip
620cdd96f2 dag: add IdDag::iter_segments_with_parent
Summary:
This removes an inline use of the indexedlog indexes.
This is going to be useful when we try to separate IndexedLog specifics from
IdDag functionality.

Reviewed By: quark-zju

Differential Revision: D20316058

fbshipit-source-id: 942a0a71660bb327376c81fd3ac435d002ecca6e
2020-03-09 10:18:07 -07:00
Mark Thomas
1017318ecf rage: add debugnetwork
Summary:
Add `hg debugnetwork` to the things that `hg rage` collects.

Some of the output from `hg debugnetwork` comes from the peer connection, which is not captured when using `ui.pushbuffer`, as it is written using the remote ui object created when the peer connection is set up.

To handle this, add `ui._outputui` as a way to redirect ui output to another ui object, and use this to redirect the output from the remoteui to the local ui object which is buffering output for hg rage.

Reviewed By: quark-zju

Differential Revision: D20307725

fbshipit-source-id: 3b79a77a39c6e2c5f8a7d5cc271ec466653d4db3
2020-03-09 08:59:13 -07:00
Mark Thomas
63d704f456 mercurial_types: add mock functions for generating commit IDs
Summary:
The mock crates contain a standard set of mock commits ids with all nybbles
set to a single hex value.

For the mutation tests I want to be able to generate them from a number and
have more than 15 changeset IDs.  Add a new function that generates an hg
changeset ID from a number.

Reviewed By: krallin

Differential Revision: D20287382

fbshipit-source-id: 1f57de89f19e2e2eea8dbfea969a4d54510e23d8
2020-03-09 07:24:46 -07:00
Stanislau Hlebik
c1ea56c17c mononoke: asyncify blobrepo_factory
Summary:
Note that comparing to many other asyncifying efforts, this one actually adds
one more clone instead of removing them. This is the clone of a logger field.
That shouldn't matter much because it can be cleaned up later and because this
function will be called once per repo.

Reviewed By: krallin

Differential Revision: D20311122

fbshipit-source-id: ace2a108790b1423f8525d08bdea9dc3a2e3c37c
2020-03-09 05:02:05 -07:00
Adam Simpkins
e0ad04357e also ignore ENOTCONN in "edenfsctl mount"
Summary:
When checking to make sure the destination directory does not look mounted,
ignore ENOTCONN errors.  This can happen if the directory is from a previous
EdenFS instance and did not get unmounted from the kernel properly.

While ideally it would be nicer to run `umount -lf` to clean up this stale
mount point, simply mounting a new checkout on top of this directory is fine.
We don't try to clean up the old mount point here since `umount -lf` would
require root priviliges.

Reviewed By: wez

Differential Revision: D20313117

fbshipit-source-id: c25c85d6b80750662b301f0dff8f293299770a4d
2020-03-06 14:09:37 -08:00
Stanislau Hlebik
c15405d96d mononoke: remove unnecessary clones from lfs_server
Reviewed By: krallin

Differential Revision: D20310686

fbshipit-source-id: 662a9cf358e389e848b1196bbf03469aec691ab8
2020-03-06 13:07:10 -08:00
Mark Thomas
f54c43c22f debugnetwork: add command for debugging network connection problems
Summary:
Add a command that performs various network tests to check the connection to
the Mercurial server for SSH peers.

These tests are:

* Check we can look up the server name in DNS.
* Check we can make a TCP connection to the SSH server.
* Check we can connect and authenticate over SSH and run `hostname`.
* Check we can make a Mercurial wireproto connection and find the `master` bookmark.
* Check the download and upload speed to the server.

Checking the speed requires a companion speed test program on the server.

Reviewed By: mitrandir77, farnz

Differential Revision: D20305227

fbshipit-source-id: adba02a6a1c40ffc20d7bf9d962a5fcf85e06544
2020-03-06 12:27:49 -08:00
generatedunixname89002005307016
4257f52a23 Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: pradeep90

Differential Revision: D20290816

fbshipit-source-id: 210d6944c32314ca6dc0c295aa95d6fbdde04ecc
2020-03-06 12:14:56 -08:00
Kuba Zika
6a25dbee81 Simplify error pattern matching
Summary:
Instead of returning `anyhow::Error` wrapping an `ErrorKind` enum
from each Thrift client method, just return an error type specific
to that method. This will make error handling simpler and less
error-prone by removing the need to downcast the returned error.

This diff also removes the `ErrorKind` enums so that we can be sure
that there are no leftover places trying to downcast to them.

(Note: this ignores all push blocking failures!)

Reviewed By: dtolnay

Differential Revision: D20260398

fbshipit-source-id: f0dd96a7b83dd49f6b30948660456539012f82e6
2020-03-06 12:09:38 -08:00
Hezi Zhang
d7fa579a9c Track readlink() requests during checkout and status
Summary: Pass a valid ObjectFetchContext down into certain untracked requests.

Reviewed By: chadaustin

Differential Revision: D20243575

fbshipit-source-id: e7112c3bab1265803a26130c4d72905c25f2e729
2020-03-06 11:58:25 -08:00
Xavier Deguillard
bfae923336 changelog: the _delaybuf is a byte list
Summary: Make a bytestring with 'b""' to fix Python3

Reviewed By: DurhamG

Differential Revision: D20287313

fbshipit-source-id: 7455d1509684bfb0857a3b060bdcca7e658343fd
2020-03-06 10:29:33 -08:00
Xavier Deguillard
2a47ead18d debug: fix _quasirepr
Summary: Just remove the b.

Reviewed By: DurhamG

Differential Revision: D20286947

fbshipit-source-id: dabdf39fc7f8efa271059e9f179d7417a03f820a
2020-03-06 10:29:32 -08:00
Xavier Deguillard
36ff5d6a7d remotenames: fix expaths
Summary: We need to encode/decode utf8 when reading/writing to the hgrc file.

Reviewed By: DurhamG

Differential Revision: D20286068

fbshipit-source-id: b1d6828fb62a83ad22414de6883004411f302142
2020-03-06 10:29:32 -08:00
Xavier Deguillard
e19f3b97ff extensions: base64.decodestring is deprecated
Summary: Use the recommended base64.b64decode instead.

Reviewed By: quark-zju

Differential Revision: D20297574

fbshipit-source-id: 9d78bc5938ae1888d1d57377e376e6775c1c87d5
2020-03-06 10:29:31 -08:00
Stanislau Hlebik
b905d1399c mononoke: change error of log messages
Summary:
Previously we could have "Started ..." before "Starting ..."
This diff fixes it.

Reviewed By: krallin

Differential Revision: D20277406

fbshipit-source-id: 3c2f3fa1723c2e0852c6b114592ab7ad90be17ff
2020-03-06 10:24:24 -08:00
Stanislau Hlebik
9df1cc0028 remotefilelog: prefetch files in chunks
Summary:
We saw >10 timeouts on Mononoke side from people who fetch a lot of files from corp network (https://fburl.com/scuba/mononoke_test_perf/qd15c5f1). They all tried to download a lot of files, and they 90 mins timeout limit.

Let's try to download these files in rather large chunks (e.g. 200000 files). That should help with resumability and prevent timeout errors, and make retries smaller.

It adds an overhead for establishing a new connection after every 200000 files. That shouldn't be a big problem, and even if it's a big problem we can just increase remotefilelog.prefetchchunksize.

Reviewed By: xavierd

Differential Revision: D20286499

fbshipit-source-id: 316c2e07a0856731629447627ae65c094c6eecc5
2020-03-06 10:06:06 -08:00
Katie Mancini
b0a5ffb100 Expose number of imports queued
Summary: expose the counters for number of pending imports (blobs, trees, prefetches) to allow use in tooling

Reviewed By: chadaustin

Differential Revision: D20269853

fbshipit-source-id: d2b7e2110520290751699c4a891d41ebd5b374cf
2020-03-06 09:28:55 -08:00
Xavier Deguillard
b43f9b8d14 remotefilelog: retry fetches on dropped connections
Summary:
On bad network link (such as on VPN), the reliability of the connection to
Mercurial might be fairly flaky. Instead of failing fetching files, let's retry
a bit first, in the hope that the connection will be back by then.

Reviewed By: quark-zju

Differential Revision: D20295255

fbshipit-source-id: d3038f5e4718b521ae4c3f2844f869a04ebb25e3
2020-03-06 08:32:16 -08:00
Jun Wu
3103fcf62b indexedlog: reload content after obtaining a lock at open time
Summary:
The old code does "read, lock, write", which is unsound because after "lock"
the data just read can be outdated and needs a reload.

Reviewed By: xavierd

Differential Revision: D20306137

fbshipit-source-id: a1c29d5078b2d47ee95cf00db8c1fcbe3447cccf
2020-03-06 08:12:02 -08:00
Thomas Orozco
9493a05e7b mononoke/filestore: update store_bytes to chunk content
Summary:
This updates the store_bytes method to chunk incoming data instead of uploading
it as-is. This is unfortunately a bit hacky (but so was the previous
implementation), since it means we have to hash the data before it has gone
through the Filestore's preparation.

That said, one of the invariants of the filestore is that chunk size shouldn't
affect the Content ID (and there is fairly extensive test coverage for this),
so, notionally, this does work.

Performance-wise, it does mean we are hashing the object twice. That actually
was the case before as well anyway (since obtain the ContentId for FileContents
would clone them then hash them).

The upshot of this change is that large files uploaded through unbundle will
actually be chunked (whereas before, they wouldn't be).

Long-term, we should try and delete this method, as it is quite unsavory to
begin with. But, for now, we don't really have a choice since our content
upload path does rely on its existence.

Reviewed By: StanislavGlebik

Differential Revision: D20281937

fbshipit-source-id: 78d584b2f9eea6996dd1d4acbbadc10c9049a408
2020-03-06 07:43:07 -08:00