How couchdb extracts all previous versions?

From what I understand, the CouchDB Btree implementation actually uses the Shadowing technique, and each update will generate a new root, the following excerpts from this PDF (this seems like an implementation of a better algorithm than traditional shading).

Shading means that for updating to disk, the entire page is read into memory, changed and later written to disk to an alternative location. When a page becomes obscured, the location on the disk changes, this creates the need to update (and obscure) the nearest ancestor of the page with a new address. The shadow extends to the root of the file system.

How does couchdb implement the selection of all revisions of a sheet as much as possible (since some changes are removed by the compaction process)? Does the couch inside hold a pointer that points to previous versions?

Thanks Chang

+6
source share
2 answers

Fortunately, CouchDB commander and community leader Adam Kocoloski recently explained this on the mailing list.

Here is what he said:

"Each sheet in the btree identifier [stores] a revision tree containing pointers to all available versions of the document. Getting the old version (before compaction) or a conflicting version of the document requires exactly the same amount of IO as getting the current one."

If I understand correctly, shadow copying is not used to hide old versions of a document at all, but rather entire revision trees that no longer make sense.

+4
source

Couch does not guarantee that old versions of a document can be restored:

The terms version and version may seem familiar (if you program without version control, drop this book right now and start exploring one of the popular systems). Using new versions for document changes greatly affects version control, but an important difference: CouchDB does not guarantee that old versions are kept around.

Source: O'Reilly CouchDB Complete Guide, p. 40.

Why is this? Since CouchDB is not a version control system : a version control mechanism exists to access the database at the same time. The final guide addresses this on pages 14-15.

+6
source

Source: https://habr.com/ru/post/891114/


All Articles