Commit Graph

15 Commits

Author SHA1 Message Date
Thomas Orozco
213276eff5 mononoke/unbundle_replay: add Scuba reporting
Summary: This adds some Scuba reporting to unbundle_replay.

Differential Revision: D20674162

fbshipit-source-id: 59e12de90f5fca8a7c341478048e68a53ff0cdc1
2020-03-30 06:25:07 -07:00
Thomas Orozco
13f24f7425 mononoke/unbundle_replay: unbundle concurrently, derive filenodes concurrently
Summary:
This updates unbundle_replay to do things concurrently where possible.
Concretely, this means we do ingest unbundles concurrently, and filenodes
derivation concurrently, and only do the actual pushrebase sequentially. This
lets us get ahead on work wherever we can, and makes the process faster.

Doing unbundles concurrently isn't actually guaranteed to succeed, since it's
*possible* that an unbundle coming in immediately after a pushrebase actually
depends the commits created in said pushrebase. In this case, we simply retry
the unbundle when we're ready to proceed with the pushrebase (in the code, this
is the `Deferred` variant). This is fine from a performance perspective

As part of this, I've also moved the loading of the bundle to processing, as
opposed to the hg recording client (the motivation for this is that we want to
do this loading in parallel as well).

This will also let us run hooks in parallel once I add this in.

Reviewed By: StanislavGlebik

Differential Revision: D20668301

fbshipit-source-id: fe2c62ca543f29254b4c5a3e138538e8a3647daa
2020-03-30 06:25:07 -07:00
Thomas Orozco
60d427e93c mononoke/unbundle_replay: log when pushrebase is starting
Summary: More logging is always helpful!

Reviewed By: HarveyHunt

Differential Revision: D20668303

fbshipit-source-id: 776f41491c4108e5f5ab9caa9351584150d7b626
2020-03-30 06:25:06 -07:00
Thomas Orozco
d18cd74f7d mononoke/unbundle_replay: ignore entries with conflicts
Summary:
pushrebase_errmsg is NULL when we have conflicts, but we still shouldn't replay
the entry (because it'll fail, with conflicts). Let's exclude those.

Reviewed By: StanislavGlebik

Differential Revision: D20668304

fbshipit-source-id: a058bb466e0a8a53ec81e41db7ba138d6aedf3f9
2020-03-30 06:25:06 -07:00
Thomas Orozco
7dd1717f7d mononoke/unbundle_replay: log the age of the commit we just replayed
Summary: It's helpful.

Reviewed By: HarveyHunt

Differential Revision: D20668302

fbshipit-source-id: 0f8e8cc72363aed337fd6fa4c3950c17eb1f92b7
2020-03-30 06:25:06 -07:00
Thomas Orozco
58eeb318aa mononoke/unbundle_replay: log when we start deriving hg changesets
Summary: This is helpful.

Reviewed By: StanislavGlebik

Differential Revision: D20645576

fbshipit-source-id: b08ec151232e46dbde1a33010c6852e9563f6a1a
2020-03-30 06:25:05 -07:00
Thomas Orozco
259e096841 mononoke/unbundle_replay: sleep when watching bookmark
Summary:
This updates unbundle_replay to support sleeping when watching for updates in a
bookmark and said bookmark isn't moving. This will be useful so it can run as a
service.

Reviewed By: StanislavGlebik

Differential Revision: D20645157

fbshipit-source-id: 6edeb66b65b2ef8b88c8db5e664982756acbfaf1
2020-03-30 06:25:05 -07:00
Thomas Orozco
d1cce10ea7 mononoke/unbundle_replay: fixup incomplete test
Summary:
I accidentally forgot to insert the entry, so that made this test a bit
useless. Let's make it not useless.

Reviewed By: StanislavGlebik

Differential Revision: D20645158

fbshipit-source-id: 0f0eb0cf9d16e8c346897088891aa3277b4d9c07
2020-03-30 06:25:05 -07:00
Thomas Orozco
8ce3d94187 mononoke/unbundle_replay: add support for replaying a bookmark
Summary:
This adds support for replaying the updates to a bookmark through unbundle
replay. The goal is to be able to run this as a process that keeps a bookmark
continuously updated.

There is still a bit of work here, since we don't yet allow the stream to pause
until bookmark update becomes available (i.e. once caught up, it will exit).
I'll introduce this in another diff.

Note that this is only guaranteed to work if there is a single bookmark in the
repo. With more, it could fail if a commit is first introduced in a bookmark that
isn't the one being replayed here, and later gets introduced in said bookmark.

Reviewed By: StanislavGlebik

Differential Revision: D20645159

fbshipit-source-id: 0aa11195079fa6ac4553b0c1acc8aef610824747
2020-03-30 06:25:04 -07:00
Thomas Orozco
7cd5eb6774 mononoke/unbundle_replay: get a stream of requests to replay
Summary:
I'm going to update this to run in a loop, so to do that it would be nice to
represent the things to replay as a stream. This does that change, but for now
all our streams have just one element.

Reviewed By: StanislavGlebik

Differential Revision: D20645156

fbshipit-source-id: fce7536d0ccbc1911335704816b71c17e80f2116
2020-03-30 06:25:04 -07:00
Thomas Orozco
6b1894cec9 mononoke/unbundle_replay: derive filenodes
Summary:
We normally derive those lazily when accepting pushrebase, but we do derive
them eagerly in blobimport. For now, let's be consistent with blobimport.

This ensures that we don't lazily generate them, which would require read traffic,
and gives a picture a little more consistent with what an actual push would look like.

Reviewed By: ikostia

Differential Revision: D20623966

fbshipit-source-id: 2209877e9f07126b7b40561abf3e6067f7a613e6
2020-03-30 06:25:04 -07:00
Thomas Orozco
8b0f92e84b mononoke/unbundle_replay: report missing Bonsai onto_rev in hg replay
Summary:
This makes it easier to realize if you used the wrong entry ID when replaying
(instead of telling you the bookmark isn't at `None` as expected, it tells you
the Hg Changeset could not be mapped to a Bonsai).

Reviewed By: ikostia

Differential Revision: D20623847

fbshipit-source-id: aaa66e7825f12373742efd4f779ae20ff21f0b46
2020-03-30 06:25:03 -07:00
Thomas Orozco
90cf5df340 mononoke/unbundle_replay: add a little more logging
Summary: More logging is nice!

Reviewed By: ikostia

Differential Revision: D20623846

fbshipit-source-id: 61eb3d17f5fb3b2bf94ef3f946b1d90d725cfece
2020-03-30 06:25:03 -07:00
Thomas Orozco
7ca14665a2 mononoke/unbundle_replay: use repo pushrebase hooks
Summary:
This updates unbundle_replay to account for pushrebase hooks, notably to assign
globalrevs.

To do so, I've extracted the creation of pushrebase hooks in repo_client and
reused it in unbundle_replay. I also had to update unbundle_replay to no longer
use `args::get_repo` since that doesn't give us access to the config (which we
need to know what pushrebase hooks to enable).

Reviewed By: ikostia

Differential Revision: D20622723

fbshipit-source-id: c74068c920822ac9d25e86289a28eeb0568768fc
2020-03-30 06:25:03 -07:00
Thomas Orozco
3804f1ca16 mononoke: introduce unbundle_replay
Summary:
This adds a unbundle_replay Rust binary. Conceptually, this is similar to the
old unbundle replay Python script we used to have, but there are a few
important differences:

- It runs fully in-process, as opposed to pushing to a Mononoke host.
- It will validate that the pushrebase being produced is consistent with what
  is expected before moving the bookmark.
- It can find sources to replay from the bookmarks update log (which is
  convenient for testing).

Basically, this is to writes and to the old unbundle replay mechanism what
Fastreplay is to reads and to the traffic replay script.

There is still a bit of work to do here, notably:

- Make it possible to run this in a loop to ingest updates iteratively.
- Run hooks.
- Log to Scuba!
- Add the necessary hooks (notably globalrevs)
- Set up pushrebase flags.

I would also like to see if we can disable the presence cache here, which would
let us also use this as a framework for benchmarking work on push performance,
if / when we need that.

Reviewed By: StanislavGlebik

Differential Revision: D20603306

fbshipit-source-id: 187c228832fc81bdd30f3288021bba12f5aca69c
2020-03-30 06:25:03 -07:00