CBL2.0 Replication Usage

Hi,

The documentation show how to start the replicator in couchbase 2.0.
I’m using it in Xamarin en c#.

That is great to begin with that in a proof of concept, but when we begun to use it really, we have to face some real problems as :

  • What to do when the replicator launch an exception ?
  • Why can’t we do that Start(), Stop(), Start() ?
  • When do we need to use the method Stop() ?
  • What to do when the status is Busy and the replicator do nothing ?
  • What to do when a document is in the bucket (added from a mobile device) and the replicator won’t sync it (from another mobile device) ?
  • How to deal with the connectivity lost ? Do we need to Stop the replicator ? Do we need to restart it ? How ?

Is there some tools to force something, to understand if we are doing something wrong ?

As a starting point, I’m assuming that the replicator is working well, so I’m probably coding something wrongly, but how to know what is it ?

Regards

Steeve

Hmmm, I guess this could use some documentation input @jamiltz Are there plans to make a page describing things like this?

Although to give a back of the napkin answer:

  • What to do when the replicator launch an exception ?
    • Analyze the exception to figure out what happened, and start the replication again if appropriate (this can be app logic dependent)
  • Start(), Stop(), Start()
    • There is not a specific prohibition on this, what happens when you try?
  • Using Stop() method
    • This is entirely up to you, though it is recommended to stop when the app enters the background to conserve battery life
  • Busy and replicator doing nothing
    • This should not happen. It it happens for more than 5 minutes (?) or so it is a bug (up to 5 minutes could be the web socket being interfered with and data not flowing)
  • Document in the bucket but not syncing
    • In general this is due to lack of required access to the document via the sync function
  • Connectivity lost
    • This is what the continuous mode is designed for. You should never need to react to connectivity changes as it should happen automatically in this mode. If for some reason it does not, and the replicator needs to stop it will notify via the changed callback (there are so many different exceptions to deal with and many are platform specific so it’s not entirely uncommon for one to slip through). For non-continuous, the replication will stop when connectivity is lost for too long or when the replication catches up to the changes it asked for.
1 Like

Hi Jim,

Would be great to have you in my office, at least for a week :wink:

It’ what I’ve done : restart the replicator. But what to do when the exception said : “LiteCoreException (1005): no status code received” ?
It’s happening only with the UWP project. The Android don’t fire any exception, just stay busy and do nothing.

I have an exception, Something like : You can’t modify a dictionnary when it’s in use.

I’m displaying the progesses numbers, when they stop to increas, and the replication isn’t completed (stay in busy status), even if you wait for an hour, nothing will change. I always have to kill my app and start it again.

It wasn’t working, so I uninstalled my app from my computer, restarted it, and the replication goes fully (with many exceptions/restart of the replicator). I’m pretty sure that I can do it again just in using another mobile to add a document. How to follow what is happening ? Why the sync don’t do is job ?

If the replicator stop by itself, do we need to restart it ?

Thank you

Steeve

If the replicator stops, it will not start again unless you start it. If connectivity is lost during a continuous replication it will go into an offline state instead (which is not stopped).

Some of these issues sound like they warrant investigation. If you consistently face problems with exceptions then please start filing issues against the repo so that they can be investigated (especially the start stop start one, that one I’d like to look into). I’ve never seen the 1005 exception you mention, but my intuition says that this is web socket error code 1005 which means that no status code was sent from the server (which seems very odd. What does Sync Gateway have to say about that?)

I haven’t had problems with stuck replications lately (there were some on Windows back around DB019, but they were fixed in DB020).

Also I might sound like a broken record for this, but our functional replication testing is coming soon. We are currently working with QE to get this moving, and I hope that if I make enough noise it will move more quickly :slight_smile: . Once that happens, it will be easier to set up test cases for things like this.

I upgraded last week, I’m in DB21.

Steeve

Thanks, there’s a good amount of info here. We’ll add that to the docs and explain how to catch the exception error codes (not 1005 but 401, 409…).

1 Like

Hi,

As I expected, I reproduced this problem.
I added a new document from my application with the UWP project running, on my windows 10 computer.

The document has been well sync into the Bucket.

I started the same app on my android tablette, and my new document don’t sync.

I look at the sync gateway log, and nothing shows me a trouble, I admit I’m not an expert in reading sync gateway log.

I’m using sync gateway 1.5, and the replicator in continuous mode, couchabse lite 2.0 DB21.

What can I do ?

Steeve

@steeve.descarpentrie, please file bug reports on Github when you run into things that are definitely bugs. Otherwise we may not ever find out about them or fix them.

1 Like