Commit Graph

4119 Commits

Author SHA1 Message Date
Stefan Filip
1fb5acf242 dag: use IdDagStore in IdDag with type parameter
Summary: Make IdDag storage generic by depending on IdDagStore.

Reviewed By: quark-zju

Differential Revision: D20471712

fbshipit-source-id: 3a2668f301758a3c880db35c9f0db6887ef1dd38
2020-03-16 14:41:41 -07:00
Stefan Filip
236292c0fd dag: add the GetLock trait
Summary: Used to generalize `get_lock` functionality.

Reviewed By: quark-zju

Differential Revision: D20471710

fbshipit-source-id: e44d5b22ecacdb653170ef83914354f521f82dfc
2020-03-16 14:41:40 -07:00
Stefan Filip
66436b4a3c dag: add the IdDagStore trait
Summary: Abstract the storage functionality required by IdDag.

Reviewed By: quark-zju

Differential Revision: D20449122

fbshipit-source-id: fc3c7d7b88d74f7a93670d310be2e680f35e8ce7
2020-03-16 14:41:40 -07:00
Stefan Filip
1239628ef8 dag: move IdDag storage details to the iddagstore module
Summary:
Right now the module has one implementation IndexedLogStore. The name could
be more specific in the context of the crate.

The goal will be to add a trait for storage requirements of IdDag and
make IndexedLogStorage one implementation of that trait.

Reviewed By: quark-zju

Differential Revision: D20446042

fbshipit-source-id: 7576e1cc4ad757c1a2c00322936cc884838ff710
2020-03-16 14:41:40 -07:00
Harvey Hunt
d1b4f83bf5 mononoke: Log number of possible LFS fetches for a getpack request.
Summary:
Update the `getpack` code to calculate how many files (and their total
size) would be served over LFS.

NOTE: The columns have `Possible` in their names as we might not have LFS
enabled, in which case we aren't actually fetching this many blobs from an LFS
server.

Reviewed By: farnz

Differential Revision: D20444137

fbshipit-source-id: 85506d8c468cfdc470684dd216567f1848c43d08
2020-03-16 14:11:49 -07:00
Chad Austin
97f2921deb fix an assertion violation in GlobBenchmark
Summary:
In dev mode, the glob benchmark failed inside of
folly::Range::operator[] because asserting null termination
technically violates the bounds check.

Reviewed By: simpkins

Differential Revision: D20268416

fbshipit-source-id: ee9b16a6eb9882e850631aa9d83fffe7b6fb67c3
2020-03-16 13:28:24 -07:00
Jun Wu
1f64b4ec50 nameset: fix LazySet iteration
Summary:
The `next` method forgot to increase the iteration index, causing infinite
iteration.

Reviewed By: ikostia

Differential Revision: D20473206

fbshipit-source-id: 82a95de1b1c12ac4e9e4d328a0adba7145d7b24c
2020-03-16 13:00:35 -07:00
Xavier Deguillard
181981452d build: have make local run on Centos8
Summary:
On Centos8, `python` no longer exist, instead `python2` or `python3` must be
used.

The onetime-setup.py will have to be re-worked a bit too for Centos8
differences.

Reviewed By: quark-zju

Differential Revision: D20284986

fbshipit-source-id: bb1d9c8b211f1e50ce379fcb6bd92d677323935b
2020-03-16 12:54:01 -07:00
Stanislau Hlebik
72f788f808 mononoke: add is_chunked method
Reviewed By: ikostia

Differential Revision: D20470896

fbshipit-source-id: 91949dd6e77e17ef06d3144fb9ade89d10423151
2020-03-16 12:33:08 -07:00
Jun Wu
1734cfe169 metalog: allow overridding root using HGFORCEMETALOGROOT
Summary:
Together with `debugmetalogroots`, this allows some kind of "time travel" to
investigate repo states in the past.

Reviewed By: sfilipco

Differential Revision: D20449409

fbshipit-source-id: ed5c134f9e9ee235b24f45c1aa35867a55a71fe5
2020-03-16 10:21:48 -07:00
Jun Wu
d7fd7c15d6 metalog: add debugmetalogroots
Summary: The command lists all metalog roots. It's useful for debugging purpose.

Reviewed By: sfilipco

Differential Revision: D20449408

fbshipit-source-id: 206573b20c7740b6e536bf5d97276175c684959a
2020-03-16 10:21:47 -07:00
Jun Wu
3bf265bcd2 bookmarks: sort bookmarks before writing
Summary:
This makes the content of `bookmarks` stable.
It will make the metalog root IDs stable in tests.

Reviewed By: sfilipco

Differential Revision: D20449410

fbshipit-source-id: 969be63ab231f5865ec62e99398b5318d4257093
2020-03-16 10:21:47 -07:00
Jun Wu
8115053c00 indexedlog: implement xxd-like fmt::Debug for Log
Summary: This makes `hg debugindexedlog dump` more useful.

Reviewed By: sfilipco

Differential Revision: D20448863

fbshipit-source-id: c5cc24449ae00ee329ce02bf0adf947ff57e72ed
2020-03-16 10:21:46 -07:00
Durham Goode
a13fcd4910 workingcopy: support returning directories from the walker
Summary:
Purge needs to be able to see what directories the walker traversed, so
it can delete them if they are empty. Instead of having the walker call
match.traversedir (which it seems like a bizarre pattern to use the matcher as a
holder for a non-matching related function), let's have the walker return an
enum and have an option to return directories.

At the python layer we then translate this into match.traversedir calls, but we
can clean that up later.

Reviewed By: quark-zju

Differential Revision: D19543795

fbshipit-source-id: cc51c86c91799d3df2c65d25a7b6cfe810206d0a
2020-03-16 10:15:26 -07:00
Durham Goode
fc7739fa26 workingcopy: rename walker results
Summary:
In preparation for supporting returning directories from the walker (to
support purge), let's rename the result structure to be more generic.

Reviewed By: kulshrax

Differential Revision: D19543791

fbshipit-source-id: 9b71452c879cf397ae92533a4ef4727140ac7369
2020-03-16 10:15:26 -07:00
Durham Goode
01285a9d4a workingcopy: handle file normalization for rust walker
Summary:
On case insensitive systems we need to normalize file case. I've made a
rust case normalizer, but it requires some more tweaks. In the mean time, let's
handle this at the matching and output stages of the rust walk.

This is probably the pattern we want to follow later anyway, so the walk is
completely decoupled from normalization.

Reviewed By: kulshrax

Differential Revision: D19543797

fbshipit-source-id: 2ef8bdcecb2611a08680441fc030c64c2f4097d1
2020-03-16 10:15:25 -07:00
Durham Goode
27d1ebe9ba workingcopy: support ignore files from rust walker
Summary:
Previously it didn't handle ignoring ignored files. Let's support this
via simple matcher composition.

Reviewed By: kulshrax

Differential Revision: D19543792

fbshipit-source-id: 0c807f3c1ffc10894f13373cbe9deb2b824f1ac9
2020-03-16 10:15:25 -07:00
Durham Goode
05e09b2b89 workingcopy: report invalid file types from rust walker
Summary:
The mercurial tests print errors when they encounter 'fifo' files.
Let's handle that case.

Differential Revision: D19543796

fbshipit-source-id: f87d4b9c3f0ad8b8d8ebe2e6d18e325fc93d0ae9
2020-03-16 10:15:25 -07:00
Durham Goode
1b892e1d50 tests: don't test \1 character in hgsql tests
Summary:
\1 is not a valid character in our new RepoPath's, so let's remove it
from the tests.

Reviewed By: quark-zju

Differential Revision: D19543793

fbshipit-source-id: 383a4b3f5c54b47180fe667f234a43eda22f91b6
2020-03-16 10:15:24 -07:00
James Crooks
20afa84689 Move fbcode/eden/mononoke/cmds/populate_healer.rs to async diff2
Summary:
Another small change moving toward using the new futures. This time we
make get_resume_state() async. This pushes the implicit .compat() we would otherwise have down to where we call ThriftManifoldBlob::get() which still returns an old-style BoxFuture.

Reviewed By: farnz

Differential Revision: D20444381

fbshipit-source-id: a5aab448c5b25e71e4ce5ea031302280d586066f
2020-03-16 09:23:46 -07:00
James Crooks
1b941f3d76 Move fbcode/eden/mononoke/cmds/populate_healer.rs main to async
Summary:
Pushes the `compat` call in main() down one level into
populate_healer_queue(). This ended up being straightforward, just a fn
signature change and a couple of callsite changes.

This only affects main(), going to follow-up with future diffs to push it down
a little farther.

Remaining line deltas are just due to rustfmt.

Reviewed By: farnz

Differential Revision: D20432676

fbshipit-source-id: 98100f1b651648d6e3509fa56e94b80ee075843f
2020-03-16 09:23:46 -07:00
Stanislau Hlebik
5790f7e176 mononoke: add lfs rollout percentage
Summary:
Allow to gradually rollout lfs. A lot of the details are covered in D20441254
I won't repeat them here. I'd only mention that in order for fastreplay to
correctly calculate percentages this diff starts to log client_hostname for
fastreplay.

Reviewed By: ikostia

Differential Revision: D20441264

fbshipit-source-id: e272176f68879f6c545784609799d21daedec5eb
2020-03-16 08:18:41 -07:00
Harvey Hunt
0146026587 mononoke: lfs_server: Use Identity::FromStr when parsing identities
Summary:
D20139308 added a FromStr implementation for Identity. The LFS
server uses the same code when reading identities from the command line.

Update `idents_from_values` to use the `FromStr` implementation.

Reviewed By: krallin

Differential Revision: D20441439

fbshipit-source-id: 5809ed54d1971fd778b82cc726739a382312747a
2020-03-16 05:41:49 -07:00
Thomas Orozco
89cbb08a09 mononoke: move ContextConcurrencyBlobstore to RepoBlobstore
Summary:
Right now, ContextConcurrencyBlobstore is instantiated in make_blobstore, which
makes it a lot more effective (3 times more effective, in fact) than we want it
to be, since a ticket is acquired by 3 blobstores in the chain in order to
complete a put:

- The multiplex
- The two underlying blobstores

This also has the potential to deadlock if all tickets are held by the
multiplex, which results in an eventual timeout after 600s of waiting in the
multiplex (this looks like it might be happening at least once or twice per
hour right now on the experimental tier).

In any case, the intention had always been to have one of those per repo, not
one per sub-blobstore, so let's do that. The more natural place to put this
seems to be the RepoBlobstore instantiation.

Since I anticipate I might not be the only one who gets tripped up by this at
some point, I also added a comment about this. I also updated the blobsync
tests to stop re-implementing `RepoBlobstoreArgs::new()` so that adding new
blobstores in RepoBlobstoreArgs will have minimal friction.

Reviewed By: HarveyHunt

Differential Revision: D20467346

fbshipit-source-id: a6ad2d8f04bff1c6fcaa151e947cb8af919eec07
2020-03-16 05:30:11 -07:00
Stanislau Hlebik
20b8b76b87 mononoke: introduce SessionLfsParams
Summary: For now it's identical to LfsParams - it will change in the next diff

Reviewed By: krallin

Differential Revision: D20442530

fbshipit-source-id: 8434610373bb9aefe16702207448283b34676ca2
2020-03-16 03:52:20 -07:00
Stanislau Hlebik
de7c2d335e mononoke: sync configerator thrift update
Reviewed By: farnz

Differential Revision: D20441275

fbshipit-source-id: ced24b35df19336c9d648b445f58ccc746caa360
2020-03-16 03:52:20 -07:00
Xavier Deguillard
0fa09ddc5d gen_version.py: run it with python3
Summary: On Centos8, python no longer exist.

Reviewed By: quark-zju

Differential Revision: D20452244

fbshipit-source-id: 07dd0256c1dc227eb9259954951184d282f5c272
2020-03-13 20:08:34 -07:00
Xavier Deguillard
fc51908dba pyworker: empty flags are valid
Summary: Empty flags can be sent by Mercurial, do not error out in that case.

Reviewed By: quark-zju

Differential Revision: D20450124

fbshipit-source-id: c85af42be2afb95b09057583f6fec3a2a13d478a
2020-03-13 19:41:48 -07:00
Xavier Deguillard
a07c1b6e77 remotefilelog: pass the right config object to Rust
Summary: Fallout from D20432938.

Reviewed By: quark-zju

Differential Revision: D20449456

fbshipit-source-id: a7c3d7f6b9b2fec57b83e5ae3e789c722a45ca39
2020-03-13 19:41:48 -07:00
Xavier Deguillard
185478d122 pyworker: stabilize quickcheck tests
Summary:
In some rare cases, quickcheck may give us 2 identical paths with different
Key, Mercurial will never do that, therefore reject this.

Reviewed By: quark-zju

Differential Revision: D20451344

fbshipit-source-id: 800b31f1aeea38322052baedb918c4f45a1ec95d
2020-03-13 19:37:09 -07:00
Hezi Zhang
f9a511070e --clean option for buck clean
Summary: `buck run edenfsctl -- du --clean` would help reclaim space from buck-out directories.

Reviewed By: chadaustin

Differential Revision: D20203950

fbshipit-source-id: bda045a48ca73b0a1d3e157eff2f92b290a611f5
2020-03-13 19:23:34 -07:00
Xavier Deguillard
fd8d92f1f5 revisionstore: allow indexing LFS pointers via sha256
Summary:
While the sha256 of a blob gives access to its content, it doesn't allow
accessing its metadata, by adding a sha256 index, we can easily get the
metadata of a blob via its content hash.

Reviewed By: quark-zju

Differential Revision: D20445624

fbshipit-source-id: 42c04bd69d3c7380706c6237c5b4f4061c016cca
2020-03-13 19:03:29 -07:00
Xavier Deguillard
d9cca63444 types: add a into_inner method to Sha256
Reviewed By: quark-zju

Differential Revision: D20445623

fbshipit-source-id: d9cba7ddd16a8e89c76cd5e988ab0fb79383d0c2
2020-03-13 19:03:29 -07:00
Xavier Deguillard
60be0ac94d types: fix typo when displaying Sha256
Reviewed By: quark-zju

Differential Revision: D20445622

fbshipit-source-id: dc9a8a165ca55fdece90a5eb3a87cd3c28f444cb
2020-03-13 19:03:29 -07:00
Xavier Deguillard
6ee3a8f42f revisionstore: add metadata to FakeHgIdRemoteStore
Summary: This is necessary to properly test LFS stores.

Reviewed By: quark-zju

Differential Revision: D20445625

fbshipit-source-id: 530ddf87249e8d721957806f2d8edef3262f303c
2020-03-13 19:03:28 -07:00
Xavier Deguillard
5002d01e0a revisionstore: allow indexedlogutil users to lookup in different indices
Summary:
The OpenOptions allow for multiple indices to be added, but lookup had no way
to querying these multiple indices.

Reviewed By: quark-zju

Differential Revision: D20445627

fbshipit-source-id: 0cb754ba17b452d892b7bcb56d502d5753ef963a
2020-03-13 19:03:28 -07:00
Xavier Deguillard
01fb3c0a77 revisionstore: add a new StoreKey type
Summary:
This type can either be a Mercurial type key, or a content hash based key. Both
the prefetch and get_missing now can handle these properly. This is essential
for stores where data can either be fetched in both ways or when the data is
split in 2. For LFS for instance, it is possible to have the LFS pointer (via
getpackv2), but not the actual blob. In which case get_missing will simply
return the content hash version of the StoreKey, to signify what it actually
has missing.

Reviewed By: quark-zju

Differential Revision: D20445631

fbshipit-source-id: 06282f70214966cc96e805e9891f220b438c91a7
2020-03-13 19:03:28 -07:00
Xavier Deguillard
d900874401 revisionstore: rename HistoryStore to HgIdHistoryStore
Summary:
Similarly to the DataStore trait, this makes it easier to understand that they
deal with a Mercurial type Key.

Reviewed By: quark-zju

Differential Revision: D20445621

fbshipit-source-id: a1143d5f5d6a2c8686d517a6ea3c25b07c0df072
2020-03-13 19:03:27 -07:00
Xavier Deguillard
2e4742cefc revisionstore: rename DataStore traits to HgIdDataStore
Summary: This makes it clear that these traits are dealing with Mercurial Key.

Reviewed By: quark-zju

Differential Revision: D20445626

fbshipit-source-id: d5acbf442e9407b973e95e40af69b5a61bff0a4d
2020-03-13 19:03:27 -07:00
Xavier Deguillard
eaf2f2e9f0 tinit: fix a typo in newserver
Summary: treemanifest was misspelled.

Reviewed By: quark-zju

Differential Revision: D20449488

fbshipit-source-id: 91a3e6533d177083af5c46c09ad09b1a51d8ece5
2020-03-13 17:36:50 -07:00
Dan Forest
1e02b6ff6f replace hashmap with structured data
Summary: Since they are static and immutable, fbwhoami/fbwhatami could be simple structs with public fields.

Reviewed By: eugeneoden

Differential Revision: D20299423

fbshipit-source-id: 492f49c2b3003760517bfc5be06ace07fabbc6b9
2020-03-13 14:52:55 -07:00
Arun Kulshreshtha
ff055aeea0 mononoke_api: Add trees_under_path method to HgRepoContext
Summary: Add a `trees_under_path` method to `HgRepoContext` which is basically just a way to call Mononoke's implementation of `gettreepack`. This is required for EdenAPI's `/trees/prefetch` endpoint, which basically returns the results of a `gettreepack` request via HTTP.

Reviewed By: StanislavGlebik

Differential Revision: D20414860

fbshipit-source-id: 840bd5d19a10625b78758949b290f1947bdb94be
2020-03-13 14:32:20 -07:00
Jun Wu
cf04fe3e1f thrift-types: recompile Thrift sources
Summary: The thrift compiler and sources are changed.

Reviewed By: xavierd

Differential Revision: D20445164

fbshipit-source-id: f20f16ae02a922042f366a9a80a3642577f60e57
2020-03-13 14:25:23 -07:00
Durham Goode
ae5fc6afde hggit: don't write flat map when using indexedlog
Summary:
The flat git map file can be huge and writing to it can hang for many
seconds or minutes on loaded systems since it calls fsync. Since we actually
rely on the indexedlog map file instead of the flat map, let's just stop writing
the flat map when indexedlog is enabled. This was previously done to enable
falling back, but we've had no issues and never needed to fallback.

Reviewed By: quark-zju

Differential Revision: D20443392

fbshipit-source-id: a3e7dbdb2b37e2e99df774f540b05d06414fb279
2020-03-13 12:11:18 -07:00
Jun Wu
f6f5649b46 test-configparser: migrate to Python unit test
Summary:
This makes the test compatible with Python 2, 3 and Windows.
It also looks easier to read.

Reviewed By: xavierd

Differential Revision: D20444919

fbshipit-source-id: c897e9abc8a5d6d98ff1fc526e2484720fb73bb1
2020-03-13 12:01:00 -07:00
Jun Wu
7a7f98f1b2 configparser: migrate from Bytes to Text
Summary:
Since configparser enforces utf-8 config files (because pest wants Rust strings),
let's migrate from Bytes to Text to remove extra encoding conversions.

Previously this was blocked by the lack of ref-counted text (since the "source"
of each config location is the entire config file). Now minibytes provides Text
so we can use it.

This unfortunately requires dependent code to be updated. The pyconfigparser
interface is in theory wrong - it shouldn't return utf-8 bytes but
local-encoded bytes. I think it's cleaner to make pyconfigparser unaware of
HGENCODING, so I changed pyconfigparser to use unicode, and add compatibility
layer in uiconfig.py.

This also fixes non-ascii encoding issues on user name (especially on Windows).
The hgrc config file should be in utf-8 and the config parser returns explicit
unicode types, and Python code round-trip them with local encodings.

Reviewed By: markbt

Differential Revision: D20432938

fbshipit-source-id: b1359429b8f1c133ab2d6b2deea6048377dfeca1
2020-03-13 10:51:41 -07:00
Jun Wu
715bc5d451 configparser: migrate from bytes to minibytes
Summary:
This makes it easier to further migrate to `Text` interface.
Dependent crate (`auth`) is updated.

Reviewed By: markbt

Differential Revision: D20432941

fbshipit-source-id: 1dc29d52c9b17ce14676ef0555470c6d36a09c2b
2020-03-13 10:51:41 -07:00
Jun Wu
c4ec99ded4 minibytes: implement Text
Summary:
Text is a reference-counted shared String.
It's similar to Bytes but works for utf-8 strings.

The motivation is to replace configparser's use of Bytes to Text.

Reviewed By: markbt

Differential Revision: D20432940

fbshipit-source-id: ef990255d269e60d433c6520819f60ccdcbe488f
2020-03-13 10:51:41 -07:00
Jun Wu
7895e70dcf minibytes: make Bytes abstract
Summary: This makes it possible to implement "Text". See the next diff.

Reviewed By: markbt

Differential Revision: D20432943

fbshipit-source-id: 94b3810ab205c260d33f57bd637e4accc3ee871d
2020-03-13 10:51:40 -07:00
Jun Wu
e9b14b3608 minibytes: implement From<&'static {str,[u8]}>
Summary:
This makes the API easier to use.

Practically this makes it easier for configparser to migrate to minibytes.

Reviewed By: markbt

Differential Revision: D20432942

fbshipit-source-id: ad08eb118d2216054dc24c86b0b129ae82b9d17c
2020-03-13 10:51:40 -07:00