Commit Graph

37 Commits

Author SHA1 Message Date
Alex 05c92204ec
[rm-sled] Remove counted_tree_hack
ci/woodpecker/push/debug Pipeline was successful Details
ci/woodpecker/pr/debug Pipeline was successful Details
2024-03-08 15:09:57 +01:00
Alex 44454aac01
[rm-sled] Remove the Sled database engine
ci/woodpecker/pr/debug Pipeline was successful Details
ci/woodpecker/push/debug Pipeline was successful Details
2024-03-08 14:11:02 +01:00
Alex 12d1dbfc6b
remove Ring and use ClusterLayout everywhere
continuous-integration/drone/pr Build is failing Details
continuous-integration/drone/push Build is failing Details
2023-11-08 15:41:24 +01:00
Alex f97168f805 garage_db: refactor transactions and add on_commit mechanism 2023-09-21 15:35:31 +02:00
Alex 8d5505514f
Make it explicit when using nonversioned encoding
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
2023-01-03 15:27:36 +01:00
Alex 426d8784da
cleanup
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2023-01-03 15:08:37 +01:00
Alex dfc131850a
Simplified and more aggressive worker exit logic
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2022-12-14 15:25:29 +01:00
Alex 2183518edc
Spawn all background workers in a separate step 2022-12-14 12:28:07 +01:00
Alex 83c8467e23
Proper queueing for delayed inserts, now backed to disk
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/pr Build is failing Details
2022-12-14 11:58:06 +01:00
Alex d6040e32a6
cli: prettier table in garage stats
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build was killed Details
2022-12-13 15:43:22 +01:00
Alex de9d6cddf7
Prettier worker list table; remove useless CLI log messages
continuous-integration/drone/push Build is passing Details
2022-12-12 17:17:05 +01:00
Alex 4f38cadf6e Background task manager (#332)
continuous-integration/drone/push Build is passing Details
- [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: #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)
continuous-integration/drone/push Build is passing Details
- [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: #322
Co-authored-by: Alex <alex@adnab.me>
Co-committed-by: Alex <alex@adnab.me>
2022-06-08 10:01:44 +02:00
Alex 8c2fb0c066
Add tracing integration with opentelemetry 2022-03-14 10:52:13 +01:00
Alex 8f6026de5e
Make table name a const in trait 2021-12-15 15:39:10 +01:00
Alex ada7899b24
Fix clippy lints (fix #121)
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
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 9ced9f78dc
Improve bootstraping: do it regularly; persist peer list 2021-04-27 16:37:08 +02:00
Alex 390ab02f41 Todo make a test for the Merkle updater
continuous-integration/drone/push Build is passing Details
2021-03-16 20:13:07 +01:00
Alex f4346cc5f4 Update dependencies
continuous-integration/drone/push Build is passing Details
2021-03-16 15:58:40 +01:00
Alex 2a41b82384 Simpler Merkle & sync
continuous-integration/drone/push Build is passing Details
2021-03-16 12:18:03 +01:00
Alex 0aad2f2e06 some reordering
continuous-integration/drone/push Build is passing Details
2021-03-16 11:47:39 +01:00
Alex 515029d026 Refactor code
continuous-integration/drone/push Build was killed Details
2021-03-16 11:43:58 +01:00
Alex 6a8439fd13 Some improvements in background worker but we terminate late
continuous-integration/drone/push Build is passing Details
2021-03-15 23:14:12 +01:00
Alex 0cd5b2ae19 WIP migrate to tokio 1
continuous-integration/drone/push Build is passing Details
2021-03-15 22:36:41 +01:00
Alex 4d4117f2b4 Refactor block resync loop; make workers infaillible
continuous-integration/drone/push Build is passing Details
2021-03-15 20:09:44 +01:00
Alex 667e4e72a8 Small fixes 2021-03-15 19:51:16 +01:00
Alex 537f652fec Tiny things
continuous-integration/drone/push Build is passing Details
2021-03-15 18:40:27 +01:00
Alex 0290afe1f8 Make block rc code more understandable 2021-03-15 18:27:26 +01:00
Alex c475471e7a Implement table gc, currently for block_ref and version only
continuous-integration/drone/push Build is passing Details
2021-03-12 19:57:37 +01:00
Alex a1442f072a Implement garage stats to get info on node contents
continuous-integration/drone/push Build is passing Details
2021-03-12 15:40:54 +01:00
Alex 8860aa19b8 Make syncer have its own rpc client/server 2021-03-12 15:05:26 +01:00
Alex 7fdaf7aef0 Fix merkle updater not being notified; improved logging
continuous-integration/drone/push Build is passing Details
2021-03-12 14:37:46 +01:00
Alex 1ec49980ec whoops
continuous-integration/drone/push Build is passing Details
2021-03-11 19:30:24 +01:00
Alex 046b649bcc (not well tested) use merkle tree for sync
continuous-integration/drone/push Build is passing Details
2021-03-11 18:28:27 +01:00
Alex 94f3d28774 WIP big refactoring
continuous-integration/drone/push Build is passing Details
2021-03-11 16:54:15 +01:00
Alex 8d63738cb0 Checkpoint: add merkle tree in data table
continuous-integration/drone/push Build is passing Details
2021-03-11 13:47:21 +01:00