How does couchdb retrieve all previous revisions?

From what I understand, CouchDB's Btree implementation actually uses Shadowing technique, and every update will produce new root, the following excerpts from this PDF (it looks like implementing a better algorithm than traditional shadowing).

Shadowing means that to update an on-disk page, the entire page is read into memory, modified, and later written to disk at an alternate location. When a page is shadowed its location on disk changes, this creates a need to update (and shadow) the immediate ancestor of the page with the new address. Shadowing propagates up to the file system root.

How does couchdb implement fetching all leaf revisions as possible as it can( since some revisions are removed by compacting process)? Does couch internally store a pointer which points to previous revisions?

Thanks Chang

Answers


By good luck, CouchDB committer and community leader Adam Kocoloski explained this recently on the mailing list.

Here is what he said:

"Each leaf in the ID btree [stores] a revision tree containing pointers to all available revisions of a document. Retrieving an old revision (before compaction) or a conflicting version of a document requires exactly the same number of IOs as retrieving the current one."

If I understand correctly, shadowing is not used to conceal old document revisions at all, but rather entire revision trees that are no longer meaningful.


Couch doesn't guarantee that old revisions of a document can be retrieved:

The terms version and revision might sound familiar (if you are programming without version control, drop this book right now and start learning one of the popular systems). Using new versions for document changes works a lot like version control, but there’s an important difference: CouchDB does not guarantee that older versions are kept around.

Source: O'Reilly CouchDB The Definitive Guide, page 40.

Why is this? Because CouchDB is not a version control system: the versioning mechanism is there for concurrent access to the database. The Definitive Guide touches on this on pages 14-15.


Need Your Help

textchanged event doesn't fire

c# .net asp.net textbox

I have CalendarExtender and bound it to a textbox but when i write code in textchanged event found that it doesn't fire;here my code snippet:

Using Core Animation with objects other than CALayers

iphone objective-c cocoa cocoa-touch core-animation

I was pretty sure I had seen discussions of this around the Net, but now I can't seem to find anything. The question is simple: is there a way to use for example CABasicAnimation to animate a prope...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.