[Question]: Behavior after server rebuild with older database #359
-
|
Hi, I have a question regarding PowerSync behavior. Scenario: Clients already synced and have newer data locally. The server was rebuilt and restored using an older database snapshot. PowerSync instance was recreated. Some record UUIDs may also be different after the rebuild. Question: What happens when the client syncs again? Will the older server data overwrite the newer local data? Or will the local client push the newer changes back to the server? If neither, what's the recommended approach to avoid conflicts or duplicated records (e.g., client reset, version check, conflict resolution)? Looking for guidance on the expected default behavior and best practices for handling this situation. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
For the most part, we can split uploading client-side changes from downloading server-side state:
So in short, uploading changes from the client is the main place where issues could come in. Once the upload queue is processed, the client should match the server-side state exactly after completing a sync. One thing that stands out to me though:
Why would UUIDs change due to a snapshot restore? Changing UUIDs would make it much more likely to run into conflicts/issues when the client uploads changes. |
Beta Was this translation helpful? Give feedback.
For the most part, we can split uploading client-side changes from downloading server-side state:
PowerSyncBackendConnector, and make sure it can handle conflicts. The best strategy here depends on your use case - for example you can just discard conflicting changes (which reverts them), or save the conflicting changes to a separate table for manual review. F…