LevelDB compaction of levels

493 views
Skip to first unread message

Anuj Khandelwal

unread,
Nov 6, 2014, 11:37:11 AM11/6/14
to lev...@googlegroups.com
Hi,

I am new user of leveldb and want to understand the compaction process of levels. I already went through http://leveldb.googlecode.com/svn/trunk/doc/impl.html which gives me a good understanding of compactions. I have couple of questions related to this:

1. Updates always comes first in ".log" file and after it reaches threshold, it converts to .sst (level-0). After first compaction happens: All the level-0 file will be moved to level-1. So now updates which are coming to ".log" file will be going to the level-1 after crossing the threshold ? 

2. When ".log" file converts to .sst (level-0), it's size decreases. Why so ? What is the reason behind this size reduction between levels ?

3. Is there any limit on number of levels ?

4. When does SNAPPY compression comes into the picture ? Does it only compress data before being store in the db ?


Thanks,
Anuj

Anuj Khandelwal

unread,
Nov 7, 2014, 1:36:11 AM11/7/14
to lev...@googlegroups.com
Did anyone get a chance to look at this ?

Michael Overmeyer

unread,
Mar 2, 2015, 2:31:01 PM3/2/15
to lev...@googlegroups.com
I don't know the answer to the other questions, but I can answer #3:

The maximum number of levels depends on the value of kNumLevels in https://github.com/google/leveldb/blob/master/db/dbformat.h. It is hard-coded to 7, giving level-0 to level-6.
Reply all
Reply to author
Forward
0 new messages