Skip to main content
In distributed systems like PocketSync, conflicts occur when multiple devices modify the same database record without immediate synchronization. The MergeEngine component is responsible for detecting these conflicts and resolving them according to configurable strategies.

Conflict detection

A conflict is detected when both the local device and the server have changes for the same record. The MergeEngine identifies conflicts by grouping changes by their unique record identifier (table name + record ID).

Conflict resolution strategies

PocketSync supports four different strategies for resolving conflicts, defined in ConflictResolutionStrategy:

Best practices

When working with PocketSync’s conflict resolution:
  • Choose the appropriate strategy for your application’s needs
  • Use custom resolution for complex business logic requirements

Limitations

The current conflict resolution system has these limitations:
  • Conflicts are resolved at the record level, not at the field level
  • The default last-write-wins strategy depends on accurate device timestamps
  • Conflicts between delete and update operations always follow the configured strategy
For more advanced conflict resolution needs, see custom conflict resolution.