https://slatedb.io logo
wanna ask another question on the write path: when...
# general
f
wanna ask another question on the write path: when do we put the data from WAL/WriteBatch into Memtable? i've read the code in
write_batch()
, which is considered the unified entrance of all the write operations, all i could found is
freeze_wal
, but have not found the code about writing the write batch data into memtable, any hint? 😮
c
write_batch.rs calls maybe_freeze_wal: https://github.com/slatedb/slatedb/blob/c43753e12659216ddfeb553be204ee22ec9e4e9f/src/batch_write.rs#L87 m_f_w calls freeze_wal and sends a FlushImmutableWals message: https://github.com/slatedb/slatedb/blob/c43753e12659216ddfeb553be204ee22ec9e4e9f/src/db_common.rs#L36-L39 flush.rs receives the mesage and calls flush(): https://github.com/slatedb/slatedb/blob/c43753e12659216ddfeb553be204ee22ec9e4e9f/src/flush.rs#L133 Which calls flush_imm_wals: https://github.com/slatedb/slatedb/blob/c43753e12659216ddfeb553be204ee22ec9e4e9f/src/flush.rs#L27 Which calls flush_imm_wal_to_memtable and then maybe_freeze_memtable: https://github.com/slatedb/slatedb/blob/c43753e12659216ddfeb553be204ee22ec9e4e9f/src/flush.rs#L92-L93 The flush_imm_wal_to_memtable is where the WAL gets put into the memtable: https://github.com/slatedb/slatedb/blob/c43753e12659216ddfeb553be204ee22ec9e4e9f/src/flush.rs#L53-L81 And then the maybe_Freeze_memtable is where the mem_table_flush.rs gets notified it should flush (maybe).
f
thank you a lot for the sharing! let me dive into this and learn about the details 🫡
2 Views