sapling/eden/mononoke
Yan Soares Couto 30d4c8fc2d Make RNG in 'arbitrary' calls more correct
Summary:
Using modulo on arbitrary integers to get random numbers [isn't correct](https://www.internalfb.com/diff/D31305392 (da13975a4f)?dst_version_fbid=311037904117090&transaction_fbid=550270779610744), as the distribution between numbers isn't fair (unless the size is a power of two).

This was raised on D31305392 (da13975a4f), but we decided to land that quickly to unblock builds before doing these changes.

I'm applying the changes suggested on D31305392 (da13975a4f). This is what this diff does:
- For all cases where we generate small numbers (up to 5), replace with call to `Gen::choose`, so `u32::arbitrary(g) % 3` becomes `g.choose(&[0, 1, 2]).unwrap()`.
- For generating numbers in range 0..=1, I instead replaced with generating a boolean, which gets rid of the `unreachable!` calls.
- I removed the code to generate numbers in range 0..=0.
- For generating larger numbers, I used `u64::arbitrary` instead, which should make things "less wrong".

Some things I assumed, but am happy to change before landing, just let me know:
- Theoretically we don't *need* to change the code for `% 2` and `% 4`, as the math checks out there. I changed it for consistency there, but am happy to change it back.
- Using boolean also wasn't suggested initially, I'm happy to change back.

Reviewed By: krallin

Differential Revision: D31379381

fbshipit-source-id: a0bac26ebabd32a6c65f717512de998ef5dc37c8
2021-10-06 09:39:23 -07:00
..
admin Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
aliasverify Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
alpn Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
backfill_derived_data Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
benchmark_filestore Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
benchmarks Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
blobimport Daily common/rust/cargo_from_buck/bin/autocargo 2021-10-06 02:06:23 -07:00
blobimport_lib Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
blobrepo dangerous_override: add overrides for derived data manager 2021-10-04 06:59:25 -07:00
blobrepo_utils Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
blobstore Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
blobstore_healer Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
blobstore_sync_queue Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
bonsai_git_mapping Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
bonsai_globalrev_mapping Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
bonsai_hg_mapping Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
bonsai_svnrev_mapping Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
bookmarks Make RNG in 'arbitrary' calls more correct 2021-10-06 09:39:23 -07:00
bulkops Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
cache_warmup Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
changesets Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
cmdlib Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
cmds backfill_derived_data: use background session class 2021-10-06 06:31:21 -07:00
commit_rewriting Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
common bounded_traversal: fix warning 2021-10-04 06:59:25 -07:00
derived_data Make RNG in 'arbitrary' calls more correct 2021-10-06 09:39:23 -07:00
edenapi_server Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
edenapi_service Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
fastreplay Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
filenodes Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
filestore Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
git git_types: switch to manager-based derivation 2021-10-04 06:59:25 -07:00
gotham_ext Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
hgcli Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
hgproto Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
hook_tailer Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
hooks Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
lfs_import Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
lfs_import_lib Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
lfs_protocol Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
lfs_server Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
manifest Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
megarepo_api Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
mercurial Make RNG in 'arbitrary' calls more correct 2021-10-06 09:39:23 -07:00
metaconfig Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
microwave Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
mononoke_api mononoke_api: ignore copy-replaced files when computing diff renames 2021-10-04 07:16:35 -07:00
mononoke_api_hg Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
mononoke_hg_sync_job Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
mononoke_types Make RNG in 'arbitrary' calls more correct 2021-10-06 09:39:23 -07:00
mutable_counters Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
mutable_renames Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
newfilenodes Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
observability Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
permission_checker Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
phases Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
pushrebase Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
pushrebase_mutation_mapping Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
quiet_stream Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
rate_limiting Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
reachabilityindex Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
regenerate_hg_filenodes Daily common/rust/cargo_from_buck/bin/autocargo 2021-10-06 02:06:23 -07:00
repo_attributes dangerous_override: add overrides for derived data manager 2021-10-04 06:59:25 -07:00
repo_client Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
repo_factory Cleanup old derived data 2021-10-06 06:01:42 -07:00
repo_import git_types: switch to manager-based derivation 2021-10-04 06:59:25 -07:00
revset Make RNG in 'arbitrary' calls more correct 2021-10-06 09:39:23 -07:00
scs mononoke/scs: make commit_lookup_pushrebase_history more precise by using sync direction 2021-10-06 09:22:33 -07:00
scs_server mononoke/scs: make commit_lookup_pushrebase_history more precise by using sync direction 2021-10-06 09:22:33 -07:00
segmented_changelog Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
server Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
sshrelay Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
statistics_collector Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
streaming_clone Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
tests fix test 2021-10-06 04:40:18 -07:00
time_window_counter Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
tunables Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
unbundle_replay Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
upload_globalrevs Vendor curl-sys crate with patched curl 2021-10-04 03:13:50 -07:00
walker filenodes: switch to manager-based derivation 2021-10-05 06:26:34 -07:00
Cargo.toml Make RNG in 'arbitrary' calls more correct 2021-10-06 09:39:23 -07:00
README.md mononoke: add README.md and the missing pieces for supporting cargo (#13) 2020-02-13 00:12:36 -08:00

Mononoke

Mononoke is a next-generation server for the Mercurial source control system, meant to scale up to accepting thousands of commits every hour across millions of files. It is primarily written in the Rust programming language.

Caveat Emptor

Mononoke is still in early stages of development. We are making it available now because we plan to start making references to it from our other open source projects.

The version that we provide on GitHub does not build yet.

This is because the code is exported verbatim from an internal repository at Facebook, and not all of the scaffolding from our internal repository can be easily extracted. The key areas where we need to shore things up are:

  • Full support for a standard cargo build.
  • Open source replacements for Facebook-internal services (blob store, logging etc).

The current goal is to get Mononoke working on Linux. Other Unix-like OSes may be supported in the future