Commit Graph

1000 Commits

Author SHA1 Message Date
Stanislau Hlebik
2d24ddf2e1 mononoke: add --all-types to backfill_derive_data single
Summary: It's useful to derive all enabled derived data at once

Reviewed By: krallin

Differential Revision: D22336338

fbshipit-source-id: 54bc27ab2c23c175913fc02e6bf05d18a54c249c
2020-07-03 00:20:58 -07:00
Stanislau Hlebik
2a54f281f2 mononoke: add an option to perform a stack move in megarepotool
Summary:
We've recently added an option to perform a stack move in megarepolib. A "stack
move" it's a stack of commits that move a files according to a mover. Now let's
expose it in the megarepotool

Reviewed By: ikostia

Differential Revision: D22312486

fbshipit-source-id: 878d4b2575ed2930bbbf0b9b35e51bb41393e622
2020-07-03 00:18:41 -07:00
Mark Thomas
dba11deb2d scs_server: implement commit_list_descendant_bookmarks
Summary:
Implement `commit_list_descendant_bookmarks` by iterating over all bookmarks and
checking if the target commit is an ancestor of the bookmark's current target.

Reviewed By: mitrandir77

Differential Revision: D22357988

fbshipit-source-id: e1b1d7387742ba7133370f52c4d36c0b1a77f4e3
2020-07-02 12:58:16 -07:00
Mark Thomas
309e4539ab mononoke_api: bypass cache for old bookmark location in move_bookmark
Summary:
Currently the `move_bookmark` API needs to get the old bookmark location in order
to move the bookmark.  We'll fix that in general later, but for now we need to
make sure the value we use doesn't come from an out-of-date cache (e.g. the
warm_bookmarks_cache), as it may prevent the move from working.

Reviewed By: krallin

Differential Revision: D22358467

fbshipit-source-id: 4d46a6be717644b24663318326fdcd81249481c9
2020-07-02 11:01:04 -07:00
Mark Thomas
6d5bce25c6 mononoke_api: implement pagination for all bookmarks
Summary:
Bookmark requests that are truncated because the requested limit is reached now return a `continue_after` value, containing the last bookmark that was processed.

Callers can make a subsequent request with the same parameters, but `after` set to the value received in `continue_after` to continue their request where it left off.

Reviewed By: krallin

Differential Revision: D22338301

fbshipit-source-id: 81e398bee444e0960e65dc3b4cdbbe877aff926d
2020-07-02 07:53:12 -07:00
Mark Thomas
344c8edda4 add commit_list_descendant_bookmarks
Summary:
Add `commit_list_descendant_bookmarks` which will list all bookmarks that are
descendants of a particular commit.

We will also use this opportunity to complete the implementation of pagination
for regular bookmark listing, so add the appropriate fields to the
`repo_list_bookmarks` request and response structs.

Reviewed By: StanislavGlebik

Differential Revision: D22338300

fbshipit-source-id: defd019795c2a2ac9e5573d58de187c10848397f
2020-07-02 07:53:12 -07:00
Mark Thomas
3e4e59baef bookmarks: add 'pagination' filter to 'list'
Summary:
Add a new parameter, `pagination`, to the `list` method of the `Bookmarks` trait.

This restricts the returned bookmarks to those lexicographically after the
given bookmark name (exclusive).  This can be use to implement pagination:
callers can provide the last bookmark in the previous page to fetch the
next page of bookmarks.

Reviewed By: krallin

Differential Revision: D22333943

fbshipit-source-id: 686df545020d936095e29ae5fee24258511f4083
2020-07-02 07:53:12 -07:00
Mark Thomas
742eb6f829 bookmarks: rework Bookmarks traits
Summary:
Rework the bookmarks traits:

* Split out log functions into a separate `BookmarkUpdateLog` trait.  The cache doesn't care about these methods.

* Simplify `list` down to a single method with appropriate filtering parameters.  We want to add more filtering types, and adding more methods for each possible combination will be messier.

* The `Bookmarks` and `BookmarkUpdateLog` traits become `attributes` on `BlobRepo`, rather than being a named member.

Reorganise the bookmarks crate to separate out the bookmarks log and transactions into their own modules.

Reviewed By: krallin

Differential Revision: D22307781

fbshipit-source-id: 4fe514df8b7ef92ed3def80b21a16e196d916c64
2020-07-02 07:53:12 -07:00
Mark Thomas
64610d46c2 bookmarks: escape LIKE patterns used for bookmark prefixes
Summary:
The LIKE pattern used by bookmark prefixes needs to be escaped, otherwise
users looking for bookmarks containing `\`, `_` or `%` will get the
wrong results.

Reviewed By: krallin

Differential Revision: D22336716

fbshipit-source-id: 99b0ad6097f096358e66042752e4d153359935be
2020-07-02 07:53:11 -07:00
Kostia Balytskyi
b134a2f5bb blobstore_healer: fix how replication lag is monitored
Summary: We were monitoring the wrong lag so far.

Reviewed By: farnz

Differential Revision: D22356455

fbshipit-source-id: abe41a4154c2a8d53befed4760e2e9544797c845
2020-07-02 06:18:35 -07:00
Stanislau Hlebik
f6d06a266a mononoke: check conflicts correctly when doing bulk adds in transaction
Summary:
`bulk_add()` method was checking for conflicts correctly i.e. it wouldn't fail
if we try to insert the same mapping twice.
`bulk_add_git_mapping_in_transaction` wasn't doing this check i.e. it would
fail.

This caused us a few problems and this diff fixes them - now
`bulk_add_git_mapping_in_transaction` would do the same checks as bulk_add was
doing previously.

There is another important change in behaviour: if we try to insert two entries, one of them
has a conflict another don't then previously we'd insert the second entry.
Now we don't insert any, arguably that's a preferred behaviour.

Reviewed By: krallin

Differential Revision: D22332001

fbshipit-source-id: 86fff8c23c43eeca0fb36b01b10cdaa73b3ce4ab
2020-07-02 05:31:29 -07:00
Arun Kulshreshtha
632596e947 edenapi: make JSON representation of DataRequest into an object
Summary:
EdenAPI's `make_req` tools allows developers to create ad-hoc CBOR request payloads for debugging purposes (e.g., for use with `curl`). The tool generates requests from human-created JSON, which are particularly useful in Mercurial and Mononoke's integration tests.

Later in this stack, the use of this JSON format will be extended beyond just this one tool. As such, it is important that the representation be sufficiently extensible so accommodate future changes to the request structs. In the case of the JSON representation of `DataRequest`, this means changing from an array to a single-attribute object, so that additional fields can potentially be added in the future.

Reviewed By: quark-zju

Differential Revision: D22319314

fbshipit-source-id: 5931bc7ab01ca48ceab5ffd1c9177dd3035b643c
2020-07-01 23:03:00 -07:00
Stefan Filip
422c84b659 mononoke: monitor replication lag in segmented_changelog::IdMap
Summary:
The (re)construction process for the IdMap will generate millions of rows
to be inserted in our database. We want to throttle the inserts so that
the database doesn't topple over.

Reviewed By: ikostia

Differential Revision: D22104349

fbshipit-source-id: 73b7c2bab12ae0cd836080bcf1eb64586116e70f
2020-07-01 18:18:55 -07:00
Stefan Filip
a688181255 mononoke: add MyAdmin implementation for ReplicaLagMonitor
Summary:
Simple implementation that queries the MyAdmin service to fetch replication
lag.

Caching like in sqlblob::facebook::myadmin will probably come in a follow
up change.

Reviewed By: StanislavGlebik

Differential Revision: D22104350

fbshipit-source-id: fbd90174d528ddae4045e957c343e6c213f70d26
2020-07-01 18:18:55 -07:00
Stefan Filip
bf61eb5c64 mononoke: add trait ReplicaLagMonitor
Summary:
ReplicaLagMonitor is aimed to generalize over different stategies of fetching
the replication lag in a SQL database. Querying a set of connections is one
such strategy.

Reviewed By: ikostia

Differential Revision: D22104348

fbshipit-source-id: bbbeccb55a664e60b3c14ee17f404982d09f2b25
2020-07-01 18:18:55 -07:00
Viet Hung Nguyen
5f43a49743 mononoke/repo_import: add a packman config
Summary: A tool to automate repo imports (intern project: https://fburl.com/hlq6cyma)

Reviewed By: krallin

Differential Revision: D22334417

fbshipit-source-id: 21125a73afede5cf555fc66294d8b02c619c6bba
2020-07-01 11:26:31 -07:00
Mark Thomas
60c5a1722b sql_ext: make sqlite LIKE case sensitive
Summary:
SQLite's `LIKE` operator is case insensitive by default.  This doesn't match MySQL, and
also seems like a surprising default.  Set the pragma on every connection to make it
case sensitive.

Reviewed By: farnz

Differential Revision: D22332419

fbshipit-source-id: 4f503eeaa874e110c03c27300467ddc02dc9b365
2020-07-01 11:08:43 -07:00
Mark Thomas
4baaceef2d bookmarks: rename BookmarkHgKind to BookmarkKind
Summary:
Whether a bookmark is publishing or not is not specific to Mercurial - it also affects
whether a commit is draft, so it is interesting to the Bonsai world.

Rename `BookmarkHgKind` to `BookmarkKind` to make this clear.

Since negatives are more awkward to work with, rename `PublishingNotPullDefault` to
`Publishing` and `PullDefault` to `PullDefaultPublishing` to make it clearer that
pull-default bookmarks are also publishing.

We can't rename the database column, so that remains as `hg_kind`.

Reviewed By: StanislavGlebik

Differential Revision: D22307782

fbshipit-source-id: 9e686a98cc5eaf9af722fa62fac5ffd4844967fd
2020-07-01 11:08:43 -07:00
Kostia Balytskyi
a40d9bb264 blobstore healer: improve incomplete batch identification logic
Summary:
Blobstore healer has a logic, which prevents it from doing busy work, when the
queue is empty. This is implemented by means of checking whether the DB query
fetched the whole `LIMIT` of values. Or that is the idea, at least. In
practice, here's what happens:

1. DB query is a nested one: first it gets at most `LIMIT` distinct
`operation_key` entries, then it gets all rows with such entries. In practice
this almost always means `# of blobstores * LIMIT` rows, as we almost always
succeed writing to every blobstore
2. Once this query is done, the rows are grouped by the `blobstore_key`, and a
future is created for each such row (for simplicity, ignore that future may not
be created).
3. We then compare the number of created futures with `LIMIT` and report an
incomplete batch if the numbers are different.

This logic has a flaw: same `blobstore_key` may be written multiple times with
different `operation_key` values. One example of this: `GitSha1` keys for
identical contents. When this happens, grouping from step 2 above will produce
fewer than `LIMIT` groups, and we'll end up sleeping for nothing.

This is not a huge deal, but let's fix it anyway.

My fix also adds some strictly speaking unnecessary logging, but I found it
helpful during this investigation, so let's keep it.

The price of this change is collecting two `unique_by` calls, both of which
allocates a temporary hash set [1] of the size `LIMIT * len(blobstore_key) * #
blobstores` (and another one with `operation_key`). For `LIMIT=100_000`
`len(blobstore_key)=255`, `# blobstores = 3` we have roughly 70 mb for the
larger one, which should be ok.

[1] https://docs.rs/itertools/0.9.0/itertools/trait.Itertools.html#method.unique

Reviewed By: ahornby

Differential Revision: D22293204

fbshipit-source-id: bafb7817359e2c867cf33c319a886653b974d43f
2020-07-01 02:08:54 -07:00
Viet Hung Nguyen
f5db2fdcdc mononoke/repo_import: add rewrite_commit functionality
Summary:
Previous commit: D22233127 (fa1caa8c4e)

In this diff, I added rewrite commit path functionality using Mover https://fburl.com/diffusion/6rnf9q2f to repo_import.
Given a prefix (e.g. new_repo), we prepend the paths of the files extracted from the bonsaichangesets given by gitimport (e.g. folder1/file1 => new_repo/folder1/file1). Previously, we did this manually when importing a git repo (https://www.internalfb.com/intern/wiki/Mercurial/Admin/ImportingRepos/) using convert extension.

Reviewed By: StanislavGlebik

Differential Revision: D22307039

fbshipit-source-id: 322533e5d6cbaf5d7eec589c8cba0c1b9c79d7af
2020-06-30 11:39:35 -07:00
Simon Farnsworth
aa00466319 Sync hook_type change from D22282802
Summary: Also fix up the parser test that now fails with this change

Reviewed By: StanislavGlebik

Differential Revision: D22306340

fbshipit-source-id: 820aad48068471b03cbc1c42107c443bfa680607
2020-06-30 11:20:54 -07:00
Mateusz Kwapich
15256a91be add an option to limit commit_history to descendants of commit
Summary: This will be used for commits_between replacement

Differential Revision: D22234236

fbshipit-source-id: c0c8550d97a9e8b42034d605e24ff54251fbd13e
2020-06-30 08:09:30 -07:00
Mateusz Kwapich
66a810a68c new history format
Summary: Some SCMQuery queries need just a list of commit hashes instead of full coverage.

Reviewed By: markbt

Differential Revision: D22165006

fbshipit-source-id: 9eeeab72bc4c88ce040d9d2f1a7df555a11fb5ae
2020-06-30 08:09:30 -07:00
Mateusz Kwapich
398ab603c2 add into_response that would map commit ids across identity schemes
Summary: This way we can go from list of changesets into changet ids that we're returning as an answer in few queries.

Differential Revision: D22165005

fbshipit-source-id: 4da8ab2a89be0de34b2870044e44d35424be5510
2020-06-30 08:09:30 -07:00
Stanislau Hlebik
c43ea517b0 mononoke: move derive_data_for_csids to derived_data_utils
Summary: It can be useful in other places as well, not only in blobimport

Reviewed By: krallin

Differential Revision: D22307314

fbshipit-source-id: f7d8c91101edc2ed4f230f7ef6796e39fbea5117
2020-06-30 06:22:31 -07:00
Mark Thomas
160936b732 bookmarks: convert to new-style BoxFutures and BoxStreams
Summary: Convert the bookmarks traits to use new-style `BoxFuture<'static>` and `BoxStream<'static>`.  This is a step along the path to full `async`/`await`.

Reviewed By: farnz

Differential Revision: D22244489

fbshipit-source-id: b1bcb65a6d9e63bc963d9faf106db61cd507e452
2020-06-30 02:37:34 -07:00
Jun Wu
4b45a2a185 test-pushrebase: use modern configs
Summary:
Enable narrow-heads.

Changed log revset from `:` to `all()` to make the test compatible.

Reviewed By: krallin

Differential Revision: D22200495

fbshipit-source-id: 148a82e77c953b9e7dbed055ef464c318e56cafa
2020-06-29 13:00:07 -07:00
Jun Wu
4c1634b9fd test-commitcloud: use modern configs
Summary:
Enable narrow-heads, and mutation. Disable obsmarker related features.

Change phase manipulation to `debugmakepublic` which works with narrow-heads.

Reviewed By: krallin

Differential Revision: D22200511

fbshipit-source-id: 8dec050f137e6cc055015fe084eb4cc67faa1216
2020-06-29 13:00:07 -07:00
Jun Wu
42b145a65d test-walker-scrub-blobstore: use modern configs
Summary:
Enable narrow-heads.

The test output seems a bit unstable - sometimes I got 28 there. So I globbed
it out.

Reviewed By: krallin

Differential Revision: D22200497

fbshipit-source-id: f005381a341d88c0bcbb09150e7d1878df7a38f3
2020-06-29 13:00:07 -07:00
Jun Wu
9eb40deffe test-pushrebase-emit-obsmarkers: use modern configs
Summary:
Enable narrow-heads.

Change the revset `:` to `all()`. With narrow-heads, `:` selects all commits
including those that are not referred by visible heads. The `all()` revset
only selects commits reachable from visible heads.

Reviewed By: krallin

Differential Revision: D22200498

fbshipit-source-id: beb863d42069ae898e419a4a75b3a707c72ae1f9
2020-06-29 13:00:07 -07:00
Jun Wu
e0c9b2b87b test-sqlblob: use modern configs
Summary:
Enable remotenames, selectivepull, and narrow-heads. Use the new stream clone
code path.

Selectivepull makes a difference. `hg pull -r HASH` also pulls the selected
bookmarks so an extra `pull` was unnecessary. Change the clone command to use
`-U` to trigger the new clone code path.

Reviewed By: krallin

Differential Revision: D22200499

fbshipit-source-id: 764202098c7e8afdbb5e2ee83679da7570c08c90
2020-06-29 13:00:07 -07:00
Jun Wu
adcf846f2f test-reduction: use modern configs
Summary:
Enable remotenames and narrow-heads.

Local bookmarks are replaced by remote bookmarks, causing the test change.

Reviewed By: krallin

Differential Revision: D22200500

fbshipit-source-id: aeee528d1766e0642c12e78a6c1a50cadc8a579a
2020-06-29 13:00:07 -07:00
Jun Wu
d1da1d70c1 test-push-redirector-sync-job: use modern configs
Summary:
Enable remotenames and narrow-heads.

The commits become 'draft' because there are no remote bookmarks.

Reviewed By: krallin

Differential Revision: D22200514

fbshipit-source-id: 04d0befa7c22756e936a28ffdcdf1305057cf062
2020-06-29 13:00:07 -07:00
Jun Wu
2875942761 test-infinitepush: use modern configs
Summary:
Enable remotenames and narrow-heads.

The test was migrated cleanly. The only change is that local bookmarks are
replaced by remote bookmarks.

Reviewed By: krallin

Differential Revision: D22200510

fbshipit-source-id: f5b8cd2ed125e9fc4e5daac897851d91fef5693f
2020-06-29 13:00:07 -07:00
Jun Wu
6ecf255fcf test-infinitepush-mutation: use modern configs
Summary:
Enable remotenames and narrow-heads.

Local bookmarks are replaced by remote bookmarks.

Reviewed By: krallin

Differential Revision: D22200503

fbshipit-source-id: 41ac4f4f606011dcaf6d0d9867b01fb77b9a79d8
2020-06-29 13:00:07 -07:00
Jun Wu
95cf4a2a39 test-infinitepush-hydrated: use modern configs
Summary:
Enable remotenames and narrow-heads.

Phase exchange is gone because of narrow-heads.
The remtoenames extension was written suboptimally so it issued a second
bookmarks request (which, hopefully can be removed by having selective
pull everywhere and migrate pull to use the new API).

Reviewed By: krallin

Differential Revision: D22200506

fbshipit-source-id: c522bb9fc1396d813e0f1f380c4290445bab3db3
2020-06-29 13:00:07 -07:00
Jun Wu
ffde9f50e9 test-infinitepush-commits-disabled: use modern configs
Summary:
Enable remotenames and narrow-heads. The `master_bookmark` is no longer a local
bookmark in the client repo.

Reviewed By: krallin

Differential Revision: D22200513

fbshipit-source-id: bc3c1715ce21f45a35bc67148eb00e44944bea6e
2020-06-29 13:00:06 -07:00
Jun Wu
8ecb79a921 test-gettreepack-sparse-update: use modern configs
Summary: Enable remotenames and narrow-heads.

Reviewed By: krallin

Differential Revision: D22201083

fbshipit-source-id: 585dff69db9dd725c8fa1090d47c85b150f979da
2020-06-29 13:00:06 -07:00
Jun Wu
439c029007 test-gettreepack-designated-nodes: use modern configs
Summary:
Enable remotenames and narrow-heads. The server gets one more request from
remotenames.

Reviewed By: krallin

Differential Revision: D22200502

fbshipit-source-id: 26bc28b19438c7be4a19eae6be728c83b113f822
2020-06-29 13:00:06 -07:00
Jun Wu
93318c255b test-bookmark-hg-kind: use modern configs
Summary:
Enable remotenames and narrow-heads. The client gets remote bookmarks instead
of local bookmarks during clone and phases are decided by remote bookmarks.

Reviewed By: krallin

Differential Revision: D22200515

fbshipit-source-id: 12a9e892855b3a8f62f01758565de5f224c4942b
2020-06-29 13:00:06 -07:00
Jun Wu
8bde7d1316 tests: show remotenames in tglogpnr
Summary:
Change the template to show remote bookmarks, which will be more relevant once
we migrate to modern configs. Namely, phases will be decided by remote bookmarks.

The named branches logic was mostly removed from the code base. Therefore
drop the `{branches}` template.

Reviewed By: StanislavGlebik

Differential Revision: D22200512

fbshipit-source-id: 8eca3a71ff88b8614023f4920a448156fcd712d5
2020-06-29 13:00:06 -07:00
Jun Wu
dbd29b7d06 tests: turn on narrow-heads for some tests
Summary: With narrow-heads, the phase exchange step is skipped.

Reviewed By: krallin

Differential Revision: D22200504

fbshipit-source-id: 6ab366e7e68eb3b82f52acaa8f488747435e0ecf
2020-06-29 13:00:06 -07:00
Jun Wu
889beacdf1 tests: enable narrow-heads for Mononoke tests
Summary:
Most tests pass without changes. Some incompatible tests are added to the
special list.

Reviewed By: krallin

Differential Revision: D22200505

fbshipit-source-id: 091464bbc7c9c532fed9ef91f2c955d6e4f2df0b
2020-06-29 13:00:06 -07:00
Stanislau Hlebik
04ce32014d mononoke: log pushed commits to scribe
Summary: This is the final diff of the stack - it starts logging pushed commits to scribe

Reviewed By: farnz

Differential Revision: D22212755

fbshipit-source-id: ec09728408468acaeb1c214d43f930faac30899b
2020-06-29 12:15:22 -07:00
Stanislau Hlebik
6fd54d6b22 mononoke: don't fail if logging to scribe failed
Summary:
Failing push if we failed to log to scribe doesn't make a lot of sense. By that
time the ship has sailed - commit has already been pushed and by failing the
request we can't undo that. It will just create an annoyance by whoever is
pushing.

Instead let's log it to scuba

Reviewed By: farnz

Differential Revision: D22256687

fbshipit-source-id: 2428bbf1db4cef6fa80777ad65184fab1804fa9c
2020-06-29 12:15:22 -07:00
Stanislau Hlebik
8a137ae922 mononoke: add Scribe
Summary:
At the moment we can't test logging to scribe easily - we don't have a way to
mock it. Scribe are supposed to help with that.

They will let us to configure all scribe logs to go to a directory on a
filesystem similar to the way we configure scuba. The Scribe itself will
be stored in CoreContext

Reviewed By: farnz

Differential Revision: D22237730

fbshipit-source-id: 144340bcfb1babc3577026191428df48e30a0bb6
2020-06-29 12:15:22 -07:00
Jun Wu
4902a3300c tests: enable narrow-heads by default
Summary: Many tests are incompatible. But many are passing.

Reviewed By: kulshrax

Differential Revision: D22052475

fbshipit-source-id: 1f30ac2b0fe034175d5ae818ec2be098dbd5283d
2020-06-29 11:29:04 -07:00
Simon Farnsworth
7e9b8dd9e9 Remove last vestiges of Lua hooks from tests
Summary:
For Lua hooks, we needed to know whether to run the hook per file, or per changeset. Rust hooks know this implicitly, as they're built-in to the server.

Stop having the tests set an unnecessary config

Reviewed By: krallin

Differential Revision: D22282799

fbshipit-source-id: c9f6f6325823d06d03341f04ecf7152999fcdbe7
2020-06-29 10:03:22 -07:00
Harvey Hunt
026710c2cd mononoke: Remove --config_path from server arguments
Summary:
D21642461 (46d2b44c0e) converted Mononoke server to use the
`--mononoke-config-path` common argument style to select a config path.

Now that this change has been running for a while, remove the extra logic in
the server that allowed it to accept both the deprecated `--config_path / -P`
and the new arg.

Reviewed By: ikostia

Differential Revision: D22257386

fbshipit-source-id: 7da4ed4e0039d3659f8872693fa4940c58bae844
2020-06-29 07:28:36 -07:00
Stanislau Hlebik
f55fa975a5 mononoke: fix unused imports
Reviewed By: krallin

Differential Revision: D22281331

fbshipit-source-id: 656ba6500193bd179d1e6cd1443de3e85d37c597
2020-06-29 03:22:11 -07:00