Commit Graph

124 Commits

Author SHA1 Message Date
Stanislau Hlebik
324ffbf862 mononoke: allow local blobstore sync queue
Summary: useful for tests

Reviewed By: HarveyHunt

Differential Revision: D15263210

fbshipit-source-id: 8e78e437dca4fd04b3e233bfd03af9f971508a1d
2019-05-21 12:25:47 -07:00
Jeremy Fitzhardinge
9b54d0f85b mononoke: move storage configuration to a common file
Summary:
This change has two goals:
- Put storage configuration that's common to multiple repos in a common place,
  rather than replicating it in each server.toml
- Allow tools that only operate on the blobstore level - like blobstore healing
  - to be configured directly in terms of the blobstore, rather than indirectly
    by using a representative repo config.

This change makes several changes to repo configuration:
1. There's a separate common/storage.toml which defines named storage
configurations (ie, a combination of a blobstore and metadata DB)
2. server.toml files can also define local storage configurations (mostly
useful for testing)
3. server.toml files now reference which storage they're using with
`storage_config = "name"`.
4. Configuration of multiplex blobstores is now explicit. Previously if a
server.toml defined multiple blobstores, it was assumed that it was a
multiplex. Now storage configuration only accepts a single blobstore config,
but that config can be explicitly a multiplexed blobstore, which has the
sub-blobstores defined within it, in the `components` field. (This is
recursive, so it could be nested, but I'm not sure if this has much value in
practice.)
5. Makes configuration parsing more strict - unknown fields will be treated as
an error rather than ignored. This helps flag problems in refactoring/updating
configs.

I've updated all the configs to the new format, both production and in
integration tests. Please review to make sure I haven't broken anything.

Reviewed By: StanislavGlebik

Differential Revision: D15065423

fbshipit-source-id: b7ce58e46e91877f4e15518c014496fb826fe03c
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
6123587f83 mononoke/repoconfig: use serde defaults rather than Option where possible
Summary:
We don't need Option<bool> or Option<Vec<T>> - in the former case, the
bool is always treated as having a default value if not present, and in the
latter, None is equivalent to Some(vec![]), so just use an empty vector for
absense.

Reviewed By: lukaspiatkowski

Differential Revision: D15051895

fbshipit-source-id: 0ac6f2e6b13357bf6e30dbfa25c7fdebd208e505
2019-05-21 12:25:43 -07:00
Thomas Orozco
5e0f2d895a mononoke: allow different tier name for sharded filenodes
Summary:
This updates our configuration to allow using a different tier name for sharded filenodes.

One thing I'd like to call out is that we currently use the DB tier name in the keys generated by `CachingFilenodes`. Updating the tier name will therefore result in us dropping all our caches. Is this acceptable? If not, should we just continue using the old tier name.

Reviewed By: jsgf, StanislavGlebik

Differential Revision: D15243112

fbshipit-source-id: 3bfdcefcc823768f2964b4733e570e9cef57cebc
2019-05-21 12:25:40 -07:00
Stanislau Hlebik
f0f09b2d39 mononoke: add deny_unknown_fields
Reviewed By: jsgf

Differential Revision: D15214954

fbshipit-source-id: 35a41329e6276c529c517321e05eda6654a973bd
2019-05-21 12:25:34 -07:00
Jeremy Fitzhardinge
207e6cacaa mononoke/repoconfig: use fs::read to read files
Summary: Use the existing library function to read a file into a `Vec<u8>`.

Reviewed By: aslpavel

Differential Revision: D15051894

fbshipit-source-id: 853b31450556c0a2e74a09fa06e7814ac68b1052
2019-05-21 12:25:33 -07:00
Stanislau Hlebik
9ee9bfad0a mononoke: check whitelists to see if connection is allowed
Differential Revision: D15164726

fbshipit-source-id: b959bfc3e901b40ff068077e09d8537b683e7b51
2019-05-21 12:25:32 -07:00
Stanislau Hlebik
aac6a6c835 mononoke: add security config
Summary:
The config will be used to whitelist connections with certain identities and
blacklist everything else.

Differential Revision: D15150921

fbshipit-source-id: e4090072ea6ba9714575fb8104d9f45e92c6fefb
2019-05-21 12:25:31 -07:00
Jeremy Fitzhardinge
dc7842f569 mononoke: make config parsing stricter
Summary:
Disallow unknown fields. They're generally the result of a mis-editing
a file and putting the config in the wrong place, or some incomplete refactor.

Reviewed By: StanislavGlebik

Differential Revision: D15168963

fbshipit-source-id: a9c9658378cda4866e44daf6e2c6bfbdfcdb9f84
2019-05-21 12:25:30 -07:00
Pavel Aslanov
3b6081a6f5 make it possible to enable bookmark cache from configs
Summary: Now it is possible to configure and enable/disable bookmark cache from configs

Reviewed By: StanislavGlebik

Differential Revision: D14952840

fbshipit-source-id: 3080f7ca4639da00d413a949547705ad480772f7
2019-05-21 12:25:22 -07:00
Thomas Orozco
178931cc02 mononoke: add obsmarkers to pushrebase output
Summary: Added obsmarkers to pushrebase output. This allows the client to hide commits that were rebased server-side, and check out the rebased commit.

Reviewed By: StanislavGlebik

Differential Revision: D14932842

fbshipit-source-id: f215791e86e32e6420e8bd6cd2bc25c251a7dba0
2019-05-21 12:25:17 -07:00
Zeyi (Rice) Fan
6bc1af095d update to Rust 1.34.0
Reviewed By: jsgf

Differential Revision: D14963608

fbshipit-source-id: 550d63cd10c52e8bcbb25137bc29811955da0b20
2019-05-21 12:25:14 -07:00
Jeremy Fitzhardinge
f2d3b57771 mononoke/repoconfig: refactor write_files in tests
Reviewed By: aslpavel

Differential Revision: D14944355

fbshipit-source-id: 210f727928068ab60ef749e62d3d7eb044d7114d
2019-05-21 12:25:13 -07:00
Pavel Aslanov
7ca65d1da3 restrict bookmarks moves onty to allowed set of users
Summary: restrict bookmarks moves onty to allowed set of users

Reviewed By: farnz

Differential Revision: D14934606

fbshipit-source-id: d149824b4d3d6376dde6e855cac214e5fda89fac
2019-05-21 12:25:11 -07:00
Pavel Aslanov
bde4a8319e make it possible to disable casefoldind check for admin tier
Summary: We want to have casefolding configurable for admin tier

Reviewed By: StanislavGlebik

Differential Revision: D14775535

fbshipit-source-id: 103a13b98e9c06053cf0636009c6f1e96c80f741
2019-05-21 12:25:01 -07:00
Pavel Aslanov
905ff80ee6 forbid rebases when root is not a p1 of the rebase set
Summary: We want to forbid pushrebases when root node is a p2 of its parents for now, since mercurial swaps them after pushrebase which causes inconsistency

Reviewed By: StanislavGlebik

Differential Revision: D14642177

fbshipit-source-id: f8f6e9565c53958e8cff5df6f4d006ddfe5a69c0
2019-05-21 12:24:59 -07:00
Jeremy Fitzhardinge
54ca1d89cc mononoke: convert metaconfig_parser to rust 2018
Reviewed By: StanislavGlebik

Differential Revision: D14696277

fbshipit-source-id: 413cc4c842ccc7c4fc1e10383e4b176c9a12977e
2019-05-21 12:24:55 -07:00
Harvey Hunt
5740b94203 mononoke: If write_lock_db_address isn't specified, then default to locked
Summary:
No longer require the write_lock_db_address field in the config
in order to make configs simpler and also prevent creating a mysql connection
on startup for repos that don't need it.

Reviewed By: aslpavel

Differential Revision: D14561984

fbshipit-source-id: 0fd8765b425e008b44d90de25c34a8d487dbfb3e
2019-05-21 12:24:52 -07:00
Harvey Hunt
e915e3a168 mononoke: Add lock reason to RepoReadOnly type
Summary:
As part of the mononoke lock testing, we realised that it would
be helpful to see why a repo is locked. Add the ability to express this
to the RepoReadOnly enum entry.

Reviewed By: aslpavel

Differential Revision: D14544801

fbshipit-source-id: ecae1460f8e6f0a8a31f4e6de3bd99c87fba8944
2019-03-20 13:45:44 -07:00
David Budischek
2098c4a304 Prevent merge commits
Summary: In Mononoke we want to be able to block merge commits on a repo per repo basis.

Reviewed By: aslpavel

Differential Revision: D14455502

fbshipit-source-id: 400e85834c20df811674405bc0c391860cf677dd
2019-03-18 11:20:10 -07:00
Harvey Hunt
3d724de339 mononoke: Allow dynamic repo read_only mode
Summary:
Allow using a database entry to determine if a repository
is in read-only mode.

If a repo is marked read/write in the config then we will communicate with the db.

Reviewed By: ikostia

Differential Revision: D14279170

fbshipit-source-id: 57abd597f939e57f274079011d2fdcc7e7037854
2019-03-18 08:53:53 -07:00
David Budischek
2a93fe345c Block non fastforward bookmark moves
Summary:
This is a hook in mercurial, in Mononoke it will be part of the implementation. By default all non fastforward pushes are blocked, except when using the NON_FAST_FORWARD pushvar (--non-forward-move is also needed to circumvent client side restrictions). Additionally certain bookmarks (e.g. master) shouldn't be able to be moved in a non fastforward manner at all. This can be done by setting block_non_fast_forward field in config.

Pushrebase can only move the bookmark that is actually being pushrebased so we do not need to check whether it is a fastforward move (it always is)

Reviewed By: StanislavGlebik

Differential Revision: D14405696

fbshipit-source-id: 782b49c26a753918418e02c06dcfab76e3394dc1
2019-03-18 04:12:09 -07:00
David Budischek
16bfb3eb45 Remove unnecessary Option in RepoConfig
Summary: There is no need to have an Option<Vec<XYZ>> as None can simply be represented by an empty vector. This makes these fields easier to use.

Reviewed By: StanislavGlebik

Differential Revision: D14405687

fbshipit-source-id: e4c5ba12a1e3c6a18130026af6814d54952da4d2
2019-03-18 04:12:09 -07:00
David Budischek
7b92ba7c25 Remove logging to scribe from blobrepo
Summary: See D14279065, this diff is simply to clean up the deprecated code

Reviewed By: StanislavGlebik

Differential Revision: D14279210

fbshipit-source-id: 10801fb04ad533a80bb7a2f9dcdf3ee5906aa68d
2019-03-12 04:50:45 -07:00
David Budischek
a76d7c1cdd Log pushrebase commits to scribe
Summary:
Currently we are logging new commits from BlobRepo. This will lead to issues once CommitCloud starts using Mononoke as we cannot differentiate between phases at that level. The solution is to log commits when they are pushrebased as this guarantees that they are public commits.

Note: This only introduces the new logic, cleaning up the existing implementation is part of D14279210

Reviewed By: StanislavGlebik

Differential Revision: D14279065

fbshipit-source-id: d714fae7164a8af815fc7716379ff0b7eb4826fb
2019-03-12 04:50:45 -07:00
Lukas Piatkowski
8b3d09d620 hooks: enable configuring hooks for all bookmarks matching a given regex
Reviewed By: StanislavGlebik

Differential Revision: D14047223

fbshipit-source-id: 084b1843c10fedc429b16ab15e3bfc331e88d7ee
2019-02-13 09:07:18 -08:00
David Budischek
79cbf5c245 post-commit send scribe message
Summary: New commits should be logged to scribe, these will be used to trigger the update for the hg clone streamfile.

Reviewed By: lukaspiatkowski

Differential Revision: D14022599

fbshipit-source-id: a8a68f12a8dc1e65663d1ccf1a5eafa54ca2daf0
2019-02-13 07:26:33 -08:00
Kostia Balytskyi
7919782c14 mononoke: add bundle2_replay_params config option
Summary: This is to tell Mononoke whether to preserve bundle2 raw content or not.

Reviewed By: StanislavGlebik

Differential Revision: D14038588

fbshipit-source-id: f1781ed8b4aca7e37925e7f40aeb506af60d071a
2019-02-12 13:03:48 -08:00
Lukas Piatkowski
0e541063c1 hooks: pass configs down to Lua hooks via ctx
Reviewed By: StanislavGlebik

Differential Revision: D13896436

fbshipit-source-id: b610909cc20fdef8b91ccfd5efb7e2faed9c4d23
2019-02-01 05:52:20 -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
0d92dd47fe mononoke: remove unnecessary dependencies from metaconfig
Reviewed By: HarveyHunt

Differential Revision: D13877541

fbshipit-source-id: 334624a32b7d3ae89e49064520472955d1ab670a
2019-01-30 06:31:10 -08:00
Stanislau Hlebik
a055f8e409 mononoke: move open_blobrepo to blobrepo crate and remove TestDelay blobrepo type
Summary:
The main reason to do it is to remove dependency from cmdlib to repo_client.
repo_client depends on a lot of other crates like bundle2-resolver, hooks etc.
And it means that in order to compile mononoke_admin we need to compile these
crates too. By moving open_blobrepo into blobrepo crate we are removing
unnecessary dependencies.

Also let's remove unused blobrepo type

Reviewed By: aslpavel

Differential Revision: D13848878

fbshipit-source-id: cd3d04354649cdb5b2947f08762051318725c781
2019-01-30 06:31:10 -08:00
Lukas Piatkowski
9ff11fa3ef config: add HookConfig to pass configs in hashmap into hooks code
Summary: In this diff the configs are parsed from toml and passed around to hook's execution context. The actual usage of configs will be introduced in separate diff.

Reviewed By: StanislavGlebik

Differential Revision: D13862837

fbshipit-source-id: 60ac10aa9c25d224e703e1e55bef13dc481ba07e
2019-01-30 05:04:22 -08:00
Pavel Aslanov
3a44162690 added: multiplexed blobstore scuba logging
Summary:
- Added scuba logging for put/get operation of `MultiplexedBlobstore`
- Added `blobstore_scuba_table` configuration field

Reviewed By: StanislavGlebik

Differential Revision: D13732064

fbshipit-source-id: 9ac0e31f9e1773321b2a7a4d8d561cce9289944b
2019-01-21 10:04:41 -08:00
Lukas Piatkowski
eba422a209 blobstore healer: minimalistic implementation
Summary:
This version still misses:
- proper production-ready logging
- smarter handling of case where the queue entries related to each other do not fit in the limit or `older_than` limit, so the healer will heal much more entries without realizing it shouldn't do so.

Reviewed By: aslpavel

Differential Revision: D13528686

fbshipit-source-id: 0245becea7e4f0ac69383a7885ff3746d81c4add
2019-01-15 10:41:07 -08:00
Lukas Piatkowski
b9ecb39676 sqlblob: add support for MyRouter
Reviewed By: StanislavGlebik

Differential Revision: D13465323

fbshipit-source-id: a9d6b7626617fcd85d91b4118b22ad9a7db3aa32
2019-01-15 09:38:26 -08:00
Lukas Piatkowski
e785b92bf0 mononoke sql: use from_value_opt instead of parsing numbers from sql manually
Summary: the from_value_opt already knows how to properly parse an integer from sql response, no need to reinvent the wheel and introduce bugs

Reviewed By: aslpavel

Differential Revision: D13651328

fbshipit-source-id: 55af810c99b93bd2f9c67c721a9d0be6034ee466
2019-01-15 07:16:13 -08:00
Lukas Piatkowski
b36dd037ad sqlblob: initial implementation of the sql based blobstore
Summary: MyRouter and cache support will come in next diffs

Reviewed By: StanislavGlebik

Differential Revision: D13465146

fbshipit-source-id: 0ede0e875d4a49794ff71173bd0d1563abb3ff08
2019-01-15 07:05:33 -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
Stanislau Hlebik
d460da7ad2 mononoke: remove unused options
Summary: These config options weren't used at all. Let's delete them from the configs

Reviewed By: aslpavel

Differential Revision: D13597545

fbshipit-source-id: 5e99b38e2e9fc4ba6d836322ceba38a8b65ad2f4
2019-01-09 01:14:57 -08:00
Johan Schuijt-Li
55fa57dbdf Disable AclChecker for integration tests
Summary:
Currently some tests are failing intermittently due to a timeout, this timeout
is caused by the integration tests making an external call to AclChecker which
is intermittently very slow.

For our integration tests we disable this call since it's not part of the test
suite to stop our tests from being flaky.

Reviewed By: StanislavGlebik

Differential Revision: D13580144

fbshipit-source-id: 0c26bb14dd222b888ca2638319071f4d99eab6df
2019-01-04 06:19:23 -08:00
Pavel Aslanov
eb75d48a95 correctly handle configurations with multiple blobstores
Summary: Correctly handle repository with multiple blobstores

Reviewed By: StanislavGlebik

Differential Revision: D13434206

fbshipit-source-id: f4ab70ec037deba150ed5c1ee8e53d23317b8e09
2018-12-18 06:55:56 -08:00
Pavel Aslanov
043b374bf1 make BlobstoreId configurable from repoconfig
Summary: Make `BlobstoreId` configurable from repoconfig

Reviewed By: StanislavGlebik

Differential Revision: D13376824

fbshipit-source-id: 45e1b45fb0fcba6de91374e3621c7bbb1b465544
2018-12-18 06:55:56 -08:00
Lukas Piatkowski
4e5acf2f50 mononoke config: make fbsource readonly, disables unbundle requests
Reviewed By: StanislavGlebik

Differential Revision: D13357886

fbshipit-source-id: ff5bd79d5418bdcb51ea7a91e0d294fd53dcb96e
2018-12-06 05:42:36 -08:00
Stanislau Hlebik
706e98799b mononoke: support many blobstores in metaconfig
Summary: Restructure the configs so that we can specify more than one blobstore

Reviewed By: lukaspiatkowski

Differential Revision: D13234286

fbshipit-source-id: a98ede17921ed6148add570288ac23636b086398
2018-12-05 05:58:07 -08:00
Stanislau Hlebik
a51cb1dacf mononoke: rename TestBlobManifold to BlobRemote
Reviewed By: aslpavel

Differential Revision: D13319437

fbshipit-source-id: 7f5eccde3698b2c4fdcf9f0cb5843a2965ab11a3
2018-12-05 05:58:07 -08:00
Stanislau Hlebik
04fb5f514b mononoke: reverse dependencies between BlobRepo and metaconfig
Summary:
Previously metaconfig depended on BlobRepo, and so ManifoldArgs had to be
definided in BlobRepo. That was an weird dependency, but a necessary one
because of Mononoke config repo. In the previous diffs we got rid of the
Mononoke config repo, so now we can reverse the dependencies.

Reviewed By: lukaspiatkowski

Differential Revision: D13180160

fbshipit-source-id: efe713ce3b160c98d56fc13559c57a920146841f
2018-12-04 03:52:26 -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