Commit Graph

33 Commits

Author SHA1 Message Date
Alex Auvolat
8d5505514f
Make it explicit when using nonversioned encoding 2023-01-03 15:27:36 +01:00
Alex Auvolat
426d8784da
cleanup 2023-01-03 15:08:37 +01:00
Alex Auvolat
dfc131850a
Simplified and more aggressive worker exit logic 2022-12-14 15:25:29 +01:00
Alex Auvolat
2183518edc
Spawn all background workers in a separate step 2022-12-14 12:28:07 +01:00
Alex Auvolat
83c8467e23
Proper queueing for delayed inserts, now backed to disk 2022-12-14 11:58:06 +01:00
Alex Auvolat
d6040e32a6
cli: prettier table in garage stats 2022-12-13 15:43:22 +01:00
Alex Auvolat
de9d6cddf7
Prettier worker list table; remove useless CLI log messages 2022-12-12 17:17:05 +01:00
Alex
4f38cadf6e Background task manager (#332)
- [x] New background worker trait
- [x] Adapt all current workers to use new API
- [x] Command to list currently running workers, and whether they are active, idle, or dead
- [x] Error reporting
- Optimizations
  - [x] Merkle updater: several items per iteration
  - [ ] Use `tokio::task::spawn_blocking` where appropriate so that CPU-intensive tasks don't block other things going on
- scrub:
  - [x] have only one worker with a channel to start/pause/cancel
  - [x] automatic scrub
  - [x] ability to view and change tranquility from CLI
  - [x] persistence of a few info
- [ ] Testing

Co-authored-by: Alex Auvolat <alex@adnab.me>
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/332
Co-authored-by: Alex <alex@adnab.me>
Co-committed-by: Alex <alex@adnab.me>
2022-07-08 13:30:26 +02:00
Alex
b44d3fc796 Abstract database behind generic interface and implement alternative drivers (#322)
- [x] Design interface
- [x] Implement Sled backend
  - [x] Re-implement the SledCountedTree hack ~~on Sled backend~~ on all backends (i.e. over the abstraction)
- [x] Convert Garage code to use generic interface
- [x] Proof-read converted Garage code
- [ ] Test everything well
- [x] Implement sqlite backend
- [x] Implement LMDB backend
- [ ] (Implement Persy backend?)
- [ ] (Implement other backends? (like RocksDB, ...))
- [x] Implement backend choice in config file and garage server module
- [x] Add CLI for converting between DB formats
- Exploit the new interface to put more things in transactions
  - [x] `.updated()` trigger on Garage tables

Fix #284

**Bugs**

- [x] When exporting sqlite, trees iterate empty??
- [x] LMDB doesn't work

**Known issues for various back-ends**

- Sled:
  - Eats all my RAM and also all my disk space
  - `.len()` has to traverse the whole table
  - Is actually quite slow on some operations
  - And is actually pretty bad code...
- Sqlite:
  - Requires a lock to be taken on all operations. The lock is also taken when iterating on a table with `.iter()`, and the lock isn't released until the iterator is dropped. This means that we must be VERY carefull to not do anything else inside a `.iter()` loop or else we will have a deadlock! Most such cases have been eliminated from the Garage codebase, but there might still be some that remain. If your Garage-over-Sqlite seems to hang/freeze, this is the reason.
  - (adapter uses a bunch of unsafe code)
- Heed (LMDB):
  - Not suited for 32-bit machines as it has to map the whole DB in memory.
  - (adpater uses a tiny bit of unsafe code)

**My recommendation:** avoid 32-bit machines and use LMDB as much as possible.

**Converting databases** is actually quite easy. For example from Sled to LMDB:

```bash
cd src/db
cargo run --features cli --bin convert -- -i path/to/garage/meta/db -a sled -o path/to/garage/meta/db.lmdb -b lmdb
```

Then, just add this to your `config.toml`:

```toml
db_engine = "lmdb"
```

Co-authored-by: Alex Auvolat <alex@adnab.me>
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/322
Co-authored-by: Alex <alex@adnab.me>
Co-committed-by: Alex <alex@adnab.me>
2022-06-08 10:01:44 +02:00
Alex Auvolat
8c2fb0c066
Add tracing integration with opentelemetry 2022-03-14 10:52:13 +01:00
Alex Auvolat
8f6026de5e
Make table name a const in trait 2021-12-15 15:39:10 +01:00
Alex Auvolat
ada7899b24
Fix clippy lints (fix #121) 2021-10-26 10:20:05 +02:00
Trinity Pointard
f5a0cf0414
fix clippy warnings on table 2021-05-03 22:11:41 +02:00
Alex Auvolat
9ced9f78dc
Improve bootstraping: do it regularly; persist peer list 2021-04-27 16:37:08 +02:00
Alex Auvolat
390ab02f41 Todo make a test for the Merkle updater 2021-03-16 20:13:07 +01:00
Alex Auvolat
f4346cc5f4 Update dependencies 2021-03-16 15:58:40 +01:00
Alex Auvolat
2a41b82384 Simpler Merkle & sync 2021-03-16 12:18:03 +01:00
Alex Auvolat
0aad2f2e06 some reordering 2021-03-16 11:47:39 +01:00
Alex Auvolat
515029d026 Refactor code 2021-03-16 11:43:58 +01:00
Alex Auvolat
6a8439fd13 Some improvements in background worker but we terminate late 2021-03-15 23:14:12 +01:00
Alex Auvolat
0cd5b2ae19 WIP migrate to tokio 1 2021-03-15 22:36:41 +01:00
Alex Auvolat
4d4117f2b4 Refactor block resync loop; make workers infaillible 2021-03-15 20:09:44 +01:00
Alex Auvolat
667e4e72a8 Small fixes 2021-03-15 19:51:16 +01:00
Alex Auvolat
537f652fec Tiny things 2021-03-15 18:40:27 +01:00
Alex Auvolat
0290afe1f8 Make block rc code more understandable 2021-03-15 18:27:26 +01:00
Alex Auvolat
c475471e7a Implement table gc, currently for block_ref and version only 2021-03-12 19:57:37 +01:00
Alex Auvolat
a1442f072a Implement garage stats to get info on node contents 2021-03-12 15:40:54 +01:00
Alex Auvolat
8860aa19b8 Make syncer have its own rpc client/server 2021-03-12 15:05:26 +01:00
Alex Auvolat
7fdaf7aef0 Fix merkle updater not being notified; improved logging 2021-03-12 14:37:46 +01:00
Alex Auvolat
1ec49980ec whoops 2021-03-11 19:30:24 +01:00
Alex Auvolat
046b649bcc (not well tested) use merkle tree for sync 2021-03-11 18:28:27 +01:00
Alex Auvolat
94f3d28774 WIP big refactoring 2021-03-11 16:54:15 +01:00
Alex Auvolat
8d63738cb0 Checkpoint: add merkle tree in data table 2021-03-11 13:47:21 +01:00