Commit Graph

2532 Commits

Author SHA1 Message Date
Stanislau Hlebik
f72b0853fb mononoke: do not log command args in getbundle
Reviewed By: krallin

Differential Revision: D17791769

fbshipit-source-id: 2e3592e9cba0e61d1f0f741a1c33b0ab90f45351
2019-10-07 11:30:06 -07:00
Thomas Orozco
1e872f48b5 mononoke/blobstore_healer: remove hardcoded list of regions
Summary:
This updates the blobstore healer to avoid using a hardcoded list of regions.

Facebook

I'll remove this from the TW spec once this makes it through Conveyor.

This Configerator file is referenced in the DBA region turnup instructions: https://our.intern.facebook.com/intern/wiki/MySQL/DBaaS/Internal/Regional_Turnup_Steps/#configs (they update `configerator/raw_configs/myrouter/routing_v3.jsonc`, which includes this file)

Reviewed By: StanislavGlebik

Differential Revision: D17787579

fbshipit-source-id: ec9128202679ce0dbe18d77fb84c3fbf6186cd19
2019-10-07 07:34:10 -07:00
Thomas Orozco
6c29aad4a0 mononoke/blobstore_healer: handle missing regions gracefully
Summary:
There's a few things broken with common/rust/sql and the blobstore healer's handling of replication lag right now:

- If Seconds_Behind_Master isn't an int (it'll be NULL if replications is paused), it just panics.
- If it's talking to a server that it expected to be a replica but is a master, it returns None for the replication lag, but 0 would be more appropriate.
- If a region no longer has a replica, it errors out.

This diff fixes that:

- If replication is paused, we return None for lag.
- If we're talking to a master, we return 0.
- If a region has no replica, we ignore it.

Reviewed By: StanislavGlebik

Differential Revision: D17787580

fbshipit-source-id: 9e5e7682456870b88910afec12e1c409fd8c5ba6
2019-10-07 07:34:10 -07:00
Thomas Orozco
91fd7e2035 mononoke/cache_warmup: used bounded traversal implementation to walk manifests
Summary:
This updates cache warmup to avoid using `recursive_entry_stream`, and to
instead use `ManifestOps::list_all_entries`. Notably, the
`recursive_entry_stream` implementation tends to get slower the more things we
add (P116031891), whereas the bounded traversal-based implementation does not
(P116031745), which makes the latter faster.

Reviewed By: StanislavGlebik

Differential Revision: D17763152

fbshipit-source-id: e5df452472f4dcd90bbdfa1523d01afbd8189c30
2019-10-07 01:56:32 -07:00
Stanislau Hlebik
b3c4a3d929 mononoke: do not log to logview in tests
Reviewed By: ahornby

Differential Revision: D17765160

fbshipit-source-id: 7d78fe1b059d6fbfdff21384cdff4b194e3ec542
2019-10-06 10:02:53 -07:00
Kostia Balytskyi
b5917c96ea mononoke: use csid_resolve in places where we used resolve_hg_rev
Summary:
This is better from the usability perspective, as it can resolve hg changeset, bonsai changeset and a
bookmark.

However, this also means that when the user does provide an Hg commit hash and we need an hg commit hash, we are doing one more database query (`get_hg_from_bonsai_changeset`). This is a little bad, but all of the use-cases I changed here are from the admin tool, so we should be fine.

Reviewed By: StanislavGlebik

Differential Revision: D17740448

fbshipit-source-id: 7c1620979e25631f1a4e44d6310668fe634b2075
2019-10-05 05:48:43 -07:00
Stanislau Hlebik
890d2fccb2 mononoke: remove unnecessary code from integration tests
Summary: It should be used only in pushrebase replay tests

Reviewed By: krallin

Differential Revision: D17746350

fbshipit-source-id: 5c0877b4b554ad53f0fe3228a696c5730dc6958f
2019-10-05 00:46:35 -07:00
Stanislau Hlebik
b6c3a5caf0 mononoke: add support for changegroup v3 in sync job
Reviewed By: krallin

Differential Revision: D17709909

fbshipit-source-id: 6bfeee5daeaf5279d41be6619e9b4e35bb5e063c
2019-10-03 12:04:31 -07:00
Kostia Balytskyi
db9b66e1cb mononoke: invalidate bonsai_hg_mapping cache
Summary: A fallout from T54639354.

Reviewed By: HarveyHunt

Differential Revision: D17718890

fbshipit-source-id: a10c7f82100fe2477777bc57cbc145367e77ce99
2019-10-03 10:00:59 -07:00
Thomas Orozco
445cc6aefc mononoke/apiserver: don't run Thrift on a single core
Summary:
This udpates the apiserver to spawn requests on a Tokio runtime, instead of an
Actix arbiter (which does contain a Tokio runtime, but it's a `current_thread`
one).

This allows us to make use of more than one core when serving Thrift requests.

Reviewed By: HarveyHunt

Differential Revision: D17738537

fbshipit-source-id: 5d17fa73e0185342dc6976de1423919ba545ca79
2019-10-03 08:55:28 -07:00
Thomas Orozco
dddbc706c9 mononoke: silence glog logs in tests
Summary:
This silences logging from various cpp libraries we use (but not our own
logging) in tests. This should remove some flakyness in our tests coming from
those.

Reviewed By: StanislavGlebik

Differential Revision: D17475237

fbshipit-source-id: ecee69b543d1b431d1da883f67fbc30915697e13
2019-10-03 08:45:31 -07:00
Mark Thomas
f39045a35b apiserver: implement SourceControlService file_content_chunk
Summary: Implmement the `file_content_chunk` method, which gets a chunk of file content.

Reviewed By: StanislavGlebik

Differential Revision: D17686286

fbshipit-source-id: 0330aef9f0be1dea3040e9ba3e767867165827e7
2019-10-02 09:08:08 -07:00
Mark Thomas
81828fa498 mononoke_api: add methods for fetching file contents
Summary:
Add methods to fetch file contents, either for the full file, or part of the
file.

Reviewed By: StanislavGlebik

Differential Revision: D17686294

fbshipit-source-id: 8bceee63db13e5eac274f8372631e554a6583036
2019-10-02 09:08:08 -07:00
Mark Thomas
f177942371 filestore: add fetch_range and fetch_range_with_size
Summary:
Allow clients to fetch parts of a file specified by range, rather than the
whole file.

For chunked files the fetch skips over chunks which don't overlap with the
range, so only relevant chunks are fetched from the blobstore.

Reviewed By: krallin

Differential Revision: D17672378

fbshipit-source-id: b1cd2f6b9f069ce86f7d1bccd610f4ff9d767f3e
2019-10-02 09:08:07 -07:00
Stanislau Hlebik
e2fa15a599 mononoke: do not fuse() loggers
Reviewed By: markbt

Differential Revision: D17711467

fbshipit-source-id: b89ecad364fb72ece80cb0cb9897649c0e699ed3
2019-10-02 07:46:50 -07:00
Daniel Grzegorzewski
469d115e01 Skip fetching file content for big files in statistics_collector tool
Summary: Skip calculating number of lines for files with size greater than 10MB

Reviewed By: krallin

Differential Revision: D17710287

fbshipit-source-id: 025e94b66539b471e5e48aee0ec7e61808cb0bd6
2019-10-02 06:22:57 -07:00
Stanislau Hlebik
d5d4d20f64 mononoke: fix parent order in blobimport
Summary:
Attached tasks have more details, but in short - if a commit has two parents
then the order of them in mercurial can change but the commit hash won't
change. In Mononoke it's different - change of parent order changes the hash.

This option allows us to fix parent order if needed

Reviewed By: krallin

Differential Revision: D17683807

fbshipit-source-id: 23549e55369b625ea5d597bc336b465373cbbc74
2019-10-01 15:18:32 -07:00
Stanislau Hlebik
e7a1195181 mononoke: log names of failed hooks
Summary:
We'd like to log hook names so that it's easier to add monitor and alarm if a
single hook is failing.

Note that I had to make a small fix on stats side.

Reviewed By: farnz

Differential Revision: D17686683

fbshipit-source-id: 06d3d72477ecdfe02df34633fe100be64c15f2d0
2019-10-01 15:11:07 -07:00
Daniel Grzegorzewski
1fadbb3013 Added STATS counter to statistics_collector tool
Summary: Added STATS counter to stats tool, at the beginning one counter: calculated_changesets

Reviewed By: HarveyHunt

Differential Revision: D17685882

fbshipit-source-id: 3fbd6ea72cfa4f4ee7f39da623a4adfd85587b5b
2019-10-01 09:46:51 -07:00
Kostia Balytskyi
0ad76e0137 mononoke: add scuba reporting to the cross-repo sync job
Reviewed By: farnz

Differential Revision: D17665131

fbshipit-source-id: 297ecf9e4def2aa3943994c40bf443ea28a5b274
2019-10-01 05:24:00 -07:00
Stanislau Hlebik
06117f82d2 mononoke: switch new sync job to push not pushrebase
Summary:
I ran into one more problem with generating pushrebase bundles - if a bookmark was
deleted, then recreated again then sync job might send commits that already
exists on hg server and that causes sync failure.

There's a way to make it work (tracking mercurial heads instead of bookmarks),
however at this point I feel like it's not worth it - generating normal push
bundles should be easier.

Reviewed By: farnz

Differential Revision: D17683425

fbshipit-source-id: a2a7d2bf6a65a9a85de7de0c44cd12eb23e01727
2019-10-01 01:55:01 -07:00
Daniel Grzegorzewski
95ed50db45 Moved info logging to log_statistics function
Summary: print_statistics and log_statistics were used in the same places in code.

Reviewed By: StanislavGlebik

Differential Revision: D17665790

fbshipit-source-id: 5d41f1b9d77edbe12db25f109a8bb171c8072fb4
2019-09-30 07:21:26 -07:00
Stanislau Hlebik
71378bb0c1 mononoke: change required_checks logic
Summary:
UploadEntries::finalize() function is called during pushes and blobimports i.e.
when new commit is created from hg changeset. It does a few checks, one of them
is making sure that all entries referenced by a manifest are present in the
blobstore.

The problem is that it's actually quite wasteful - if a single file was
modified in a directory then it'll check that all of the entries in this
directory are present.

Let's change the logic and check that only entries that were added by this
commit are present in the blobstore (this is what find_intersection_of_diffs is
doing). That doesn't make it less correct - if an entry is referenced in a
manifest but not added in this commit then it will be checked in one of the
parent commits.

Reviewed By: farnz

Differential Revision: D17664062

fbshipit-source-id: 6e7e16084c9126bdb757793d441707fada5052ff
2019-09-30 07:21:26 -07:00
Daniel Grzegorzewski
19331de1c1 Set time of changeset creation in statistics_collector samples saved in Scuba
Summary: Set time when changeset was created instead of current time (default time) in samples that are saved in Scuba

Reviewed By: StanislavGlebik

Differential Revision: D17629069

fbshipit-source-id: a4c34f38eff520b96f7e8a85445ee2255c220941
2019-09-30 06:31:45 -07:00
Daniel Grzegorzewski
bf09fb7f65 Added HgChangesetId field to statistics_collector
Summary: Added hg_cs_id field to RepoStatistics struct + logging changeset_hash to samples in Scuba.

Reviewed By: StanislavGlebik

Differential Revision: D17626381

fbshipit-source-id: 97c91543bcfb15a50e9c6630f3dd441b58264894
2019-09-30 02:56:34 -07:00
Andres Suarez
5f19c31135 Enable text linter for toml files
Reviewed By: mzlee

Differential Revision: D17638063

fbshipit-source-id: 9ee13ab9ac2f2202d33028c34922234d51d5dd08
2019-09-27 16:21:43 -07:00
Kostia Balytskyi
4b9e787f12 mononoke: add docstrings for is_ancestor in reachabilityindex
Summary: This is very important.

Reviewed By: StanislavGlebik

Differential Revision: D17629412

fbshipit-source-id: 36d056b28c7bde324d478f94bac228bd1aff5238
2019-09-27 09:38:29 -07:00
Harvey Hunt
ba4247c5b9 mononoke: lfs_server: Log oids of blobs fetched from upstream
Summary:
In certain circumstances we will fetch a blob from the upstream
rather than internal. Log the oids of blobs that we fetch from upstream.

Reviewed By: farnz

Differential Revision: D17605435

fbshipit-source-id: 23a202dcd57f8af12586449f0d9fc2fd251c7114
2019-09-27 06:22:26 -07:00
Thomas Orozco
bd88aecb94 mononoke/lfs_server: allow for reporting unhealthy while still serving traffic
Summary:
This way, when Tupperware tells us to terminate, we'll start reporting
unhealthy, which means Proxygen will stop sending traffic to us, and then we'll
exit gracefully a few minutes later.

Reviewed By: HarveyHunt

Differential Revision: D17626009

fbshipit-source-id: 480ae9fdaab97419199d6c05fea51f7c6d6c40f6
2019-09-27 05:03:59 -07:00
Thomas Orozco
d0e2311d9e mononoke/lfs_server: gracefully shutdown
Summary: This adds support for gracefully shutting down the LFS Server when SIGINT or SIGTERM is received. This will ensure that we don't close in-flight connections when restarting LFS instances.

Reviewed By: StanislavGlebik

Differential Revision: D17626010

fbshipit-source-id: 32b27e888346cc052a8256a3f7685a9bd60afa46
2019-09-27 05:03:59 -07:00
Stanislau Hlebik
ce8a91dfcd mononoke: use i64 instead of i32 in delta parsing
Summary: Note that it should be possible to replace i64 with usize in a couple of places. That said, it feels like a riskier change than just changing i32 to i64.

Reviewed By: krallin

Differential Revision: D17626031

fbshipit-source-id: 140feb5040054363f7d27bdc4b285e2ff0643f8e
2019-09-27 03:54:31 -07:00
Shu-Ting Tseng
47124e795a add /{repo}/resolve_bookmark/{bookmark}
Summary:
scmquery_exporter is a tool to replace svn export and it needs 3 method from scmquery:
- log: to resolve a bookmark to a hash so later calls will be consistent
- ls and cat: to list and download file contents

ScmQuery proxy is currently not accessible from Corp to Prod VIP and will be available soon.
However people using the `js1 upgrade` tool is currently blocked due to the svn deprecation and we
have to make this tool work again ASAP.

The easiest way to make it work, comparing to all other worse approach, is to add this method
in mononoke api server and therefore we can add a backend in scmquery_export.

Discussion: https://fb.workplace.com/groups/JavaScriptOne/permalink/2454194331532724/

Reviewed By: StanislavGlebik

Differential Revision: D17605626

fbshipit-source-id: 19f229123cd980089e1e896c592a0f1afa3c531d
2019-09-27 02:25:19 -07:00
Daniel Grzegorzewski
aef2f4d6d1 Add info logging in statistics_collector tool
Summary: Logging basic info about statistics_collector tool.

Reviewed By: StanislavGlebik

Differential Revision: D17605520

fbshipit-source-id: 1b44bcaa0fb5dd2ce4f54a5a02d49979f0e91e2f
2019-09-27 02:22:45 -07:00
Stanislau Hlebik
be0fdc791e mononoke: change how force pushes are handled in the sync job
Summary:
There's a corner case that wasn't covered by the new sync job - if a user does
a "hg push --force" which pushes new commits to the server AND moves existing
bookmark then sync job just failed to sync. It tried to do a pushrebase of new
commits on top of existing bookmarks and that would result either in hash
mismatch or a pushrebase conflicts.

To fix it let's generate force pushrebase push in the sync job if bookmark did
non-fast forward move (i.e. "from" is not an ancestor of "to").

Note that there was an option to always do force pushrebase. That should work however that
would make stackpush optimization that we have on hg server impossible and that
might increase sync latency (see https://fburl.com/jpflbd67). Note that it's possible
that we'll switch to use normal push instead of pushrebase in the sync job,
however for now I'd like to go with pushrebase approach because it's exercised much more often.

Reviewed By: krallin

Differential Revision: D17624543

fbshipit-source-id: 1d6121a4767f67fbbbadae712ae8ab9d695857d5
2019-09-27 02:06:15 -07:00
Stanislau Hlebik
f9155cc770 mononoke: do not use recorded timestamps in new sync job
Summary:
After that diff the sync job won't require bundle_replay_data at all if
--generate-bundles flag is specified.

Reviewed By: farnz

Differential Revision: D17605727

fbshipit-source-id: 8fdd43ce7eae41dcf586b17446339c6ba60e960d
2019-09-27 00:34:57 -07:00
David Tolnay
1cd333be79 rust/thrift: Rename rust_thrift runtime library to fbthrift
Summary:
As suggested by yfeldblum in https://our.intern.facebook.com/intern/diff/D17544447/?transaction_id=2964022370277861.

> the `rust_` bit seems superfluous; the `_thrift` bit opens the door for confusion with apache thrift. Any issue using a module name like `fbthrift`?

 ---

```
$ fastmod '\brust_thrift\b' fbthrift -d ~/fbcode -e rs,toml
$ fastmod '\brust_thrift\b' fbthrift -d ~/fbcode -g '**/TARGETS'
$ hg revert experimental
$ arc lint -a
```

Reviewed By: bolinfest

Differential Revision: D17611123

fbshipit-source-id: b621a422480b00eb2e339ff7542cc66c3ca5b8ec
2019-09-26 20:23:47 -07:00
Adam Simpkins
9590968b1f change the scm/hg:hg target to use a sh_binary() rule
Summary:
Change the `//scm/hg:hg` target to use an `sh_binary()` rule that invokes the
`:hg_rust` binary with the proper environment so it can find its dependencies,
rather than copying the binary and all of its dependencies into a new
subdirectory.

In dev mode builds the `hg_rust` binary isn't guaranteed to work anywhere
other than its original location, due to the way that dev mode builds use
`$ORIGIN` in the binary's `RPATH` setting.  This happened to work up until now
as the hg_rust binary did not have any separate libraries, but I plan to add
one on the `chg` library.

Reviewed By: quark-zju

Differential Revision: D17109104

fbshipit-source-id: ae8bb1126969f012d1d2fb7d04e80867a310b9a8
2019-09-26 20:14:54 -07:00
Kostia Balytskyi
a7f3f7fb04 mononoke: add slog duration logging for commit sync
Reviewed By: farnz

Differential Revision: D17601579

fbshipit-source-id: ad9e65c65d63acc5b52db1502fe67621408e4c8c
2019-09-26 14:47:12 -07:00
Kostia Balytskyi
198b4cf69d mononoke: add phase preservation to cross-repo commit sync job
Reviewed By: farnz

Differential Revision: D17601085

fbshipit-source-id: bd01d51a8f7dcb157bb7d4b9c3eb92436886a97d
2019-09-26 14:47:12 -07:00
Kostia Balytskyi
9f7ba4b676 mononoke: add a cross-repo sync tailer
Reviewed By: farnz

Differential Revision: D17155814

fbshipit-source-id: a13f951662a9d035ed6ef9d077923d60da23687c
2019-09-26 14:47:12 -07:00
Kostia Balytskyi
7b9612738d mononoke: add find_first_synced query to synced_commit_mapping
Summary:
Given a list of changesets, a source and a target repo id, this query tells
you the first changeset from the list, which comes from the source repo and
has a synced equivalent in the target repo. Here, the word "first" refers to
the order of changesets in the provided list.

The naming is a little unfortunate, as the use case for this query is to
find the *last* (meaning newest) changeset that had been synced. But I wanted
the name to reflect this particular fn's behavior, rather than the intended
use.

Reviewed By: farnz

Differential Revision: D17600505

fbshipit-source-id: ea7336dcf839302e7b9ca6e1bc2ee88a3a1d99a9
2019-09-26 14:47:11 -07:00
Stanislau Hlebik
3bab7e393e mononoke: add BundleResolverError
Summary:
It gives us a nice ability to classify push errors and log them separately.
For example, we can distinguish pushrebase conflicts and hook failures

Reviewed By: farnz

Differential Revision: D17602576

fbshipit-source-id: 014197109056e044f59c397f7ccd17c93fadfe91
2019-09-26 10:18:30 -07:00
Thomas Orozco
6dbab019ca mononoke/lfs_server: log batch order to Scuba
Summary: I'd like to get this in Scuba to do a bit more reporting there.

Reviewed By: farnz

Differential Revision: D17600786

fbshipit-source-id: 90d34362b5212abf3ff6642f55e57a997f86006f
2019-09-26 06:55:26 -07:00
Harvey Hunt
b6cb8778e3 mononoke: lfs_server: Replace method name with repo in ODS key
Summary:
The method name was incorrectly added to the ODS key, rather than the repo
name. Fix this. :-)

Reviewed By: krallin

Differential Revision: D17600416

fbshipit-source-id: 203f3be428b15a0b7d1cce90dd85a3932311c89c
2019-09-26 04:49:32 -07:00
Stanislau Hlebik
a99534e4ec mononoke: fix sync job bookmark tracking
Summary:
Previously new bookmarks from overlay were ignored. This diff fixes it.

Also new sync job tests didn't have replay hook enabled. This diff fixes it and removes a bit of code duplication

Reviewed By: krallin

Differential Revision: D17597561

fbshipit-source-id: 686499e94f32b7b39fd00fa1af449bd1b456775e
2019-09-26 01:45:16 -07:00
Thomas Orozco
cca3a87533 mononoke/lfs_server: log listen port when we start
Summary:
This is nice when running locally to know when we're done with setting up
cachelib and such.

Reviewed By: farnz

Differential Revision: D17569829

fbshipit-source-id: adfe5944991c8842a459df8606d9d81c2dcd02de
2019-09-25 10:49:04 -07:00
Stanislau Hlebik
c85a0eeb09 mononoke: support bookmark deletion and bookmark move in sync job
Summary:
After this diff new sync job (the one that generates bundles instead of reusing
existing) should be feature complete i.e. it should support the same pushes
as normal sync job.

One noteable refactoring is adding BookmarkChange enum. Previously we were passing and converting `from_` and `to_` parameters down the stack and also doing conversion in the middle, and it was easy to mix them up and use `from_hg_cs_id` instead of `to_hg_cs_id` and vice versa. My hope is that with this enum isolates most of the `from_` and `to_` shenanigans in one places so that's it's easier to keep track of it.

Reviewed By: krallin

Differential Revision: D17546808

fbshipit-source-id: 1b5e2553f80b33996ec361e89b01cb55ec811ec7
2019-09-25 10:29:35 -07:00
Stanislau Hlebik
f8ce273485 mononoke: support bookmark creation in the sync job
Reviewed By: krallin

Differential Revision: D17526179

fbshipit-source-id: 3c92e5e448daaa3a784ebefdc3d1a5c7b687d07c
2019-09-25 10:29:35 -07:00
Stanislau Hlebik
0463b2bcfa mononoke: keep track of hg bookmarks in the sync job
Summary:
After this diff sync job [1] starts to keep track of bookmark on hg server.
There are two reasons for that:

1) Some pushes just move a bookmark i.e. they don't push any new commits.
However without knowing hg server state it's impossible to tell apart normal push vs
bookmark-only push and generate correct bundles for it (note that the actual
support for bookmark-only pushes will be added in the next diffs, this diffs
just tracks hg sever bookmarks).

2) There are force pushes that move a bookmark to a completely new place AND
push new commits. Without knowing the state of hg server the sync job might try
to push too many commits.

To track the bookmarks they are fetched from hg server on sync job start up,
and later updated and the sync job progresses. To fetch bookmark from hg server
a separate listserverbookmarks extension is used.

If bundles are prepared together (see --bundle-prefetch option) then we also need to have bookmark overlay
i.e. bookmarks that were modified by the previous bundles in the same batch.

Note that combine-bundles is removed since it hasn't been used at all, include tw specs.

[1] It only keeps track if the job needs to regenerate bundles

Reviewed By: krallin

Differential Revision: D17525983

fbshipit-source-id: 528949ad4ad57ae51ad68fced9caf7256a057ba3
2019-09-25 10:29:35 -07:00
Simon Farnsworth
e65a44a8c7 Add a quick query tool for the commit sync remapping database
Summary: This is the bare minimum to ask the remapping table for any values it has. Combined with other admin tool commands, you can use this to track down a synced commit.

Reviewed By: StanislavGlebik

Differential Revision: D17554261

fbshipit-source-id: f5f967a55182b614b68b5a8c1421401921c9a268
2019-09-25 09:25:46 -07:00