Sync conflicts - stefffdev/NubeSync GitHub Wiki

In an offline scenario it can easily happen that separate clients change the same record. When this changes are synced back to the server a conflict occurs.

Conflict handling

In NubeSync conflict resolution is handled at the server, making changes to the resolving strategy centralized and easier to maintain.

The NubeSync framework resolves conflicts automatically, following the "last update wins" strategy:

  • When separate fields were changed on the same record, both changes are saved to the record.
    Example: one client changes the name of the customer and another client changes the telephone number of the same customer, both changes are written to the database
  • When the same field is changed on the same record, the change that was made last, wins. The "last change" is not the one that synced last, but the one that were made last regarding the update time.
    Example: Client A changes a customers name, but does not sync. Client B changes the name of the same customer later in time and syncs immediately. Client A syncs, his changes are discarded, because Client B made the changes after Client A.
  • When a record is deleted on one device, all changes made by other devices are discarded
    Example: Client A deletes a customer and syncs. Client B changes the name of that customer and syncs, this changes are discarded because this customer was already deleted.