cloudant / sync-android

A JSON-based document datastore for Android applications
Apache License 2.0
267 stars 90 forks source link

Add support for mango selectors in Pull replicator #566

Closed jjrodrig closed 6 years ago

jjrodrig commented 6 years ago

Thanks for your hard work, please ensure all items are complete before opening.

What

Support for mango selectors is added to the Pull Replicator. This allows to use a more efficent mechanism for changes filtering in CouchDB 2.x

How

I've found many performance problems with filtered replication using JavaScript filters. This can be improved by using mango selectors.

I've created a PullSelector class equivalent to PullFilter that can be used in the ReplicatorBuilder.

Testing

I've rewrite every pull replication filter test with the selector mechanism

Issues

This a proposal for the enhancement #560

tomblench commented 6 years ago

@jjrodrig thanks for your contribution. We are seeing some test failures because we test against some versions of CouchDB which do not support the mango selector feature. I'll suggest a work-around shortly.

tomblench commented 6 years ago

@jjrodrig you may want to cherry-pick this commit and add the new category to your tests which require Cloudant (as opposed to CouchDB 1.x).

This means that your tests will be skipped in Travis but will still run in our private Jenkins pipeline.

jjrodrig commented 6 years ago

Thanks @tomblench, it is done. I've excluded RequireCloudant category also during test stage

jjrodrig commented 6 years ago

Thanks, I pushed the changes.

tomblench commented 6 years ago

@jjrodrig as a general comment, it's very difficult to read your diff because your IDE is set to auto-format every file you edit which changes the whitespace and creates lots of noise in the diff.

jjrodrig commented 6 years ago

Sorry, I think that I have configured the formatting as specified in the contributing guide. Is there something I miss?

I'll check it in order to be closer with the previous code format.

tomblench commented 6 years ago

OK, don't worry it's not a big deal. There are a few comments where whitespace is significant though, like this, because it's easier to read the example json in the comment if it is correctly indented.

jjrodrig commented 6 years ago

Thanks @tomblench