Multi-version Concurrency Control (MVCC)
The CouchDB uses MVCC as the concurrency control policy for read operations, each clients sees a consistent snapshot during the read operation.
As the CouchDB is append-only, the critical header of the database file is in the tail of the file, which will be access/re-append by each append operation.
The values in the body of a file header is:
8 bits -- File format version (Currently 10)
48 bits -- Update sequence number counter.
This is the sequence number that will appear in the by-sequence index for the next update.
48 bits -- Purge sequence number.
48 bits -- Purged documents pointer
16 bits -- Size of by-sequence B-tree root
16 bits -- Size of by-ID B-tree root
16 bits -- Size of local documents B-tree root
The B-tree roots, in the order of the sizes, are B-tree node pointers as described in the "Node Pointers" section.
To locate the file header, the database file are organized as 4096-byte file blocks.
The data in the file are organized as variable-length chunks.
https://github.com/apache/couchdb
http://docs.couchdb.org/en/stable/index.html
Damien Katz
2005
Apache Software Foundation
C, C#, Erlang, Haskell, Java, JavaScript, Lisp, Lua, Objective-C, Ocaml, Perl, PHP, PL/SQL, Python, Ruby, Smalltalk
Android, BSD, iOS, Linux, OS X, Solaris, Windows