Commit Graph

7 Commits

Author SHA1 Message Date
Mark Juggurnauth-Thomas
a5f7cccc38 benchmark: remove dependency on blobrepo_factory
Summary:
Remove the dependency on blobrepo factory by defining a custom facet factory
for benchmark repositories.

Reviewed By: krallin

Differential Revision: D27400618

fbshipit-source-id: 626e19f09914545fb72053d91635635b2bfb6e51
2021-04-07 14:01:48 -07:00
Mark Juggurnauth-Thomas
3b9817b5d8 benchmark_storage_config: remove dependency on blobrepo_factory
Summary: Use the equivalent function from `repo_factory`.

Reviewed By: krallin

Differential Revision: D27363470

fbshipit-source-id: dce3cf843174caa2f9ef7083409e7935749be4cd
2021-04-07 14:01:47 -07:00
Mark Juggurnauth-Thomas
f902acfcd1 repo_factory: add main repo factory
Summary:
Add a factory for building development and production repositories.

This factory can be re-used to build many repositories, and they will share
metadata database factories and blobstores if their configs match.

Similarly, the factory will only load redacted blobs once per metadata
database config, rather than once per repo.

Reviewed By: krallin

Differential Revision: D27323369

fbshipit-source-id: 951f7343af97f5e507b76fb822ad2e66f4d8f3bd
2021-04-07 14:01:46 -07:00
Mark Juggurnauth-Thomas
69896e90b5 bonsai_hg_mapping: construct rendezvous connections in a blocking closure
Summary:
`RendezVousConnection::new` can block for some time doing work on the CPU,
specifically creating the stats objects.  This causes problems for other
futures during repo construction.

Instead, move rendez-vous construction to a `spawn_blocking` closure, so that
it doesn't interfere with the other futures.

Since `SqlBonsaiHgMapping::from_sql_connections` is not async, and is part of
the SqlConstruct trait, we must convert this to the builder pattern so that we
can defer rendez-vous construction to later on.

Reviewed By: farnz

Differential Revision: D27501915

fbshipit-source-id: 9c58c32411301128424985deeab127d052c43532
2021-04-01 08:27:15 -07:00
Mark Juggurnauth-Thomas
69ab7c1540 derived_data: remove dangerous_override in tests
Summary:
Remove uses of dangerous_override from derived data tests.

These were being used to override the derived data config or the lease object.
Extend the factory to allow customization of the config or the lease object,
and use that instead.

Reviewed By: StanislavGlebik

Differential Revision: D27169438

fbshipit-source-id: e8d0be248391d02bb054e19fdb9a90005db09c84
2021-03-25 10:46:07 -07:00
Mark Juggurnauth-Thomas
78fb5b120f commit_rewriting: remove dangerous_override
Summary:
Remove uses of dangerous_override in the commit rewriting tests.

Previously, the test was using dangerous_override to replace the bookmarks
attributes with ones that share a backing database with a `SqlMutableCounters`
instance.

With TestRepoFactory, all attributes share one metadata database.  Obtain that
from the factory and use it to initialize the `SqlMutableCounters` instance.

Reviewed By: StanislavGlebik

Differential Revision: D27169429

fbshipit-source-id: 3c1b285db38a96deca7029d37e6692cb49356d31
2021-03-25 10:46:07 -07:00
Mark Juggurnauth-Thomas
cc30bf6552 test_repo_factory: add factory for test repos
Summary:
Create a factory that can be used to build repositories in tests.

The test repo factory will be kept in a separate crate to the production repo factory, so that it can depend on a smaller set of dependencies: just those needed for in-memory test repos.  This should eventually help make compilation speeds faster for tests.

A notable difference between the test repos produced by this factory and the ones produced by `blobrepo_factory` is that the new repos share the in-memory metadata database.  This is closer to what we use in production, and in a couple of places it is relied upon and existing tests must use `dangerous_override` to make it happen.

Reviewed By: ahornby

Differential Revision: D27169441

fbshipit-source-id: 82541a2ae71746f5e3b1a2a8a19c46bf29dd261c
2021-03-25 07:34:49 -07:00