We have different different buckets. So we make different Replicator objects. But when we start all of them together it seems to stress the application too much and our android app crashes. Is there a way to run them sequential. That’s to say: if the replication of one bucket is finished the next one starts?
Are you talking about the first time an app starts and syncs, or is this an issue every time? Also, how many buckets are you using? As a rough guideline with Couchbase Server you don’t want to have more than 10 or so buckets. (That’s a Couchbase Server constraint, not a Couchbase Lite/Sync Gateway one.)
One approach we often recommend is to do one-shot replications for the initial sync, and then switching to continuous. With that approach, you would have control over the sequence. There’s no way to automatically order continuous replications right now.
Another possible approach might be to build your own sort of triggering system. For example, if you have push notifications in your app, you can use that as a way to send a notification of when replication is needed. You could do this with a dedicated control document, too.
We have aprox 8 buckets. Some of wich have a small number of documents (10 or 400) with others bigger (100 000 to 250 000).
I’m currently talking about the initial, first time app start sync when CBL databases are empty. We create every Replicator object (not-continuous, pull-only) per database and just Start() them. After a few seconds, the app crashes without warning, error or even an App has stopped working notice.
I have the Database.SetLogLevel(LogDomain.Replicator, Couchbase.Lite.Logging.LogLevel.Verbose); set but don’t really know where to physically search on the android device for it. It’s not in the app-folder.
Currently, and I really don’t know if this is the right approach, I’m about to test the following: I made wrapper with the db names as parameter where I add the following in the AddChangeListener:
if (!replication.Config.Continuous && args.Status.Activity == ReplicatorActivityLevel.Stopped && args.Status.Progress.Completed == args.Status.Progress.Total)
{
if (_progress)
progressDialog.Hide();
if (replicationConfig.Continuous == false)
{
this.Stop();
Task.Delay(1000).Wait();
_current++;
if (_current != total-1)
{
this.prepare(_dbs[_current]);
this.Start(_replicatorType);
}
}
}
But again, I don’t really know if this will be the right approach. Sometimes the Total count just reaches a 1000 where it is a bucket of 112 000.
And yes, after the initial replication I would like it to be continuous… .
We’d like to see the logs when you get them. Shouldn’t be crashing like that. Have you tried narrowing the issue down? Knowing as many details (minimum number of replications where the crash happens, bucket details) would be very helpful.
Yes indeed priya. I must say, the replications I begin with are of buckets with small amount of items. I will try a big one at work this morning and check if it holds as one instance. I’ll post the results here
UPDATE: replication of bucket with big amount of data (100 000+) also crashes
Can you guys give a quick c# .NET example of how you would code a run of multiple replication instances as sequential as possible? I’ll then check if I still have the error. Maybe my conceptualisation is just wrong?
For the crash related to pulling a single bucket of 100,000+ documents, can you please you share the crash log .
Or is it the same websocket error you observed for multiple replication instances?