Commit Graph

19 Commits

Author SHA1 Message Date
Stanislau Hlebik
44ce21f2b4 mononoke: add stats
Summary: It can be useful to understand how often do we hit a db, write to blobstore, etc

Reviewed By: farnz

Differential Revision: D7806954

fbshipit-source-id: 9c85cbb11e184ae9f7751e05e961980b29b7568a
2018-05-01 06:07:53 -07:00
Stanislau Hlebik
4a731b2118 mononoke: do not fail if duplicate changeset was inserted
Summary:
Let's fail only if inconsistent data was inserted - for example, same commit
hash but different parents.
This matches core hg behavior, and also it's completely normal for commit cloud
to send more parent commits than necessary.

Reviewed By: lukaspiatkowski

Differential Revision: D7722649

fbshipit-source-id: 172a0985fb3fda27d55e9dce8916ec3793de5db9
2018-04-24 08:49:48 -07:00
Stanislau Hlebik
ca656e46cd mononoke: use asynchronize in Changesets
Summary:
This is a nice little improvement, that makes code readable.
`asynchronize()` does all the job of executing the job on the thread pool.

Reviewed By: lukaspiatkowski

Differential Revision: D7722648

fbshipit-source-id: 6d87178c11fa56ea9738738357fb3c3af012c81a
2018-04-24 08:49:48 -07:00
Stanislau Hlebik
3f600af142 mononoke: add Changesets cache
Summary:
Use asyncmemo to cache Changesets.

Unfortunately currently we are using separate asyncmemo cache, so we have to
specify the size for the caches separately. Later we'll have a single cache for
everything, and the number of config knobs will go down.

Reviewed By: lukaspiatkowski

Differential Revision: D7685376

fbshipit-source-id: efe8a3a95fcc72fab4f4af93564e706cd1540c2f
2018-04-22 04:59:27 -07:00
Jeremy Fitzhardinge
2e7a6fd668 tp2: update to rust-1.25.0
Summary:
Update x86 and aarch64 toolchains, rust-crates-io update.
The `use_nested_groups` feature is now stable, so we don't need to list it in
`#![feature(...)]` lines.

Reviewed By: kulshrax

Differential Revision: D7690730

fbshipit-source-id: 5f74bb01df6bd88a66ac00a82e446c18e3a1c43d
2018-04-21 22:45:55 -07:00
Lukas Piatkowski
f6c3f72745 CODEMOD: rename mercurial_types::HgChangesetId to DChangesetId
Summary: mercurial_types::DChangesetId should be replaced by types from mononoke_types in most cases and by mercurial::HgChangesetId in others. This rename should help with tracking this

Reviewed By: sid0

Differential Revision: D7618897

fbshipit-source-id: 78904f57376606be99b56662164e0c110e632c64
2018-04-16 03:40:24 -07:00
Stanislau Hlebik
2aa2d10263 mononoke: update changesets table
Summary:
We don't need parent_id in the index, because we'll search only using cs_id and
seq

Reviewed By: jsgf

Differential Revision: D7487275

fbshipit-source-id: 93ceb238b7d5f42e5d37c1a85eadb8e7aab5c1f4
2018-04-04 01:27:34 -07:00
Stanislau Hlebik
069200aaaa mononoke: use BIGINT for mysql changesets id
Summary: There can be a lot of changesets - let's not limit ourselves to 2B

Reviewed By: farnz

Differential Revision: D7429645

fbshipit-source-id: 9501214f6f10b87b8a37cb5b9503a9d231e241be
2018-03-28 13:54:01 -07:00
Jeremy Fitzhardinge
5c616f4ff6 mononoke: fix changesets unit tests
Summary:
They would hang on any failure rather than reporting properly.
Convert to using async_unit::tokio_unit_test() to make sure unwinds are caught.

Reviewed By: StanislavGlebik

Differential Revision: D7408174

fbshipit-source-id: 39b41bd66557e0d455f87ad29a2df73768cfb9c6
2018-03-27 17:39:52 -07:00
Jeremy Fitzhardinge
3373c16b62 scm/mononoke: run changeset operations in worker threads
Summary:
Run changeset db operations in worker threads to make them async as
far as the rest of the system is concerned.

Reviewed By: farnz

Differential Revision: D7350002

fbshipit-source-id: 66fadf9ad2f16929e0c07a6907aa9d5f5a7075a8
2018-03-23 13:47:55 -07:00
Jeremy Fitzhardinge
d6504de44c scm/mononoke: make Changesets::add take ChangesetInsert by value
Summary:
There's no point passing it by reference since callers don't need to
retain it, and the async implementation needs to move it into another context.

Reviewed By: farnz

Differential Revision: D7350001

fbshipit-source-id: 5947557a84621afae801dc20e3994496244e3a10
2018-03-23 13:47:54 -07:00
Jeremy Fitzhardinge
dabdef6e7e mononoke/changesets: use pooled connections for mysql
Summary:
Use connection pooling for mysql. We can't use it for sqlite because each
"connection" ends up being to a separate db.

Reviewed By: sid0

Differential Revision: D7350000

fbshipit-source-id: 37be71b863810c48ae69da579cf74358058f7d2f
2018-03-23 13:47:54 -07:00
Simon Farnsworth
e108e9b258 Make it possible to create tables if missing in SQLite changesets
Summary:
For testing, I want to be able to persist state in SQLite (so that
when we have in-process caching, I can restart and see cold cache behaviour).
This means that I want to open a database, and create the tables ignoring
failures. Make it possible

Reviewed By: StanislavGlebik

Differential Revision: D7353231

fbshipit-source-id: 0d0926c501e7951dfaf82998ed58d152e80ace7e
2018-03-23 13:09:13 -07:00
Lukas Piatkowski
5ba5c0b0e0 mercurial_types: distinguish between HgManifestId and HgChangesetId in sql types
Summary: the diesel schemas should prevent from reading a manifest hash as changeset and vice versa

Reviewed By: StanislavGlebik

Differential Revision: D7339725

fbshipit-source-id: c619ab7ecabfd10f42e64a38c0f16abd114d4a31
2018-03-21 05:14:37 -07:00
Stanislau Hlebik
f023874ed9 mononoke: remove unused parameter
Reviewed By: farnz

Differential Revision: D7324591

fbshipit-source-id: 53b16d0a44fea0011a15634939b3f385658288e4
2018-03-19 15:36:01 -07:00
Siddharth Agarwal
b338897dc4 prefix ChangesetId, ManifestId and BlobHash with Hg
Summary:
Mononoke will introduce its own ChangesetId, ManifestId and BlobHash, and it
would be good to rename these before that lands.

Reviewed By: farnz

Differential Revision: D7293334

fbshipit-source-id: 7d9d5ddf1f1f45ad45f04194e4811b0f6decb3b0
2018-03-15 17:45:29 -07:00
Arun Kulshreshtha
9f091474bb Fill in missing code in MysqlChangesets
Summary: Add in the missing code to establish a MySQL connection to the `changesets` crate. Also add unit tests for `MysqlChangesets`.

Reviewed By: jsgf

Differential Revision: D7174371

fbshipit-source-id: b531c5d5efb95eeb5e39188c4d608540f0c0261f
2018-03-06 17:07:46 -08:00
Enji Cooper
21de6e7785 Fix typos ("and and" -> "and")
Reviewed By: yfeldblum

Differential Revision: D7091797

fbshipit-source-id: cbba7e5c17e1b6d4446570fb7a2b888db8bcd17e
2018-02-27 16:36:59 -08:00
Siddharth Agarwal
1e5ddafbd4 initial complete table backend using diesel
Summary:
Diesel looks quite promising overall, as long as we can ensure async operations
work.

Some basic notes:

* This just looks async but isn't really -- doing that would need a way to send
queries over to a thread pool. (cc kulshrax)
* It is unfortunate that we must use a macro for the exact same `add` code across
MySQL and SQLite. There doesn't appear to be a way out though -- there is no
trait bound that we can apply to the `add` method here.

This is currently pretend-async -- it would be good to make this really async, but that should wait for a future diff IMO

Reviewed By: StanislavGlebik

Differential Revision: D6932028

fbshipit-source-id: ac1cfde3b96bb790f00b73d49c6d90ed128f0255
2018-02-22 17:08:59 -08:00