Reviewing Lightning memory-mapped database libraryMVCC
MVCC stands for Multi Versioning Concurrency Control. This is how you can have both readers & writer at the same time and not have to arrange locks for the two. With LMDB, MVCC is implemented by always creating a new page, never modifying them in place. That also means that when we “free” a page, we need to make sure not to actually use it until all the transactions that could see it has completed.
To be honest, I can’t follow the code. It is somewhat related to me_pghead , but I just can’t follow what is going on. I think that this is related to the way it manage multiple transactions, but I am just unable to follow the code .Maybe it is just that I overloaded my senses with too much C code, I have been diving into this code, and sometimes it feels like this:
That said, I understand how it has to work, so that should be enough for now. Next, I want to see how to do it myself .
More posts in "Reviewing Lightning memory-mapped database library" series:
- (08 Aug 2013) MVCC
- (07 Aug 2013) What about free pages?
- (06 Aug 2013) Transactions & commits
- (05 Aug 2013) A thoughtful hiatus
- (02 Aug 2013) On page splits and other painful things
- (30 Jul 2013) On disk data
- (25 Jul 2013) Stepping through make everything easier
- (24 Jul 2013) going deeper
- (15 Jul 2013) Because, damn it!
- (12 Jul 2013) tries++
- (09 Jul 2013) Partial
Comments
There's one nice side to your LMDB series - without that I wouldn't even know such library exists, and it certainly deserves better recognition. But I don't like the ending very much. After all, the title is 'Reviewing the LMDB', so where's the review?
Lol, this post is obviously more about psychology.
Rafal, What do you think those posts _are_?
Well, i'm not sure what they are. You've expressed some opinions about source code not being up to your expectations and general difficulty in understanding it, but today's post looks like a final one and there's no conclusion other than you're going to copy some part of LMDB... I'd expect a comparison to other libraries, pointing out of good and bad sides, an 'overall' verdict (do you like it or not, why?) etc.
Rafal, I went over the codebase in details, offering comparisons for other stuff, and talking about how it works. I have a summary post scheduled for 22th, but that is pretty much it.
Comment preview