aboutsummaryrefslogtreecommitdiff
path: root/src/table/data.rs
Commit message (Collapse)AuthorAgeFilesLines
* Abstract database behind generic interface and implement alternative drivers ↵Alex2022-06-081-54/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#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>
* First implementation of K2V (#293)Alex2022-05-101-25/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | **Specification:** View spec at [this URL](https://git.deuxfleurs.fr/Deuxfleurs/garage/src/branch/k2v/doc/drafts/k2v-spec.md) - [x] Specify the structure of K2V triples - [x] Specify the DVVS format used for causality detection - [x] Specify the K2V index (just a counter of number of values per partition key) - [x] Specify single-item endpoints: ReadItem, InsertItem, DeleteItem - [x] Specify index endpoint: ReadIndex - [x] Specify multi-item endpoints: InsertBatch, ReadBatch, DeleteBatch - [x] Move to JSON objects instead of tuples - [x] Specify endpoints for polling for updates on single values (PollItem) **Implementation:** - [x] Table for K2V items, causal contexts - [x] Indexing mechanism and table for K2V index - [x] Make API handlers a bit more generic - [x] K2V API endpoint - [x] K2V API router - [x] ReadItem - [x] InsertItem - [x] DeleteItem - [x] PollItem - [x] ReadIndex - [x] InsertBatch - [x] ReadBatch - [x] DeleteBatch **Testing:** - [x] Just a simple Python script that does some requests to check visually that things are going right (does not contain parsing of results or assertions on returned values) - [x] Actual tests: - [x] Adapt testing framework - [x] Simple test with InsertItem + ReadItem - [x] Test with several Insert/Read/DeleteItem + ReadIndex - [x] Test all combinations of return formats for ReadItem - [x] Test with ReadBatch, InsertBatch, DeleteBatch - [x] Test with PollItem - [x] Test error codes - [ ] Fix most broken stuff - [x] test PollItem broken randomly - [x] when invalid causality tokens are given, errors should be 4xx not 5xx **Improvements:** - [x] Descending range queries - [x] Specify - [x] Implement - [x] Add test - [x] Batch updates to index counter - [x] Put K2V behind `k2v` feature flag Co-authored-by: Alex Auvolat <alex@adnab.me> Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/293 Co-authored-by: Alex <alex@adnab.me> Co-committed-by: Alex <alex@adnab.me>
* Add wrapper over sled tree to count items (used for big queues)Alex Auvolat2022-03-141-1/+3
|
* Add tracing integration with opentelemetryAlex Auvolat2022-03-141-1/+0
|
* Add many metrics in table/ and rpc/Alex Auvolat2022-03-141-1/+5
|
* Implement basic metrics in tableMaximilien R2022-03-141-0/+6
|
* Fix a bug when a migration is followed by a rebalanceAlex Auvolat2022-02-101-9/+18
| | | | | | | Nodes would stabilize on different encoding formats for the values, some having the pre-migration format and some having the post-migration format. This would be reflected in the Merkle trees never converging and thus having an infinite resync loop.
* Make table name a const in traitAlex Auvolat2021-12-151-14/+6
|
* Implement GC delay for table dataAlex Auvolat2021-11-081-1/+1
|
* Refactor and comment table GC logicAlex Auvolat2021-11-081-1/+2
|
* First port of Garage to NetappAlex Auvolat2021-10-221-1/+1
|
* rename types to CamelCaseTrinity Pointard2021-05-031-2/+2
|
* Improve bootstraping: do it regularly; persist peer listAlex Auvolat2021-04-271-1/+7
|
* Leader-based GCAlex Auvolat2021-03-161-3/+17
|
* Refactor codeAlex Auvolat2021-03-161-71/+65
|
* WIP migrate to tokio 1Alex Auvolat2021-03-151-3/+3
|
* Small fixesAlex Auvolat2021-03-151-1/+5
|
* cargo fmtAlex Auvolat2021-03-121-42/+49
|
* Implement table gc, currently for block_ref and version onlyAlex Auvolat2021-03-121-12/+55
|
* Implement garage stats to get info on node contentsAlex Auvolat2021-03-121-1/+1
|
* Fix merkle updater not being notified; improved loggingAlex Auvolat2021-03-121-2/+2
|
* (not well tested) use merkle tree for syncAlex Auvolat2021-03-111-6/+9
|
* WIP big refactoringAlex Auvolat2021-03-111-0/+189