Recognizing new documents from sync-gateway replication


#1

I am trying to understand an issue with sync-gateway and replication. I am current running 1.2 Android lite and 1.2 sync gateway. I have the same android apps running on two devices. The main issue that I am trying to solve is what happens when I initiate on the second device which has an empty DB. It brings down all the documents correctly from the sync-gateway. However, I need to perform some operations on these new records as they come into the app.
I have setup the changeListener on the pull replicator and it gets called but the changesCount and CompletedChangesCount are always 0. (It appears to get called twice even though I have 10 documents). (There is also a push replicator that gets called twice). Replication is set to continuous on both replicators.
The documents all get into the app. What I am trying to catch is the new records as they get put in the app’s DB.
I have a changeListener on the database. But that is never called.
How do I catch the new documents?


#2

This could be user error. When I did a restart of the sync-gateway, The database changeListener, has a list of change with multiple revisions. I assume that DocumentChange with a winningRevisionId (not null) is the one that needs to be processed.


#3

@miltgrin,

We recently fixed the issue that multiple ChangeTrackers are running for a pull replicator. This issue might send duplicated change event notifications. Based on my understanding, multiple change trackers causes thread-leak and memory leak, but not cause functional problem.

If you can test against non-release version, please try to use following? If you still observe this issue please file the ticket to https://github.com/couchbase/couchbase-lite-java-core/issues ?

Couchbase Lite v1.2.1-5 on Couchbase maven repo:
http://files.couchbase.com/maven2/com/couchbase/lite/couchbase-lite-android/1.2.1-5/

How to use couchbase maven repo:

Closed tickets related with multiple change trackers:

Thanks,
Hideki