Commit Graph

84886 Commits

Author SHA1 Message Date
Mark Juggurnauth-Thomas
eb7495935f hgmanifest: don't overallocate when loading manifests
Summary: We are using the upperbound of `<[u8]>::split`'s iterator as the value for `with_capacity`, however this is incredibly pessimistic, and as a result we overallocate.  Let's just make an initial pass and count the actual number.

Reviewed By: RajivTS

Differential Revision: D49951367

fbshipit-source-id: c3ce6fa0d4125f2cac26c9ea017a0992f9291397
2023-10-05 10:24:09 -07:00
Alex Hornby
0db20e2b24 reviewstack: fix verify addons/ folder github ci (#730)
Summary:
reviewstack: fix verify addons/ folder github ci

analytics.test.ts was trying to call the real gh cli rather than a mock, which was causing errors when gh not installed, and process and handle leaks when gh was installed. Fixed bu using mock execa as we don't need real gh to test the analytics tracking

Jest was also reporting leaks of timeouts after above fix, so added dispose() to debounce.ts and call dispose() from githubCodeReviewProvider

Found shared/ depends on reviewstack generated textmate grammars, so can't run concurrently without flakiness (fails with missing import).  Fixed test ordering in verify-addons-folder.py

Tests also log about missing watchman which triggers a failure due to logs after test exit, even if watchman disabled. Install fb-watchman to silence it

Tes plan:

Before, ./verify-addons-folder.py tests broken in CI with:
```
Error: Unhandled error. (Error: GhNotInstalledError: Error: Command failed with ENOENT: gh api graphql -f searchQuery=repo:facebook/sapling is:pr author:me -F numToFetch=100 --hostname github.com -f query=
    query YourPullRequestsQuery($searchQuery: String!, $numToFetch: Int!) {
  search(query: $searchQuery, type: ISSUE, first: $numToFetch) {
    nodes {
      ... on PullRequest {
```
```

After, works

 ---
Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/sapling/pull/730).
* https://github.com/facebook/sapling/issues/693
* https://github.com/facebook/sapling/issues/696
* https://github.com/facebook/sapling/issues/692
* https://github.com/facebook/sapling/issues/691
* https://github.com/facebook/sapling/issues/682
* https://github.com/facebook/sapling/issues/689
* https://github.com/facebook/sapling/issues/697
* https://github.com/facebook/sapling/issues/706
* __->__ https://github.com/facebook/sapling/issues/730

Pull Request resolved: https://github.com/facebook/sapling/pull/730

Reviewed By: evangrayk

Differential Revision: D49875301

Pulled By: genevievehelsel

fbshipit-source-id: 2e322467200189781b881decc3a3af5647605cc6
2023-10-05 09:34:39 -07:00
Muir Manders
b22ca6b910 merge: split update() into goto() and merge()
Summary:
merge.update() had a lot of complicated arg checking to differentiate simple working copy updates from tricker three way merges. In particular, the eden and nativeupdate code paths only support the simple update case.

To make things clearer, let's separate update() into goto() and merge(). goto() handles the simple case, and moving it to Rust will be the (achievable) goal of some upcoming work. merge() handles the full enchilada, and isn't ripe for Rustification at this point.

Reviewed By: zzl0

Differential Revision: D49058005

fbshipit-source-id: f8106c04c48bfba0e7fad244e1dd9933142674e1
2023-10-05 08:03:08 -07:00
Muir Manders
5144e52f36 update: delete some more dead stuff from merge.py
Summary: I couldn't find any references to the eden.prefetchsparseprofiles and clone.nohttp config settings.

Reviewed By: sggutier

Differential Revision: D49058002

fbshipit-source-id: 833cff3b3da0531ca18cabb3ade8289bf13dfaca
2023-10-05 08:03:08 -07:00
Muir Manders
2ddf809bcd update: remove experimental.updatecheck config
Summary:
Been deprecated for a while in favor of "commands.update.check".

There is a terrible subtlety here: "commands" config settings are automatically filtered out when HGPLAIN=1. "experimental" settings are not. So, experimental.updatecheck=noconflict was active with HGPLAIN=1, but commands.update.check=noconflict is not active with HGPLAIN=1. This would be a change in behavior, though, so I set the configitems.py default value to "noconflict" which will take effect with HGPLAIN=1.

Still, there is a change in behavior in that locally configured commands.update.check behavior will no longer take effect with HGPLAIN=1. It doesn't look to be configured anywhere outside hg, so I think we are okay.

We are planning to simplify and improve the update check with upcoming Rust work, so this config knob should go away, hopefully.

Reviewed By: sggutier

Differential Revision: D49058007

fbshipit-source-id: af2d01bf7bc6fac0bbbd913b745ce5da8353f13d
2023-10-05 08:03:08 -07:00
Jan Mazur
96dfe6674d force index (repo_id_hg_kind_category) on bookmarks query
Summary:
This should be faster: P843478180

COntext: https://fb.workplace.com/groups/1371712213722489/permalink/1409766953250348/

Differential Revision: D49819703

fbshipit-source-id: 252e6d3d5643768f950e86dd857d096a4cf6f663
2023-10-05 06:36:18 -07:00
Youssef Ibrahim
ec0437abe0 new_admin: fix doc comment for derived-data exists command
Summary: zuckwoah

Reviewed By: RajivTS, singhsrb

Differential Revision: D49952148

fbshipit-source-id: 0e274ab0692b808bd402ccc7ad34be3807d47b5d
2023-10-05 06:33:51 -07:00
Liubov Dmitrieva
7634e365ea implement task local ClientRequestInfo
Summary: implement task local ClientRequestInfo and pass thread local into task local for EdenApi

Reviewed By: quark-zju

Differential Revision: D49912043

fbshipit-source-id: 1327aecd2162a441737a0602c42899980f3c2e23
2023-10-05 05:26:09 -07:00
Liubov Dmitrieva
43e36518b9 fetch thread local client request info in places where we need to pass it
Summary:
fetch thread local client request info edenfs would set in places where we need to pass it
over to async code that maybe running of different thread.

Assuming EdenFs calls store_client_request_info_onto_thread_local to set up
Client Request Info C++ side
https://www.internalfb.com/code/fbsource/[81b42a9f7d29e61f59c2b3cabf97ffb9e786a557]/fbcode/eden/scm/lib/clientinfo/facebook/src/lib.rs?lines=18

Reviewed By: zzl0

Differential Revision: D49830193

fbshipit-source-id: d1a334fa41aee7b136ca6cd3f8d74c1731318f71
2023-10-05 03:41:22 -07:00
Rajiv Sharma
9e9b019eac Update DeltaInstructions storage logic
Summary: This diff updates the `DeltaInstructions` storage logic to use `flate2` Zlib encoding instead of the `async-compression` ZLib encoding to maintain consistency with how Git objects are encoded and decoded when creating packs and bundles. It also adds a unit test to validate that the round trip from storage to bytes works as expected for `DeltaInstructions`

Reviewed By: markbt

Differential Revision: D49814036

fbshipit-source-id: 2c934f392a6be47a2d419a8ff84dbf1645dc6fae
2023-10-05 02:54:26 -07:00
Open Source Bot
bca3c4e066 Updating submodules
Summary:
GitHub commits:

170abaa92e
fbdf7dfb6c
0c2e35db75
2b046829b2

Reviewed By: zpao

fbshipit-source-id: 64f2546756db802ed6e10d527b2e533ada261142
2023-10-05 01:31:55 -07:00
generatedunixname89002005287564
f19537e70e eden (3693101019543887448)
Reviewed By: xavierd

Differential Revision: D49860603

fbshipit-source-id: 7dc8d663b65e89d859ef692265873ee7b472fba5
2023-10-05 01:11:20 -07:00
Jun Wu
8388c6c3ca version: show website and more information
Summary: Hopefully this can further reduce confusion.

Reviewed By: muirdm

Differential Revision: D49922798

fbshipit-source-id: 6da9f05eb9f3327976640bc67be6fed724611bd3
2023-10-04 18:01:10 -07:00
Jun Wu
4300eecc8f identity: update identity to show "Sapling"
Summary:
Make `version` show "Sapling" even when running under hg identity.
This might reduce confusion internally.

Reviewed By: muirdm

Differential Revision: D49922799

fbshipit-source-id: 41cf17b461547ac4b2e16364667486216adeec27
2023-10-04 18:01:10 -07:00
Open Source Bot
4c30caeaef Updating submodules
Summary:
GitHub commits:

1829b66e24
305301384d
8ede242a58
413a20c6a8
8e949116f7
c4936c125c
ea18a680b9

Reviewed By: zpao

fbshipit-source-id: 00a3176282bba2b518121e10e74c912c854269dc
2023-10-04 17:01:53 -07:00
Zhaolong Zhu
897427a413 copytrace: increase the value of DEFAULT_MAX_RENAME_CANDIDATES
Summary:
We met a copytrace failure, which was caused below two combined factors:
1. lib.rs is common name
2. commit 843db9ece03c is a big commit that changed many "lib.rs" files.

Let's increase the DEFAULT_MAX_RENAME_CANDIDATES, so we will check more
candidates files in this case.

Reviewed By: muirdm

Differential Revision: D49894288

fbshipit-source-id: 442f6901d8a4b7c3edfb9ccb59b7f5ef295d4885
2023-10-04 14:25:41 -07:00
Open Source Bot
ce2abd4616 Updating submodules
Summary:
GitHub commits:

11984b1b40
67b9fb20fb
ad31e68486
2b6dfffd0e

Reviewed By: zpao

fbshipit-source-id: 770ad291e965712203628ec4be4faf396f58c3cf
2023-10-04 13:05:30 -07:00
Open Source Bot
2e55634646 Updating submodules
Summary:
GitHub commits:

d87b8f249b
f6bf0eeb6e
d75faffc51

Reviewed By: zpao

fbshipit-source-id: a5d5d0c2fadbac2d376975d919cf69d96ceda51e
2023-10-04 11:57:28 -07:00
Daniel Mueller
d2db2da220 Update lru to 0.11.1
Summary: Update the `lru` version we use to `0.11.1`.

Reviewed By: zertosh

Differential Revision: D49889174

fbshipit-source-id: 4b8103b9f6a4a066eded1667983bc45bd9991192
2023-10-04 09:42:59 -07:00
Open Source Bot
b8d51e660e Updating submodules
Summary:
GitHub commits:

7790b33936
8d268a2ed4
de9e5729e2

Reviewed By: zpao

fbshipit-source-id: 99e1b9adbada595e1a16cb69b158d9f86367d5e8
2023-10-04 01:16:02 -07:00
Open Source Bot
d1b257cf50 Updating submodules
Summary:
GitHub commits:

ed8ef26d47
1c2cb9d27b
a528fffe23
4026a6b2a1
b55002a311

Reviewed By: zpao

fbshipit-source-id: a3b6dccd6a9c832a08d84242a8a3966e0fe80acd
2023-10-03 22:59:21 -07:00
Jun Wu
828384adfa config: further rename dynamicconfig to internalconfig
Summary:
See the previous change for context. This diff updates the rest of the internal
functions, modules to use the internalconfig name.

Reviewed By: muirdm

Differential Revision: D49881848

fbshipit-source-id: 439fc82f7c9345a79d7c6d32d0d0610556901505
2023-10-03 22:38:36 -07:00
Jun Wu
64700cefc2 hgcommands: rename {,dump}dynamicconfig to {refresh,dumpinternal}config
Summary:
Per discussion on Aug 28, we'd like to rename dynamicconfig to internalconfig
to better reflect its actual features (Meta-internal static + dynamic + remote
configs). See also the `mode.rs` in D48042830.

The `dynamicconfig` command has effects writing files. Rename it to
`refreshconfig` to emphasize the effects.

The `dumpdynamicconfig` command only writes to stdout. So keep its "dump"
name but rename "dynamic" to "internal".

Reviewed By: muirdm

Differential Revision: D49881549

fbshipit-source-id: 0c3bb9caf6ea91ae7fe624e199cd3355244489e0
2023-10-03 22:38:36 -07:00
Open Source Bot
e8fb75f7d5 Updating submodules
Summary:
GitHub commits:

311e326ec3
5639861ff9
06e8bc10c7

Reviewed By: zpao

fbshipit-source-id: 2b8e4c19aeb28d0b523d7c7da9f4dd4552eb5f5b
2023-10-03 19:32:42 -07:00
Jun Wu
b7302632be alias: mark some common aliases non-legacy
Summary:
People with muscle memories would be a bit surprised that certain commands no
longer work with `sl`. By moving them back from `legacyaliases` to `aliases` the
migration from `hg` to `sl` could be more smooth.

Reviewed By: zzl0

Differential Revision: D49879280

fbshipit-source-id: 20c747d7c44c1c53a89fc425187eb2280134a62d
2023-10-03 18:32:08 -07:00
John Elliott
fbc906b3cc Refactor HgDatapackStore batch fetch code
Summary: In previous diffs the amount of code that was duplicative grew. This diff, refactors that duplicative code into a single method.

Reviewed By: kmancini

Differential Revision: D49753337

fbshipit-source-id: 34e5c5f132fcb4fa36754bad96b4277fcce9c08e
2023-10-03 18:16:39 -07:00
John Elliott
9c6dcd6233 Update HgDatapackStore to handle duplicate blob metadata requests
Summary:
As part of the project to remove HgImporter (aka `hg debugedenimporthelper`) it was discovered that we present duplicate keys to the EdenAPI when making batched requests - https://fburl.com/scuba/edenfs_events/owb8b65e. This reults in the requests being failed in the `backingstore` library (to avoid being failed by Mononoke). When these batched requests fail - they fall back to using HgImporter and fetch each object one at a time.

This diff addresses the batching of blob metadata. It creates a map of unique object ids to vectors of requests. In most cases the vector is size 1.

With the help of chadaustin, we were able to root cause why duplicate requests are submitted to  EdenAPI. From Eden's POV, each individual file and directory are different and identified by a different hash. From Mononoke's POV, content (tree or blob) that contain the exact same bytes are the same regardless of where they are in a repo. For this reason, it is possible (somewhat common) to create a batch of requests that contain the same proxy hash to be submitted to EdenAPI and the solution put in place here is the correct one - identifying a set of duplicates, submitting only one hash for the set, and fulfilling all the set's promises when completed.

This diff and subsequent diffs also are increasing the amount of duplicate code between getBobBatch, getBlobMetadataBatch and getTreeBatch. This will be address in subsequent diffs - see T165043385.

Reviewed By: kmancini

Differential Revision: D49717032

fbshipit-source-id: cb1d18dc038dd2c4672313eb1433dd94d5bdd506
2023-10-03 18:16:39 -07:00
John Elliott
6abee9e9bb Update HgDatapackStore to handle duplicate tree requests
Summary:
As part of the project to remove HgImporter (aka `hg debugedenimporthelper`) it was discovered that we present duplicate keys to the EdenAPI when making batched requests - https://fburl.com/scuba/edenfs_events/owb8b65e. This reults in the requests being failed in the `backingstore` library (to avoid being failed by Mononoke). When these batched requests fail - they fall back to using HgImporter and fetch each object one at a time.

This diff addresses the batching of trees. It creates a map of unique object ids to vectors of requests. In most cases the vector is size 1.

With the help of chadaustin, we were able to root cause why duplicate requests are submitted to  EdenAPI. From Eden's POV, each individual file and directory are different and identified by a different hash. From Mononoke's POV, content (tree or blob) that contain the exact same bytes are the same regardless of where they are in a repo. For this reason, it is possible (somewhat common) to create a batch of requests that contain the same proxy hash to be submitted to EdenAPI and the solution put in place here is the correct one - identifying a set of duplicates, submitting only one hash for the set, and fulfilling all the set's promises when completed.

This diff and subsequent diffs also are increasing the amount of duplicate code between getBobBatch, getBlobMetadataBatch and getTreeBatch. This will be address in subsequent diffs - see T165043385.

Reviewed By: kmancini

Differential Revision: D49707255

fbshipit-source-id: f176b785e74e71a2d13865397e9023ce538e928c
2023-10-03 18:16:39 -07:00
John Elliott
18a8aec9d7 Update HgDatapackStore to handle duplicate blob requests
Summary:
As part of the project to remove HgImporter (aka `hg debugedenimporthelper`) it was discovered that we present duplicate keys to the EdenAPI when making batched requests - https://fburl.com/scuba/edenfs_events/owb8b65e. This reults in the requests being failed in the `backingstore` library (to avoid being failed by Mononoke). When these batched requests fail - they fall back to using HgImporter and fetch each object one at a time.

This diff addresses the batching of blobs. It creates a map of unique object ids to vectors of requests. In most cases the vector is size 1.

With the help of chadaustin, we were able to root cause why duplicate requests are submitted to  EdenAPI. From Eden's POV, each individual file and directory are different and identified by a different hash. From Mononoke's POV, content (tree or blob) that contain the exact same bytes are the same regardless of where they are in a repo. For this reason, it is possible (somewhat common) to create a batch of requests that contain the same proxy hash to be submitted to EdenAPI and the solution put in place here is the correct one - identifying a set of duplicates, submitting only one hash for the set, and fulfilling all the set's promises when completed.

This diff and subsequent diffs also are increasing the amount of duplicate code between getBobBatch, getBlobMetadataBatch and getTreeBatch. This will be address in subsequent diffs - see T165043385.

Reviewed By: kmancini

Differential Revision: D49663711

fbshipit-source-id: 8f08b1e577c791550f446f86ddf301721b9587bf
2023-10-03 18:16:39 -07:00
Zhaolong Zhu
dde8296cfd makefile: set 'HGNAME' env variable when running 'make oss'
Summary:
before

```
$ make oss
...
rm -f sl
cp build/scripts-3*/sl sl
cp: build/scripts-3*/sl: No such file or directory
make: *** [local] Error 1
```
after

```
...
rm -f sl
cp build/scripts-3*/sl sl
```

Reviewed By: muirdm

Differential Revision: D49871832

fbshipit-source-id: ecbd083f5187b6fb0f0c4e640d732f336ef2cb30
2023-10-03 17:33:41 -07:00
Open Source Bot
d78dea6466 Updating submodules
Summary:
GitHub commits:

c4306fde3e
2d301c8e7f
40b618f234
6844f13da7
af0d9618d7
6fa43cd360
181762aa3b

Reviewed By: zpao

fbshipit-source-id: 408a38a2440daa95cb4845efdbd382ef5833703b
2023-10-03 16:47:01 -07:00
Genevieve (Genna) Helsel
73935d5a54 thread ObjectFetchContext to HgDatapackStore
Summary: In order to pass the requestInfo map to deeper layers, thread the Thrift layer `ObjectFetchContext` to `HgDatapackStore`. This is not consumed anywhere yet, but will passed to the sapling_backing_store in follow up diffs. This is part of a broader effort to thread a common client identifier from scm clients (sapling and edenfs to Mononoke)

Reviewed By: jdelliot

Differential Revision: D49795940

fbshipit-source-id: 67b2f703caae403f9d93fcb010b810a61437017d
2023-10-03 15:50:14 -07:00
Genevieve (Genna) Helsel
9e31c077e1 thread ObjectFetchContext through importTreeManifestImpl
Summary: In order to pass the `requestInfo` map to deeper layers, thread the Thrift layer `ObjectFetchContext` in to `HgBackingStore` to `importTreeManifestImpl()` . This is not consumed anywhere yet, but will passed to the `sapling_backing_store` in follow up diffs. This is part of a broader effort to thread a common client identifier from scm clients (`sapling` and `edenfs` to Mononoke)

Reviewed By: jdelliot

Differential Revision: D49718778

fbshipit-source-id: 7296319b220cf75cee5ca820c5cc4ce1efacfae2
2023-10-03 14:57:19 -07:00
Genevieve (Genna) Helsel
05a74852b3 thread ObjectFetchContext through importManifestForRoot
Summary: In order to pass the `requestInfo` map to deeper layers, thread the Thrift layer `ObjectFetchContext` to `BackingStore::importManifestForRoot`. This is not consumed anywhere yet, but will passed to the `sapling_backing_store` in follow up diffs. This is part of a broader effort to thread a common client identifier from scm clients (`sapling` and `edenfs` to Mononoke)

Reviewed By: jdelliot

Differential Revision: D49718772

fbshipit-source-id: 0249afe827da68f2916976c180844e52a0d3df0b
2023-10-03 14:57:19 -07:00
Open Source Bot
eb0be1a156 Updating submodules
Summary:
GitHub commits:

72f3014baa
68f12569f4
260fe10714
37797670d1
ef025990f9

Reviewed By: zpao

fbshipit-source-id: 61f58b50d71f42981c7701f4e1f36ca06ea7674f
2023-10-03 14:50:49 -07:00
Genevieve (Genna) Helsel
51670c5bfa thread ObjectFetchContext to StatsFetchContext via DiffContext
Summary: In order to pass the `requestInfo` map to deeper layers, thread the Thrift layer `ObjectFetchContext` to `DiffContext` and `StatsFetchContext`. This is not consumed anywhere yet, but will passed to the `sapling_backing_store` in follow up diffs. This is part of a broader effort to thread a common client identifier from scm clients (`sapling` and `edenfs` to Mononoke)

Reviewed By: jdelliot

Differential Revision: D49716042

fbshipit-source-id: b5df9754058e1f1585954ff6c25bbafa9aa820c1
2023-10-03 14:02:07 -07:00
Chad Austin
c8718fc11b remove the dead HgProxyHash::sha1
Summary: This was a remnant of the old HgProxyHash scheme.

Reviewed By: kmancini

Differential Revision: D49753911

fbshipit-source-id: 9883c2015f0c9d660122ff3bfdf2efff88aa00f3
2023-10-03 12:24:41 -07:00
Genevieve (Genna) Helsel
d6a9c0b3fe thread ObjectFetchContext to CheckoutContext
Summary: In order to pass the `requestInfo` map to deeper layers, thread the Thrift layer `ObjectFetchContext` to `CheckoutContext`. This is not consumed anywhere yet, but will passed to the `sapling_backing_store` in follow up diffs. This is part of a broader effort to thread a common client identifier from scm clients (`sapling` and `edenfs` to Mononoke)

Reviewed By: jdelliot

Differential Revision: D49716030

fbshipit-source-id: 7b079e554711ec610dd919243c7e459b2737fa48
2023-10-03 12:10:14 -07:00
Mark Juggurnauth-Thomas
2d2b62ba29 request_info: use Rust naming conventions for ClientEntryPoint
Summary: Rust is [opinionated](https://rust-lang.github.io/api-guidelines/naming.html) about the case of enum values.  Change this type so that its values match.

Reviewed By: quark-zju

Differential Revision: D49782706

fbshipit-source-id: 4906729a7fe0fcd6e4618cd4b6c139a30ec2078a
2023-10-03 11:55:38 -07:00
Mark Juggurnauth-Thomas
ef37767b4b derivation_worker: log client request info to scuba
Summary: Add logging of client request info objects to scuba in the derviation worker.  This requires us to stop using a single context object, and instead construct a new one for each request.  For now we just create a new client info.  We will accept one from the derived data service in a later diff.

Reviewed By: RajivTS

Differential Revision: D49743404

fbshipit-source-id: 68b16b265593a8a4f487976f96e4d3e62904b543
2023-10-03 11:55:38 -07:00
Mark Juggurnauth-Thomas
6d968f6e6d clientinfo: derive more traits
Summary: Make client info objects comparable.

Reviewed By: zzl0

Differential Revision: D49743402

fbshipit-source-id: 9ec4e706d08f51d8ce0733b88c2b0251bae5f60a
2023-10-03 11:55:38 -07:00
Mark Juggurnauth-Thomas
483f4f7462 clientinfo: rename ClientInfo::into_json and add ::from_json
Summary:
The naming conventions for Rust are that `into_X` methods usually take `self` by value.  A method that takes `&self` and produces something else is usually termed `to_X`.  Make this change for `ClientInfo`.

Additionally add a `from_json` method so we can easily parse it, too.

Reviewed By: quark-zju

Differential Revision: D49743401

fbshipit-source-id: 1f40e123eb7c4945ab6cdd069c991f3b54aef130
2023-10-03 11:55:38 -07:00
Mark Juggurnauth-Thomas
43c32f5751 derivation_queue: add enqueue time and log time spent in queue
Summary:
Now that we can pass additional information from the derived data service to the derivation workers, start by passing the enqueue time and logging the approximate time spent on the queue.

Note that this is approximate as we rely on the clocks on the derived data service and derivation workers being in sync.

Reviewed By: mitrandir77

Differential Revision: D49689667

fbshipit-source-id: 86c09bc8c8800f10cb25c73831619bb7f5ee3bfe
2023-10-03 11:55:38 -07:00
Zhaolong Zhu
990bbdfea6 debugger: catch more generic ImportError instead of ModuleNotFoundError
Summary:
'ipdb' is a nice to have feature, import related errors should not
break the system.

Reviewed By: quark-zju

Differential Revision: D49868343

fbshipit-source-id: caa7767352f1412b7e0531416e0778dcea03f0bf
2023-10-03 11:14:20 -07:00
Xavier Deguillard
045b006b84 store: deduplicate BackingStore operations in ObjectStore
Summary:
One surprising behavior of the ObjectStore is that it leaves deduplication of
get operations to the BackingStore, the side effect is that all the work
performed between the ObjectStore to the deduplication logic might get
duplicated.

For instance, the LocalStoreCachedBackingStore will call into the underlying
BackingStore and then cache the result to the LocalStore. In the case where
concurrent operations are done for the same ObjectId, the result will be stored
several times to the LocalStore.

Taking an extreme example, calling the Thrift API `getSHA1` with the same path
10k times will force the all the Trees all the way to the final path to be
written potentially 10k times to the LocalStore.

Several solutions can be taken to fix this. An obvious one would be to let the
underlying BackingStore bubble up when the operation was deduplicated and not
perform LocalStore caching, but unfortunately this ignores the case where data
was available in local caches and thus not duplicated. Another potential
solution would be to do some deduplication at the `getSHA1` level, this would
unfortunately be a very ad-hoc solution that would need to be done for
getBlake3 and other Thrift calls.

The solution taken in this diff is to simply deduplicate the BackingStore
operations. The main downsides being the overhead of the deduplication map as
well as the inability to priority boost fetches.

Another benefit of this diff has to do with performance and memory. Let's
consider the case where `getSHA1` is called on 1M paths, all of which under a
common directory P. The Tree for P is neither present in Mercurial's caches,
nor in the LocalStore. In that scenario, the `getSHA1` Thrift handler will
trigger the fetch of P which will quickly complete and thus be present in
Mercurial's caches, but due to the use of `deferValue` in the
LocalStoreCachedBackingStore, the Tree for P will not be cached in the
LocalStore until the `getSHA1` Thrift call returns. At this point, all the
subsequent paths will hit the Mercurial cache, allocate a new Tree, and get
blocked in the deferValue mentioned above: the Tree for P may end up being
duplicated in memory many thousands of time, and depending on how big that Tree
is, EdenFS may need to allocate several GB of memory to hold these.

Switching the deferValue to use ImmediateFuture will be done in a subsequent
diff.

Reviewed By: jdelliot

Differential Revision: D48925204

fbshipit-source-id: ab2f6cce1e868b0d80b27328d99a62dae04ec3dd
2023-10-03 10:34:56 -07:00
Max 👨🏽‍💻 Coplan
b5afbbef0b fix(build): correctly set target-specific variable values (#741)
Summary:
fix(build): correctly set target-specific variable values
Previously, the `HGNAME` and `OSS` variables were not being set correctly when
building with `make oss`.  In my version of GNU Make on Ubuntu 22.04:
```
GNU Make 4.3
Built for x86_64-pc-linux-gnu
```
instead of the `OSS` variable being set to `true` and `HGNAME` being set to
`sl`, the `OSS` variable was being set to `true HGNAME=sl`. This was causing
the eden binary to be built with the default `HGNAME` value of `hg`.

Here is a minimal example of the issue:

```makefile
HG_NAME = hg
oss: OSS=true HG_NAME=sl
oss: local

local:
	fuzic "OSS is $(OSS)"
	fuzic "Building for $(HG_NAME)"
```

On my machine `make oss` prints

```
OSS is true HG_NAME=sl
Building for hg
```

However,

```makefile
HG_NAME = hg
oss: OSS=true
oss: HG_NAME=sl
oss: local

local:
	fuzic "OSS is $(OSS)"
	fuzic "Building for $(HG_NAME)"
```

prints

```
OSS is true
Building for sl
```

Pull Request resolved: https://github.com/facebook/sapling/pull/741

Test Plan:
1. On Ubuntu 22.04 and GNU Make 4.3, build sapling with `make oss`
2. should see an error like

```bash
running build_mo
rm -f hg
cp build/scripts-3*/hg hg
cp: cannot stat 'build/scripts-3*/hg': No such file or directory
make: *** [Makefile:85: local] Error 1
```

3. apply this patch and repeat step 1
4. `sl` should build successfully

Reviewed By: quark-zju

Differential Revision: D49870741

Pulled By: zzl0

fbshipit-source-id: f31017fc647167a17871d46712f91355b4ce5a68
2023-10-03 10:08:42 -07:00
Haitao Mei
3902258646 GC - Log total storage footprint
Summary: This diff allows the GC to log the total storage footprint for each run. This allows us to find out the storage footprint changes along with the time easier.

Reviewed By: YousefSalama

Differential Revision: D49864056

fbshipit-source-id: c5a9117f8883e0ac696d3bd9646dc3a0958799e2
2023-10-03 08:16:21 -07:00
Gustavo Galvao Avena
dd6ae668f0 Change log from info to debug
Summary:
I noticed a lot of these logs when running gitexport for larger directories...
This can be printed `O(# of commits)`, so I think it should probably be a `debug` instead of `info`.

Differential Revision: D49772392

fbshipit-source-id: e52c6e1be5fea0140e292656844a0e5b310c7291
2023-10-03 08:15:18 -07:00
Youssef Ibrahim
eae84fb344 fix clippy lint
Summary: shyteletubbies

Reviewed By: RajivTS

Differential Revision: D49865811

fbshipit-source-id: 3d4de17f18ce5aa0d86385c9d71e3086bc8b5725
2023-10-03 06:58:28 -07:00
Rajiv Sharma
9df07ceabb Add tag hash support in gitimport
Summary: This diff implements the necessary changes to ensure that when direct-`gitimport`ing a repo, the imported tags are recorded along with the tag hash of the Git object ID of the tag. Note that this just applies for direct `gitimport`. Support for `remote-gitimport` would be added in a follow up diff.

Reviewed By: mzr

Differential Revision: D49805885

fbshipit-source-id: 18502476298acaf9f04ab76c9de9f395018b9247
2023-10-03 03:08:36 -07:00