Repository: apache/couchdb

Issue #984: update_seq of a view is set to zero after compaction
Created: 2017-11-12T11:01:42Z
After compaction of the view, update seq of the view  (not _info) is reset to zero.
Expected Behavior
Update_seq ought to persist
Current Behavior
Update_seq is reset to zero during or after compaction
Possible Solution
fix it
Steps to Reproduce (for bugs)

create view
feed with some data
check update_seq and remember (&update_seq=true)
compact the view
now check the update_seq again

Context
I am trying to create stream of changes which is initialized from the view. Common scenario is:

query view and update_seq
monitor changes from the update_seq returned by the view

Your Environment
{"couchdb":"Welcome","version":"2.1.1","features":["scheduler"],"vendor":{"name":"The Apache Software Foundation"}}
Example of result
total_rows":500,"offset":0,"update_seq":"0-g2wAAAABaANkABFjb3VjaGRiQDEyNy4wLjAuMWwAAAACYQBuBAD_____amEAag","rows":[
{"id":"o.1eDpbvT74bkV0ux7HrHg","key":1510482931,"value":null},
{"id":"o.1eDpc1T74elEZ4Lp59Ye","key":1510482937,"value":null},
{"id":"o.1eDpc1T74faGIb297jKL","key":1510482938,"value":null},
{"id":"o.1eDpc2T74idp04YSOhCE","key":1510482938,"value":null},
{"id":"o.1eDpc2T74k1tnW9z3SJy","key":1510482938,"value":null},
{"id":"o.1eDpc3T74l5srIbkwVh7","key":1510482939,"value":null},
{"id":"o.1eDpc3T74n1Wvr3NYkT0","key":1510482939,"value":null},
{"id":"o.1eDpc3T74oXJoxyzxEQ1","key":1510482939,"value":null},
{"id":"o.1eDpc3T74pJq9HJIZyVb","key":1510482939,"value":null},
{"id":"o.1eDpc3T74qe0oR5Jw4nb","key":1510482940,"value":null},
{"id":"o.1eDpc4T74rltlVYBI5xH","key":1510482940,"value":null},
{"id":"o.1eDpc4T74sd8kD1RVSTf","key":1510482940,"value":null},
{"id":"o.1eDpc4T74tSaZlqIg6Px","key":1510482940,"value":null},
{"id":"o.1eDpc4T74uKmSg0OlANd","key":1510482940,"value":null},
IMPORTANT NOTE
This bug was not fixed from the 1.6!

Duplicate issue #1221: `_changes` filtered on `_doc_ids` returns unexpected `last_seq`
Created: 2018-03-14T11:32:31Z
Expected Behavior
From: http://docs.couchdb.org/en/2.1.1/api/database/changes.html#post--db-_changes:

"last_seq is the update sequence of the last update returned (Equivalent to the last item in the results)."

When filtering on _doc_ids, I was expecting last_seq to be the same thing as the last seq in the list of changes returned when filtering on _doc_ids.
Current Behavior
When filtering on _doc_ids, _changes responds with the latest sequence in the database or, if there's a limit argument, the sequence number after the limit number.
Steps to Reproduce (for bugs)

POST /{db}/_changes?filter=_doc_ids&since=0 with body {doc_ids: ['one-example-id']}
See that last_seq in response is not the last seq in the list of changes.

Context
Grabbing the last_seq from the _changes response and using it as the since parameter on the next request to _changes is PouchDB's approach to a replication filtered on IDs. Using that later sequence number means documents are (sometimes) missed in the replication.
pouchdb/pouchdb#6809
Your Environment
Saw this when running a single node CouchDB 2.1 & on CouchDB 1.6 locally on a macbook pro.

Closing comment (2018-03-28T21:27:58Z): I wonder if this is related to #984 and @rnewson 's investigation there.