Commit Graph

6268 Commits

Author SHA1 Message Date
Arun Kulshreshtha
6a00dd8e8a http_client: update client description
Reviewed By: quark-zju

Differential Revision: D22606295

fbshipit-source-id: e8fca2fd6b074d0991cde4a3cacb95bf0fe07877
2020-07-17 18:49:01 -07:00
Arun Kulshreshtha
cc6dd8ef03 edenapi: allow sending extra HTTP headers with each request
Summary: Allow the user to specify extra HTTP headers that should be sent with each EdenAPI request in the `edenapi.headers` config option. The field is expected to be a JSON object whose key-value pairs are used as header keys and values.

Reviewed By: quark-zju

Differential Revision: D22591870

fbshipit-source-id: ac1bb669270d667895554dcc5f7176d18736375c
2020-07-17 17:33:26 -07:00
Jun Wu
6685a3facc changelog: implement descendant using isancestor
Reviewed By: DurhamG

Differential Revision: D22368835

fbshipit-source-id: bbd7aac5f61b03c76185b055c42e160fccd58e9b
2020-07-17 17:25:54 -07:00
Jun Wu
15c824afe3 changelog: use Rust RevlogIndex for ancestor
Summary:
This can pick a different common ancestor in criss-cross case.
The test is updated to reflect that.

Reviewed By: DurhamG

Differential Revision: D22368837

fbshipit-source-id: 9f897142b3a4bacd0fc90a4a054b7806f1bde826
2020-07-17 17:25:54 -07:00
Stanislau Hlebik
9d18c46b1f remediation of S205607
fbshipit-source-id: 798decc90db4f13770e97cdce3c0df7d5421b2a3
2020-07-17 17:16:13 -07:00
Stanislau Hlebik
3665548bb0 remediation of S205607
fbshipit-source-id: 5113fe0c527595e4227ff827253b7414abbdf7ac
2020-07-17 17:16:13 -07:00
Arun Kulshreshtha
bfd46b50b0 pyedenapi: return dict from health method
Summary: Make the Python EdenAPI client's `health()` method return a dict of server metadata.

Reviewed By: DurhamG

Differential Revision: D22604932

fbshipit-source-id: 51ca60cc95a8dbd15635520b2a9bd72603643cb6
2020-07-17 16:04:32 -07:00
Qinfan Wu
bf06c5782a Import libra-crypto
Summary: Will be useful and avoid copy-pasting some code.

Differential Revision: D22592284

fbshipit-source-id: c42df645042722ea26c13d0737cb349fc2e8fbc1
2020-07-17 13:55:04 -07:00
Jun Wu
b769de39d3 tests: 'buck run :run-tests-py3' should use Python 3 hg
Summary:
`unittestify.py` has logic to discover executables. It is hardcode as Python 2
hg for now. Change it to be aware of the Python 3 versions.

Reviewed By: DurhamG

Differential Revision: D22562875

fbshipit-source-id: 2a19ac6ee805e22fbcc2651ada5f4eaa1bc85f51
2020-07-17 12:31:04 -07:00
Jun Wu
e76eafca39 chgserver: do not save or restore io
Summary:
It's not needed as chgserver forks per request.

This avoids potential EBUSY issues:

  File "chgserver.py", line 267, in _restoreio
    os.dup2(fd, fp.fileno())
  OSError: [Errno 16] Device or resource busy

Reviewed By: DurhamG

Differential Revision: D22534976

fbshipit-source-id: 3e673a7366d1cb060670260ff0b2f5864b75a22d
2020-07-17 12:13:07 -07:00
Ailin Zhang
316698a3c6 add --mount option to eden debug processfetch
Summary: add `--mount` option to `eden debug processfetch` as users might want to know under which checkout they have run those commands.

Reviewed By: kmancini

Differential Revision: D22485225

fbshipit-source-id: df321e6c30064c17abc62584863119b362b2c296
2020-07-17 06:43:58 -07:00
Ailin Zhang
aef527dbb0 eliminate extra blank line in tabulate
Summary: Eliminate extra blank line in tabulate

Reviewed By: kmancini

Differential Revision: D22477405

fbshipit-source-id: b867bfa5c971fcac0104563e866a314416f24fb0
2020-07-17 06:43:58 -07:00
Ailin Zhang
2deb2f28eb eden debug processfetch
Summary:
This diff added a sub-command `process_fetch` to `eden debug`, which lists eden processes sorted by their fetch counts.

New argument options will be added in following diffs.

Reviewed By: fanzeyi

Differential Revision: D22456147

fbshipit-source-id: 75f94ec0ad03d59af1a5bf31c37bdf56de70241b
2020-07-17 06:43:57 -07:00
Thomas Orozco
8a244dc0de mononoke/derived_data: log perf counters to derived data Scuba
Summary:
Like it says in the title. This would be helpful to understand why a particular
derivation took a given amount of time. To avoid having other work that shares
this CoreContext resulting in biased counters, I set this up so that we start
new perf counters for derivation.

Reviewed By: farnz

Differential Revision: D22595473

fbshipit-source-id: de85d5108aabde23cf6587662f15f25aac0cd650
2020-07-17 04:32:12 -07:00
Jun Wu
74e5bc403a bookmarks: ignore default-push remote names
Summary:
See https://fburl.com/1rft34i8 for context. Ignore the default-push names until
we have cleaned up most repos.

Reviewed By: DurhamG

Differential Revision: D22395806

fbshipit-source-id: fd60dd89d8ba82fb9b7c4d145c8c86c9b11c6e68
2020-07-16 23:15:30 -07:00
Jun Wu
10f53151f4 remotenames: normalize 'default-push' to 'default'
Summary:
We have seen cases where `default-push` remote name gets written during pull.
Teach `paths.getname` (new code path) and `remotenames.activepath` (old code
path) to optionally normalize `default-push` to `default` to avoid that.

Reviewed By: DurhamG

Differential Revision: D22395521

fbshipit-source-id: ed16dc30150fc1369f7037296cf77f7f0fc83fee
2020-07-16 23:15:30 -07:00
Arun Kulshreshtha
6f2adbf2cc edenapi: include field names in malformed config errors
Summary: Include the name of bad config fields in the error message so the user can more easily fix the problem.

Reviewed By: quark-zju

Differential Revision: D22591871

fbshipit-source-id: e23e2c71e49e0458e7ea5c13e7feac3a990ead0c
2020-07-16 21:26:37 -07:00
Qinfan Wu
50a8016efc Update libra to latest revision
Summary: Update libra to latest revision.

Reviewed By: jsgf

Differential Revision: D22574392

fbshipit-source-id: e8b937d6957a159c3dc6f1809a042e74c6aa3729
2020-07-16 21:10:44 -07:00
Arun Kulshreshtha
0b7a612c0e edenapi: use CA cert bundle specified in hg config
Summary: Update `edenapi::Builder` to use the CA certificate bundle specified in the `[auth]` section of the user's config.

Reviewed By: quark-zju

Differential Revision: D22591034

fbshipit-source-id: 3a417adbf50ef7d2c538f4a032e54a038cbd282e
2020-07-16 19:48:36 -07:00
Arun Kulshreshtha
3613e4c840 auth: allow specifying a CA certificate bundle
Summary: Allow specifying a CA certificate bundle in the `auth` section of an `hgrc`. This is useful for testing with locally-built servers using self-signed certificates.

Reviewed By: quark-zju

Differential Revision: D22591045

fbshipit-source-id: 023fe006267b0b781a1af16a7505e188c008a8c0
2020-07-16 19:48:36 -07:00
Meyer Jacobs
e3b86cf77d debug: introduce binding layer for propagating error metadata to Python
Summary:
Implements based Rust-Python binding layer for error metadata propagation.

We introduce a new type, `TaggedExceptionData`, which carries CommonMetadata and the original (without metadata) error message for a Rust Anyhow error. This class is passed to RustError and can be accessed in Python (somewhat awkwardly) via indexing:
```
except error.RustError as e:
    fault = e.args[0].fault()
    typename = e.args[0].typename()
    message = e.args[0].message()
```
As far as I can tell, due to limitations in cpython-rs, this can't be made more ergonomic without introducing a Python shim around the Rust binding layer, which could adapt the cpython-rs classes to use whatever API we'd like.

Currently, anyhow errors that are not otherwise special-cased will be converted into RustError, with both the original error message and any attached metadata printed as shown below
```
  abort: intentional error for debugging with message 'intentional_error'
  error has type name taggederror::IntentionalError and fault None
```
We can of course re-raise the error if desired to maintain the previous behavior for handling a RustError.

If we'd like other, specialized Rust Python Exception types to carry metadata (such as `IndexedLogError`), we'll need to modify them to accept a `TaggedExceptionData` like `RustError`.

Renamed the "cause an error in pure rust command" function to `debugcauserusterror`, and instead used the name `debugthrowrustexception` for a command which causes an error in rust which is converted to a Python exception across the binding layer.

Introduced a simple integration test which exercises `debugthrowrustexception`.

Added a basic handler for RustError to scmutil.py

Reviewed By: DurhamG

Differential Revision: D22517796

fbshipit-source-id: 0409489243fe739a26958aad48f608890eb93aa0
2020-07-16 19:30:00 -07:00
Durham Goode
43489d91d4 py3: fix prompt being erased by progress
Summary:
Flushing behavior changed in Python 3 and now we need to flush the
progress bar after clearing it, since clearing it is part of suspending the
progress and we don't want any stored up redraw bytes to wipe out future writes
from the caller.

Reviewed By: quark-zju

Differential Revision: D22579013

fbshipit-source-id: f3afd560e1365696509f56b137cceababcfed794
2020-07-16 16:26:33 -07:00
Arun Kulshreshtha
bffb24216d revisionstore: move tokio runtime into EdenApiRemoteStore
Summary: Move the `tokio::Runtime` into `EdenApiRemoteStore` so that if initialization fails, we can propagate the error instead of panicking.

Reviewed By: xavierd

Differential Revision: D22564210

fbshipit-source-id: 9db1be99f2f77c6bb0f6e9dc445d624dc5990afe
2020-07-16 13:32:19 -07:00
Arun Kulshreshtha
6849666105 edenapi_types: add metadata field to DataEntry
Summary:
Add a metadata field to `read_res` containing a `revisionstore::Metadata` struct (which contains the object size and flags). The main purpose of this is to support LFS, which is indicated via a metadata flag.

Although this change affects the `DataEntry` struct which is serialized over the wire, version skew between the client and server should not break things since the field will automatically be populated with a default value if it is missing in the serialized response, and ignored if the client was built with an earlier version of the code without this field.

In practice, version skew isn't really a concern since this isn't used in production yet.

Reviewed By: quark-zju

Differential Revision: D22544195

fbshipit-source-id: 0af5c0565c17bdd61be5d346df008c92c5854e08
2020-07-16 13:32:19 -07:00
Arun Kulshreshtha
3327e15201 edenapi: percent-encode repo names
Summary: Instead of restricting the allowed characters in a repo name, allow any UTF-8 string. The string will be percent-encoded before being used in URLs.

Reviewed By: quark-zju

Differential Revision: D22559830

fbshipit-source-id: f9caa51d263e06d424531e0947766f4fd37b035f
2020-07-16 13:32:19 -07:00
Lukasz Piatkowski
0dd3c4e4bb add Mononoke integration tests CI (#26)
Summary:
This diff adds a minimal workflow for running integrations tests for Mononoke. Currently only one test is run and it fails.

This also splits the regular Mononoke CI into separate files for Linux and Mac to match the current style in Eden repo.
There are the "scopeguard::defer" fixes here that somehow escaped the CI tests.
Some tweaks have been made to "integration_runner_real.py" to make it runnable outside FB context.
Lastly the change from using "[[ -v ... ]" to "[[ -n "${...:-}" ]]; in "library.sh" was made because the former is not supported by the default Bash version preinstalled on modern MacOS.

Pull Request resolved: https://github.com/facebookexperimental/eden/pull/26

Reviewed By: krallin

Differential Revision: D22541344

Pulled By: lukaspiatkowski

fbshipit-source-id: 5023d147823166a8754be852c29b1e7b0e6d9f5f
2020-07-16 12:16:10 -07:00
Durham Goode
9d2a577ac4 merge: backout checkunknownfiles fix
Summary:
This fix was originally meant to prevent doing checkunknown files when
it was clear there was no conflict. Unfortunatley, the data doesn't appear to
show it helped, and in some cases it definitely hurt it. Let's back it out for
now until we can do more investigation.

Reviewed By: StanislavGlebik

Differential Revision: D22574000

fbshipit-source-id: aeb644ecd6da046df17e6d10418a72363c1ee532
2020-07-16 10:45:14 -07:00
Genevieve Helsel
4624d1f3af if APFS volume name exceeds 127 length, hash it to avoid failure
Summary: APFS volume names have a length limit of 128, so we need to hash mount point to make sure we do not error out. Right now what happens if we get an error, but we do still successfully mount and the volume name is just truncated. Since we errored, we don't store this information anywhere. Instead now, we will check the volume name, and if it is too long, we hash the volume name in order to mitigate the "name too long" error.

Reviewed By: wez

Differential Revision: D22327372

fbshipit-source-id: d68f90472c1d952879078d0541b341d271c17092
2020-07-16 09:17:16 -07:00
Durham Goode
905ee42654 configs: add support for hostname-based dynamicconfigs
Summary: Makes the hostname available for dynamicconfig conditions.

Reviewed By: quark-zju

Differential Revision: D22537946

fbshipit-source-id: 630ee833bb3ec00253d718b3d03bbb8b3d49afca
2020-07-16 09:07:54 -07:00
Durham Goode
76df783c93 configs: implement user sharding
Summary: Adds support for sharding based on user name.

Reviewed By: quark-zju

Differential Revision: D22537540

fbshipit-source-id: 962f9582c8947335dc9d9d29c500d8c09df69878
2020-07-16 09:07:53 -07:00
Simon Farnsworth
ae4b55ccaf Sort test output in test-cmd-manual-scrub.t
Reviewed By: krallin

Differential Revision: D22570814

fbshipit-source-id: bd1ef5defb2c401a3a6d19c4102c8904a211289d
2020-07-16 05:48:07 -07:00
Durham Goode
2eae6130fb py3: fix eden lfs fetching
Summary: The tests now pass

Reviewed By: xavierd

Differential Revision: D22561933

fbshipit-source-id: 7f130391de845207589b0abe52481d03915ce18f
2020-07-15 22:16:19 -07:00
Stanislau Hlebik
2a07de29df dynamicconfig: do not use perfpipe_hgerrors
Summary:
Turned out we have perfpipe_hgerrors and perfpipe_hg_errors. Having both of
them is quite confusing, so I suggest to only use perfpipe_hg_errors

We don't seem to have any alarms on these tables, so renaming should be esy

Reviewed By: quark-zju

Differential Revision: D22546855

fbshipit-source-id: a450444e8c2270603c3146f4f05072029f935f4d
2020-07-15 19:41:58 -07:00
Jun Wu
2dd3bb83d4 test-fb-hgext-fbconduit: update the test
Summary:
D22526230 (7ab2c54f08) adds extra output.
The test seems to be skipped in buck test due to the hgsql requirement.

Reviewed By: kulshrax

Differential Revision: D22555707

fbshipit-source-id: 8659de3cda517a49296c747e65bfbd0d372c031a
2020-07-15 19:00:50 -07:00
Jun Wu
3068ac02bd hgsql: fix chunksize py3 compatibility
Summary: `int / int` gives `float` on Python 3 and that can cause issues.

Reviewed By: singhsrb

Differential Revision: D22563891

fbshipit-source-id: 443245710a0d2de660019f03845bed0077d62889
2020-07-15 17:16:33 -07:00
Arun Kulshreshtha
c7bffff0ff edenapi: allow all ASCII characters in repo names
Summary: We have several repos whose names contain various non-alphanumeric/underscore/hyphen characters, so we need to be more permissive about accepting repo names.

Reviewed By: quark-zju

Differential Revision: D22554846

fbshipit-source-id: e7bb030e0b8fb6aa275c119ba0aa540405b29186
2020-07-15 15:12:49 -07:00
Arun Kulshreshtha
8cc3939f35 revisionstore: do not swallow errors from EdenAPI stores
Summary:
Previously, the EdenAPI stores would not report errors returned from the remote store. The intention behind this pattern in other stores is to prevent `KeyError`s from aborting the operation since the local store might still have the key.

However, in the case of the EdenAPI store, EdenAPI will simply omit missing keys in its response rather than returning an error. Instead, any error returned by the EdenAPI store indicates a more fundamental problem (e.g., unable to reach the server, connection reset, etc) which should cause an abort and return the error.

Reviewed By: quark-zju

Differential Revision: D22544031

fbshipit-source-id: e01e8d88b75e46dcebd2eef5203e3a0edde69fc7
2020-07-15 15:07:51 -07:00
Arun Kulshreshtha
e9a291438b edenapi: add limit option to read_res
Summary: When working with large CBOR responses, it is sometimes useful to limit processing to the first N entries to prevent the operation from taking a long time. This diff adds an option to the `read_res` tool to only look at the first N entries in a data or history response.

Reviewed By: quark-zju

Differential Revision: D22544451

fbshipit-source-id: 5e8e2c7212aa3b315a25bd4cf9273009a5e43f72
2020-07-15 13:19:16 -07:00
Jun Wu
5b8885d50d changelog: use Rust RevlogIndex for isancestor
Reviewed By: DurhamG

Differential Revision: D22368826

fbshipit-source-id: b4e03e99b29f5f8b28f561ef8048da4ef4f7c235
2020-07-15 13:16:47 -07:00
Jun Wu
c60a9aed4d changelog: use Rust RevlogIndex for findcommonmissing
Reviewed By: DurhamG

Differential Revision: D22368828

fbshipit-source-id: fc263b9a867f3bccb72bb57d967f510f0c467b66
2020-07-15 13:16:47 -07:00
Jun Wu
d3df634f14 changelog: use Rust RevlogIndex for descendants
Reviewed By: DurhamG

Differential Revision: D22368830

fbshipit-source-id: ccfc1128012014223c86c52fab6cf3845827e3f1
2020-07-15 13:16:47 -07:00
Jun Wu
a7dc48bfeb changelog: use Rust RevlogIndex for children
Reviewed By: DurhamG

Differential Revision: D22368829

fbshipit-source-id: 4ba4d59af784dd2195f2485c2cefa70c9f2e04ca
2020-07-15 13:16:47 -07:00
Jun Wu
482661f33e changelog: use Rust RevlogIndex for rev and node
Reviewed By: DurhamG

Differential Revision: D22368833

fbshipit-source-id: 86732db40c7aaa6ccb5851892f41aab5eac3021d
2020-07-15 13:16:47 -07:00
Jun Wu
4bcafe228f changelog: use Rust RevlogIndex for nodesbetween
Summary:
The pure Python `nodesbetween` implementation relies on raw revlog details and
weirdness (ex.  `index[len(repo)]` returns `nullid`). Replace them with cleaner
code paths.

Reviewed By: DurhamG

Differential Revision: D22368831

fbshipit-source-id: c7eb0c2bb2759e9fb574afc63ad2b398d7b17d38
2020-07-15 13:16:47 -07:00
Jun Wu
a3cc71f184 changelog: use Rust RevlogIndex for revision
Reviewed By: DurhamG

Differential Revision: D22368824

fbshipit-source-id: 16c43e377443850200212f813dcbf544b622206e
2020-07-15 13:16:47 -07:00
Stanislau Hlebik
1ebc6ab608 fbscmquery: use correct exception message field
Summary:
We got user reports about failing hg log call -
https://fb.workplace.com/groups/scm/permalink/3016242448425355/.

If we can't fetch the data from graphql then we try to e.msg, however we don't
have such a field. We have e.message instead.

This diff fixes it, and also adds new line to make formatting better.

Reviewed By: quark-zju

Differential Revision: D22548251

fbshipit-source-id: 117489d8e6a22ab5bc43be1154697398086508d0
2020-07-15 13:11:12 -07:00
Arun Kulshreshtha
165f387df5 backingstore: do not require remotefilelog.reponame to be set
Summary: Some repos do not have `remotefilelog.reponame` set, so this shouldn't be a required config item.

Reviewed By: fanzeyi

Differential Revision: D22553141

fbshipit-source-id: a0fe9c289a1a32650572a4c123cda60af90e79ec
2020-07-15 12:14:00 -07:00
Meyer Jacobs
4ccbd119d7 debug: introduce error classification and metadata propagation
Summary:
Introduce new rust library, taggederror, which contains utilities for attaching metadata to errors. The library provides two main methods for attaching metadata to an error, the TaggedError wrapper type, and the AnyhowExt trait methods. Provides a struct, CommonMetadata, which contains all the metadata types introduced by taggederror (fault, transience, category, and typename), which can also be attached individually (and the same pattern can be used to attach other metadata).

Introduce a new native rust command, debugthrowrustexception, which causes the command to return an error, with some attached metadata.

Modify hg rust native command dispatch error handling to use debug formatter to print anyhow::Error errors. This will print out the source chain, contexts, and backtrace if available, which will cause the metadata we attach as a wrapper error or context to be printed.

Reviewed By: DurhamG

Differential Revision: D22420941

fbshipit-source-id: d38c5a10b686d86b69a2c0a19f5bcbf4ca24dff6
2020-07-15 10:03:10 -07:00
Mark Thomas
0bd84ab898 scs_server: increase list_bookmarks limits (part 2)
Summary:
Increase the max limits for repo_list_bookmarks and commit_list_descendant_bookmarks
from 1,000 to 10,000.  The higher number is still reasonable for a single request,
and this reduces the number of round-trips when there are lots of bookmarks.

This updates the constants in the thrift definition.  The server was updated to accept
higher limits in a previous diff.

Reviewed By: mitrandir77

Differential Revision: D22524891

fbshipit-source-id: bc47c1e50af35f213ebcfbca1574669e79b2fe92
2020-07-15 08:15:06 -07:00
Thomas Orozco
ef6d7b48b4 mononoke/lfs_server: popularity: add ODS counters, timeouts and tests
Summary:
ODS counters are helpful to know if the feature is turned on or off without
requiring a traffic spike, so let's log them. Also, let's add timeouts in here,
so we know if things aren't working as expected (I did check in the Mononoke
LFS dataset — 10ms is a very conservative number, that's way beyond the p99 of
batch requests, which include potentially many counter checks).

To make this easier to iterate on, let's also add tests.

Reviewed By: StanislavGlebik

Differential Revision: D22545853

fbshipit-source-id: 02ea4484a4e4ba0dfd4a71030c129eb5c6bb1ec9
2020-07-15 03:39:23 -07:00