Commit Graph

18 Commits

Author SHA1 Message Date
Simon Farnsworth
0c3fe9b20f Fully asyncify blobstore sync queue
Summary: Move it from `'static` BoxFutures to async_trait and lifetimes

Reviewed By: markbt

Differential Revision: D22927171

fbshipit-source-id: 637a983fa6fa91d4cd1e73d822340cb08647c57d
2020-08-05 15:41:15 -07:00
Simon Farnsworth
33c2a0c846 Update auto_impl to 0.4
Summary: We were using a git snapshot of auto_impl from somewhere between 0.3 and 0.4; 0.4 fixes a bug around Self: 'lifetime constraints on methods that blocks work I'm doing in Mononoke, so update.

Reviewed By: dtolnay

Differential Revision: D22922790

fbshipit-source-id: 7bb68589a1d187393e7de52635096acaf6e48b7e
2020-08-04 18:12:45 -07:00
Simon Farnsworth
9287bfca2c Move blobstore healer tests to their own file
Summary: I'm about to asyncify the healer - move 2/3rds of the file content (tests) into their own file.

Reviewed By: ikostia

Differential Revision: D22460166

fbshipit-source-id: 18c0dde5f582c4c7006e3f023816ac457d38234b
2020-07-11 05:41:36 -07:00
Simon Farnsworth
78847ff88c Make BlobstoreSyncQueue use new futures
Summary: Stage 1 of a migration - next step is to make all users of this trait use new futures, and then I can come back, add lifetimes and references, and leave it modernised

Reviewed By: StanislavGlebik

Differential Revision: D22460164

fbshipit-source-id: 94591183912c0b006b7bcd7388a3d7c296e60577
2020-07-10 06:43:13 -07:00
Kostia Balytskyi
f210326656 blobstore_healer: log the speed with which queue rows are deleted
Summary: This allowed me to compare two alternative approaches to queue draining, and generally seems like a useful thing to do.

Reviewed By: krallin

Differential Revision: D22364733

fbshipit-source-id: b6c76295c85b4dec6f0bfd7107c30bb4e4a28942
2020-07-03 05:09:56 -07:00
Alex Hornby
0c1ccb601a mononoke: blobstore_sync_queue: switch to insert rather than insert ignore
Summary: Now that the blobstore_sync_queue has no unique key we do not expect duplicate key errors,  and would like to know of any other problems occuring on insert.

Reviewed By: StanislavGlebik

Differential Revision: D21618062

fbshipit-source-id: 85991184234a807553388b456ad76971104000a3
2020-06-10 19:29:41 -07:00
Stefan Filip
60966c93e7 autocargo: regenerate
Summary: maintenance

Reviewed By: StanislavGlebik

Differential Revision: D21640322

fbshipit-source-id: d0b2ce604735c05d540d06835c8e4c8a940fbf5c
2020-05-19 16:08:40 -07:00
Simon Farnsworth
92fce3d518 Clean out unused deps from our TARGETS files
Summary:
We had accumulated lots of unused dependendencies, and had several test_deps in deps instead. Clean this all up to reduce build times and speed up autocargo processing.

Net removal is of around 500 unneeded dependency lines, which represented false dependencies; by removing them, we should get more parallelism in dev builds, and less overbuilding in CI.

Reviewed By: krallin, StanislavGlebik

Differential Revision: D20999762

fbshipit-source-id: 4db3772cbc3fb2af09a16601bc075ae8ed6f0c75
2020-04-14 03:38:11 -07:00
Mateusz Kwapich
4163e2937f use operation keys for selects
Summary:
This way we'll never select more than (no_of_stores * limit) rather than
potentially unbounded output.

NOTE: This diff has to be landed and rolled out **after** D20557702 is rolled out. I'm assuming that after some time since D20557702 rollout  all the rows in the production db will have proper `operation_key` value set so we can make queries based on them.

Reviewed By: krallin

Differential Revision: D20557700

fbshipit-source-id: 5a1d4b69949b425915214f5227c5c0dcce374360
2020-04-06 09:57:24 -07:00
Mateusz Kwapich
975ddc043f test showing the problem with repeating blob_keys
Summary:
When we have more entries with a single blobkey we always select all of them
regardles when and how they were added. That's why we need to select basing on
operation_key.

Reviewed By: krallin

Differential Revision: D20557699

fbshipit-source-id: 77ccf992bb24d1a46ea28a13ab0780e6c92935ae
2020-04-06 09:57:24 -07:00
Mark Thomas
640f272598 migrate from sql_ext::SqlConstructors to sql_construct
Summary:
Migrate the configuration of sql data managers from the old configuration using `sql_ext::SqlConstructors` to the new configuration using `sql_construct::SqlConstruct`.

In the old configuration, sharded filenodes were included in the configuration of remote databases, even when that made no sense:
```
[storage.db.remote]
db_address = "main_database"
sharded_filenodes = { shard_map = "sharded_database", shard_num = 100 }

[storage.blobstore.multiplexed]
queue_db = { remote = {
    db_address = "queue_database",
    sharded_filenodes = { shard_map = "valid_config_but_meaningless", shard_num = 100 }
}
```

This change separates out:
* **DatabaseConfig**, which describes a single local or remote connection to a database, used in configuration like the queue database.
* **MetadataDatabaseConfig**, which describes the multiple databases used for repo metadata.

**MetadataDatabaseConfig** is either:
* **Local**, which is a local sqlite database, the same as for **DatabaseConfig**; or
* **Remote**, which contains:
    * `primary`, the database used for main metadata.
    * `filenodes`, the database used for filenodes, which may be sharded or unsharded.

More fields can be added to **RemoteMetadataDatabaseConfig** when we want to add new databases.

New configuration looks like:
```
[storage.metadata.remote]
primary = { db_address = "main_database" }
filenodes = { sharded = { shard_map = "sharded_database", shard_num = 100 } }

[storage.blobstore.multiplexed]
queue_db = { remote = { db_address = "queue_database" } }
```

The `sql_construct` crate facilitates this by providing the following traits:

* **SqlConstruct** defines the basic rules for construction, and allows construction based on a local sqlite database.
* **SqlShardedConstruct** defines the basic rules for construction based on sharded databases.
* **FbSqlConstruct** and **FbShardedSqlConstruct** allow construction based on unsharded and sharded remote databases on Facebook infra.
* **SqlConstructFromDatabaseConfig** allows construction based on the database defined in **DatabaseConfig**.
* **SqlConstructFromMetadataDatabaseConfig** allows construction based on the appropriate database defined in **MetadataDatabaseConfig**.
* **SqlShardableConstructFromMetadataDatabaseConfig** allows construction based on the appropriate shardable databases defined in **MetadataDatabaseConfig**.

Sql database managers should implement:

* **SqlConstruct** in order to define how to construct an unsharded instance from a single set of `SqlConnections`.
* **SqlShardedConstruct**, if they are shardable, in order to define how to construct a sharded instance.
* If the database is part of the repository metadata database config, either of:
    * **SqlConstructFromMetadataDatabaseConfig** if they are not shardable.  By default they will use the primary metadata database, but this can be overridden by implementing `remote_database_config`.
    * **SqlShardableConstructFromMetadataDatabaseConfig** if they are shardable.  They must implement `remote_database_config` to specify where to get the sharded or unsharded configuration from.

Reviewed By: StanislavGlebik

Differential Revision: D20734883

fbshipit-source-id: bb2f4cb3806edad2bbd54a47558a164e3190c5d1
2020-04-02 05:27:16 -07:00
Lukas Piatkowski
3bc2ea3d8f mononoke/blobstore: make multiplexed blobstore OSS buildable
Reviewed By: mitrandir77

Differential Revision: D20279770

fbshipit-source-id: b8b8e5dbffe8e5da133da5ede916e277dbfea35f
2020-03-27 11:40:12 -07:00
Mateusz Kwapich
3d314761c3 introduce OperationKey
Summary:
From time to time we're experiencing the blobstore healer to crash
because its SQL queries timing out. The rootcause of the problem
is that the same blob_key may show up on the queue many times repeatedly
and the query is trying to select all occurences.

But, the original intention of blobstore healer is to act on a single
put operation across all blobstores. To be able to identify which
puts in the healer queue are part of the same operation we need
some unique id that we'll use per such operation, let's call it OperationKey.

corresponding configerator change to create db column: D20557659

NOTE: This diff has to be landed and rolled out first, before D20557700 is rolled out. I'm assuming that after some time since rolling out this diff all the rows in the production db will have proper `operation_key` value set.

Reviewed By: krallin

Differential Revision: D20557702

fbshipit-source-id: 404d9fdea6796b38193292d1bbd4b8cd4b5b3eb8
2020-03-24 10:07:31 -07:00
Thomas Orozco
6da3dc939a mononoke/blobstore_sync_queue: delete in smaller batches
Summary:
Our blobstore_sync_queue selects entries with a limit on the number of unique
keys it's going to load. Then, it tries to delete them. However, the number of
entries might be (much) bigger than the number of keys. When we try to delete
them, we time out waiting for MySQL because deleting 100K entries at once isn't
OK.

This results in crashlooping in the healer, where we start, delete 100K
entries, then time out.

This is actually double bad, because when we come back up we just go wihhout
checking replication lag first, so if we're crashlooping, we disregard the
damage we're doing in MySQL (I'm fixing this later in this stack).

So, let's be a bit more disciplined, and delete keys 10K at a time, at most.

Reviewed By: HarveyHunt

Differential Revision: D19997588

fbshipit-source-id: 2262f9ba3f7d3493d0845796ad8f841855510180
2020-02-20 12:26:50 -08:00
Lukasz Piatkowski
542d1f93d3 Manual synchronization of fbcode/eden and facebookexperimental/eden
Summary:
This commit manually synchronizes the internal move of
fbcode/scm/mononoke under fbcode/eden/mononoke which couldn't be
performed by ShipIt automatically.

Reviewed By: StanislavGlebik

Differential Revision: D19722832

fbshipit-source-id: 52fbc8bc42a8940b39872dfb8b00ce9c0f6b0800
2020-02-11 11:42:43 +01:00
Harvey Hunt
3d6d9754b5 mononoke: Add original_timestamp column to blobstore_sync_queue sqlite schema
Summary:
D19767626 added an original_timestamp column to the
blobstore_sync_queue. Update the sqlite schema to keep it in sync.

Reviewed By: krallin

Differential Revision: D19787488

fbshipit-source-id: ad576e2ec99349953e2ab69e3defb73d1ff556c0
2020-02-10 04:37:40 -08:00
Harvey Hunt
78c44c5ec2 mononoke: Populate multiplex_id when writing blobs and update the healer to read them
Summary:
Modify the multiplexed blobstore implementation so that the
multiplex_id is written to the healer queue after a put. Further, update the
blobstore healer to only look at entries with the same multiplex ID as it's
configured to run with.

Reviewed By: ahornby

Differential Revision: D19770057

fbshipit-source-id: 41db19f0b0f84c048d49ab9e6258cccc89cf4195
2020-02-10 04:37:40 -08:00
Lukasz Piatkowski
e8d62b64d5 mononoke: move the codebase under eden/ directory
fbshipit-source-id: 43a0252cb3ec42aa365f20d1b6faa4d24d74c9b8
2020-02-06 13:46:04 +01:00