Commit Graph

10614 Commits

Author SHA1 Message Date
Zeyi (Rice) Fan
dfc5480620 cli: disable edenfsctl top for Windows
Summary:
Currently running `edenfsctl top` will crash on Windows:

```
Traceback (most recent call last):
  File "C:\Python38\Lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python38\Lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\tools\eden\bin\edenfsctl.exe\__main__.py", line 3, in <module>
  File "C:\tools\eden\bin\edenfsctl.exe\eden\fs\cli\main.py", line 2253, in zipapp_main
  File "C:\tools\eden\bin\edenfsctl.exe\eden\fs\cli\main.py", line 2236, in main
  File "C:\Python38\Lib\asyncio\runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "C:\Python38\Lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "C:\tools\eden\bin\edenfsctl.exe\eden\fs\cli\main.py", line 2212, in async_main
  File "C:\tools\eden\bin\edenfsctl.exe\eden\fs\cli\main.py", line 1059, in run
  File "C:\tools\eden\bin\edenfsctl.exe\eden\fs\cli\top.py", line 395, in __init__
  File "C:\Python38\Lib\curses\__init__.py", line 13, in <module>
    from _curses import *
ModuleNotFoundError: No module named '_curses'
```

This diff will let it prints an error message.

Reviewed By: xavierd

Differential Revision: D28207330

fbshipit-source-id: a465fe5941b469f4a1ef964f1d4dc8a593639e7c
2021-05-05 18:24:12 -07:00
Zeyi (Rice) Fan
bd08aac957 cli: parse command line args outside asyncio
Summary:
It looks like argparse's exit was not able to handle asyncio event loop well,
causing edenfsctl to generate a long ugly stack trace when the command line
flag does not parse.

Let's just move the arguments parsing outside the asyncio runloop to avoid this
problem as a whole. In theory it should improve our `--help` time a little bit.

Reviewed By: chadaustin

Differential Revision: D28206622

fbshipit-source-id: 881eefaea73b244eadff0165965085e64dad935f
2021-05-05 18:24:12 -07:00
Zeyi (Rice) Fan
70f7b5151b cli: do not call os.getuid on Windows
Summary:
Some user reported to see `edenfsctl restart` crashes due to this call to
os.getuid() since it does not available on Windows. P410914264

https://docs.python.org/3.9/library/os.html#os.getuid

Reviewed By: chadaustin

Differential Revision: D28204262

fbshipit-source-id: 077bf207d8b1b6c014fface63ea93e66057629cd
2021-05-05 18:24:12 -07:00
Jun Wu
7a0765ab25 edenapi: do not dependent on eagerepo
Summary:
eagerepo -> metalog -> git2 -> libgit2-sys -> libgit2 conflicts with edenfs'
non-Rust libgit2 dependency. Rust git2 crate does not seem to provide a way to
depend on specified libgit2.

Quote https://github.com/rust-lang/git2-rs/issues/263#issuecomment-450934287:

> It's expected that git2-rs builds its own copy of libgit2 and doesn't use the
> system version, as the system version is likely incompatible

It also seems non-trivial to make buck C++ use the libgit2 frm `libgit2-sys` crate.

Let's just avoid depending on eagerepo from edenapi directly for now to solve the
issue. This basically revives D27948369 and D27951632.

Reviewed By: xavierd

Differential Revision: D28243784

fbshipit-source-id: 0c38c20c2d3a80c550732129da572fe26a229799
2021-05-05 18:21:00 -07:00
Jun Wu
2cf4957de0 runtests: expand $TESTTMP in hgrc
Summary:
This makes it easier to use `--keep` to investigate tests by using
`--configfile`.

Reviewed By: kulshrax

Differential Revision: D27971122

fbshipit-source-id: 8adcbeab825155858499c24ca74c2979049adeda
2021-05-05 17:53:39 -07:00
Stefan Filip
f6c588a7a0 context: rename CoreContext's base constructor
Summary:
Rename `new_with_containers` to `new`. `new` the standard name for
what the fuction does.

Reviewed By: krallin

Differential Revision: D28210005

fbshipit-source-id: 9ad0dad5e8afd89d7538fd32d93de10837e26f9d
2021-05-05 15:29:26 -07:00
Stefan Filip
0eabd94e5f context: remove CoreContext::test_mock_class
Summary:
Refactoring the construction logic for CoreContext.
`test_mock_class` is used in only one place. That usage can be replaced with
`test_mock_session`.

Reviewed By: krallin

Differential Revision: D28210007

fbshipit-source-id: c81ca31cb7255ef640fe641e9b38f239cfb69267
2021-05-05 15:29:26 -07:00
Stefan Filip
86ef0755d4 context: rename CoreContext contructor for bulk processing
Summary:
Refactoring CoreContext construction to express purpose. We will have
a constructor for request processing, for background processing.
Bulk processing is another category that has it's own constructor
already. Renaming it to make it more prominent.

Reviewed By: krallin

Differential Revision: D28210006

fbshipit-source-id: 2bb74d97e2f3588aa539e58c3d6dd6842f898121
2021-05-05 15:29:26 -07:00
Zeyi (Rice) Fan
9d64cd399d backingstore: fix winhttp linkage issue
Summary:
We have a linker issue on Windows when building EdenFS with CMake:

```
backingstore.lib(winhttp.o) : error LNK2019: unresolved external symbol __imp_WinHttpSetStatusCallback referenced in function winhttp_connect
backingstore.lib(winhttp.o) : error LNK2019: unresolved external symbol __imp_WinHttpOpen referenced in function winhttp_connect
backingstore.lib(winhttp.o) : error LNK2019: unresolved external symbol __imp_WinHttpCloseHandle referenced in function winhttp_close_connection
backingstore.lib(winhttp.o) : error LNK2019: unresolved external symbol __imp_WinHttpConnect referenced in function winhttp_connect
backingstore.lib(winhttp.o) : error LNK2019: unresolved external symbol __imp_WinHttpReadData referenced in function winhttp_stream_read
backingstore.lib(winhttp.o) : error LNK2019: unresolved external symbol __imp_WinHttpWriteData referenced in function winhttp_stream_read
backingstore.lib(winhttp.o) : error LNK2019: unresolved external symbol __imp_WinHttpQueryOption referenced in function certificate_check
```

This fixes that.

Reviewed By: xavierd

Differential Revision: D28230163

fbshipit-source-id: f74e42ee30ec8f3b81c1f80b7cf63a21ea97732c
2021-05-05 15:01:01 -07:00
Zeyi (Rice) Fan
a500f985d3 integration: fix test failure on Windows
Summary: This should fix the test failure introduced in D28203778 (9bee308885) where fsck tests were not skipped on Windows.

Reviewed By: genevievehelsel

Differential Revision: D28227230

fbshipit-source-id: 97ef5717fbda567b48f02a60e1906e374fdc6766
2021-05-05 15:01:01 -07:00
Jun Wu
f347dc94f9 remotefilelog: do not use f strings
Summary: The syntax is not supported by Python 2.

Reviewed By: DurhamG

Differential Revision: D28233280

fbshipit-source-id: 9f882827b1357cb339e60180acadb38842c3cf8d
2021-05-05 13:30:11 -07:00
Jun Wu
2e07267f2d remotefilelog: do not use **kwargs,
Summary: The syntax is not supported by Python 2.

Reviewed By: DurhamG

Differential Revision: D28232995

fbshipit-source-id: 62058751b4f00b78a2bd56908100a7bb7a3adfde
2021-05-05 13:22:30 -07:00
Alex Hornby
da5dac311b rust: remove patch for async-compression
Summary: Upstream crate has landed my PR for zstd 1.4.9 support and made a release, so can remove this patch now.

Reviewed By: ikostia

Differential Revision: D28221163

fbshipit-source-id: b95a6bee4f0c8d11f495dc17b2737c9ac9142b36
2021-05-05 12:20:34 -07:00
Jun Wu
60e240b17e eagerepo: fix Windows compatibility
Summary: Windows path like `eagerepo:///C:\foo\bar` needs special handling.

Reviewed By: kulshrax

Differential Revision: D27971119

fbshipit-source-id: 9d4b87782eca2734b708565f0ee22a7495253cff
2021-05-05 12:01:50 -07:00
Stanislau Hlebik
bc9fefff5b mononoke: remove tunables for skeleton manifest create changeset rollout
Summary: We needed only for the initial rollout, we can delete it now

Reviewed By: krallin

Differential Revision: D28226715

fbshipit-source-id: 20349e9775b71292604a4054162f026087511db8
2021-05-05 11:58:06 -07:00
Genevieve Helsel
100fccc193 retire hg gc
Summary: `hg gc` does not do anything anymore, so in order to reduce confusion, let's just print a message that says it is no longer supported and provide a manual remediation.

Reviewed By: xavierd

Differential Revision: D28164614

fbshipit-source-id: 7ed2392cdb0091cd604a15b4c2382632706981f2
2021-05-05 11:48:58 -07:00
Thomas Orozco
16fa5d1bdf mononoke: sample logging from Quicksand
Summary:
Quicksand is about 60% of our logging, but we don't really need to log
everything it does because the workload is pretty much the same across all
hosts.

Reviewed By: HarveyHunt

Differential Revision: D28225416

fbshipit-source-id: 68c0f68c4da73e0f7543754c917d7efa4bbf374e
2021-05-05 11:02:50 -07:00
Toan Mai
410f7c5c61 Imported a mysql_common patch to support FromRow for tuples up to arity 16 (#23)
Summary:
Pull Request resolved: https://github.com/facebookexperimental/rust-shed/pull/23

Pull Request resolved: https://github.com/facebookincubator/resctl/pull/8081

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

Imported a mysql_common patch to support FromRow for tuples upto arity 16
Context: https://fburl.com/zfnw7r86

Followed the guide: https://www.internalfb.com/intern/wiki/Rust-at-facebook/Managing_fbsource_third-party_with_Reindeer/#maintaining-local-change

Reviewed By: marcelogomez

Differential Revision: D28094262

fbshipit-source-id: fed48e3950e8a3ba3d7a15407522167e5ae41a98
2021-05-05 10:32:48 -07:00
Alex Hornby
394ff15823 mononoke: make phases take iterator get_public_raw
Summary: It was requesting a slice but always converted it to an Iterator anyway.  Receiving an iterator saves constructing a temporary Vec both here and later in the stack

Reviewed By: krallin

Differential Revision: D28127582

fbshipit-source-id: 625c1f17f1ded973f8b2aa13566928af0df83aec
2021-05-05 09:52:36 -07:00
Jun Wu
c793852fba treemanifest: do not bundle trees present on server
Summary:
This avoids issues where the tree is stored without p1, p2. It is similar to
what we do for public commits (in createtreepackpart):

  if sendtrees == shallowbundle.AllTrees or ctx.phase() != phases.public:
      ...

Note: the trees API actually provides p1, p2, but p1, p2 are dropped when
writing to the current data store implementation.

Reviewed By: liubov-dmitrieva

Differential Revision: D28200388

fbshipit-source-id: e1fe93d8ae8576e691077d6db432d55f7b9d498d
2021-05-05 09:48:29 -07:00
Jun Wu
e0f02950ea pyedenapi: add trees API unrelated to store
Summary: Add a way to fetch tree content without going through store.

Reviewed By: liubov-dmitrieva

Differential Revision: D28200387

fbshipit-source-id: 8f5b2214aafba39c7674f0f6b27af0c985f0ea72
2021-05-05 09:48:29 -07:00
Jun Wu
e687a92d10 pyedenapi: rename trees to storetrees
Summary:
The `trees` API is coupled with a store. We're going to add another API that is
not coupled with a store so let's rename `trees` to `storetrees`.

Reviewed By: liubov-dmitrieva

Differential Revision: D28200389

fbshipit-source-id: 826116f0b461873b2f5df07e7fd35e6d1018f929
2021-05-05 09:48:29 -07:00
Andrey Chursin
eec8e784f5 tests: do not test native checkout debug output in test-update-reverse.t
Summary:
This output is non-determenistic, and it does not seem to be important in this test
We could replace HashMap with BTreeMap to make it deterministic, as an alternative, but it is probably not justified for this test

Reviewed By: quark-zju

Differential Revision: D28204050

fbshipit-source-id: 50000671520e3bbf41849dc53c420ccab496dca0
2021-05-05 09:40:29 -07:00
Alex Hornby
74f5e21506 mononoke: add a cmdlib option for manifold weak consistency
Reviewed By: farnz

Differential Revision: D28217480

fbshipit-source-id: c520650cbf0a34bc042e711ddb7e09063e0eea47
2021-05-05 05:51:03 -07:00
Filipe Mourao Leite
4f0890d93c Remove unused import
Summary: This import is not used anywhere (since D28007850 (bb3d207e33)) and could be removed (currently it throws a warning whenever someone attempts to do a cargo check)

Reviewed By: sandeepkumarpani888

Differential Revision: D28220436

fbshipit-source-id: a7fc0fe84d485d37fe86476011a853df57a6bc03
2021-05-05 04:45:39 -07:00
CodemodService Bot
b4afda3890 Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: krallin

Differential Revision: D28216338

fbshipit-source-id: 2384a332505881bbc8cd621694496cf9f37c3bea
2021-05-05 04:03:47 -07:00
Stanislau Hlebik
f4c799dffa mononoke: record how long saving the raw bundle took
Reviewed By: krallin

Differential Revision: D28215994

fbshipit-source-id: 5be23dd10eeb483cd17926cb064ecfe9f566cad4
2021-05-05 03:03:47 -07:00
Liubov Dmitrieva
b506eeea0c do not perform syncing for public commits
Summary: we display incorrectly 'local changes' for public commits

Reviewed By: DurhamG

Differential Revision: D28000088

fbshipit-source-id: 81bb8926dd7e96bf283eabe2b0aca84a9155fea3
2021-05-05 02:48:19 -07:00
Liubov Dmitrieva
f74c212472 remove dead code
Summary: the option has been deprecated and is not used anywhere

Reviewed By: krallin

Differential Revision: D28191314

fbshipit-source-id: f5f092b93a9644c8249628520d8d707b60854aac
2021-05-05 02:45:45 -07:00
Durham Goode
27d58bbd42 configs: delete applydynamicconfig
Summary: This is no longer used.

Reviewed By: quark-zju

Differential Revision: D26676518

fbshipit-source-id: 1cc9c32e2a95d6db78160f33ab5423338ea82e04
2021-05-04 22:18:55 -07:00
John Reese
9fd86a4fae apply upgraded black 21.4b2 formatting to fbsource
Summary:
This applies the formatting changes from black v21.4b2 to all covered
projects in fbsource. Most changes are to single line docstrings, as black
will now remove leading and trailing whitespace to match PEP8. Any other
formatting changes are likely due to files that landed without formatting,
or files that previously triggered errors in black.

Any changes to code should be AST identical. Any test failures are likely
due to bad tests, or testing against the output of pyfmt.

Reviewed By: thatch

Differential Revision: D28204910

fbshipit-source-id: 804725bcd14f763e90c5ddff1d0418117c15809a
2021-05-04 22:16:51 -07:00
Zeyi (Rice) Fan
9bee308885 cli: disable edenfsctl fsck on Windows
Summary:
Context: https://fb.workplace.com/groups/edenfswindows/permalink/828914994691047/

Even with D27872753 it doesn't really make sense to have `eden fsck` running on Windows since it requires EdenFS repository to **be unmounted**.

This diff changes it to generate a warning to redirect users to run `eden doctor` instead (which is likely what they need).

Reviewed By: kmancini

Differential Revision: D28203778

fbshipit-source-id: ae105678876903bcf6514252bf07189775f9b187
2021-05-04 21:25:00 -07:00
Jun Wu
2400e5c960 pydag: add importclonedata
Summary:
This will consume `CloneData` from EdenApi and write to the graph.

Note `CloneData<Vertex>` and `CloneData<HgId>` has the same mincode
serialization result so there is no need to do extra type conversion.

This can be used like:

  In [1]: v=api.clonedata('fbsource');
  In [6]: d=bindings.dag.commits.openhybrid(None, '/tmp/seg', '/tmp/msg', repo
     ...: .edenapi, repo.name, lazyhash=True)

  In [7]: d.importclonedata(v)

Reviewed By: kulshrax

Differential Revision: D27971125

fbshipit-source-id: 4d420c6ff0495dc184e7c9618b866a69f0a00002
2021-05-04 18:28:45 -07:00
Jun Wu
f1d1862e70 hgcommits: expose import_clone_data API
Summary:
Expose NameDag's `import_clone_data` API so this can be then exposed via
`pydag`.

Reviewed By: kulshrax

Differential Revision: D27971118

fbshipit-source-id: c9d869ffbbc8ba5a7a6ae98d17a2b7ea713bc675
2021-05-04 18:28:45 -07:00
Jun Wu
1b4f6be538 pyedenapi: add clonedata endpoint
Summary: The `CloneData` is currently only exposed in Rust. Expose it in Python too.

Reviewed By: kulshrax

Differential Revision: D27971124

fbshipit-source-id: 1a9c63274b6e2d78a176869b6810acbc191ba314
2021-05-04 18:28:45 -07:00
Jun Wu
fa7ba86bad exchange: skip pull phase if narrow-heads is on
Summary: We skip it in other places but missed this one. Skip it too.

Reviewed By: kulshrax

Differential Revision: D27957853

fbshipit-source-id: 429d25e8b692218c9bae6c10ad76d08495a4bc66
2021-05-04 18:28:45 -07:00
Jun Wu
ae81c8fd34 edenapi: force use edenapi if ui.ssh is false
Summary: If ui.ssh is "false", then ssh cannot be used at all. Force using edenapi.

Reviewed By: kulshrax

Differential Revision: D27957312

fbshipit-source-id: 9860344779e6a6bab557d3f953ee38e40fadb78b
2021-05-04 18:28:45 -07:00
Jun Wu
032f5e5158 eagerepo: add tracing messages
Summary: Make it easier to check whether APIs in EagerRepo is called or not.

Reviewed By: andll

Differential Revision: D27955426

fbshipit-source-id: 27ca505c63596368cff98642de010b5b5717454c
2021-05-04 18:28:45 -07:00
Jun Wu
66c0778db7 treemanifest: enable useruststore by default
Summary: It has been enabled for a long time in our production config.

Reviewed By: kulshrax

Differential Revision: D27953636

fbshipit-source-id: 428f6e8a3e7eae6d44c61970624a75d7d1ab3e36
2021-05-04 18:28:45 -07:00
Jun Wu
37404e7f64 treemanifest: enable ondemandfetch by default
Summary: It has been enabled for a long time in our production config.

Reviewed By: kulshrax

Differential Revision: D27953635

fbshipit-source-id: a351342fbc8cffccd16967bd0e7032ac3e4f35cf
2021-05-04 17:00:56 -07:00
Jun Wu
49e8c82d07 exchange: pull from EagerRepo without getbundle
Summary:
Add "getbundle" alternative "commitgraph" for pulling from a EagerRepo.
This avoids tech-debt like bundle2 or linkrev. It depends on a lazy
(text) changelog backend.

Reviewed By: kulshrax

Differential Revision: D27951620

fbshipit-source-id: f21119d37da6505e68c6c5f3b33b9bd1f65e4d9a
2021-05-04 17:00:56 -07:00
Jun Wu
afe31ecd00 hgcommits: make resolve_names_to_relative_paths accept empty heads
Summary: It's not an error case. It just means all nodes are unknown to the repo.

Reviewed By: kulshrax

Differential Revision: D27951619

fbshipit-source-id: 672932af3a54ffa5adfa5cccbfff7edbf4f24022
2021-05-04 17:00:56 -07:00
Jun Wu
199fba304a changelog2: allow migrating to lazy backend from an empty repo
Summary: It's okay to migrate to any backend if the repo is empty.

Reviewed By: kulshrax

Differential Revision: D27951626

fbshipit-source-id: 27c00c853bf73fa3c696d74f3c05eb620f35db0e
2021-05-04 17:00:56 -07:00
Jun Wu
494309f22a exchange: push to EagerRepo without unbundle
Summary:
Add "unbundle" alternative "addblobs" for pushing to a EagerRepo.
This avoids tech-debt like bundle2 and linkrev.

Reviewed By: kulshrax

Differential Revision: D27951628

fbshipit-source-id: 3315e0653ee12928993e4e9325fbe8e2c369307b
2021-05-04 17:00:56 -07:00
Jun Wu
bf409c27d4 edenapi: build EagerRepo on demand
Summary:
Now EdenApi trait is moved to a separate crate, we can inline the EdenApi
backed by EagerRepo without using dynamic registration functions.

Reviewed By: andll

Differential Revision: D28006553

fbshipit-source-id: 427513da94db228745b1a7e90af0e62296056128
2021-05-04 17:00:56 -07:00
Jun Wu
abe4222df9 eagerepo: move url handling to Rust
Summary: So that we don't duplicate the URL handling in Python.

Reviewed By: andll

Differential Revision: D28006552

fbshipit-source-id: 2efda622fe86787373fa4ec5978537588defec28
2021-05-04 17:00:55 -07:00
Jun Wu
917e8f3e67 eagerpeer: add a new peer type backed by EagerRepo
Summary:
`peer` is the interface in hg to support push/pull. Implement it for EagerRepo.
Note: `getbundle` and `unbundle` are not implemented yet. Push / Pull are not
working yet. They will be made work later.

Reviewed By: kulshrax

Differential Revision: D27951621

fbshipit-source-id: 71f9c26713a532a0712460fa2aa34125b2b67e35
2021-05-04 17:00:55 -07:00
Pyre Bot Jr
99f17e57ed suppress errors in fbcode/eden - batch 1
Differential Revision: D28190108

fbshipit-source-id: 6d67de1cb21f6ec4400adae2f42811f1f3e5d155
2021-05-04 15:25:14 -07:00
Durham Goode
7469868f65 make: avoid fb python for make builds
Summary:
Our BigSur mactest machines have python3 defaulting to some internal
fbprojects python install. This is breaking our OSS builds. Let's change
pick_python to avoid that install.

Note, sys.stdout was changed to print because during my manual testing on Mac,
sys.stdout did not actually print the value, despite the flush.  Using print()
did work.

Reviewed By: quark-zju

Differential Revision: D28101632

fbshipit-source-id: 2907d644b2baa8a53a9a2d7da176d33cd83dfbd5
2021-05-04 14:43:32 -07:00
Alex Hornby
058448b022 mononoke: make manual_scrub success file optional when checkpointing
Summary: Manual scrub success file can be very large and have fairly high IO rate.  When checkpointing keys to a file its not really needed, so make it optional.

Reviewed By: farnz

Differential Revision: D28199084

fbshipit-source-id: 83d946f7ab8dc6f5f17f94b6a1c3818d9af7b0b0
2021-05-04 13:32:00 -07:00