Realm does not sync to the correct online database

Hello there,

I got a problem with my realm flexible sync.
It’s a bit weird, but I will try to describe my problem.

So I use the Flutter realm sdk (version 1.0.0), and in my different devices everything seems to work correctly. Read/write is ok, everything is synced between the different devices so no problem here.

But when I connect to atlas, I see no updates inside my online database.
Really weird since the sync across devices work well.
When using Compass, I saw another database, called __realm_sync_62e01a823bc9c11cd8ae1edf.
This one isn’t visible on atlas.
Inside I saw all the updates, so I said to myself, everything work well, the data is not lost so it’s ok !

And then I tried Atlas Function, tried to connect to my database, and got no data since it’s not synced to the correct database.

Do you have any idea about this problem ?

Thanks a lot.

Hi @Geoffrey_SEBASTIANELLI, thanks for posting!

For some background, Device Sync uses a component known as the “translator” for propagating changes from your devices back to Atlas and vice versa. If the translator encounters an issue, devices will still be able to sync with each other, but the data will not be persisted back to Atlas which is the behavior you’re currently experiencing.

Taking a look at the logs for your app, it appears that the translator is running into an error related to history trimming which is preventing it from propagating changes. As far as I can tell, it’s been in this position for at least the past two weeks.

Do you know when this behavior started? Or do you recall a period of time when you paused sync on this app? That might help narrow down how your app got into this state.

In the meantime, if this is a development/test app the easiest way to recover from this state is to terminate + re-enable sync. Unfortunately, given that the translator has not been persisting changes during this time, terminating sync will cause all of the device data to be lost so we should figure out a way to backup the device data before doing so if it is sensitive.

Hi @Kiro_Morkos, thanks for you help !

I got this problem for, I think, the past 2/3 month. But I discovered the problem for the Atlas function today.
My app isn’t in production so it’s not a problem to loose some test data.

In the meantime, if this is a development/test app the easiest way to recover from this state is to terminate + re-enable sync.

But I already did that during the past 2 month when I did some change to my schema.
Inside the ‘translator’, I got a collection named ‘unsynced_documents’. And this collection is currently empty, so imo I didn’t have any problem on my data/schema side. But I may be wrong ^^
Should I do it again ?

And I didn’t mention it, because I don’t know if it related, but I got this error in the logs for some times.
But I don’t have any error in the phone’s app. I don’t know if it related (if it’s not ignore this, I will create another ticket for it)

Ok after a new terminate + re-enable sync, and some data deleted, everything seems ok.

So the problem was surely on my data side. But imo, to not have any notification or log that tell you that you have a problem on your schema or data is a problem for me.
Do you have any solution to monitor this kind of problem ?

Thanks a lot for your help !

Glad to hear it’s working for you now!

I got this error in the logs for some times. But I don’t have any error in the phone’s app.

That error is transient, it usually just means that the device has disconnected from sync.

So the problem was surely on my data side

The issue actually was unrelated to your data, or your schema. Some operations require you to terminate sync, such as performing a breaking change which it sounds like you’ve needed to do recently. A side effect of terminating sync is that it wipes all of the metadata associated with the sync app, so in this case it was able to “reset” the translator to get it out of the bad state. We still need to investigate on our side how your translator got into that state, and we have planned some work to prevent similar issues in the future.

In the meantime, one thing you can do to prevent the likelihood of this specific issue re-occurring is to increase your “Client max offline time”.

1 Like

Once again, thanks a lot for your help !

Ok, I just re read all your message and the doc and I think I understand better now.
But still, why an error occurring on trimming old data from a device will block all device to sync ? Or I may have misunderstood again ^^

That’s good !

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.