Pekka Enberg
aac835fce9
Document persistent storage design ( #24 )
2023-05-06 20:15:08 +02:00
Piotr Sarna
fb6ce70993
database: add dropping unused row versions
...
When a row version is not visible by any transactions,
active or future ones, it should be dropped.
2023-04-20 15:47:36 +02:00
Piotr Sarna
2a018ea9a3
fixup: move DatabaseError under a feature
2023-04-20 15:47:36 +02:00
Piotr Sarna
b6b36a0d94
fixup: implement Stream for JsonOnDiskStream under a feature
2023-04-20 14:46:14 +02:00
Piotr Sarna
04a78f73fb
treewide: add persistent storage trait
...
This draft adds a persistent storage trait that can be used
to store transaction logs and read the log for recovery purposes.
Work in heavy progress, because ideally the design should also
allow reading versions from the storage, so that data can be
spilled from memory to disk if there's not enough RAM available.
2023-04-17 14:46:39 +02:00
Piotr Sarna
7ca68b3d96
errors: Add I/O error class
2023-04-17 12:06:34 +02:00
Piotr Sarna
db71c7e4e3
database: make transactions (de)serializable
2023-04-17 12:06:22 +02:00
Pekka Enberg
74a4d2d11a
Garbage collect transactions
...
Fixes #2
2023-04-15 09:53:56 +03:00
Pekka Enberg
43544c9fb6
Update README.md
2023-04-14 21:32:31 +03:00
Pekka Enberg
c0881944e0
Update README.md
2023-04-14 21:31:19 +03:00
avi
87b9b27215
check if tx can see its own updates
2023-04-14 22:56:07 +05:30
avi
e006177480
fix typos
2023-04-14 22:06:55 +05:30
avi
aff901baea
bugfix: make committed rows visibile ( fixes #15 )
2023-04-14 21:59:35 +05:30
Piotr Sarna
546db5a983
sync: add AsyncMutex trait
...
With AsyncMutex, we can use different mutex mechanisms
in the database - e.g. tokio::sync::Mutex.
2023-04-14 15:09:13 +02:00
Piotr Sarna
bfe3bcef71
asyncify
...
In order to prepare for #3 , the APIs are made asynchronous.
It also applies to tests and benches.
2023-04-14 15:08:51 +02:00
Pekka Enberg
620b8c6362
Update README.md
2023-04-14 14:43:28 +03:00
Pekka Enberg
9247e44324
Minimize library binary size
...
Shrinks binary size from 319K to 282K.
2023-04-14 14:07:49 +03:00
Pekka Enberg
b8b8d3f746
Remove rustyline dependency
...
It's not needed, likely leftover from some previous prototyping.
2023-04-14 14:02:02 +03:00
Pekka Enberg
4a98d32ce1
Update README.md
2023-04-14 13:52:55 +03:00
Pekka Enberg
5f84604d67
Add some more micro-benchmarks
2023-04-14 13:50:24 +03:00
Pekka Enberg
f223615910
Merge pull request #12 from penberg/parking-lot
...
Switch to parking_lot mutex
2023-04-14 13:33:59 +03:00
Pekka Enberg
ed5e259cfe
Switch to parking_lot mutex
...
It's faster than the standard library mutex.
2023-04-14 12:04:43 +03:00
Pekka Enberg
0f956fa179
Use Criterion's throughput estimation
...
Iteration time is of course interesting, but let's also use throughput
estimation on MVCC operations such as read(), begin_tx(), etc..
2023-04-14 11:59:36 +03:00
Piotr Sarna
8b798593a1
simplify CI
...
... since the old script messed up Clippy sometimes
2023-04-14 10:46:08 +02:00
Piotr Sarna
fdbe419789
fix CI ( #9 )
...
There was a minor import inconsistency in database/benches
2023-04-14 10:37:30 +02:00
Piotr Sarna
1bb752cab9
add basic CI ( #8 )
2023-04-14 10:18:37 +02:00
Pekka Enberg
f84f185835
Improve transaction tracing
2023-04-14 11:08:35 +03:00
Piotr Sarna
aebaf623a9
database: apply clippy fixes
...
They were preexisting, but now all the future patches can
use `clippy --tests` as well.
2023-04-14 09:54:33 +02:00
Piotr Sarna
7622ea5f98
database: add transaction tracing
...
The tracing is also added to tests, so that the behavior
can be observed:
```
$ cargo test -- --nocapture --test-threads 1
test database::tests::test_dirty_write ... 2023-04-14T07:51:15.919503Z TRACE test_dirty_write: mvcc_rs::database: BEGIN { id: 0, begin_ts: 0, write_set: {}, read_set: {} }
2023-04-14T07:51:15.919554Z TRACE test_dirty_write: mvcc_rs::database: BEGIN { id: 1, begin_ts: 1, write_set: {}, read_set: {} }
ok
test database::tests::test_fuzzy_read ... 2023-04-14T07:51:15.919732Z TRACE test_fuzzy_read: mvcc_rs::database: BEGIN { id: 0, begin_ts: 0, write_set: {}, read_set: {} }
2023-04-14T07:51:15.919762Z TRACE test_fuzzy_read: mvcc_rs::database: COMMIT { id: 0, begin_ts: 0, write_set: {1}, read_set: {1} }
2023-04-14T07:51:15.919778Z TRACE test_fuzzy_read: mvcc_rs::database: BEGIN { id: 1, begin_ts: 2, write_set: {}, read_set: {} }
2023-04-14T07:51:15.919793Z TRACE test_fuzzy_read: mvcc_rs::database: BEGIN { id: 2, begin_ts: 3, write_set: {}, read_set: {} }
2023-04-14T07:51:15.919811Z TRACE test_fuzzy_read: mvcc_rs::database: COMMIT { id: 2, begin_ts: 3, write_set: {1}, read_set: {} }
ok
test database::tests::test_insert_read ... 2023-04-14T07:51:15.919944Z TRACE test_insert_read: mvcc_rs::database: BEGIN { id: 0, begin_ts: 0, write_set: {}, read_set: {} }
2023-04-14T07:51:15.919974Z TRACE test_insert_read: mvcc_rs::database: COMMIT { id: 0, begin_ts: 0, write_set: {1}, read_set: {1} }
2023-04-14T07:51:15.919989Z TRACE test_insert_read: mvcc_rs::database: BEGIN { id: 1, begin_ts: 2, write_set: {}, read_set: {} }
ok
test database::tests::test_lost_update ... 2023-04-14T07:51:15.920116Z TRACE test_lost_update: mvcc_rs::database: BEGIN { id: 0, begin_ts: 0, write_set: {}, read_set: {} }
2023-04-14T07:51:15.920146Z TRACE test_lost_update: mvcc_rs::database: COMMIT { id: 0, begin_ts: 0, write_set: {1}, read_set: {1} }
2023-04-14T07:51:15.920161Z TRACE test_lost_update: mvcc_rs::database: BEGIN { id: 1, begin_ts: 2, write_set: {}, read_set: {} }
2023-04-14T07:51:15.920178Z TRACE test_lost_update: mvcc_rs::database: BEGIN { id: 2, begin_ts: 3, write_set: {}, read_set: {} }
2023-04-14T07:51:15.920196Z TRACE test_lost_update: mvcc_rs::database: ROLLBACK { id: 2, begin_ts: 3, write_set: {}, read_set: {} }
2023-04-14T07:51:15.920210Z TRACE test_lost_update: mvcc_rs::database: COMMIT { id: 1, begin_ts: 2, write_set: {1}, read_set: {} }
2023-04-14T07:51:15.920223Z TRACE test_lost_update: mvcc_rs::database: BEGIN { id: 3, begin_ts: 6, write_set: {}, read_set: {} }
ok
test database::tests::test_read_nonexistent ... 2023-04-14T07:51:15.920352Z TRACE test_read_nonexistent: mvcc_rs::database: BEGIN { id: 0, begin_ts: 0, write_set: {}, read_set: {} }
ok
```
2023-04-14 09:53:57 +02:00
Piotr Sarna
9d99090f67
.gitignore: add Cargo.lock
...
mvcc-rs is considered a library, so let's ignore its Cargo.lock
as per https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
2023-04-14 09:53:57 +02:00
Piotr Sarna
05ee98971b
add tracing
2023-04-14 09:30:28 +02:00
Pekka Enberg
bc7269a776
Fix typo
2023-04-13 10:41:01 +03:00
Pekka Enberg
e2fc841479
Move is_write_write_conflict() definition
2023-04-13 10:19:21 +03:00
Pekka Enberg
87ef3e1cd8
Add a comment for is_write_write_conflict()
2023-04-13 10:18:19 +03:00
Pekka Enberg
f51c4ee5a8
Move TxID type definition
2023-04-13 10:14:44 +03:00
Pekka Enberg
b73c11015a
Reorder code
2023-04-13 10:13:19 +03:00
Pekka Enberg
204d65ad05
Move clock code to clock.rs
2023-04-13 10:09:23 +03:00
Pekka Enberg
44ba56c5a8
Update README
2023-04-13 10:09:13 +03:00
Pekka Enberg
824669d471
Move code into DatabaseInner
...
Let's move rest of the code into DatabaseInner like we did for
`rollback_tx` as a code cleanup.
2023-04-13 10:05:09 +03:00
Pekka Enberg
d7ecfc054c
Fix lost update anomaly
...
Fixes #5
2023-04-13 09:57:26 +03:00
Pekka Enberg
eb250e1e83
Wire up flamegraphs to cargo bench
2023-04-12 12:39:14 +03:00
Pekka Enberg
477da5b60a
Fix compile error
2023-04-12 12:17:34 +03:00
Pekka Enberg
a52bf9158b
Fix delete() TX ID parameter name
...
Align it with the rest of the code.
2023-04-12 12:12:37 +03:00
Pekka Enberg
77d639fc20
Fix concurrency test
...
It was accidentally using row ID as transaction ID...
2023-04-12 11:56:22 +03:00
Pekka Enberg
3cecf777cf
Assert that we're manipulating an active transaction
2023-04-12 11:55:34 +03:00
Pekka Enberg
22042612d5
Concurrency test
...
The test is disabled because it triggers an assertion in the MVCC
implementation.
2023-04-12 11:45:15 +03:00
Pekka Enberg
fc93642643
Simple microbenchmarks
2023-04-10 18:22:10 +03:00
Pekka Enberg
02f40c0568
Move MVCC to database.rs
...
Let's keep lib.rs small and tidy.
2023-04-09 08:55:06 +03:00
Pekka Enberg
8f30c20215
Replace unwrap() with NoSuchTransactionID error
2023-04-09 08:53:03 +03:00
Pekka Enberg
df0cadc02e
Clean up LocalClock default trait
2023-04-08 18:37:23 +03:00