Hello everyone, my question is here(badger/db.go at master · dgraph-io/badger · GitHub ) why imm
is a slice of skiplist instead of one skiplist?
I see here(badger/db.go at master · dgraph-io/badger · GitHub ) make sure imm
just pick one element every time (edited)
So why not use db.imm = db.mt
instead of db.imm = append(db.imm, db.mt)
? (edited)
I see Leveldb use db.imm = db.mt
style. (edited)
Sorry for my pool English, I hope you know what I mean…
mrjn
(Manish R Jain)
March 31, 2018, 5:07am
2
There is not just one, but many immutable tables, which are waiting to be flushed to disk. That’s why it’s a slice. You can control how many they can be here:
// 3. Flags that user might want to review
// ----------------------------------------
// The following affect all levels of LSM tree.
MaxTableSize int64 // Each table (or file) is at most this size.
LevelSizeMultiplier int // Equals SizeOf(Li+1)/SizeOf(Li).
MaxLevels int // Maximum number of levels of compaction.
// If value size >= this threshold, only store value offsets in tree.
ValueThreshold int
// Maximum number of tables to keep in memory, before stalling.
NumMemtables int
// The following affect how we handle LSM tree L0.
// Maximum number of Level 0 tables before we start compacting.
NumLevelZeroTables int
// If we hit this number of Level 0 tables, we will stall until L0 is
// compacted away.
NumLevelZeroTablesStall int
// Maximum total size for L1.
LevelOneSize int64
Got it, thanks for reply.