Commit Graph

33 Commits

Author SHA1 Message Date
Alex 357b72f4ff
Merge branch 'main' into configurable-timeouts
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
2022-09-20 15:19:58 +02:00
Alex 1f7b050b7d
Change a warn! into a debug!
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
2022-09-20 11:49:48 +02:00
Alex 56592e1853
RPC performance changes
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build was killed Details
- configurable ping timeout
- single, much higher, configurable RPC timeout
- no more concurrency semaphore
2022-09-19 20:31:00 +02:00
Alex df094bd807
Less strict timeouts 2022-09-01 16:30:44 +02: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 2cab84b1fe
Add many metrics in table/ and rpc/ 2022-03-14 10:51:50 +01:00
Alex beeef4758e
Some movement of helper code and refactoring of error handling 2022-01-04 12:52:46 +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
Alex 1b450c4b49
Improvements to CLI and various fixes for netapp version
Discovery via consul, persist peer list to file
2021-10-22 16:55:24 +02:00
Alex 4067797d01
First port of Garage to Netapp 2021-10-22 15:55:18 +02:00
Trinity Pointard e4b9e4e24d
rename types to CamelCase
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
2021-05-03 22:15:09 +02:00
Trinity Pointard f5a0cf0414
fix clippy warnings on table 2021-05-03 22:11:41 +02: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 515029d026 Refactor code
continuous-integration/drone/push Build was killed Details
2021-03-16 11:43:58 +01:00
Alex 1d9961e411 Simplify replication logic
continuous-integration/drone/push Build is passing Details
2021-03-16 11:14:27 +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 831eb35763 cargo fmt
continuous-integration/drone/push Build is passing Details
2021-03-12 21:52:19 +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 cbe7e1a66a Move table rpc client out of tableaux
continuous-integration/drone/push Build is passing Details
2021-03-12 15:07:23 +01:00
Alex 8860aa19b8 Make syncer have its own rpc client/server 2021-03-12 15:05:26 +01:00
Alex 1fea257291 Don't sync at beginning
continuous-integration/drone/push Build is passing Details
2021-03-12 14:51:17 +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 3f7a496355 More security: don't delete stuff too easily
continuous-integration/drone/push Build is passing Details
2021-03-11 19:06:27 +01:00
Alex f7c2cd1cd7 Add comment, and also whoops, this wasn't doing what we expected
continuous-integration/drone/push Build is passing Details
2021-03-11 18:56:18 +01:00
Alex fae5104a2c Add a nice warning
continuous-integration/drone/push Build is failing Details
2021-03-11 18:50:32 +01:00
Alex db7a9d4948 Tiny changes
continuous-integration/drone/push Build is passing Details
2021-03-11 18:45:26 +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