Mike Rhodes created COUCHDB-2947:
------------------------------------

             Summary: Applying limit and continuous to _changes results in odd 
behavior when writing documents during request
                 Key: COUCHDB-2947
                 URL: https://issues.apache.org/jira/browse/COUCHDB-2947
             Project: CouchDB
          Issue Type: Bug
          Components: Database Core
            Reporter: Mike Rhodes


If I have a database that is continuously receiving updates, applying 
continuous and limit parameters to my database query gives odd behaviour. 

Take this URL:

http://localhost:5984/database/_changes?since=0&limit=1&feed=continuous

If I call this URL while running a script writing documents to the database at 
a great enough rate that the continuous changes timeout is not hit, the 
behaviour isn't as I'd expect.

What I'd expect to happen:

1 doc is emitted, the _changes feed emits the last_seq line, then the request 
is terminated.

What actually happens:

Once `limit` items have been returned, entries continue being emitted until 
writing documents to the database stops. After writing stops, entries stop 
being emitted into the response. If I start writing again, the response starts 
to emit changes entries again. If I don't start writing again, the request 
eventually times out via the default setting in couch.ini and emits the 
last_seq line and closes.

If a timeout is applied in the URL, this overrides the default timeout as 
expected, but otherwise the behaviour remains the same.

Note that the _changes feed isn't catching up to the current seq, it's just 
continuing to emit while the documents are being written. Once writing to the 
database stops, the request stops emitting changes wherever it's managed to get 
up to. From what I can tell, the emitted entries into the changes feed are in 
the right sequence, so we're not missing items from the feed, just emitting too 
many of them.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to