pull replication / I'm missing something

75 views
Skip to first unread message

Seung Chan Lim

unread,
Oct 19, 2014, 10:18:13 AM10/19/14
to mobile-c...@googlegroups.com
I'm seeing a slightly different behavior from the past, so I'm double checking. (I've updated to couchdb 3 and syncgw 1.02)

(I'm on iOS/phonegap)

So I use a script to create a user on the server side
Then the mobile device talks to the sync gw to authenticate
Then using the returned session cookie the mobile device starts push/pull replication 

In the past, when I replicate I used to see a bunch of documents that were on the couchdb to replicate into the mobile device through the sync gw

this time around, I'm not seeing them replicate in.

I'm a bit confused as to why... I've checked the session, it seems legit (i.e. I see the session document on couchdb's admin interface)

The only thing else I can think of is the sync function, but I have not changed it.

Where else should I be looking?

slim

Seung Chan Lim

unread,
Oct 19, 2014, 11:26:34 AM10/19/14
to mobile-c...@googlegroups.com
BTW, I create users _through_ the sgw. And after creating the users, I also create documents I want these users to have through the same sync gw.

So my understanding from the past is that since the sync function takes care of the channel creating and giving access to the channel to the user, by the end of the user creation, channels are set for this user, and the documents are waiting to be replicated out.

slim

Seung Chan Lim

unread,
Oct 19, 2014, 4:38:40 PM10/19/14
to mobile-c...@googlegroups.com
Just to confirm

1) doing db/_all_docs?channels=true

shows that the doc belongs to the expected channel

2) doing db/_user/user_id

shows that the user has access to the channel


slim

Jens Alfke

unread,
Oct 19, 2014, 4:48:39 PM10/19/14
to mobile-c...@googlegroups.com
I'm not sure what the problem might be. Have you turned on "Sync" or "SyncVerbose" logging to see if anything relevant gets logged? This would help to make sure that your user actually gets authenticated, the change-tracker actually reads the changes feed, etc.

Also, using curl or the equivalent, you can try getting /db/_changes while authenticated as the user (not on the admin port), and see if the docs show up.

—Jens

Seung Chan Lim

unread,
Oct 19, 2014, 5:19:21 PM10/19/14
to mobile-c...@googlegroups.com
SyncVerbose ? What's that? 

Do you mean -verbose for the sync_gateway cmdline app?

slim

Seung Chan Lim

unread,
Oct 19, 2014, 5:26:02 PM10/19/14
to mobile-c...@googlegroups.com
Is SyncVerbose an iOS obj-c thing? I'm on phonegap


On Sunday, October 19, 2014 4:48:39 PM UTC-4, Jens Alfke wrote:

Seung Chan Lim

unread,
Oct 19, 2014, 6:38:04 PM10/19/14
to mobile-c...@googlegroups.com
On the server side, I see

22:27:47.518798 Cache: getCachedChanges("test4", {19 0}) --> 1 changes valid from #16

22:27:47.518808 Cache:   Querying 'channels' view for "test4" (start=#1, end=#16, limit=0)

22:27:47.681234 Cache:     Got no rows from view for "test4"

22:27:47.681250 Cache: GetChangesInChannel("test4") --> 1 rows

22:27:47.681325 Changes+: MultiChangesFeed sending &{Seq:19 ID:test4 Deleted:false Removed:{} Doc:map[] Changes:[map[rev:1-71dd2bbe30125796be41904e93d3aef5]] branched:false}

22:27:47.681331 Changes+: MultiChangesFeed waiting...

22:27:47.681338 Changes+: Waiting for "default"'s count to pass 12

22:27:47.681364 Changes: sending 1 change(s)


So I'm now 100% confident the sync gateway is sending changes.

So it has to be the client...

I ran _active_tasks on my db and I see two replications. One is idle (push?), the other is "processed 0/0 changes" (pull?) with no active requests for either.

Now, what could possibly be causing this??

The call to http://lite.couchase.com/_replicate for PULL returns http status of 200...




slim

Seung Chan Lim

unread,
Oct 19, 2014, 6:39:01 PM10/19/14
to mobile-c...@googlegroups.com
oops, I meant http://lite.couchase./_replicate

without the .com

slim

Seung Chan Lim

unread,
Oct 19, 2014, 9:02:24 PM10/19/14
to mobile-c...@googlegroups.com
Ah... Now I'm convinced it's the sever...

I ran the same code against my production server (should have done that sooner) and it works fine.

So what can I do on the server side to check what's changed since migrating rom couchbase 2.5/ sgw 1.0.0 to couchase 3 / sgw 1.0.2 ?

slim

Jens Alfke

unread,
Oct 20, 2014, 1:46:40 PM10/20/14
to mobile-c...@googlegroups.com

On Oct 19, 2014, at 2:26 PM, Seung Chan Lim <djs...@gmail.com> wrote:

Is SyncVerbose an iOS obj-c thing? I'm on phone gap

See the wiki page Enabling Logging

Even if the issue's on the server side, seeing client logs can help diagnose the problem.

—Jens

Reply all
Reply to author
Forward
0 new messages