> On Mar 18, 2015, at 6:31 AM, Rajagopal V <[email protected]> wrote: > > We are working on a system that uses CBLite + CouchDB and are testing some > offline capabilities. I was thinking that the sequence in which the documents > are created in the mobile is the same sequence in which you will get it back > when using the _changes feed. But that doesnt seem to happen.
Nope. There are no guarantees about ordering, sorry. Couchbase Mobile is a fully distributed system and that’s one of the things you have to sacrifice <https://en.wikipedia.org/wiki/CAP_theorem>. (In general: The CBL replicator pushes documents in the order they were last changed, i.e. the least-recently-changed document is pushed first, the latest-changed last. And SG’s _changes feed lists documents in the order that the most recent change was uploaded. But documents are being pushed in parallel HTTP requests on multiple sockets, and those will be processed in SG on multiple threads. If there are errors, docs that failed to upload will be retried later. It gets even crazier if you consider topologies other than stars, where document updates might reach one peer from different sources.) > It looks like the document with uuid "0c3a947b-b1b5-4209-b068-cec7ca5eac75" > which was revid: 1021 seems to have been sent before > "3dab22c4-c0e4-4246-beb5-1688ebab8001" which is rev:1020 (and rev: 1022). > Yup, you’re being bitten by the “order in which they were last changed” detail. (FYI, the numbers 1020…1022 here are sequences, not revision ids.) At the time of replication the second document has a current sequence number of 1022, which means it gets sent after the document with a current sequence of 1021. —Jens -- 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/E56D4598-4446-41BB-845F-C072938E484A%40couchbase.com. For more options, visit https://groups.google.com/d/optout.
