Jump to content
Server Maintenance This Week. ×

Spoke always wins ?


This topic is 1032 days old. Please don't post here. Open a new topic instead.

Recommended Posts

We had a database corruption and had to revert to a backup last week.

Some users had synced new data after the backup so when they synced after the it was uploaded, their data was deleted on the device.

What I wanted to do is to set the conflict resolution to "spoke always wins" so when mirrorsync does not find the record on the server it syncs it again on it. To my surprise it was not an option.

Of course I can set the sync to be unidirectional but I would lose some functionality on webdirect.

What's the solution ?

Mirrorsync config ? Customization script ?

Should I backup mirrorsync at the same time as the database backup and restore everything at the same time? What would be the impact of this on the following syncs ?

 

Edited by sfpx
Link to comment
Share on other sites

Can I use the spoke-level "will delete" callback to avoid deletion for certain tables ?

Let's say the user creates a record on his device.
He syncs at 1PM.
The database gets corrupted at 1:20 PM.
We have to revert back to 12:45PM backup
He syncs again at 3PM.
MS will try to delete the new record on the device because it's flagged as synced and is no longer on the server.
In the "will delete" spoke callback, we cancel the deletion by omitting the record.

Would it work ?

Would it be synced back to the server  or do we need to modify the record so the timestamp changes ?

In the end, I want a bi-directional sync that never deletes anything on the device (at least for certain crucial tables).

Edited by sfpx
Link to comment
Share on other sites

Hi,

Yes, you are correct that making the sync a one directional sync would be the simplest solution, even on a table to table basis. I am curious as to what functionality you would lose on WebDirect by doing so.

What is your current conflict resolution set to? If it is currently set to "Hub always wins", then setting a backup copy of the database as the hub, would cause these deletions. Instead, if you set the resolution to "Most recent wins" then since the spoke records were modified more recently than the backup, they would be synced over instead of being deleted.

You could try using "Will Delete" customization option on the spoke, where when a spoke record is marked for deletion you would exit the script, but I don't believe those records would then sync to the hub, unless the conflict resolution is set to "Most recent wins". 

Another option is to create an account that is used for syncing, and have that account be full access on the hub, but for the same account name on the spokes be unable to write/delete those records.

Link to comment
Share on other sites

Quote

Hi,

Yes, you are correct that making the sync a one directional sync would be the simplest solution, even on a table to table basis. I am curious as to what functionality you would lose on WebDirect by doing so.

Well, if the sync only sends changes from the device to the server then I can't have changes made on webdirect sent back to the device.

Quote

What is your current conflict resolution set to? If it is currently set to "Hub always wins", then setting a backup copy of the database as the hub, would cause these deletions. Instead, if you set the resolution to "Most recent wins" then since the spoke records were modified more recently than the backup, they would be synced over instead of being deleted.

My conflict resolution is set to "Most recent wins'. But it does not matter. The records are marked as synced and they are no longer on the server after the backup upload so the records will be deleted on the device. ADDED: I don't backup mirrorsync. Should I backup mirrorsync each time I backup the DB and restore both at the same time ? Would that fix everything then ?

 

Quote

Another option is to create an account that is used for syncing, and have that account be full access on the hub, but for the same account name on the spokes be unable to write/delete those records.

I like this idea. I will try it.

Edited by sfpx
Link to comment
Share on other sites

Some more thoughts

1.I tried your privilege set idea in addition of the spoke "willdelete" callback.
I made sure to update the records that were going to be deleted (unsuccessfully because of of the privilege set) to force them to be resynced on the server on the next sync. It works.

2.This solution will prevent deletion of new created records between the last backup and the database corruption and that's great but we would still lose the changes made to records between the last backup and the db corruption (there would be modified records on the device that would not be changed on the server).

So I guess , to not lose anything I also need to either backup mirrosync each time I backup the db or reset mirrorsync sync data on the server to force a long sync similar to an initial sync with pre populated data.

If want to backup mirrorsync data , how do I proceed to do it when fms backup the db ?

Link to comment
Share on other sites

This topic is 1032 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.