incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Hayton <theb...@purplebulldog.com>
Subject Re: Changes API - purged?
Date Fri, 23 Aug 2013 16:08:28 GMT
So something interesting here to me is that each document had a seq no... Is there any way
to figure out what that is from the id/rev?  

On Aug 23, 2013, at 8:15 AM, Jens Alfke <jens@couchbase.com> wrote:

> 
> On Aug 23, 2013, at 1:01 AM, Jens Rantil <jens.rantil@gmail.com> wrote:
> 
>> Just to be clear, does compaction influence the changes feed in any way?
> 
> It may help to think of the changes feed this way:
> 
> Every database has a last-sequence counter (similar to a SQL table’s autoincrement
counter.)
> Every document has a sequence number*.
> Whenever a document is updated (i.e. a revision is added) its sequence number is changed
to the next available sequence count.
> The changes feed is just a listing of documents ordered by their current sequence numbers.
> (Under the hood, the database has a separate b-tree index that maps sequence numbers
to document IDs.)
> 
> Thus the effect is that updating a document moves it to the end of the changes feed,
with a new sequence number.
> 
> Compaction doesn’t have any effect on this at all; all it does is prune intra-document
revision data.
> 
> —Other Jens ;)
> 
> * This gets more complex with BigCouch/Cloudant, because it’s clustered. The opaque
sequence IDs it shows clients are actually aggregates of the sequence numbers of all the nodes
in the cluster.

Mime
View raw message