Skip to content

Commit 3dfc3a0

Browse files
authored
docs(l1): tradeoffs of transactional RocksDB modes (#4744)
A brief pros and cons list to decide whether to turn off optimistic transactions.
1 parent de9a0b8 commit 3dfc3a0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Tradeoffs of using or not Optimistic Transaction DB in RocksDB
2+
3+
## Advantages of Optimistic Transactions
4+
- Easier to keep consistency between multiple writers.
5+
- Easier to keep consistency with readers.
6+
7+
## Advantages of Pessimistic Transactions
8+
- Lower memory usage?
9+
- No conflict resolution.
10+
11+
## Advantages of Non-Transactional DB
12+
- `delete_range`: much faster key deletion in bulk, useful during healing.
13+
- Lower memory usage (confirm).
14+
- Secondary instances are either much easier or possible.
15+
16+
## Alternatives to DB Transactions
17+
- We can use snapshots/secondary instances to provide a consistent view to block production and protocols.
18+
- We can provide crash safety by adding checkpoints or explicit markers so we can go back to the last known consistent version.
19+
- We would need to run a healing pass from that point on startup, to fix possible partial changes to tries.
20+
- We would need to add explicit tests for crashing during writes to make sure we recover correctly.
21+
- L2 can't recover from peers (at least until Based), so it should probably remain transactional.

0 commit comments

Comments
 (0)