Commit Graph

66 Commits

Author SHA1 Message Date
Thomas Orozco
5c5453af41 mononoke: fix bad help text
Summary: This help text was wrong. This fixes it.

Reviewed By: HarveyHunt

Differential Revision: D15555767

fbshipit-source-id: 5202d46a8527c9e44c5588d52f7425d3efb38898
2019-05-30 06:53:22 -07:00
Kostia Balytskyi
a4599001be mononoke: refactor the admin tool into components
Summary: Let's make it a bit more manageable.

Reviewed By: StanislavGlebik

Differential Revision: D15407978

fbshipit-source-id: 490e4d48c36349cf65171f38df0ef0372883281d
2019-05-21 12:25:59 -07:00
George-Catalin Tintareanu
19a8d1e711 mononoke: Add a noop admin subcommand for blacklisting
Summary: Practice commit. The behaviour will be implemented in the future

Reviewed By: ikostia

Differential Revision: D15372554

fbshipit-source-id: c9b3de81fcd2d79d34b8f8c898e28de2564cd887
2019-05-21 12:25:56 -07:00
Thomas Orozco
a728d3d8d3 mononoke: rustfmt cmds/admin/main.rs
Summary: I'm going to be doing some work on this file, but it's not up-to-date with rustfmt. To minimize merge conflicts and simplify diff reviews, I ran that earlier.

Reviewed By: StanislavGlebik

Differential Revision: D15364673

fbshipit-source-id: 32658629cc7ee29cdfc21be8dd526766d2dcbb0e
2019-05-21 12:25:55 -07:00
Stanislau Hlebik
0fe404988e mononoke: print bundle id to replay
Summary:
Printint id will make it easier to debug sync job problems (for example,
rewiding the latest replayed id counter)

Reviewed By: krallin

Differential Revision: D15322624

fbshipit-source-id: 5c94be9cc0dcced9df51162adb598b6498f1c749
2019-05-21 12:25:54 -07:00
Jeremy Fitzhardinge
e56d695cec mononoke: use SqlConstructors label for local db names
Summary:
Seems redundant to also require callers to open_ssl to also pass a
(mostly) identical string.

Also make open_ssl special-case filenodes with sharding (though filenodes
aren't currently opened through it).

Reviewed By: StanislavGlebik

Differential Revision: D15157834

fbshipit-source-id: 0df45307f17bdb2c021673b3153606031008bee2
2019-05-21 12:25:44 -07:00
Jeremy Fitzhardinge
046abb21ad mononoke: Migrate to new config structures, leaving config files unchanged
Summary:
This migrates the internal structures representing the repo and storage config,
while retaining the existing config file format.

The `RepoType` type has been replaced by `BlobConfig`, an enum containing all
the config information for all the supported blobstores. In addition there's
the `StorageConfig` type which includes `BlobConfig`, and also
`MetadataDBConfig` for the local or remote SQL database for metadata.

Reviewed By: StanislavGlebik

Differential Revision: D15065421

fbshipit-source-id: 47636074fceb6a7e35524f667376a5bb05bd8612
2019-05-21 12:25:43 -07:00
Jeremy Fitzhardinge
4074965fdc mononoke/admin: refactor subcommands into their own functions
Summary: main() was getting ungainly

Reviewed By: aslpavel

Differential Revision: D15046903

fbshipit-source-id: 50d1ad8cb44f84f00247dc6435bac7cc8a194ca1
2019-05-21 12:25:42 -07:00
Stanislau Hlebik
79c14ef818 mononoke: print hg hashes of next log entries to replay
Summary:
Reads current replay counter, and where a bookmark would point to after this
bundle is replayed. That can be useful for debugging

Reviewed By: aslpavel

Differential Revision: D15216378

fbshipit-source-id: fd250e27c2a6d7ee407510561a36b820cc5a1d2b
2019-05-21 12:25:41 -07:00
Thomas Orozco
feba12ad67 mononoke: admin: make tests (actually) more deterministic
Summary:
The mononoke admin integration tests can be flaky when there is logging and an error, because those are respectively sent to stdout and stderr, which means they're not ordered relative to one another.

I attempted to fix this with minimal changes in D15146392, but that didn't solve the issue: StanislavGlebik reported that he still ran into a flaky test.

The reason for this is presumably that even though we write to stderr first then to stdout, there's no guarantee that the `.t` test runner will read whetever we output to stderr before it reads what we output to stdout.

I noted in that earlier diff that a more proper fix would be to write errors to stderr so they are indeed ordered relative to logging. That is what this diff does.

For consistency, I updated other fatal outcomes (bad arguments) to also log to stderr.

Reviewed By: StanislavGlebik

Differential Revision: D15181944

fbshipit-source-id: 3ca48870c39f11a7dcc57f1341f25ce61ccae360
2019-05-21 12:25:38 -07:00
Jeremy Fitzhardinge
4b35684cb7 mononoke/cmdlib: make get_repo_id return a proper error
Reviewed By: lukaspiatkowski

Differential Revision: D15046901

fbshipit-source-id: 603b4bc66e199e0ae12d000b6d7803b7e4bb72cb
2019-05-21 12:25:34 -07:00
Thomas Orozco
477670a03c make tests more deterministic
Summary:
One of the tests for mononoke admin (which I introduced recently) appears to be flaky. Sometimes, output from stdout (the error that terminates the program) and stderr (logs emitted while the program runs) is flipped.

I suspect this is caused by buffering, so this patch flushes all output before writing the error (if there was one).

An alternative approach here might be to write the final error to stderr instead of stdosut (so everything goes to stderr). That feels cleaner, but it does change the interface a little bit, so I didn't take that approach just yet. That said, if nobody objects, I'm happy to pick that approach instead.

Reviewed By: farnz

Differential Revision: D15146392

fbshipit-source-id: 67481afd4802cb48d24d19052988be4a83433efd
2019-05-21 12:25:28 -07:00
Thomas Orozco
c224058b2e Support hg-sync-bundle remains --without-blobimport
Summary: This adds the ability to exclude blobimport entries when querying the count of remaining entries in the HG sync replay log.

Reviewed By: ikostia

Differential Revision: D15097549

fbshipit-source-id: ae1a9a31f51a044924fdebbdd219fff1e2b3d46a
2019-05-21 12:25:25 -07:00
Thomas Orozco
8daba8e8c3 Support hg-sync-bundle last-processed --skip-blobimport
Summary:
This introduces a new `--skip` flag in Mononoke admin under `hg-sync-bundle last-processed`. This will update the last-synced counter to the last blobimport that preceeds a log entry that is no a blobimport.

In other words, it makes it so that the last change to be processed is *not* a blobimport.

It will fail if:

- There is no valid log entry to jump ahead to (e.g. all the further log entries are blobimports).
- The current change to be processed is not a blobimport.
- The mutable counter was changed by someone else in the meantime.

Reviewed By: ikostia

Differential Revision: D15081759

fbshipit-source-id: 8465321b08d9c7b5bc97526400518bcf3ac77f13
2019-05-21 12:25:24 -07:00
Thomas Orozco
1a05aaa1b2 Support hg-sync-bundle verify
Summary: This adds a command in mononoke admin to verify the consistency of remaining bundles to sync -- i.e. whether all bundles are blobimports or all of them are not blobimports.

Reviewed By: ikostia

Differential Revision: D15097935

fbshipit-source-id: a0df221c38e84897213edf232972ba420977e9d3
2019-05-21 12:25:24 -07:00
Thomas Orozco
ac4afd1f0b Fix SQLBookmarks name
Summary:
The code in admin/main.rs passes `bookmarks` as the name of the SQLBookmarks database, but other pieces of code (the server which writes this data, and the hg sync job that normally consumes it) use `books`.

This hasn't been a problem until now since no integration tests exist for the admin tool. This path mismatch was never exposed since in production we don't actually care about this name.

Reviewed By: ikostia, StanislavGlebik

Differential Revision: D15081757

fbshipit-source-id: c4fcd328568160023f3c15fa2ab7d77accf2ad68
2019-05-21 12:25:23 -07:00
Stanislau Hlebik
c3f991e0ed mononoke: allow fetching multiple entries
Summary: We'll do batching to save time on the sync job. We need to sync faster

Reviewed By: ikostia, farnz

Differential Revision: D14929027

fbshipit-source-id: 3139d0ece07f344cdafa5e39b698bc3b02625f0a
2019-05-21 12:25:09 -07:00
Stanislau Hlebik
43a96a4f52 mononoke: add a command to fetch a recorded bundle
Summary: It'll make investigation of failed syncs much easier.

Reviewed By: aslpavel

Differential Revision: D14747615

fbshipit-source-id: 1f9a7af58d065bc60d29e7deccbd51b89bf86dec
2019-05-21 12:25:00 -07:00
Pavel Aslanov
a5ecb01926 tool to manually populate public phases
Summary: Tool to populate public commits

Reviewed By: HarveyHunt

Differential Revision: D14686428

fbshipit-source-id: 98457596c273ca2561bc457d35275bb15e5415e0
2019-05-21 12:24:58 -07:00
Kostia Balytskyi
27f73632e3 mononoke: add --quiet to the hg-sync-byndle remains admin subcommand
Summary: Easier to parse, per StanislavGlebik's request.

Reviewed By: StanislavGlebik

Differential Revision: D14707713

fbshipit-source-id: 6c9850d59fbf0204ad61cd72479df985219103ee
2019-05-21 12:24:54 -07:00
Jeremy Fitzhardinge
52aa7ba4df mononoke: convert admin to rust 2018
Reviewed By: aslpavel

Differential Revision: D14542676

fbshipit-source-id: 6f85f326fdd75ac441960f1b1ffef92c736ad288
2019-03-25 12:34:37 -07:00
Jeremy Fitzhardinge
d76d128059 mononoke: move memblob and prefixblob out of the base blobstore crate
Summary: Slim down the blobstore trait crate as much as possible.

Reviewed By: aslpavel

Differential Revision: D14542675

fbshipit-source-id: faf09255f7fe2236a491742cd836226474f5967c
2019-03-25 12:34:36 -07:00
David Budischek
9579288aaf Switch to skiplist with shorter jumps
Summary:
Pointing the configs to a new package allows us to control the rollout more easily than overriding the existing skiplist in manifold.

This skiplist features a single skip entry for each node with a depth of up to 512 commits. Previously depth was 32k. This means on average we will have to do 16k iterations to find the commit we want after doing the last skiplist jump.

If we were to jump to the very beginning of the repo that would mean before we had to do ~130 skips and then on average 16k steps. With this skiplist we would do ~8k skips and 256 steps. As skips and steps are equally expensive this should be faster in almost every scenario. The total size of the skiplist is not affected by this change (as each node still contains one skip entry) but the new skiplist also covers the complete history, not only the 2kk most recent commits. This leads to size increase of ~20%.

Reviewed By: StanislavGlebik, HarveyHunt

Differential Revision: D14540318

fbshipit-source-id: 86fda5b6c57a06bc4a77e30625014ec119e7a155
2019-03-22 05:32:03 -07:00
Kostia Balytskyi
4969428ce4 mononoke: add remaining bundles count to the admin tool
Summary: To learn how far behind are we in the absolute bundle numbers.

Reviewed By: StanislavGlebik

Differential Revision: D14491672

fbshipit-source-id: 31d16f115b2b6fe4b88c25a847ce229e123b048b
2019-03-17 14:53:09 -07:00
Kostia Balytskyi
468036f5f2 mononoke: add hg sync counter manipulations to the admin tool
Summary: We want to be able to manipulate hg-sync counters from the Mononoke admin.

Reviewed By: StanislavGlebik

Differential Revision: D14477676

fbshipit-source-id: 11218390bf469d4f297f7f13e9daee2d5f9bb35b
2019-03-16 05:20:32 -07:00
Lukas Piatkowski
515a2909eb monononoke hashes: remove usages of borrows of hashes which are Copy
Summary: The Copy trait means that something is so cheap to copy that you don't even need to explicitly do `.clone()` on it. As it doesn't make much sense to pass &i64 it also doesn't make much sense to pass &<Something that is Copy>, so I have removed all the occurences of passing one of ouf hashes that are Copy.

Reviewed By: fanzeyi

Differential Revision: D13974622

fbshipit-source-id: 89efc1c1e29269cc2e77dcb124964265c344f519
2019-02-06 15:11:35 -08:00
Jeremy Fitzhardinge
b4dc225420 mononoke: split complex stuff out of blobstore crate
Summary: Move complex things out of `blobstore` to thin out the dep graph. This didn't work as well as I'd hoped because `blobstore`->`mononoke-types`->`thrift`/`sql`.

Reviewed By: StanislavGlebik

Differential Revision: D13915511

fbshipit-source-id: c210dda23fa7102168c0ca14a035ed5c03a6993c
2019-02-05 15:21:15 -08:00
Stanislau Hlebik
a6f6f28564 mononoke: split reachability index
Summary:
Let's split reachability index crate. The main goal is to reduce compilation
time. Now crates like revsets will only depend on traits definition but not on
the actual implementation (skiplist of genbfs).

Reviewed By: lukaspiatkowski

Differential Revision: D13878403

fbshipit-source-id: 022eca50ac4bc7416e9fe5f3104f0a9a65195b26
2019-01-31 00:41:48 -08:00
Stanislau Hlebik
3d06332693 mononoke: move changeset_fetcher out of blobrepo into separate crate
Summary:
Some crates, namely revsets and reachabilityindex, currently depend on
blobrepo, while all they need is the ability to fetch commits.

By moving changeset_fetcher outside this dependency will be removed. That may
make builds faster

Reviewed By: lukaspiatkowski

Differential Revision: D13878369

fbshipit-source-id: 9ee8973a9170557a4dede5404dd374aa4a000405
2019-01-31 00:41:48 -08:00
Stanislau Hlebik
4d48415149 mononoke: split metaconfig crate
Summary:
Currently if a crate depends even on a single type from metaconfig then in
order to compile this trait buck first compiles metaconfig crate with all the
logic of parsing the configs.

This diff split metaconfig into two crates. The first one just holds the types for
"external consumption" by other crates. The second holds the parsing logic.

That makes builds faster

Reviewed By: jsgf, lukaspiatkowski

Differential Revision: D13877592

fbshipit-source-id: f353fb2d1737845bf1fa0de515ff8ef131020063
2019-01-31 00:41:48 -08:00
Stanislau Hlebik
56b867be32 mononoke: migrate RangeNodeStream to ChangesetFetcher
Reviewed By: lukaspiatkowski

Differential Revision: D13860325

fbshipit-source-id: 3c51d964b6fd4a55587230682c644132f71fd619
2019-01-30 06:31:10 -08:00
Stanislau Hlebik
67f220c89c mononoke: fix pushrebasing an empty commit
Summary:
Previously pushrebasing an empty commit failed because we assumed that root
manifest of a commit is always sent in a bundle. This diff removes this
assumption

Reviewed By: lukaspiatkowski

Differential Revision: D13818556

fbshipit-source-id: 44e96374ae343074f48e42a90c691b21e3c41386
2019-01-28 14:40:40 -08:00
Johan Schuijt-Li
3d1463231a disable authorization verification hook for import
Reviewed By: StanislavGlebik

Differential Revision: D13770727

fbshipit-source-id: 8830c63124bc12a40ffe624110d23a3713cad680
2019-01-23 08:00:55 -08:00
Stanislau Hlebik
bacf9f2d64 mononoke: update skiplist building
Summary:
Previously we rely on CachingChangesetFetcher to quickly fetch all commits into
memory, but CachingChangesetFetcher was deleted in D13695201. Instead let's use
`get_many()` method from Changesets trait to quickly fetch many changesets at
once into memory.

Reviewed By: lukaspiatkowski

Differential Revision: D13712783

fbshipit-source-id: 12e8fa148f7989028547ac8d374438e23b44b6d1
2019-01-21 12:58:44 -08:00
Lukas Piatkowski
ceda67a78a blobstore: extract CacheOpsUtil for direct access for blobstores
Summary: refactor CacheOps to prepare for next diff

Reviewed By: aslpavel

Differential Revision: D13487500

fbshipit-source-id: f9023938d7c2c7573a7957bf38ec6b8641441b75
2019-01-15 09:38:26 -08:00
David Budischek
1558f571c1 Add JSON printing of 'mononoke_admin bonsai-fetch', j...
Reviewed By: StanislavGlebik

Differential Revision: D13622701

fbshipit-source-id: b0b61c23966f9485b99ead7196e276efa8e1e267
2019-01-15 04:02:05 -08:00
David Budischek
7fbfb4ad1d rustfmt mononoke_admin
Reviewed By: StanislavGlebik

Differential Revision: D13634949

fbshipit-source-id: ae97ecba84aa835ad141e4895d1861ad537abfdb
2019-01-15 04:02:05 -08:00
David Budischek
d94fe79b7f Prettify printing of mononoke_admin bonsai-fetch
Summary: Instead of dumping the debug output we print the most important information: Changeset id, author, message and file changes.

Reviewed By: StanislavGlebik

Differential Revision: D13621492

fbshipit-source-id: ea0f93f58516cc759d0dc9aac14545b1827ea136
2019-01-15 04:02:05 -08:00
Pavel Aslanov
1eea4fdb09 asynchronous blobrepo constructor
Summary:
- Support for gluster blubstore
- Asynchronous blobrepo constructor

Reviewed By: StanislavGlebik

Differential Revision: D13630033

fbshipit-source-id: 3e7f5a7be4451063dca3df2f5a7f70d30a2def58
2019-01-14 09:31:58 -08:00
Pavel Aslanov
2efacff245 rustfmt effected files
Summary: Format files effected by next commit in a stack

Reviewed By: StanislavGlebik

Differential Revision: D13650639

fbshipit-source-id: d4e37acd2bcd29b291968a529543c202f6944e1a
2019-01-14 09:31:58 -08:00
Lukas Piatkowski
5155134d0d blobrepo: generalize methods creating Blobrepo over any remote blobstore
Reviewed By: aslpavel

Differential Revision: D13464953

fbshipit-source-id: cb732204bea571788e5b45cee718e8ddf496dd0d
2019-01-10 02:57:36 -08:00
Lukas Piatkowski
2f8ddd0cfa mononoke admin: rustfmt main.rs for easier reviewing of next diffs
Reviewed By: HarveyHunt

Differential Revision: D13606992

fbshipit-source-id: 08600da1c390a552f80bf8b7c160daab78d16f9a
2019-01-09 04:27:33 -08:00
Abhay Bothra
b81b8b0005 Add convert subcommand to mononoke admin tool
Summary:
Added new command which looks as:
```
admin-convert
convert between bonsai and hg changeset hashes

USAGE:
    admin convert <HASH> --from <from> --to <to>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -f, --from <from>    Source hash type [possible values: hg, bonsai]
    -t, --to <to>        Target hash type [possible values: hg, bonsai]

ARGS:
    <HASH>    source hash
```

Reviewed By: StanislavGlebik

Differential Revision: D13494012

fbshipit-source-id: 1e1de7e1e28638b2001f612b9a2c9edda3979dc5
2019-01-07 11:00:48 -08:00
Stanislau Hlebik
92563375c5 mononoke: name variable correctly
Summary: Their names were mixed up

Reviewed By: ikostia

Differential Revision: D13565334

fbshipit-source-id: 1b56adb582900addf2f21ae9baa6dc4ea01c57cb
2019-01-02 10:24:12 -08:00
Harvey Hunt
162dafa9d9 mononoke: admin: Remove ability to build fbpkgs
Summary:
Now that mononoke's config can be built using normal fbpkg tools,
we can remove the ability for mononoke_admin to build configuration.

Reviewed By: StanislavGlebik

Differential Revision: D13399189

fbshipit-source-id: 17aff327773b9c904916f99030a732a99aa34134
2018-12-11 03:56:02 -08:00
Lukas Piatkowski
5d9a151d85 mononoke: pass CoreContext down to blobstore
Reviewed By: jsgf

Differential Revision: D13324220

fbshipit-source-id: af7a2a650338ea66e504ea0acae1d103af10f8e3
2018-12-04 11:40:15 -08:00
Stanislau Hlebik
f07155b402 mononoke: remove mononoke configs, use toml files
Summary:
Config repo proved to be tricky to understand and hard to use. Let's just use
toml files.

Reviewed By: farnz

Differential Revision: D13179926

fbshipit-source-id: 3a44ee08c37284cc4c189c74b5c369ce82651cc6
2018-12-04 03:52:26 -08:00
Lukas Piatkowski
02e79837a4 mononoke: pass CoreContext down to bookmarks
Reviewed By: StanislavGlebik

Differential Revision: D13302943

fbshipit-source-id: 356ec3cd3c47f843a5869edb7079d4cbd0ee33aa
2018-12-04 01:16:32 -08:00
Lukas Piatkowski
14636545aa mononoke: pass CoreContext down to changesets
Reviewed By: StanislavGlebik

Differential Revision: D13277448

fbshipit-source-id: 6e9a8dac77af8ab991005d14f654e315c234fe44
2018-11-30 10:14:22 -08:00
Lukas Piatkowski
08db0a35eb mononoke: pass CoreContext down to bonsai-hg-mapping
Reviewed By: aslpavel

Differential Revision: D13277450

fbshipit-source-id: 97cfbd917b321727bb4d960c91a784787660eb5b
2018-11-30 10:14:22 -08:00