RocksDB Put operation creates a new record in the specified DB.
RocksDB code is very flexible and has several levels of abstractions. If
you are planning to understand the code path you can start reading from
the functions specified in this post.
DB Put Operation
RocksDB
stores the recently inserted data in the MemTable and periodically
flushes the data to disk based SSTables (sst files). But MemTable data can be lost when power failure occurs or the application crashes. It needs to make the changes durable. It uses WAL file to provide the durability. Every write is stored in MemTable and also committed to WAL. The entry function for the Put operation is db/db_impl/db_impl_write.cc:Put() .
Write Batch
RocksDB creates a write batch even for single write. The write batch will have a set of key, value records, the count of records in it, sequence number, and a checksum. This code is in db/write_batch.cc
WAL Commit
No comments:
Post a Comment