dgraph-io / badger

Fast key-value DB in Go.

Home Page:https://dgraph.io/badger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[QUESTION]: maybe should pin the memtable and levelcontroller in a seqcst view when call db.get

guoxiangCN opened this issue · comments

commented

Question.

current logic of db::get

memtables := []
db.RLock()
append(memtables, mutableMemtable);
append(memtables, imuutableMemtable);
db.RUnlock()

for memtable in memtables {
    if memtable.got() 
       return got
}
// point1: after search memtable
// point2: find in the level sst
...
for i in 0..7 {
 level.get()
}

the logic of pin memtable and level-controller was not in an consistent view.
if a flush or compaction finished between point 1 and point2, the sst distrubution and the pinned memtable is not match.