Hi, After speaking with Andrew Reslan and looking through Sync Gateway's source code, it seems that when Sync Gateway receives updates from Couchbase's TAP feed out of order, it starts to buffer them, while waiting for the gaps to be filled.
In cases when it buffers more than 10k items, or waits for longer than 5 seconds, it gives up, and puts the items into its cache. This can happen when Couchbase and Sync Gateway are under load. We can see it happen in our load tests. The requests to the _changes feed are served from the cache (if possible). In cases where the Sync Gateway gave up waiting for missed updates, any subscriber to the _changes feed that looks at the highest sequence in the feed and uses it next time as its "since" parameter, will lose updates. As the client does not know that it's "since" parameter is "too high" it will continue to get only later changes, as its "since" parameter will continue to increase. Therefore, unless the document that triggered the lost sequence is updated again, it's update will be lost to these clients. As far as I know Couchbase Lite (at least on Android) always looks at the highest received sequence and uses it as the "since" parameter in it's sync requests. Therefore lost updates can happen when using Couchbase Lite on Android. >From what I can tell the situation is not very easy to fix, as a sequence can get lost in cases where Sync Gateway acquired a new sequence (using Incr function) but an update failed. So it is difficult for the Sync Gateway to tell if updates on the TAP feed are delayed, and are arriving out of order, or are actually lost. Am I understanding the situation correctly? If so, would you be able to explain how this can be avoided? Do you have a plan on getting this fixed? If so, I would love to learn what your approach will be? If I am misunderstanding the situation, could you correct where I am going wrong? How does a client ensure it does not lose updates in cases after Sync Gateway "gave up" waiting for some sequences? Cheers, Anton -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/da36a05d-86c8-487f-aaf5-d79eac6c760f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
