-
Why do we need MVCCWe have introduced a cache layer between kvrocks and client, which supports multi-point writing in the cache layer. like this: flowchart TB
client-->cache1
client-->cache2
cache1 <--> kvrocks0_0
cache1 <--> kvrocks1_0
cache2 <--> kvrocks0_0
cache2 <--> kvrocks1_0
kvrocks0_0 --- kvrocks0_1
kvrocks0_0 --- kvrocks0_2
kvrocks1_0 --- kvrocks1_1
kvrocks1_0 --- kvrocks1_2
There is such a scenario: sequenceDiagram
client ->> cache1: set k=10
cache1 ->> cache1: write WAL and buffer, k=10
cache1 ->> cache1: failed
client ->> cache2: set k=12
cache2->> cache2: write WAL and buffer, k=12
cache2 ->> kvrocks: flush k=12
cache1 ->> cache1: recovery and load WAL
cache1->>kvrocks: flush k=10
client ->> cache1: get k
cache1->> kvrocks: get k
kvrocks->>cache1: return k
cache1->>client: return k
We want k=12, but in fact k=10, that's why we expect kvrocks to support mvcc. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
@xinhua5 Thanks for your feedback. |
Beta Was this translation helpful? Give feedback.
-
Intrdocuing mvcc is hard, especially when you have multiple
1-3 using I think the key reason in your design is never mvcc, is transaction. Maybe a key service like zk or redlock is required when calling |
Beta Was this translation helpful? Give feedback.
-
I agree. I think your design needs to do more at the cache layer. This will be much less work than modifying kvrocks. |
Beta Was this translation helpful? Give feedback.
Intrdocuing mvcc is hard, especially when you have multiple
kvrocks
instance, for simplest case, if we want to implement single key mvcc, we need:k
in kvrocks. Apart from RocksDB'ssequence_id
, it should be encoding to RocksDB's key, and generated by aincr
like operation.set
with the mvcc key.1-3 using
set
andget
is impossible, so new command should be created. If you want multi-key transaction, it would be mu…