Non sequential order of pulled revesions

30 views
Skip to first unread message

Rustam Yuzmukhametov

unread,
May 19, 2014, 4:15:28 AM5/19/14
to mobile-c...@googlegroups.com
For creation described situation I did some modifications in "Grocerey Sync" app (release/1.0.0).
App replicates with remote database (pull continuous mode). 

In RootViewController I added next code:

- (void)startObserving
{
   
[[NSNotificationCenter defaultCenter] addObserver: self
                                             selector
: @selector(databaseChanged:)
                                                 name
: kCBLDatabaseChangeNotification
                                               
object: self.database];
}


- (void) databaseChanged:(NSNotification*)notification
{
   
NSArray *changes = [notification.userInfo objectForKey:@"changes"];
   
NSLog(@"{{{{{{{{{{{{{{{{");
   
for (CBLDatabaseChange* change in changes) {
       
NSLog(@"### database changed %@ %@", change.documentID, change.revisionID);
   
}
   
NSLog(@"}}}}}}}}}}}}}}}}}}}");
}



I call startObserving in RootViewController viewDidLoad. 

After it I speed down my network (using "Network Link Conditioner") and launch demo application in simulator.

So when I did changes with remote database document I got next log lines:

2014-05-19 13:51:47.272 Grocery Sync[74784:60b] SYNC progress: 7 / 8
2014-05-19 13:51:49.446 Grocery Sync[74784:60b] SYNC progress: 7 / 9
2014-05-19 13:51:51.678 Grocery Sync[74784:60b] {{{{{{{{{{{{{{{{
2014-05-19 13:51:51.679 Grocery Sync[74784:60b] ### database changed 4cba3f8ff653d44a67143d578e0006c0 171-3ba229e81babb74ecbe8db110cde1182
2014-05-19 13:51:51.679 Grocery Sync[74784:60b] }}}}}}}}}}}}}}}}}}}
2014-05-19 13:51:51.679 Grocery Sync[74784:60b] SYNC progress: 8 / 9
2014-05-19 13:51:52.084 Grocery Sync[74784:60b] SYNC progress: 8 / 10
2014-05-19 13:51:57.054 Grocery Sync[74784:60b] {{{{{{{{{{{{{{{{
2014-05-19 13:51:57.054 Grocery Sync[74784:60b] ### database changed 4cba3f8ff653d44a67143d578e0006c0 169-0197e21bf0626cb774cedb22bbf2554f
2014-05-19 13:51:57.054 Grocery Sync[74784:60b] }}}}}}}}}}}}}}}}}}}
2014-05-19 13:51:57.054 Grocery Sync[74784:60b] SYNC progress: 9 / 10
2014-05-19 13:51:59.349 Grocery Sync[74784:60b] {{{{{{{{{{{{{{{{
2014-05-19 13:51:59.349 Grocery Sync[74784:60b] ### database changed 4cba3f8ff653d44a67143d578e0006c0 172-b86656f5559090bf39187c624994b94d
2014-05-19 13:51:59.349 Grocery Sync[74784:60b] }}}}}}}}}}}}}}}}}}}

So, document revisions are got in non sequential order: 171, 169, 172. Is it correct behaviour?

Jens Alfke

unread,
May 19, 2014, 1:58:03 PM5/19/14
to mobile-c...@googlegroups.com

On May 19, 2014, at 1:15 AM, Rustam Yuzmukhametov <ryuzmuk...@gmail.com> wrote:

> So, document revisions are got in non sequential order: 171, 169, 172. Is it correct behaviour?

It’s unusual that the replicator would pull down three revisions of the same document. Normally it only pulls the latest revision. But if this document is in conflict and has three leaf revisions, it would make sense that all three of them are pulled.

As for the order, no, there is no guarantee what order revisions or documents are pulled in. The ordering on the server’s changes feed isn’t guaranteed, and the pull replicator is downloading multiple revisions in parallel so there’s no telling which one will finish first.

—Jens

Rustam Yuzmukhametov

unread,
May 20, 2014, 4:21:28 AM5/20/14
to mobile-c...@googlegroups.com
Ok, 

I also want find out about the skipped revision (170).

Let the pull replicator finished downloading of some revision.
Does the replicator ignore other downloading revisions with smaller number?

понедельник, 19 мая 2014 г., 23:58:03 UTC+6 пользователь Jens Alfke написал:

Rustam Yuzmukhametov

unread,
May 20, 2014, 8:00:11 AM5/20/14
to mobile-c...@googlegroups.com
Thank you, I understand reasons of such behaviour.


понедельник, 19 мая 2014 г., 23:58:03 UTC+6 пользователь Jens Alfke написал:
Reply all
Reply to author
Forward
0 new messages