Skip to content

Latest commit

 

History

History
42 lines (27 loc) · 1.05 KB

leveldb_write.md

File metadata and controls

42 lines (27 loc) · 1.05 KB

LevelDB write

Key Points

  • a single put operation just result one disk write and one memory write(一次写入操作只涉及一次磁盘顺序写和一次内存写入)

Big picture

Memtable -> Immutable Memtable -> SSTable
(skiplist)                     (bloomfilter)

Internal

Example

code

Status s = DB::Open(options, kDBPath, &db);
s = db->Put(WriteOptions(), "key1", "value");
  1. Update WAL(more info: WAL)

  2. Update Memory table(more info: skiplist)

  3. Switch to immutable memtable

  4. Compaction(more info: compaction)

Notes for rocksdb

rocksdb_read




Code

DBImpl::Write in db/db_impl.cc

Update WAL

WriteInto MemTable

Trigger compaction