Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_changes with doc_ids filter does not work with feed=longpoll #1703

Closed
snej opened this issue Apr 17, 2016 · 4 comments
Closed

_changes with doc_ids filter does not work with feed=longpoll #1703

snej opened this issue Apr 17, 2016 · 4 comments

Comments

@snej
Copy link
Contributor

snej commented Apr 17, 2016

If you send a changes request with both filter=_doc_ids and feed=longpoll, the filter is ignored and all changed documents are returned.

This will break client continuous pull of a set of docIDs, because the replicator will end up pulling every doc int the database, not just the ones requested. (We could add a workaround to Couchbase Lite and ignore the returned docIDs that don't match, but this would still be a waste of bandwidth.)

@zgramana zgramana added this to the 1.3 milestone Apr 18, 2016
@adamcfraser
Copy link
Collaborator

The current implementation of the doc_ids filter doesn't support continuous/longpoll replication - it's strictly for one-shot replication. The missing piece is a document-level notification mechanism - currently our changes notification process only triggers for channel or user/role changes. It might be possible to add doc-level notification tags, but we'd need to evaluate the performance impact associated with that.

To test this out, we'd need to:

  • When a changes feed with a doc id filter, register a wait listener with keys like _d/[doc_id] (prefix needed to ensure uniqueness between doc ids and channel names
  • During channel index processing, send notification for each document seen on the feed, in the same format

A bigger challenge would be supporting this for sg-accel - since each node isn't listening to the full feed, clients would have to poll for updates to the list of doc ids, which has the potential for significant performance overhead when many active changes feeds are listening for docs.

@snej
Copy link
Contributor Author

snej commented Apr 19, 2016

What about just having the change handler look up every incoming change's docID against the set being filtered on, and ignore it if it's not in the set? Clearly this has scalability problems, but it at least produces correct results, so I think it's better than what's there now.

In any case, until this is fixed, I think the REST handler should return an error with this combination of options. It would be better for the client to get an error than to start getting updates for docs it didn't want to sync.

@adamcfraser
Copy link
Collaborator

I agree about returning an error for this combination of options - filed #1712 for that change.

We can use this ticket to track non-one-shot w/ doc_id filtering. I think we need to come up with a solution that scales - at least something that's compatible with sg-accel - before we deliver it.

@adamcfraser adamcfraser modified the milestones: Future, 1.3 Jul 29, 2016
@adamcfraser adamcfraser removed this from the Future milestone Oct 5, 2016
@adamcfraser adamcfraser added icebox and removed backlog labels Oct 5, 2016
@djpongh djpongh added this to the 2.1.0 milestone Jan 31, 2018
@djpongh djpongh modified the milestones: 2.1.0, 2.2.0 Feb 5, 2018
@djpongh djpongh removed the P2: medium label Feb 5, 2018
@djpongh djpongh modified the milestones: Iridium, Cobalt Sep 24, 2018
@djpongh djpongh modified the milestones: Cobalt, Mercury Dec 13, 2018
@adamcfraser
Copy link
Collaborator

Moved to CBG-793

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants