couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Alfke <j...@couchbase.com>
Subject Re: Changes API - purged?
Date Fri, 23 Aug 2013 15:15:18 GMT

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