wohali commented on issue #984: update_seq of a view is set to zero after 
compaction
URL: https://github.com/apache/couchdb/issues/984#issuecomment-343757731
 
 
   Paraphrasing a response that has been given before:
   
   The update sequence values in CouchDB are opaque. In CouchDB 1.x, they were 
integers but, in Cloudant and 2.x, the value is an encoding of the sequence 
value for each shard of the database.
   
   In both CouchDB and Cloudant, `_changes` and the view info will return a 
"seq" value with every row that is guaranteed to return newer updates if you 
pass it back as "since". _In cases of failover, that might include changes 
you've already seen._
   
   So, the correct way to read changes since a particular update sequence is 
this;
   
       call /dbname/_changes?since=
       read the entire response, applying the changes as you go
       Record the last_seq value as your new checkpoint seq value.
   
   Do not interpret the two values, you can't compare them for equality. You 
can, if you need to, record any "seq" value as you go in step 2 as your current 
checkpoint seq value. The key thing you cannot do is compare them.
   
   Potential workaround:
   You cannot use a view as a _changes feed, but you *can* [apply a filter 
function to a _changes 
feed](http://docs.couchdb.org/en/2.1.1/api/database/changes.html#get--db-_changes),
 which may help your use case. You can also use the [new Mango 
selector](http://docs.couchdb.org/en/2.1.1/api/database/changes.html#selector) 
which has significantly better performance than map-reduce views for this 
purpose. (I have personally seen 10x better performance with Mango selectors.)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to