You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Remove the memtable from the immutable memtables.
snapshot.imm_memtables.pop();
// Add L0 table
snapshot.l0_sstables.push(sst);
// Update SST ID
snapshot.next_sst_id += 1;
// Update the snapshot.
*guard = Arc::new(snapshot);
}
In sync() we push the memtable to imm_memtables first, but remove it during flush to ssTable. What's the reason for removing memtable from imm_memtables? If we do not remove it, we can get key-value in imm_memtables which is located in memory.
And what is the role of imm_memtables in LsmStorage? It's unclear to me.
The text was updated successfully, but these errors were encountered:
imm_memtables are immutable memtables. Memory is not unlimited, and it will eventually become full. We will need to flush those memtables to disk as SST files. After flushing to disk, you can read them from block cache, and we can also run background compaction so consolidate SSTs.
Soga. I found that I overlooked block cache in SsTable.
There is another point I don't really understand. The variable imm_memtable seems to be only used for temporarily store memtable. Is this all its functions? or are other aspects ignored by me?
In the future, we will have flush thread in the background, which flushes imm_memtable to disk. sync will be very light-weight. It will only do a fsync on WAL file.
mini-lsm/mini-lsm/src/lsm_storage.rs
Lines 165 to 177 in 130b47b
In
sync()
we push thememtable
toimm_memtables
first, but remove it during flush to ssTable. What's the reason for removingmemtable
fromimm_memtables
? If we do not remove it, we can get key-value inimm_memtables
which is located in memory.And what is the role of
imm_memtables
in LsmStorage? It's unclear to me.The text was updated successfully, but these errors were encountered: